From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Thu Jun 20 2019 - 17:21:51 CDT

Ahh. I see what I did. CUDA 9.0 wasn't available when 1.9.3 was released, but based on the CVS logs, it looks like the inclusion of the cuda_fp16.h headers was done fairly early in the process for the current development cycle, and I adapted the current code from CVS to get VMD-1.9.3 compiled on my system with newer CUDA variants. So just edit the source for CUDAMDFF.cu to include the required header, and all should be well (unless something else changed too).

-Josh



On 2019-06-20 15:11:08-06:00 owner-vmd-l_at_ks.uiuc.edu wrote:

Thanks for the suggestions.



Are these checks in the VMD source? The only CUDART_VERSION checks I'm seeing in there are for 4000 and lower.

Tried clearing the LD_LIBRARY_PATH and updating $cuda_include, $cuda_library, still getting the same undefined symbol.


--
Gerard Weatherby| Application Architect
NMRbox | Department of Molecular Biology and Biophysics | UConn Health
263 Farmington Avenue, Farmington, CT 06030-6406
Phone: 860 679 8484
uchc.edu
________________________________
From: Vermaas, Joshua <Joshua.Vermaas_at_nrel.gov>
Sent: Thursday, June 20, 2019 3:40 PM
To: vmd-l_at_ks.uiuc.edu; Weatherby,Gerard
Subject: RE: Error compiling 1.9.3 with CUDA
Hi Gerard,

I *think* the error is coming from the header area. Starting with CUDA 9.0, NVIDIA moved some of those helper functions to its own header. So at the top of the file, you see something like this:

#if CUDART_VERSION >= 9000
#include <cuda_fp16.h> // need to explicitly include for CUDA 9.0
#endif
#if CUDART_VERSION < 4000
#error The VMD MDFF feature requires CUDA 4.0 or later
#endif

This leads me to think that somehow CUDART_VERSION isn't being set correctly for you, leading to the correct header not being included and the compilation error you are now faced with. One of the basic checks I always do if CUDA is being squirrely is nvidia-smi, and in your case I'd also look to see if there is a libcudart.so in LD_LIBRARY_PATH that is inconsistent with CUDA 10.

Another difference between your configuration file and mine that compiles on similar hardware is at line 898:

$cuda_include = "-I$cuda_dir/include";
$cuda_library = "-L$cuda_dir/lib64";

This may also be useful.

-Josh


On 2019-06-20 12:58:26-06:00 owner-vmd-l_at_ks.uiuc.edu wrote:

I've installed CUDA-10 from the NVIDIA debian repository on an Ubuntu18.04.2 LTS system. I'm getting the following message:


echo "Compiling " CUDAMDFF.cu " --> " CUDAMDFF.o " ..."; \
/usr/local/cuda/bin/nvcc --ptxas-options=-v -gencode arch=compute_30,code=compute_30 -gencode arch=compute_30,code=sm_35 -gencode arch=compute_30,code=sm_37 -gencode arch=compute_50,code=compute_50 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=compute_60 -gencode arch=compute_60,code=sm_60 --ftz=true --machine 64 -O3 -DARCH_LINUXAMD64 -DVMDOPENGL -DVMDCOLVARS -DVMDCUDA -DMSMPOT_CUDA -DVMDIMD -DVMDXINERAMA -DVMDXINPUT -DVMDLIBPNG -DVMDLIBTACHYON -DVMDPYTHON -DVMDTHREADS -DWKFTHREADS -DUSEPOSIXTHREADS -D_REENTRANT -DVMDNUMPY -DVMDQUICKSURF -DVMDWITHCARBS -DVMDPOLYHEDRA -DVMDSURF -DVMDMSMS -DVMDNANOSHAPER -DVMDTCL -DVMDTK -DVMDSTATICPLUGINS -DVMDGUI -DVMDFLTK -I../lib/tachyon/include -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/lib/python2.7/dist-packages/numpy/core/lib -I/usr/include/tcl8.5 -I/usr/include/tk8.5 -I../plugins/include -I../plugins/LINUXAMD64/molfile -I../lib/netcdf/include -I../lib/fltk/include -I. -c CUDAMDFF.cu -o ../LINUXAMD64/CUDAMDFF.o
Compiling CUDAMDFF.cu --> CUDAMDFF.o ...
CUDAMDFF.cu(133): error: identifier "__float2half_rn" is undefined
1 error detected in the compilation of "/tmp/tmpxft_000042a7_00000000-8_CUDAMDFF.compute_60.cpp1.ii".
Makefile:582: recipe for target 'CUDAMDFF.o' failed
make: *** [CUDAMDFF.o] Error 1

Goggle search results suggest I have version mismatch of something, but I'm not sure what the exact issue is. Any suggestions for what to try/change next?
Version info:
------
/usr/local/cuda/bin/nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Apr_24_19:10:27_PDT_2019
Cuda compilation tools, release 10.1, V10.1.168
-----
/usr/local/cuda/bin/nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Apr_24_19:10:27_PDT_2019
Cuda compilation tools, release 10.1, V10.1.168

​My build script:
------------------------------
#!/bin/bash
ORIGIN=$(dirname $(readlink -f $0))
WORK=/tmp/vmdwork
VERS=1.9.3
#setup parallel make
MAKE_J=$(($(nproc)+1))
export PLUGINDIR=$WORK/plugin.d
#install prerequisites
function prep( ) {
sudo apt-get -qq -y install libfltk1.3-dev tk8.5-dev libnetcdf-dev libtachyon-dev-common libtachyon-mt-0-dev libxinerama-dev libxi-dev python-dev
}
#untar the source to our work directory
function extract( ) {
mkdir -p $WORK
tar xf $ORIGIN/vmd-${VERS}.src.tar.gz -C $WORK
}
#build the plugins
function plugins( ) {
cd $WORK/plugins
#not really configured for parallel make, so do a few times and ignore errors
    DIR="TCLINC=-I/usr/include/tcl8.5 TCLLIB=-L/usr/lib/x86_64-linux-gnu/ LINUXAMD64"
make $DIR -s -j ${MAKE_J} 2>/dev/null
make $DIR -s -j ${MAKE_J} 2>/dev/null
#finally, compile serially and make sure valid
make $DIR -s || { echo "plugin compile fail"; exit 1; }
make distrib || { echo "plugin distrib fail"; exit 1; }
}
#
# config file expects python2.5, cuda-8.0 -> patch it to use python.27, current cuda
#
function patchconfig( ) {
(
cat <<'ENDPATCH'
--- /tmp/configure 2019-06-20 13:02:58.183049223 -0400
+++ ./configure 2019-06-20 13:15:47.374880104 -0400
@@ -466,7 +466,7 @@
 $arch_cc = "cc";
 $arch_ccpp = "CC";
-$arch_nvcc = "/usr/local/cuda-8.0/bin/nvcc";
+$arch_nvcc = "/usr/local/cuda/bin/nvcc";
 $arch_nvccflags = "--ptxas-options=-v " .
                     "-gencode arch=compute_30,code=compute_30 " .
                     "-gencode arch=compute_30,code=sm_35 " .
@@ -922,7 +922,7 @@
 # This option enables the use of CUDA GPU acceleration functions.
 #######################
 $cuda_defines = "-DVMDCUDA -DMSMPOT_CUDA";
-$cuda_dir = "/usr/local/cuda-8.0";
+$cuda_dir = "/usr/local/cuda";
 $cuda_include = "";
 $cuda_library = "";
 $cuda_libs = "-Wl,-rpath -Wl,\$\$ORIGIN/ -lcudart_static";
@@ -1388,7 +1388,7 @@
 $python_defines = "-DVMDPYTHON";
 $python_include = "-I$stock_python_include_dir -I$stock_numpy_include_dir -I$stock_numpy_library_dir";
 $python_library = "-L$stock_python_library_dir";
-$python_libs = "-lpython2.5 -lpthread";
+$python_libs = "-lpython2.7 -lpthread";
 @python_h = ('PythonTextInterp.h',
                        'VMDTkinterMenu.h',
         'py_commands.h',
@@ -2293,7 +2293,7 @@
     if ($config_cuda) {
       $arch_nvccflags .= " --machine 64 -O3 $cuda_include";
- $cuda_library = "-L/usr/local/cuda-8.0/lib64";
+ $cuda_library = "-L/usr/local/cuda/lib64";
     }
     $arch_lex = "flex"; # has problems with vendor lex
ENDPATCH
) > /tmp/vmdpatch$$
patch $WORK/vmd-${VERS}/configure /tmp/vmdpatch$$
}
#
# configure and build VMD
#
function vmd( ) {
set -e
cd $WORK/vmd-${VERS}
if [ ! -d plugins ]; then
ln -s $WORK/plugin.d plugins
fi
export TCL_INCLUDE_DIR=/usr/include/tcl8.5
export TK_INCLUDE_DIR=/usr/include/tk8.5
export NETCDFLIB="-L/usr/lib64"
export NETCDFINC="-I/usr/include"
export NETCDFLDFLAGS="-lnetcdf"
export PYTHON_INCLUDE_DIR="/usr/include/python2.7"
export PYTHON_LIBRARY_DIR="/usr/lib/python2.7"
export NUMPY_INCLUDE_DIR="/usr/lib/python2.7/dist-packages/numpy/core/include"
export NUMPY_LIBRARY_DIR="/usr/lib/python2.7/dist-packages/numpy/core/lib"
echo 'LINUXAMD64 FLTK OPENGL TK IMD TCL PTHREADS PYTHON NUMPY NETCDF COLVARS XINPUT LIBPNG LIBTACHYON CUDA XINERAMA NOSILENT' > configure.options
./configure
cd src
make
sudo make install
}
prep
extract
plugins
patchconfig
vmd​



--
Gerard Weatherby| Application Architect
NMRbox | Department of Molecular Biology and Biophysics | UConn Health
263 Farmington Avenue, Farmington, CT 06030-6406
Phone: 860 679 8484
uchc.edu