Skip to content

Fix GPU build

Igor S. Gerasimov requested to merge foxtran/libxc:GPU_FUNCTION into master

I have tried to compile GPU code with the current master and I got these errors:

./work_lda.c(149): error: identifier "func1" is undefined in device code

./work_lda.c(149): error: identifier "func2" is undefined in device code

./work_lda.c(151): error: identifier "func1" is undefined in device code

./work_lda.c(151): error: identifier "func2" is undefined in device code

./work_lda.c(151): error: identifier "func1" is undefined in device code

./work_lda.c(151): error: identifier "func2" is undefined in device code

6 errors detected in the compilation of "/tmp/tmpxft_00010d26_00000000-6_lda_x_1d_exponential.cpp1.ii".

on Polus (http://hpc.cmc.msu.ru/polus).

It has

$ xlc --version
IBM XL C/C++ for Linux, V13.1.6 (5725-C73, 5765-J08)
Version: 13.01.0006.0000

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:22:21_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85

Compilation process:

export CC="/usr/local/cuda-9.1/bin/nvcc -ccbin xlc -x cu"
export CCLD="/usr/local/cuda-9.1/bin/nvcc -ccbin xlc"
export CFLAGS="-arch=sm_60 -g -O3 --std=c++14 --compiler-options -fPIC,-g,-Wall,-Wfatal-errors,-Wno-unused-variable,-Wno-unused-but-set-variable"
autoreconf -i
./configure --disable-vxc --disable-fxc --enable-cuda --disable-fortran --prefix=/home/`whoami`
make -j100

I fixed it by adding GPU_FUNCTION attribute to func1 and func2 in lda_x_1d_exponential.c.

Edited by Igor S. Gerasimov

Merge request reports