Skip to content
Snippets Groups Projects
Commit 858e3eb6 authored by Mulas, Giacomo's avatar Mulas, Giacomo
Browse files

set up for gpu offload

parent 3221fcec
No related branches found
No related tags found
No related merge requests found
...@@ -60,6 +60,10 @@ ...@@ -60,6 +60,10 @@
#include <nvtx3/nvToolsExt.h> #include <nvtx3/nvToolsExt.h>
#endif #endif
#ifdef USE_TARGET_OFFLOAD
#pragma omp requires unified_shared_memory
#endif
using namespace std; using namespace std;
/*! \brief C++ implementation of FRFME /*! \brief C++ implementation of FRFME
...@@ -377,11 +381,14 @@ void frfme(string data_file, string output_path) { ...@@ -377,11 +381,14 @@ void frfme(string data_file, string output_path) {
#ifdef USE_NVTX #ifdef USE_NVTX
nvtxRangePush("j80 loop"); nvtxRangePush("j80 loop");
#endif #endif
#pragma omp parallel for #pragma omp target parallel for
for (int j80 = jlmf; j80 <= jlml; j80++) { for (int j80 = jlmf; j80 <= jlml; j80++) {
dcomplex *vec_w = new dcomplex[nkv * nkv](); // dcomplex *vec_w = new dcomplex[nkv * nkv]();
dcomplex **w = new dcomplex*[nkv]; // dcomplex **w = new dcomplex*[nkv];
dcomplex *wk_local = new dcomplex[nlmmt](); // dcomplex *wk_local = new dcomplex[nlmmt]();
dcomplex *vec_w = (dcomplex *) calloc(nkv * nkv, sizeof(dcomplex));
dcomplex **w = (dcomplex **) calloc(nkv, sizeof(dcomplex *));
dcomplex *wk_local = (dcomplex *) calloc(nlmmt, sizeof(dcomplex));
for (int wi = 0; wi < nkv; wi++) w[wi] = vec_w + wi * nkv; for (int wi = 0; wi < nkv; wi++) w[wi] = vec_w + wi * nkv;
int wk_index = 0; int wk_index = 0;
for (int jy50 = 0; jy50 < nkv; jy50++) { for (int jy50 = 0; jy50 < nkv; jy50++) {
...@@ -421,9 +428,12 @@ void frfme(string data_file, string output_path) { ...@@ -421,9 +428,12 @@ void frfme(string data_file, string output_path) {
} // ix65 loop } // ix65 loop
} // iy70 loop } // iy70 loop
} // iz75 loop } // iz75 loop
delete[] vec_w; // delete[] vec_w;
delete[] w; // delete[] w;
delete[] wk_local; // delete[] wk_local;
free(vec_w);
free(w);
free(wk_local);
} // j80 loop } // j80 loop
#ifdef USE_NVTX #ifdef USE_NVTX
nvtxRangePop(); nvtxRangePop();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment