File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
source/source_pw/module_pwdft/operator_pw Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -173,7 +173,16 @@ void get_exx_potential(const K_Vectors* kv,
173173 }
174174
175175 // copy the potential to the device memory
176+ #ifdef __CUDA
177+ cudaError_t err = cudaHostRegister (pot_cpu, sizeof (Real) * npw, cudaHostRegisterPortable);
178+ if (err != cudaSuccess) {
179+ printf (" 临时锁定失败: %s\n " , cudaGetErrorString (err));
180+ }
181+ #endif
176182 syncmem_real_c2d_op ()(pot, pot_cpu, rhopw_dev->npw );
183+ #ifdef __CUDA
184+ cudaHostUnregister (pot_cpu);
185+ #endif
177186
178187 delete pot_cpu;
179188}
@@ -341,7 +350,16 @@ void get_exx_stress_potential(const K_Vectors* kv,
341350 }
342351
343352 // copy the potential to the device memory
353+ #ifdef __CUDA
354+ cudaError_t err = cudaHostRegister (pot_cpu, sizeof (Real) * npw, cudaHostRegisterPortable);
355+ if (err != cudaSuccess) {
356+ printf (" 临时锁定失败: %s\n " , cudaGetErrorString (err));
357+ }
358+ #endif
344359 syncmem_real_c2d_op ()(pot, pot_cpu, rhopw_dev->npw );
360+ #ifdef __CUDA
361+ cudaHostUnregister (pot_cpu);
362+ #endif
345363
346364 delete pot_cpu;
347365}
You can’t perform that action at this time.
0 commit comments