Comments (5)
For now, I use CMAKE_CUDA_FLAGS
and set it to, e.g., -arch=sm_60
.
Please check the attached file (C file uploaded as TXT due to GitHub constraints).
It is a small program that uses only CUDA Driver API, and prints out the flags for all NVidia GPU cards present in the system (there might be a couple of them, not all with the same SM capabilities).
If CUDA driver cannot be properly initialized, the program will print a message and return the error code 1 (otherwise 0).
The program was integrated into GNU Autotools build system for another open-source project, but I have no clue how to do it for CMake (I'm not an expert in build systems at all).
A small help on building the program is placed in the comment at the top of the file.
from ginkgo.
P.S. Such an approach works fine if the GPU architecture(s) on the build machine are the same or a superset of the ones on the target machine(s). However, that might not always be the case. A tipical example: the frontend node of a cluster has some low-end GPU, and the compute nodes have newer GPUs. Therefore, setting the variable manually has to be possible at all times. I don't have a clever idea how to have both the auto-detection by a program similar to the one proposed above, and an option of manually setting the flags. Maybe there should be a boolean variable, e.g., GINKGO_AUTODETECT_GPUS
that is initially ON
and calls the flag-detection program. If you set it manually to OFF
, then you are on your own to supply the correct architecture flags in CMAKE_CUDA_FLAGS
.
from ginkgo.
That's why I suggested running the automatic detection only if the user doesn't set the flags. So, if you're installing it on you local system, you just don't set the flags and automatic detection will set them for you. If you're on a head node of the server, you just set the architectures to whatever you want, and by doing this you prevent the hardware detector for setting them for you.
P.S. I also already have a small C++ program (using the runtime API) that prints the flags for detecter architectures (no special flags needed, just compile it with nvcc, or alternatively with any C++ compiler, and link it with cuda runtime libraries).
from ginkgo.
Sure. Please just consider one thing: the user might set CMAKE_CUDA_FLAGS
for some other unrelated reason (e.g., setting the compiler, linker, or ptxas options), and not put -arch
or -gencode
or something similar at all there. Should (s)he then loose the auto-detection feature?
The program I proposed is by no means perfect, and please ignore it if you wish (it was there only to illustrate an idea). Using CUDA Driver API there made sense in case that you have only the driver installed, and not the whole CUDA Toolkit (which provides the CUDA Runtime libraries).
from ginkgo.
Setting the CMAKE_CUDA_FLAGS
shouldn't prevent auto-detection. What I had in mind is adding another flag, which the build system will use to populate CMAKE_CUDA_FLAGS
internally. For example, something like cmake -DCUDA_ARCHITECTURES="3.5;6.0;7.0" ...
. If the flag is not set, the build system uses auto-detection to populate it. Afterwards, it loops through the architectures set in this flag, verifies that each specified architecture is valid and supported by Ginkgo, and adds the required flags to CMAKE_CUDA_FLAGS
.
As for runtime/driver API, yes, for some projects that don't need the CUDA toolkit, the driver API might be a way to go. However, in our case, we can rely on the whole CUDA toolkit being there, as otherwise we cannot build Ginkgo anyway. And using the runtime API does result in a simpler and easier to maintain code.
from ginkgo.
Related Issues (20)
- Ginkgo build crashes HOT 3
- Configuration failed while looking for unsolicited feature HOT 3
- Documentation link HOT 1
- Issue with batch_ell matrix when solving with non zero per line > 1 HOT 5
- `static_assert` on supported index and value types
- Fail to build on 32-bit x86 windows HOT 2
- BiCGStab OMP issue HOT 14
- Build failure with CUDA 12.4 HOT 2
- HIP platform detection with hipconfig is not sufficient HOT 1
- Build failure with ROCm 6.0 HOT 3
- Ginkgo 1.7.0 tests capture stderr and fail due to different number of mpirun warnings HOT 1
- METIS dependency is not documented
- ABI incompatibility: shared library linked to libstdc++, but program linking to libc++ HOT 2
- Fail to build batch ell structure on gpu
- CUDA error with batched solvers HOT 5
- Newer reuse versions do not recognize .inc extensions
- CMake install step with DESTDIR does not work HOT 6
- ROCm / HIP PATHs related ginkgo installation problems on Ubuntu 22.04 HOT 11
- Default HIP_PATH does not work with ROCm >= 6.0 HOT 1
- MM-Format IO Checking HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ginkgo.