For sites that don't use modules, below are a pair of scripts that can be placed in /etc/profile.d on Linux. They will correctly configure environments for most shells so that CUDA C just works. They've been used at several sites under RHEL/CentOS, but probably work on other distros with little or no modifications.
# cuda.sh -- CUDA intialization script (sh/bash)
# resultsovercoffee@gmail.com
# edit this line and place script in /etc/profile.d
cudapath="/usr/local/cuda"
# set LD_LIBRARY_PATH
if [[ ${LD_LIBRARY_PATH} != *${cudapath}/lib64* ]]
then
export LD_LIBRARY_PATH=${cudapath}/lib64:${cudapath}/lib:${LD_LIBRARY_PATH}
fi
# set PATH
if [[ ${PATH} != *${cudapath}/bin* ]]
then
export PATH=${cudapath}/bin:${PATH}
fi
# cuda.csh -- CUDA intialization script (csh)
# resultsovercoffee@gmail.com
# edit this line and place script in /etc/profile.d
set cudapath="/usr/local/cuda"
# set LD_LIBRARY_PATH
if ( "${?LD_LIBRARY_PATH}" == "0" ) then
setenv LD_LIBRARY_PATH ${cudapath}/lib64:${cudapath}/lib
else if ( "${LD_LIBRARY_PATH}" !~ "*${cudapath}/lib64*" ) then
setenv LD_LIBRARY_PATH ${cudapath}/lib64:${cudapath}/lib:${LD_LIBRARY_PATH}
endif
# set path
if ( "${path}" !~ "*${cudapath}/bin*" ) then
set path = ( ${cudapath}/bin $path )
endif
You can use the time not spent on helpdesk calls to read a book on CUDA.
No comments:
Post a Comment