Started cuda profiling, added first result to logbook

This commit is contained in:
Maximilian Gaul 2021-12-03 08:13:43 +01:00
parent 7691b23d67
commit 2a099da5b7

View File

@ -24,6 +24,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h> #include <stddef.h>
#include <cuda_profiler_api.h>
#include <cuda_runtime.h> #include <cuda_runtime.h>
#include <device_launch_parameters.h> #include <device_launch_parameters.h>
@ -122,6 +123,8 @@ double computeForce(
MD_FLOAT epsilon = param->epsilon; MD_FLOAT epsilon = param->epsilon;
#endif #endif
cudaProfilerStart();
for(int i = 0; i < Nlocal; i++) { for(int i = 0; i < Nlocal; i++) {
fx[i] = 0.0; fx[i] = 0.0;
fy[i] = 0.0; fy[i] = 0.0;
@ -129,7 +132,12 @@ double computeForce(
} }
const char *num_threads_env = getenv("NUM_THREADS"); const char *num_threads_env = getenv("NUM_THREADS");
const int num_threads = atoi(num_threads_env); int num_threads = 0;
if(num_threads_env == nullptr)
num_threads = 2;
else {
num_threads = atoi(num_threads_env);
}
Atom c_atom; Atom c_atom;
c_atom.Natoms = atom->Natoms; c_atom.Natoms = atom->Natoms;
@ -225,6 +233,8 @@ double computeForce(
cudaFree(c_neighs); cudaFree(c_neigh_numneigh); cudaFree(c_neighs); cudaFree(c_neigh_numneigh);
cudaProfilerStop();
LIKWID_MARKER_STOP("force"); LIKWID_MARKER_STOP("force");
double E = getTimeStamp(); double E = getTimeStamp();