ralna / spral

Sparse Parallel Robust Algorithms Library
https://ralna.github.io/spral/
Other
102 stars 27 forks source link

NVCC include path not found #194

Closed NCKempke closed 2 months ago

NCKempke commented 2 months ago

This is, I think, the same issue as in #5

On a fresh master clone running

./autogen.sh
mkdir build
cp nvcc_arch_sm.c build/ # If building for GPU
cd build
../configure --with-metis="-L../../metis-5.1.0/build/Linux-x86_64/libmetis/ -lmetis"

I get

checking for unistd.h... yes
checking for METIS library... checking for metis_nodend_ in -L../../metis-5.1.0/build/Linux-x86_64/libmetis/ -lmetis... yes
checking version of METIS... "version 5"
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for hwloc... yes
checking for cuda_runtime_api.h... no
checking for cuda_runtime_api.h... (cached) no
configure: error: NVCC include path not found

I can fix this by setting export C_INCLUDE_PATH=/usr/local/cuda/include however, I cannot fix this by setting either of CUDA_HOME or NVCC_INCLUDE_FLAGS via export CUDA_HOME=/usr/local/cuda/ or export NVCC_INCLUDE_FLAGS=-I/usr/local/cuda/include which seem to be used in configure as a lookup locations:

# Check in default path first
NVCC_INCLUDE_FLAGS="$NVCC_INCLUDE_FLAGS"
ac_fn_c_check_header_compile "$LINENO" "cuda_runtime_api.h" "ac_cv_header_cuda_runtime_api_h" "$ac_includes_default"
if test "x$ac_cv_header_cuda_runtime_api_h" = xyes
then :
  spral_nvcc_inc_ok=yes
fi

# Check in CUDA_HOME/include
if test x"$spral_nvcc_inc_ok" != xyes; then
   NVCC_INCLUDE_FLAGS="$NVCC_INCLUDE_FLAGS -I$CUDA_HOME/include"
   save_CPPFLAGS="$CPPFLAGS"; CPPFLAGS="$CPPFLAGS $NVCC_INCLUDE_FLAGS"
   ac_fn_c_check_header_compile "$LINENO" "cuda_runtime_api.h" "ac_cv_header_cuda_runtime_api_h" "$ac_includes_default"
if test "x$ac_cv_header_cuda_runtime_api_h" = xyes
then :
  spral_nvcc_inc_ok=yes
fi

   CPPFLAGS=$save_CPPFLAGS
fi

Again, I feel this is just (the first part of) #5 but the PR #22 that imo would have fixed this was closed.

jfowkes commented 2 months ago

Thanks for reporting! I will see if I can resurrect #22 against the latest master branch for you to test the proposed fix.

jfowkes commented 2 months ago

@NCKempke I've created #195 with the proposed fix in #22, please test and let us know.

NCKempke commented 2 months ago

@NCKempke I've created #195 with the proposed fix in #22, please test and let us know.

@jfowkes I just checked the branch in #195. It works fine and resolves all of my issues.

I tested both flags, so export CUDA_HOME=/usr/local/cuda/ and export NVCC_INCLUDE_FLAGS=-I/usr/local/cuda/include (each separately in a clean environment) and both times the configure command passes just fine.

jfowkes commented 2 months ago

Fantastic, thank you @NCKempke! I will merge into master now.