diff --git a/source/lib/src/rocm/coord.hip.cu b/source/lib/src/rocm/coord.hip.cu index b5516d3603..12c797ab3e 100644 --- a/source/lib/src/rocm/coord.hip.cu +++ b/source/lib/src/rocm/coord.hip.cu @@ -66,8 +66,8 @@ __global__ void normalize_one( FPTYPE inter[3]; phys2Inter(inter,out_c+idy*3,rec_boxt); for (int dd = 0; dd < 3; ++dd) { - while(inter[dd] >= 1.) inter[dd] -= 1.; - while(inter[dd] < 0.) inter[dd] += 1.; + inter[dd]=(FPTYPE)fmod((double)inter[dd], 1.); + if (inter[dd] < 0.) inter[dd] += 1.; } inter2Phys(out_c+idy*3,inter,boxt); } diff --git a/source/lib/src/rocm/gelu.hip.cu b/source/lib/src/rocm/gelu.hip.cu index d8f02ae9fc..83e7a3be6d 100644 --- a/source/lib/src/rocm/gelu.hip.cu +++ b/source/lib/src/rocm/gelu.hip.cu @@ -56,6 +56,10 @@ namespace deepmd { const FPTYPE * xx, const int size) { + if(size <= 0) + { + return ; + } const int THREAD_ITEMS = 1024; const int BLOCK_NUMS = (size + THREAD_ITEMS - 1) / THREAD_ITEMS; @@ -69,6 +73,10 @@ namespace deepmd { const FPTYPE * dy, const int size) { + if(size <= 0) + { + return; + } const int THREAD_ITEMS = 1024; const int BLOCK_NUMS = (size + THREAD_ITEMS - 1) / THREAD_ITEMS; @@ -83,6 +91,10 @@ namespace deepmd { const FPTYPE * dy_2, const int size) { + if(size <= 0) + { + return; + } const int THREAD_ITEMS = 1024; const int BLOCK_NUMS = (size + THREAD_ITEMS - 1) / THREAD_ITEMS; diff --git a/source/lib/src/rocm/prod_env_mat.hip.cu b/source/lib/src/rocm/prod_env_mat.hip.cu index 3d1e66c006..af1f8022f7 100644 --- a/source/lib/src/rocm/prod_env_mat.hip.cu +++ b/source/lib/src/rocm/prod_env_mat.hip.cu @@ -504,7 +504,7 @@ void prod_env_mat_a_gpu_rocm( const int ndescrpt = nnei * 4; hipErrcheck(hipMemset(em, 0.0, sizeof(FPTYPE) * nloc * ndescrpt)); hipErrcheck(hipMemset(em_deriv, 0.0, sizeof(FPTYPE) * nloc * ndescrpt * 3)); - hipErrcheck(hipMemset(rij, 0., sizeof(FPTYPE) * nloc * nnei * 3)); + hipErrcheck(hipMemset(rij, 0.0, sizeof(FPTYPE) * nloc * nnei * 3)); format_nbor_list_gpu_rocm( nlist, @@ -541,7 +541,7 @@ void prod_env_mat_r_gpu_rocm( const int ndescrpt = nnei * 1; hipErrcheck(hipMemset(em, 0.0, sizeof(FPTYPE) * nloc * ndescrpt)); hipErrcheck(hipMemset(em_deriv, 0.0, sizeof(FPTYPE) * nloc * ndescrpt * 3)); - hipErrcheck(hipMemset(rij, 0., sizeof(FPTYPE) * nloc * nnei * 3)); + hipErrcheck(hipMemset(rij, 0.0, sizeof(FPTYPE) * nloc * nnei * 3)); format_nbor_list_gpu_rocm( nlist, diff --git a/source/lib/src/rocm/tabulate.hip.cu b/source/lib/src/rocm/tabulate.hip.cu index 80aec8af8f..b4097083b0 100644 --- a/source/lib/src/rocm/tabulate.hip.cu +++ b/source/lib/src/rocm/tabulate.hip.cu @@ -209,6 +209,7 @@ template const int nnei, const int last_layer_size) { + if(nloc <= 0){return;} hipLaunchKernelGGL(HIP_KERNEL_NAME(tabulate_fusion_fifth_order_polynomial), nloc, last_layer_size, sizeof(FPTYPE) * MM * last_layer_size, 0, out, table, em_x, em, table_info[0], table_info[1], table_info[2], table_info[3], table_info[4], nnei, last_layer_size); @@ -227,6 +228,7 @@ template const int nnei, const int last_layer_size) { + if( nloc<=0 ) { return;} hipErrcheck(hipMemset( dy_dem_x, 0.0, sizeof(FPTYPE) * nloc * nnei));