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);
}
if(!data.isNull())
{
Matrix sosValue = solveParameterIterator(buildMatrixR.M, b, dims, false, transParams::nonNeg)[0][0];
result.outSOS = slownessToSOS(sosValue, SOS_IN_WATER) ;
#pragma omp parallel for num_threads(2)
for (int i =0; i<2; i++){
if (i ==0){
if(!data.isNull())
{
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;

View File

@@ -19,6 +19,7 @@ namespace Recon
float TVAL3Beta;
float TVAL3Beta0;
bool nonNeg = false;
int deviceIndex ;
};
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.beta = solverOptions.TVAL3Beta;
opt.beta0 = solverOptions.TVAL3Beta0;
int device = (int)solverOptions.gpuSelectionList[0];
int device = (int)solverOptions.gpuSelectionList[solverOptions.deviceIndex];
return callTval3(M, b, dims, device, opt);
}
//SART
@@ -50,7 +51,7 @@ namespace Recon
}
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"){
std::vector<std::vector<Aurora::Matrix>> result(Recon::transParams::muValues.getDataSize());

View File

@@ -6,7 +6,7 @@
namespace Recon {
std::vector<std::vector<Aurora::Matrix>>
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
#endif // __SOLVE_H__