How to change compiler (gcc)

Hi @Erica.Lastufka

The difference between your case and @Yann.Sagon’s example is where you executed your command lines.

# Working with srun (load module before then the job)
(baobab)-[alberta@login2 ~]$ ml GCC/12.2.0
(baobab)-[alberta@login2 ~]$ srun which gcc
srun: job 610387 queued and waiting for resources
srun: job 610387 has been allocated resources
/opt/ebsofts/GCCcore/12.2.0/bin/gcc

# Not working with salloc and gcc command directly
(baobab)-[alberta@login2 ~]$ salloc
salloc: Pending job allocation 610400
salloc: job 610400 queued and waiting for resources
salloc: job 610400 has been allocated resources
salloc: Granted job allocation 610400
salloc: Waiting for resource configuration
salloc: Nodes cpu001 are ready for job
(baobab)-[alberta@cpu001 ~]$ which gcc
/usr/bin/gcc
(baobab)-[alberta@cpu001 ~]$ gcc --version
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-16)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(baobab)-[alberta@cpu001 ~]$ ml GCC/12.2.0
(baobab)-[alberta@cpu001 ~]$ gcc --version
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-16)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# Working using the full path
(baobab)-[alberta@cpu001 ~]$ /opt/ebsofts/GCCcore/12.2.0/bin/gcc --version
gcc (GCC) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I don’t know why it’s not working with the salloc, but you should be able to compile your soft using srun instead of salloc

Or sbatch but be careful about the current issue on Boabab:

PS: I had some free time for an exceptional answer. Due to May 1st, the HPC service is not available :wink: