Make TVAL parrall

This commit is contained in:
kradchen
2023-11-21 13:32:24 +08:00
parent d028a604a4
commit 356691ee6f
3 changed files with 20 additions and 15 deletions

View File

@@ -222,19 +222,23 @@ namespace Recon {
{ {
allHitMaps.push_back(buildMatrixR.hitmap); allHitMaps.push_back(buildMatrixR.hitmap);
} }
#pragma omp parallel for num_threads(2)
if(!data.isNull()) for (int i =0; i<2; i++){
{ if (i ==0){
Matrix sosValue = solveParameterIterator(buildMatrixR.M, b, dims, false, transParams::nonNeg)[0][0]; if(!data.isNull())
result.outSOS = slownessToSOS(sosValue, SOS_IN_WATER) ; {
Matrix sosValue = solveParameterIterator(buildMatrixR.M, b, dims, false, transParams::nonNeg)[0][0];
result.outSOS = slownessToSOS(sosValue, SOS_IN_WATER) ;
}
}
else{
if(!dataAtt.isNull())
{
Matrix attValue = solveParameterIterator(buildMatrixR.M, bAtt, dims, false, transParams::nonNeg,1)[0][0];
result.outATT = attValue/100 ;
}
}
} }
if(!dataAtt.isNull())
{
Matrix attValue = solveParameterIterator(buildMatrixR.M, bAtt, dims, false, transParams::nonNeg)[0][0];
result.outATT = attValue/100 ;
}
Recon::notifyProgress(10 + 10 * (iter/numIter));
} }
return result; return result;

View File

@@ -19,6 +19,7 @@ namespace Recon
float TVAL3Beta; float TVAL3Beta;
float TVAL3Beta0; float TVAL3Beta0;
bool nonNeg = false; bool nonNeg = false;
int deviceIndex ;
}; };
Aurora::Matrix solve( Aurora::Sparse& M, Aurora::Matrix& b, const Aurora::Matrix& dims, int niter, TVAL3SolverOptions solverOptions){ Aurora::Matrix solve( Aurora::Sparse& M, Aurora::Matrix& b, const Aurora::Matrix& dims, int niter, TVAL3SolverOptions solverOptions){
@@ -39,7 +40,7 @@ namespace Recon
opt.mu = solverOptions.TVAL3MU; opt.mu = solverOptions.TVAL3MU;
opt.beta = solverOptions.TVAL3Beta; opt.beta = solverOptions.TVAL3Beta;
opt.beta0 = solverOptions.TVAL3Beta0; opt.beta0 = solverOptions.TVAL3Beta0;
int device = (int)solverOptions.gpuSelectionList[0]; int device = (int)solverOptions.gpuSelectionList[solverOptions.deviceIndex];
return callTval3(M, b, dims, device, opt); return callTval3(M, b, dims, device, opt);
} }
//SART //SART
@@ -50,7 +51,7 @@ namespace Recon
} }
std::vector<std::vector<Aurora::Matrix>> solveParameterIterator(Aurora::Sparse M, Aurora::Matrix &b, std::vector<std::vector<Aurora::Matrix>> solveParameterIterator(Aurora::Sparse M, Aurora::Matrix &b,
const Aurora::Matrix &dims, bool oneIter, bool nonNeg) const Aurora::Matrix &dims, bool oneIter, bool nonNeg, int index)
{ {
if (Recon::transParams::name == "TVAL3"){ if (Recon::transParams::name == "TVAL3"){
std::vector<std::vector<Aurora::Matrix>> result(Recon::transParams::muValues.getDataSize()); std::vector<std::vector<Aurora::Matrix>> result(Recon::transParams::muValues.getDataSize());

View File

@@ -6,7 +6,7 @@
namespace Recon { namespace Recon {
std::vector<std::vector<Aurora::Matrix>> std::vector<std::vector<Aurora::Matrix>>
solveParameterIterator(Aurora::Sparse M, Aurora::Matrix &b, solveParameterIterator(Aurora::Sparse M, Aurora::Matrix &b,
const Aurora::Matrix &dims, bool oneIter = true, bool nonNeg = false); const Aurora::Matrix &dims, bool oneIter = true, bool nonNeg = false,int index=0);
} // namespace Recon } // namespace Recon
#endif // __SOLVE_H__ #endif // __SOLVE_H__