Skip to content

Commit 54ae9ab

Browse files
HanatoKgiacomofiorin
authored andcommitted
build: guard the CUDAGM interface by NAMD_CUDA and NAMD_HIP macros
Only build the plugin when NAMD_CUDA or NAMD_HIP is defined. This commit is a step to integrate the plugin in the NAMD's build scripts.
1 parent 4b0c88d commit 54ae9ab

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

namd/cudaglobalmaster/colvarproxy_cudaglobalmaster.C

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include <nvtx3/nvToolsExtCuda.h>
1919
#endif // CUDAGLOBALMASTERCOLVARS_CUDA_PROFILING
2020

21+
#if defined (NAMD_CUDA) || defined (NAMD_HIP)
22+
2123
#if defined (__linux__) || defined (__APPLE__)
2224
extern "C" {
2325
CudaGlobalMasterColvars* allocator() {
@@ -1159,3 +1161,5 @@ int CudaGlobalMasterColvars::updateFromTCLCommand(const std::vector<std::string>
11591161
delete[] objv;
11601162
return error_code;
11611163
}
1164+
1165+
#endif // defined (NAMD_CUDA) || defined (NAMD_HIP)

namd/cudaglobalmaster/colvarproxy_cudaglobalmaster.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#include "HipDefines.h"
1919

20+
#if defined (NAMD_CUDA) || defined (NAMD_HIP)
21+
2022
class Lattice;
2123

2224
class colvarproxy_impl;
@@ -81,4 +83,6 @@ class CudaGlobalMasterColvars: public CudaGlobalMasterClient {
8183
std::string mTCLResult;
8284
};
8385

86+
#endif // defined (NAMD_CUDA) || defined (NAMD_HIP)
87+
8488
#endif // COLVARPROXY_CUDAGLOBALMASTER_H

namd/cudaglobalmaster/colvarproxy_cudaglobalmaster_kernel.cu

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "colvarproxy_cudaglobalmaster_kernel.h"
22

3+
#if defined (NAMD_CUDA) || defined (NAMD_HIP)
4+
35
__global__ void transpose_to_host_rvector_kernel(
46
const double* __restrict d_data_in,
57
cvm::rvector* __restrict h_data_out,
@@ -72,3 +74,5 @@ void copy_float_to_host_double(
7274
copy_float_to_host_double_kernel<<<grid, block_size, 0, stream>>>(
7375
d_data_in, h_data_out, num_atoms);
7476
}
77+
78+
#endif // defined (NAMD_CUDA) || defined (NAMD_HIP)

namd/cudaglobalmaster/colvarproxy_cudaglobalmaster_kernel.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "colvartypes.h"
55

6+
#if defined (NAMD_CUDA) || defined (NAMD_HIP)
7+
68
#ifdef NAMD_CUDA
79
#include <cuda_runtime.h>
810
#endif // NAMD_CUDA
@@ -40,4 +42,6 @@ void copy_float_to_host_double(
4042
const int num_atoms,
4143
cudaStream_t stream);
4244

45+
#endif // defined (NAMD_CUDA) || defined (NAMD_HIP)
46+
4347
#endif // COLVARPROXY_CUDAGLOBALMASTER_KERNEL_H

0 commit comments

Comments
 (0)