Singularity container for executables

Versions

FLUKA: 4-5.0
Flair: 3.4-0
Operating system: WSL Ubuntu & Singularity container

Description

Dear FLUKA experts,

I have been running my simulations locally on my computer so far. However, as the simulations have become larger, I want to move to a cluster. I successfully built a Singularity container following a previous post, adjusting it for my version of FLUKA. My container definition file (my_container.def) is attached below.

As a first test, I ran the basic FLUKA example inside the container on the cluster. The simulation completed successfully.
I used the following command (for a job array with 5 parallel runs):
singularity exec fluka_v03_20250731.simg bash -c “cd $WORKDIR && rfluka -M 1 $INPUT_NAME”

In a second test, I wanted to include a user routine (mgdraw). I compiled it in Flair, which generated a runfluka.exe executable. It worked correctly in my local FLUKA installation.
I then copied the executable to the working directory on the cluster and adjusted the run command as follows:
singularity exec fluka_v03_20250731.simg bash -c “cd $WORKDIR && rfluka -M 1 -e ./runfluka.exe $INPUT_NAME”

However, this time the simulation failed with the following output:

F L U K A
Dir: /usr/local/fluka
Data: /usr/local/fluka/data
Exec: /home/hd/hd_hd/hd_on296/FLUKA/20250731_test/runfluka.exe
Input: /home/hd/hd_hd/hd_on296/FLUKA/20250731_test/r04_01.inp
Error: /home/hd/hd_hd/hd_on296/FLUKA/20250731_test/runfluka.exe does not exist or it is not executable!

I confirmed that the executable is at the specified path. So I suspect that the executable is not recognized as executable in the container’s environment.

Now I was wondering if you could help me finding the problem. Do I need to include the compiled executable (runfluka.exe) during the container build process (and if so how), or is my singularity exec command incorrectly set up?

Any help in resolving this issue would be greatly appreciated.
Thanks in advance!
Stefan

Input files

Definition file for building the container:
my_container.def (1.2 KB)

Input file:
r04.inp (1.6 KB)

Dear Stefan,

It seems to be a permission issue. If you run the following command on your custom fluka file:

stat --format '%a' <file>

If the result is 7xx, then it should be executable; if it’s 6xx, then you need to make it executable with the chmod command.

But I expect another issue if you compile the FLUKA executable locally and want to run it in the container. If the OS of the local system and the container are different, the locally created executable may not be compatible with the container.
I suggest installing the g++ and libz-dev packages in the container during its creation, then you can open a shell in the container: singularity shell <image>.simg and compile FLUKA using lfluka there.

Cheers,
David

Thank you very much for your help. It’s working now!