Skip to content

Compilation Errors with Standard Math Functions using CUDA 12.2 and NVHPC 23.7 #19

@zimb3l-priv

Description

@zimb3l-priv

Since the only available CUDA Versions on my system are 11.2, 12.1 and 12.2 I tried to install the GPU version with the newest available versions. If this is already an error or if this is rather a problem with NVIDIA HPC instead of Tinker; ignore the rest and inform me. Otherwise;

Description:
When attempting to compile Tinker-HP with CUDA version 12.2 and NVIDIA HPC SDK version 23.7, compilation errors are encountered related to standard C++ math functions not being recognized within the std namespace.

Environment:

Operating System: Rocky Linux 8.7
CUDA Version: 12.2
NVIDIA HPC SDK Version: 23.7
GCC Version: 9.2.1
Compiler Used: nvfortran from NVIDIA HPC SDK

Steps to Reproduce:

Loaded the NVIDIA HPC SDK module for version 23.7.
Set the NVHPC_CUDA_HOME to point to /usr/local/cuda-12.2.
Updated the PATH and LD_LIBRARY_PATH accordingly to include paths for the HPC SDK and CUDA toolkit.
Edited install.sh to specify cuda version 12.2
Ran the Tinker-HP install.sh script to begin the compilation process.
Encountered errors regarding standard math functions not being found in the std namespace in the file /usr/local/cuda-12.2/include/crt/math_functions.h.

Expected Behavior:
The compilation should recognize standard math functions from the C++ standard library and compile without errors.

Actual Behavior:
The following errors are displayed during the compilation process:

/usr/local/cuda-12.2/include/crt/math_functions.h: error: namespace "std" has no member "cos"
using std::cos;

(Additional similar errors for other math functions like cosh, atan, atan2, tan, tanh, etc.)

Additional Information:

The localrc file within the HPC SDK was configured to set DEFCUDAVERSION=12.2.
Unsure about compatibility of GCC 9.2.1 with CUDA 12.2
The same math functions compile correctly in non-CUDA related C++ projects

I also created a file to source with a couple of paths to ensure Tinker-HP uses the right ones during compilations. Maybe someone sees an error here:

NVARCH=`uname -s`_`uname -m`; export NVARCH
NVCOMPILERS=/opt/nvidia/hpc_sdk; export NVCOMPILERS
MANPATH=$MANPATH:$NVCOMPILERS/$NVARCH/23.7/compilers/man; export MANPATH
PATH=$NVCOMPILERS/$NVARCH/23.7/comm_libs/bin:$NVCOMPILERS/$NVARCH/23.7/compilers/bin:$NVCOMPILERS/$NVARCH/23.7/cuda/bin:$PATH; export PATH
LD_LIBRARY_PATH=$NVCOMPILERS/$NVARCH/23.7/compilers/lib:$NVCOMPILERS/$NVARCH/23.7/comm_libs/lib:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
CPATH=$NVCOMPILERS/$NVARCH/23.7/compilers/include:$CPATH; export CPATH

Attempted Fixes:

Ensuring the environment variables are correctly set.
Checking for the correct paths and versions in the localrc file.
Looking for online solutions related to similar issues.

Request:
Assistance is requested to resolve the compilation issues related to the standard C++ library functions in CUDA 12.2 headers when using the NVIDIA HPC SDK. Any known fixes, patches, or suggestions to bypass these errors would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions