:~$sudo apt-get install -y nvhpc-24-1
Reading package lists... Done
Building dependency tree
Reading state information... Done
nvhpc-24-1 is already the newest version (24.1).
:~$ nvfortran --version
nvfortran: command not found
If it is already the newest version why does it show the error ?
I have been including the following in my .bashrc to make ifx, ifort, nvfortran, Classic flang, AOCC flang, and armflang (if applicable) available in my bash under Ubuntu.
# Intel OneAPI
# See https://software.intel.com/content/www/us/en/develop/articles/installing-intel-oneapi-toolkits-via-apt.html
# The setvars script provided by Intel takes TOO MUCH time to run. So we record its results in
# .setintelvars and then source it. This will work after the following code is executed for the
# first time.
if [[ -d /opt/intel ]] ; then
SETVARS="$(find /opt/intel -type f -name setvars.sh -print | sort | tail -n 1)"
SETVARS_SAVE="$HOME/.setintelvars"
if [[ -n "$SETVARS" ]] ; then
(source "$SETVARS" > /dev/null ; env | grep -i 'intel\|oneapi' \
| sed "s/:\/Users\/.*$//" | sed 's/^/export /' > "$SETVARS_SAVE") & disown
fi
if [[ -f "$SETVARS_SAVE" ]] ; then
source "$SETVARS_SAVE"
fi
# The following does not work. Why?
#source /opt/intel/oneapi/setvars.sh > /dev/null & disown
fi
# NAVIDIA HPC SDK
# See https://developer.nvidia.com/hpc-sdk
if [[ -d /opt/nvidia ]] ; then
NVFORTRAN="$(find /opt/nvidia -type f -executable -name nvfortran -print | sort | tail -n 1)"
if [[ -n "$NVFORTRAN" ]] ; then
PATH=$PATH:"$(dirname "$NVFORTRAN")"
fi
fi
# Classic flang
# Install: Get the correct version of flang corresponding to your architecture from https://github.com/zaikunzhang/flang, and decompress it into $FLANGDIR.
FLANGDIR="~/.local/flang"
if [[ -d "$FLANGDIR" ]] ; then
export PATH=$PATH:"$FLANGDIR"/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$FLANGDIR"/lib
fi
# AMD Flang Fortran compiler (will be known as `aflang` by bash).
# See https://developer.amd.com/amd-aocc
if [[ -d /opt/AMD ]] ; then
AOCCDIR="$(find /opt/AMD -maxdepth 1 -name "aocc-compiler*" -type d -print | sort | tail -n 1)"
# The following must be done after NVFORTRAN.
if [[ -n "$AOCCDIR" ]] ; then
AFLANG=$(find -L /opt/AMD -type f -executable -name flang -print 2>/dev/null | sort | tail -n 1)
if [[ -n "$AFLANG" ]] ; then alias aflang="$AFLANG" ; fi
export LD_LIBRARY_PATH="$AMDFDIR"/lib:$LD_LIBRARY_PATH
############################################################################################
# Do NOT do the following. Otherwise, the flang of AOCC will become the default flang,
# rather than the Classic flang. This is also why we made an alias named aflang as above.
#AOCC_ENVSH="$(find "$AOCCDIR" -name "*setenv*.sh" -type f)"
#source "$AOCC_ENVSH"
############################################################################################
fi
fi
# ARM Flang. See https://developer.arm.com/downloads/-/arm-compiler-for-linux
# For 32-bit Raspberry Pi, `uname -m` returns `armv*`. N.B.: Do not quote `armv*`.
if [[ ("$(uname -m)" == aarch* || "$(uname -m)" == arm*) && -d /opt/arm ]] ; then
ARMDIR="$(find /opt/arm -maxdepth 1 -name "arm-linux-compiler*" -type d -print | sort | tail -n 1)"
if [[ -n "$ARMDIR" ]] ; then
export PATH=$PATH:"$ARMDIR"/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
ARMLD_DIR=$(find /opt/arm -type f -executable -name ld | xargs dirname)
ARMLD_DIR=${ARMLD_DIR//$'\n'/:}
export PATH=$PATH:"$ARMLD_DIR"
fi
fi
I am not a bash expert. My code may not be optimal, but it works well for my use. Comments and suggestions will be appreciated. Thanks.
By seeing at your error log, you installed the HPC SDK with the instruction from “Linux x86_64 Ubuntu (apt)”. I did the same thing (Becasue I’m using WSL Ubuntu), but even after setting environment variables that the above answer mentioned, it didn’t worked.
I solved this problem by reinstalling HPC SDK using different ways(using tar), and setting environment variables using Installation Guide Version 24.3 .
Guide:
Install HPC SDK using “Linux x86_64 (tar file)”
$ wget https://developer.download.nvidia.com/hpc-sdk/24.3/nvhpc_2024_243_Linux_x86_64_cuda_12.3.tar.gz
$ tar xpzf nvhpc_2024_243_Linux_x86_64_cuda_12.3.tar.gz
$ nvhpc_2024_243_Linux_x86_64_cuda_12.3/install