Compile the case on another computer before execution

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
rodion
Posts: 98
Joined: Wed Jan 11, 2017 4:13 pm

Compile the case on another computer before execution

Post by rodion »

Hello everyone,

I need to use Code_Saturne on a HPC cluster with Linux. But the cluster cannot compile the code for some reason, which is not clear for me.
As far as I understand, it will work if I compile the code on a separate computer and then just copy the compiled code to the cluster.
Does someone have any idea how to do this?
I found some start parameter "compile" but I don't understand, how to use it.

Best regards,
Rodion
Yvan Fournier
Posts: 4079
Joined: Mon Feb 20, 2012 3:25 pm

Re: Compile the case on another computer before execution

Post by Yvan Fournier »

Hello,

This can be quite tricky, because you need to ensure the libraries installed on both machines are identical, or at least binary compatible.

Could you obain more details on why you cannot compile the code on the cluster ? On some clusters, you cannot compile code on the compute nodes, but you may do son on the front-end nodes, in which case using the "code_saturne submit /runcase" (instead of submitting a runcase directly) should work (you need to make sure the post-install configuration for the batch system is done to use this).

If you can't compile the code even on the front-end nodes, then you should check with the administrators why this is not possible.

Regards,

Yvan
rodion
Posts: 98
Joined: Wed Jan 11, 2017 4:13 pm

Re: Compile the case on another computer before execution

Post by rodion »

Thanks a lot for your answer, Yvan.

I think, it is the case for me: compilation doesn't work on the compute nodes. So I need to discuss it more with the administrator.
I just hoped that the compilation could be done without problems on a virtual machine with Ubuntu and then sent to the cluster.
Could you please explain, how I should use the command "code_saturne submit /runcase"?

Best regards,
Rodion
Yvan Fournier
Posts: 4079
Joined: Mon Feb 20, 2012 3:25 pm

Re: Compile the case on another computer before execution

Post by Yvan Fournier »

Hello,

If you have done the post-install step to configure the code for the cluster's batch system (which is recommended in any case), and created a case after this configuration (or updated the case using "code_saturne create --import-only" from that case's directory), then startign the computation from the GUI will automatically use "code_saturne submit" instead odf "code_saturne run" (the "run" button should be replaced by a "submit" button, so it is easy to check).

If you are starting the code manually, simply "cd" to the SCRIPTS directory, and run "code_saturne submit ./runcase" instead of "./runcase".

Best regards,

Yvan
rodion
Posts: 98
Joined: Wed Jan 11, 2017 4:13 pm

Re: Compile the case on another computer before execution

Post by rodion »

Thank you for your answer, Yvan.

Unfortunately, I cannot use Code_Saturne from the terminal and I do not have GUI. I have to start all the calculations with a script for Slurm just by typing "sbatch script_for_calc.batch".
The script currently looks as following:

Code: Select all

#!/bin/bash
#!/bin/bash
#SBATCH --partition=24h
#SBATCH --tasks=4
#SBATCH --cpus-per-task=1
#SBATCH --mem=32g

module load code_saturne/4.2.4
module load gcc/5.4.0
module unload configuration
module load intel/composer/xe_2017
srun code_saturne run --param WOBCInit_ElecArcAndElectrodes.xml --nprocs 8
This script is located in the folder DATA and it does not work. It cannot find -lmpifort
I think, the administrator already installed the necessary compiler. Also MPI exists on the cluster for sure.
Could you please explain, what am I doing wrong?

Best regards,
Rodion
Luciano Garelli
Posts: 284
Joined: Fri Dec 04, 2015 1:42 pm

Re: Compile the case on another computer before execution

Post by Luciano Garelli »

Hello Rodion,

When I run a case in a cluster using TUI I do the following steps:

1) In the DATA directory I run

code_saturne run --nprocs=3 --initialize --param setup.xml

This will run the data preparation stage (compile user functions, read mesh and join mesh, etc) and create the directory
(YYYYMMDD-HHMM) inside of the RESU. In this directory is created the following run_solver script.

Code: Select all

#!/bin/bash
.....
....
....
export OMP_NUM_THREADS=1

cd /share/storage/Test/RESU/20180111-1740

# Run solver.
/share/apps/openmpi-1.8.7-g4.8/bin/mpiexec -n 3 ./cs_solver --param setup.xml --mpi $@
export CS_RET=$?

exit $CS_RET
2) After that I edit the run_solver script to be executed using slurm

Code: Select all

#!/bin/bash
#SBATCH --ntasks=24 --ntasks-per-node=4
#SBATCH --cpus-per-task=1
....
...
...

export OMP_NUM_THREADS=1

cd  /share/storage/Test/RESU/20180111-1740

# Run solver.
/share/apps/openmpi-1.8.7-g4.8/bin/mpiexec  ./cs_solver --param setup.xml --mpi $@
export CS_RET=$?

exit $CS_RET
3) Then I run: sbatch run_solver

In this example I have compile some user functions so the local ./cs_solver binary is used, if you don't compile any user function the system (in my case /share/apps/code-saturne/5.0.1/libexec/code_saturne/cs_solver) cs_solver is used.

I hope that this helps you

Regards,
Luciano
rodion
Posts: 98
Joined: Wed Jan 11, 2017 4:13 pm

Re: Compile the case on another computer before execution

Post by rodion »

Thanks a lot, Luciano.
Post Reply