Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building sleef quad inline for CUDA problem #559

Open
mrjbom opened this issue Jul 1, 2024 · 4 comments
Open

Building sleef quad inline for CUDA problem #559

mrjbom opened this issue Jul 1, 2024 · 4 comments

Comments

@mrjbom
Copy link

mrjbom commented Jul 1, 2024

I need to use the quadruple-precision floating point number in CUDA.
The Quad-precision math library reference for CUDA shows that I should use sleefquadinline_cuda.h and the type Sleef_quadx1.

I have:
Sleef 3.6.1 from GitHub
Visual Studio 2022
CUDA 12.5 Toolkit

I downloaded Sleef-3.6.1 from github.
I started the CMake GUI, clicked Configure and then set the following options:
SLEEF_ENABLE_CUDA=true
SLEEF_ENFORCE_CUDA=true
SLEEF_BUILD_QUAD=true
SLEEF_BUILD_INLINE_HEADERS=true
I clicked Configure again, then Generate and Open Project, built the x64 Release several times so that all the files would be builded at all (some files are not built the first time).
I tried using a file search to find the file sleefquadinline_cuda.h, but I didn't find it anywhere.
What am I doing wrong?

@mrjbom mrjbom changed the title Building inline for CUDA problem Building sleef quad inline for CUDA problem Jul 1, 2024
@joanaxcruz
Copy link
Contributor

Hi, will look into this today!

@mrjbom
Copy link
Author

mrjbom commented Jul 5, 2024

@joanaxcruz, Thanks, I'll be waiting

@blapie
Copy link
Collaborator

blapie commented Jul 8, 2024

Hi! We realise the documentation to get started with CUDA is very minimalistic/inexistent. Will make sure this is improved before closing this issue.
In the meantime could you please provide a log for your configure and build steps?
We are a bit limited when it comes to reproducing issues on Windows, but I had a go on Linux/Ubuntu and it seems to be working correctly there with something like

#!/bin/bash

COMMON_CMAKE_CFLAGS="-DSLEEF_SHOW_CONFIG=ON \
  -DSLEEF_BUILD_INLINE_HEADERS=ON \
  -DSLEEF_BUILD_DFT=OFF \
  -DSLEEF_BUILD_QUAD=ON \
  -DSLEEF_BUILD_SCALAR_LIB=OFF \
  -DSLEEF_BUILD_TESTS=OFF \
  -DSLEEF_ENABLE_CUDA=ON \
  -DSLEEF_ENFORCE_CUDA=ON \
  -DCMAKE_VERBOSE_MAKEFILE=ON"

rm -rf build-cuda
cmake -S . -B build-cuda -GNinja ${COMMON_CMAKE_CFLAGS}
cmake --build build-cuda -j --clean-first

My log starts with something like this where you see that CMAKE_CUDA_COMPILER is detected and set, thus enabling the CUDA code and header to be emitted by SLEEF.

-- The C compiler identification is GNU 12.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/arm/gcc-12.3.0_Ubuntu-22.04/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- The CUDA compiler identification is NVIDIA 12.5.82
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /usr/local/cuda-12.5/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
...

Then, the inline headers are available in build-cuda/include/

@mrjbom
Copy link
Author

mrjbom commented Jul 8, 2024

@blapie Hi. I did the same as you and tried to build the library in Ubuntu and I succeeded.
But I still couldn't compile the test code because sleefquadinline_cuda.h uses the undeclared type vdouble_cuda_sleefq and so on.
The compiler says: error: identifier "vdouble_cuda_sleefq" is undefined

As for Windows:
CMake finds the CUDA compiler but does not set the CMAKE_CUDA_COMPILER variable.

The CUDA compiler identification is NVIDIA 12.5.40
Detecting CUDA compiler ABI info
Detecting CUDA compiler ABI info - done
Check for working CUDA compiler: D:/ProgrammingLibs/CUDA/v12.5/bin/nvcc.exe - skipped
Detecting CUDA compile features
Detecting CUDA compile features - done

FAILED CUDA COMPILER
Some CUDA variables are set, but CMAKE_CUDA_COMPILER is not. This problem does not occur in Ubuntu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants