From 46c6f9c5a2c75a4f12bc04d8a0afb06f877db4d5 Mon Sep 17 00:00:00 2001 From: tang070205 Date: Mon, 6 Jan 2025 19:24:43 +0800 Subject: [PATCH] Add files via upload --- src/minimize/minimizer_fire_box_change.cu | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/minimize/minimizer_fire_box_change.cu b/src/minimize/minimizer_fire_box_change.cu index d91919860..57ca82e12 100644 --- a/src/minimize/minimizer_fire_box_change.cu +++ b/src/minimize/minimizer_fire_box_change.cu @@ -66,9 +66,9 @@ void update_box(double* box, const double* d_v, int N) double processed_v[9]; double* d_processed_v; - cudaMalloc(&d_processed_v, 9 * sizeof(double)); + gpuMalloc(&d_processed_v, 9 * sizeof(double)); process_matrix<<<1, 9>>>(d_v, d_processed_v, N); - cudaMemcpy(processed_v, d_processed_v, 9 * sizeof(double), cudaMemcpyDeviceToHost); + gpuMemcpy(processed_v, d_processed_v, 9 * sizeof(double), gpuMemcpyDeviceToHost); transpose9(processed_v); for (int i = 0; i < 9; i++) { @@ -82,7 +82,7 @@ void update_box(double* box, const double* d_v, int N) box[i] += result[i]; } - cudaFree(d_processed_v); + gpuFree(d_processed_v); } __global__ void get_force_temp_kernel( @@ -127,8 +127,8 @@ void get_force_temp( { double* d_deform; - cudaMalloc(&d_deform, 9 * sizeof(double)); - cudaMemcpy(d_deform, deform, 9 * sizeof(double), cudaMemcpyHostToDevice); + gpuMalloc(&d_deform, 9 * sizeof(double)); + gpuMemcpy(d_deform, deform, 9 * sizeof(double), gpuMemcpyHostToDevice); int threadsPerBlock = 256; int blocksPerGrid = (N + threadsPerBlock - 1) / threadsPerBlock; @@ -139,13 +139,13 @@ void get_force_temp( virial_cpu_deform[m] = virial_cpu_deform[m] / N; } - cudaMemcpy(force_temp + N, virial_cpu_deform, 3 * sizeof(double), cudaMemcpyHostToDevice); - cudaMemcpy( - force_temp + 2 * N + 3, virial_cpu_deform + 3, 3 * sizeof(double), cudaMemcpyHostToDevice); - cudaMemcpy( - force_temp + 3 * N + 6, virial_cpu_deform + 6, 3 * sizeof(double), cudaMemcpyHostToDevice); + gpuMemcpy(force_temp + N, virial_cpu_deform, 3 * sizeof(double), gpuMemcpyHostToDevice); + gpuMemcpy( + force_temp + 2 * N + 3, virial_cpu_deform + 3, 3 * sizeof(double), gpuMemcpyHostToDevice); + gpuMemcpy( + force_temp + 3 * N + 6, virial_cpu_deform + 6, 3 * sizeof(double), gpuMemcpyHostToDevice); - cudaFree(d_deform); + gpuFree(d_deform); } template @@ -552,4 +552,4 @@ void Minimizer_FIRE_Box_Change::compute( } printf("Energy minimization finished.\n"); -} \ No newline at end of file +}