mphowardlab / azplugins

A HOOMD-blue component for soft matter simulations.
BSD 3-Clause "New" or "Revised" License
20 stars 12 forks source link

azplugins not compiling with HOOMD-blue v2.9.4 #48

Closed ara137 closed 3 years ago

ara137 commented 3 years ago

azplugins fails to compile with version 2.9.4 of HOOMD-blue. Several errors are thrown, which seem to be related to cub:

/usr/local/lib/python3.7/dist-packages/hoomd/include/hoomd/extern/cub/cub/block/specializations/../../block/../util_type.cuh(72): error: class template "cub::If" has already been defined

Commenting out the include of the cub header in the offending files (MPCDReversePerturbationFlowGPU.cu and ReversePerturbationFlowGPU.cu) seems to fix this issue.

mphoward commented 3 years ago

This is not likely an issue with a particular version of HOOMD, but with the version of the CUDA toolkit.

Starting with CUDA 11, CUB is bundled with the toolkit like thrust. Hence, we no longer require the extern/cub headers, and including both causes a symbol redefinition. That these files compile with the include commented out is probably chance that cub is still being included properly elsewhere.

This is the required fix:

#if __CUDACC_VER_MAJOR__ >= 11
#include <cub/cub.cuh>
#else
#include "hoomd/extern/cub/cub/cub.cuh"
#endif

Can you try that and let me know if it works?

mphoward commented 3 years ago

Here is a pull request with the changes if you just want to check out the branch and try compiling:

https://github.com/mphowardlab/azplugins/pull/49

mphoward commented 3 years ago

Resolved with #49