[Solved] nvcc: command not found on hpcc cluster using pbs

When I submit a job like this

#PBS -N vector_sum
#PBS -l nodes=1:ppn=4


nvcc -o vector_sum.out vector_sum.cu

I get this error:

/var/spool/torque/mom_priv/jobs/93558.XXXX: line 6: nvcc: command not found

but when i use which nvcc i get the correct path to nvcc /usr/local/cuda/bin/nvcc

I also added these lines to my .bashrc

export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export PATH=$PATH:/usr/local/cuda/bin

I don’t know what to do

Thank you in advance

when you launch a job on a hpc cluster using a cluster job scheduler (PBS) it’s often the case that your environment won’t find its way into the spawned job environment.

many clusters use the module system for managing your environments, therefore one of the first things you might need to do in your job script is something like:

module load cuda

to pull in the environment settings needed for cuda compilation, for example.

The specifics of this are going to be unique to your cluster. This is probably a question for you to ask the cluster administrators or read existing documentation on how to launch jobs on your cluster.

Alternatively you may try just putting those export commands in your job script. But in any event, the job system probably is not running your .bashrc in the new process it creates to run your job.

thank you for your quick response, I tried this way and is working now.

#PBS -N vector_sum
#PBS -l nodes=1:ppn=4:gpus=1


/usr/local/cuda/bin/nvcc -o vector_sum.out vector_sum.cu