30#if defined(OMPI_MPI_H) || defined(_MPI_H)
31#error CU-file includes mpi.h! This should not happen!
51 cudaDeviceProp deviceProp;
52 CUDA_CHECK(cudaGetDeviceProperties(&deviceProp, dev))
65 char buffer[256] = {
'\0'};
66 std::strncpy(buffer, prop.name, 256);
68 std::strncpy(name, buffer, 256);
72 cudaDeviceProp deviceProp;
73 CUDA_CHECK(cudaGetDeviceProperties(&deviceProp, dev))
78 cudaDeviceProp deviceProp;
79 CUDA_CHECK(cudaGetDeviceProperties(&deviceProp, dev))
86 deviceProp.totalGlobalMem,
87 deviceProp.multiProcessorCount};
109 err = cudaMalloc((
void **)&d,
sizeof(
int));
110 if (err != cudaSuccess) {
113 err = cudaMemcpy(d, &
h,
sizeof(
int), cudaMemcpyHostToDevice);
114 if (err != cudaSuccess) {
119 err = cudaMemcpy(&
h, d,
sizeof(
int), cudaMemcpyDeviceToHost);
121 if (err != cudaSuccess) {
137 if (compute_capability !=
ES_OK or communication_test !=
ES_OK) {
139 " is not capable of running ESPResSo.");
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
#define ES_OK
error code if no error occurred
#define ES_ERROR
error code if an error occurred
int cuda_test_device_access()
Test if actual CUDA device works.
static const int computeCapabilityMinMajor
EspressoGpuDevice cuda_get_device_props(const int dev)
Get properties of a CUDA device.
void cuda_check_device()
Check that a device is available, that its compute capability is sufficient for ESPResSo,...
void cuda_get_gpu_name(int dev, char *const name)
Get the name of a CUDA device.
static const int computeCapabilityMinMinor
int cuda_check_gpu_compute_capability(int dev)
Check that a given GPU has compute capability.
int cuda_get_device()
Get the current CUDA device.
static void cuda_copy_gpu_name(char *const name, cudaDeviceProp const &prop)
Safely copy the device name and pad the string with null characters.
void cuda_set_device(int dev)
Choose a device for future CUDA computations.
int cuda_get_n_gpus()
Get the number of CUDA devices.
void cuda_init()
Initializes the CUDA stream.
static constexpr int deviceCount
Struct to hold information relevant to ESPResSo about GPUs.
#define CUDA_CHECK(statement)
Convert CUDA error codes into runtime errors.