Differences between revisions 10 and 17 (spanning 7 versions)
Revision 10 as of 2020-09-11 09:08:29
Size: 2285
Editor: bonaccos
Comment:
Revision 17 as of 2023-10-16 13:36:41
Size: 3300
Editor: alders
Comment:
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
=== Compiling OpenGL/ NVidia CUDA-based applications on Debian Linux ===
The Debian platform managed by ISG.EE uses the following directory layout for the OpenGL libraries and headers:
== Compiling OpenGL/ NVidia CUDA-based applications on Debian Linux ==
The Debian platform managed by ISG D-ITET uses the following directory layout for the OpenGL libraries and headers:
Line 9: Line 9:
==== Libraries ==== === Libraries ===
 * The `/usr/lib/x86_64-linux-gnu/libGL*.so` OpenGL libraries are symbolic links to the hardware-specific libraries. There is a mechanism in the startup process of each client workstation which detects the accurate OpenGL library based on the information about the graphics card and the kernel driver. The CUDA runtime libraries are found in the same directory.
Line 11: Line 12:
 * The /usr/lib/x86_64-linux-gnu/libGL*.so OpenGL libraries are symbolic links to the hardware-specific libraries. There is a mechanism in the starup process of each client workstation which detects the accurate OpenGL library based on the information about the graphics card and the kernel driver. The CUDA runtime libraries are found in the same directory. === OpenGL header files ===
The OpenGL headers are found under `/usr/include/GL`.
Line 13: Line 15:
==== Header Files ====
 * The OpenGL headers are found under /usr/include/GL. For NVidia programming, a CUDA toolkit that should work with the installed NVidia graphics card is installed (CUDA headers in /usr/include).
=== CUDA header files ===
For NVidia programming, a CUDA toolkit matching the installed NVidia driver is selected when a toolkit program like `nvcc`is run.<<BR>>
Any CUDA headers have to bee included by manually matching the toolkit version used. Check the content of the SEPP package [[https://www.sepp.ee.ethz.ch/sepp-debian/cuda_toolkit-1x.x-sr.html|cuda_toolkit-1x.x-sr]] for available versions by listing its contents with `ls /usr/pack/cuda_toolkit-1x.x-sr`
Line 16: Line 19:
==== Compiling sources and linking against NVidia libraries ==== Usually, there is a lower driver/toolkit version combo for desktop PCs and a higher version combo for Slurm GPU nodes:
 * For desktop PCs: driver version `418` works with toolkit version `10.1.243`
 * For Slurm GPU nodes: driver version `470` works with toolkit version `11.4.4`
Line 18: Line 23:
 * No special CFLAGS/ CXXFLAGS and LDFLAGS must be set. The required headers and libraries are all found under the standard system paths. If you use an own OpenGL/ CUDA toolkit, e.g. installed in your home, make sure it is compatible with the graphics driver/ hardware installed on the system. Note: if you don't have brand new hardware in your computer, the most current CUDA release most probably won't work with it - use an older relase or ask ISG.EE if you are in doubt about the right version.
 * Then set CFLAGS (for C-compiler), CXXFLAGS (for C++ compiler) and LDFLAGS (linker flags) as follows: {{{

Assume you have installed the toolkit under /home/$USER/toolkit, then set the mentioned environment variables
in your Debian shell (bash, tcsh, ...) as follows, before you start compiling/ linking:

export CFLAGS="-I/home/$USER/toolkit/include"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="-L/home/$USER/toolkit/lib -Wl,-rpath,/home/$USER/toolkit/lib"

$USER must of course be replaced with your ETH (login-) username.
The following environment variables have to be set with the correct driver or toolkit version:
{{{#!highlight bash numbers=disable
export CPPFLAGS='-I/usr/pack/cuda_toolkit-1x.x-sr/<driver or toolkit version>/include'`
export LDFLAGS='-L/usr/pack/cuda_toolkit-1x.x-sr/<driver or toolkit version>/lib64 -Wl,-rpath,/usr/pack/cuda_toolkit-1x.x-sr/<driver or toolkit version>/lib64' `
Line 31: Line 29:
==== Reccomendation ==== === Compiling sources and linking against NVidia libraries ===
 * Make sure no special `CPPFLAGS` and `LDFLAGS` are set. The required headers and libraries are all found under the standard system paths. If you use your own OpenGL/ CUDA toolkit, e.g. installed in your home, make sure it is compatible with the graphics driver/ hardware installed on the system. Note: if you don't have brand new hardware in your computer, the most current CUDA release most probably won't work with it - use an older relase or ask ISG D-ITET if you are in doubt about the right version.
 * Then set `CPPFLAGS` (for the C preprocessor used by most compilers) and `LDFLAGS` (linker flags) as follows:
Line 33: Line 33:
That said we encourage the use of CUDA and CUDA Toolkit within Conda environments. More details can be found in the [[Programming/Languages/GPUCPU|Working with GPU or CPU in data sciences]] and [[Programming/Languages/Conda|Conda]] subpages of this wiki.  Assuming you installed the toolkit under `/home/$USER/toolkit` you set the mentioned environment variables in your Debian shell (`bash`, `tcsh`, ...) as follows, before you start compiling/ linking:
 {{{#!highlight bash numbers=disable
export CPPFLAGS="-I/home/$USER/toolkit/include"
export LDFLAGS="-L/home/$USER/toolkit/lib -Wl,-rpath,/home/$USER/toolkit/lib"
}}}
 `$USER` must of course be replaced with your E
TH (login-)username.

=== Recomendation ===
T
hat said we encourage the use of CUDA Toolkit within Conda environments. More details can be found in the [[Programming/Languages/GPUCPU|Working with GPU or CPU in data sciences]] and [[Programming/Languages/Conda|Conda]] subpages of this wiki.

OpenGL

Compiling OpenGL/ NVidia CUDA-based applications on Debian Linux

The Debian platform managed by ISG D-ITET uses the following directory layout for the OpenGL libraries and headers:

Libraries

  • The /usr/lib/x86_64-linux-gnu/libGL*.so OpenGL libraries are symbolic links to the hardware-specific libraries. There is a mechanism in the startup process of each client workstation which detects the accurate OpenGL library based on the information about the graphics card and the kernel driver. The CUDA runtime libraries are found in the same directory.

OpenGL header files

The OpenGL headers are found under /usr/include/GL.

CUDA header files

For NVidia programming, a CUDA toolkit matching the installed NVidia driver is selected when a toolkit program like nvccis run.
Any CUDA headers have to bee included by manually matching the toolkit version used. Check the content of the SEPP package cuda_toolkit-1x.x-sr for available versions by listing its contents with ls /usr/pack/cuda_toolkit-1x.x-sr

Usually, there is a lower driver/toolkit version combo for desktop PCs and a higher version combo for Slurm GPU nodes:

  • For desktop PCs: driver version 418 works with toolkit version 10.1.243

  • For Slurm GPU nodes: driver version 470 works with toolkit version 11.4.4

The following environment variables have to be set with the correct driver or toolkit version:

export CPPFLAGS='-I/usr/pack/cuda_toolkit-1x.x-sr/<driver or toolkit version>/include'`
export LDFLAGS='-L/usr/pack/cuda_toolkit-1x.x-sr/<driver or toolkit version>/lib64 -Wl,-rpath,/usr/pack/cuda_toolkit-1x.x-sr/<driver or toolkit version>/lib64' `

Compiling sources and linking against NVidia libraries

  • Make sure no special CPPFLAGS and LDFLAGS are set. The required headers and libraries are all found under the standard system paths. If you use your own OpenGL/ CUDA toolkit, e.g. installed in your home, make sure it is compatible with the graphics driver/ hardware installed on the system. Note: if you don't have brand new hardware in your computer, the most current CUDA release most probably won't work with it - use an older relase or ask ISG D-ITET if you are in doubt about the right version.

  • Then set CPPFLAGS (for the C preprocessor used by most compilers) and LDFLAGS (linker flags) as follows:

    Assuming you installed the toolkit under /home/$USER/toolkit you set the mentioned environment variables in your Debian shell (bash, tcsh, ...) as follows, before you start compiling/ linking:

    export CPPFLAGS="-I/home/$USER/toolkit/include"
    export LDFLAGS="-L/home/$USER/toolkit/lib -Wl,-rpath,/home/$USER/toolkit/lib"
    

    $USER must of course be replaced with your ETH (login-)username.

Recomendation

That said we encourage the use of CUDA Toolkit within Conda environments. More details can be found in the Working with GPU or CPU in data sciences and Conda subpages of this wiki.


CategoryLXSW

Programming/Libraries/OpenGL (last edited 2023-10-16 13:36:41 by alders)