BdaBridge lets cusparseSolver copy the resulting x vector from the GPU directly into the BlockVector from ISTLSolverEbos, this only works if the underlying data from BlockVector is contiguous

This commit is contained in:
T.D. (Tongdong) Qiu 2019-12-05 10:59:33 +01:00
parent 5cb6ec510c
commit cf48650a5e
3 changed files with 4 additions and 7 deletions

View File

@ -203,9 +203,7 @@ template <class BridgeVector>
void BdaBridge::get_result(BridgeVector &x){
#if HAVE_CUDA
if(use_gpu){
double *h_x = backend->post_process();
// convert flat array to blockvector
memcpy(&(x[0]), h_x, sizeof(double) * x.N() * x[0].dim());
backend->post_process(&(x[0][0]));
}
#endif
}

View File

@ -427,7 +427,8 @@ namespace Opm
// copy result to host memory
double* cusparseSolverBackend::post_process(){
// caller must be sure that x is a valid array
void cusparseSolverBackend::post_process(double *x){
double t1, t2;
if(verbosity > 2){
@ -441,8 +442,6 @@ namespace Opm
t2 = second();
printf("cusparseSolver::post_process(): %f s\n", t2-t1);
}
return x;
} // end post_process()

View File

@ -94,7 +94,7 @@ public:
// return true iff converged
bool solve_system(BdaResult &res);
double* post_process();
void post_process(double *x);
bool isInitialized();