[Gate-users] GATE IN MULTICORE PROCESSOR STAND ALONE WORKSTATION

Josh Knowland jknowland at lucernodynamics.com
Sat Jun 13 19:51:11 CEST 2020


Hi Mohammed,
Did you divide the time for each macro?

For example, each copy of your macro should specify:
The total activity to simulate as if you were running only one macro
a unique output filename
divided time slice and total time

To split a simulation into 4 parts, I’d create 4 copies of the macro named:
                Sim_00.mac
                Sim_01.mac
                Sim_02.mac
                Sim_03.mac

Then, each macro would specify its own output filename, but the same activity and tim info (total time divided by the number of splits)

Sim_00.mac
                /gate/source/src_0/setActivity 1 mCi
                /gate/output/ascii/setFileName Sim_00_
/gate/application/setTimeSlice 0.25 s
/gate/application/setTimeStart 0.0 s
/gate/application/setTimeStop 0.25 s

                Sim_01.mac
/gate/source/src_0/setActivity 1 mCi
                /gate/output/ascii/setFileName Sim_01_
/gate/application/setTimeSlice 0.25 s
/gate/application/setTimeStart 0.0 s
/gate/application/setTimeStop 0.25 s

                Sim_02.mac
                /gate/source/src_0/setActivity 1 mCi
                /gate/output/ascii/setFileName Sim_02_
/gate/application/setTimeSlice 0.25 s
/gate/application/setTimeStart 0.0 s
/gate/application/setTimeStop 0.25 s

                Sim_03.mac
                /gate/source/src_0/setActivity 1 mCi
/gate/output/ascii/setFileName Sim_03_
/gate/application/setTimeSlice 0.25 s
/gate/application/setTimeStart 0.0 s
/gate/application/setTimeStop 0.25 s

Note how each macro has its own output filename, but they all have the same time and source activity.

The results would then be output files for each macro:
                Sim_00_Run.dat
                Sim_00_Singles.dat
                Sim_01_Run.dat
                Sim_01_Singles.dat
Sim_02_Run.dat
                Sim_02_Singles.dat
                Sim_03_Run.dat
                Sim_03_Singles.dat

The Run.dat files contain the number of primaries simulated for that particular macro. Each should be approximately the source activity (1 mCi in my example) divided by the number of splits.

The Singles.dat files contain the singles for that macro. You should see that they only contain singles for the time slice simulated.

I hope that helps!
If you wish, you may send me your macros and I will take a look.
Josh





From: Mohammed REZZOUG <nmedrezz at gmail.com>
Sent: Saturday, June 13, 2020 10:52 AM
To: Josh Knowland <jknowland at lucernodynamics.com>
Subject: Re: [Gate-users] GATE IN MULTICORE PROCESSOR STAND ALONE WORKSTATION

Thanks for your help
I used your method, I created 20 copies of my macro, but I got the same result.
The simulation took the same time as if I was using one macro

Le mer. 10 juin 2020 à 23:16, Mohammed REZZOUG <nmedrezz at gmail.com<mailto:nmedrezz at gmail.com>> a écrit :
Thank you very much

Le mer. 10 juin 2020 à 15:06, Josh Knowland <jknowland at lucernodynamics.com<mailto:jknowland at lucernodynamics.com>> a écrit :
I forgot to add that my process does result in multiple output files, so you will likely need to combine them afterwards. I use singles data, so it’s a simple matter of combining the text files. I’m not sure how you would combine different output files (root, etc.)




From: Gate-users <gate-users-bounces at lists.opengatecollaboration.org<mailto:gate-users-bounces at lists.opengatecollaboration.org>> On Behalf Of Josh Knowland
Sent: Wednesday, June 10, 2020 10:03 AM
To: Mohammed REZZOUG <nmedrezz at gmail.com<mailto:nmedrezz at gmail.com>>; gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>
Subject: Re: [Gate-users] GATE IN MULTICORE PROCESSOR STAND ALONE WORKSTATION

Hello Mohammed,
This is actually a topic that I have experience with.

I run my simulations remotely on a 64-core virtual machine through Azure, but the process should be the same.
Here is the workflow I use:

Generate a  macro that does what I want. Test it out with a small activity to make sure. Create multiple copies of the macro, each with a different output filename. You can also use different time-slices if you want to, but all other information can be the same (volume names, etc. do not need to change). Run all the macros concurrently using a shell script like below. Each process will be put on a different core and htop will display CPU usage. It’s also possible to insert a command to send you an email alert when all the scripts are finished. It will depend on your mail server, so I haven’t shown a specific example here.
#!/bin/bash
(
(
Gate macro_00.mac > macro_00_log.txt &
Gate macro_01.mac > macro_01_log.txt &
Gate macro_02.mac > macro_02_log.txt &
Gate macro_03.mac > macro_03_log.txt &
Gate macro_04.mac > macro_04_log.txt &
Gate macro_05.mac > macro_05_log.txt &
Gate macro_06.mac > macro_06_log.txt &
Gate macro_07.mac > macro_07_log.txt &
Gate macro_08.mac > macro_08_log.txt &
Gate macro_09.mac > macro_09_log.txt &
Gate macro_10.mac > macro_10_log.txt &
wait
)
# insert command to send email here
) &
htop



An alternative approach is to use parameterized macros. For this, you’d create one macro with GATE parameters as place holders using braces. Then, the script file would call that macro multiple times while changing the parameters. For instance, you could run one simulation by splitting it over time by using parameters for timestart and timestop like this in the macro:

/gate/application/setTimeSlice 0.125 s
/gate/application/setTimeStart {timestart} s
/gate/application/setTimeStop {timestop} s

Then the script would define the parameters for each process:

#!/bin/bash
(
(
Gate -a [timestart,0.000][timestop,0.125] paramMacro.mac > output_00_log.txt &
Gate -a [timestart,0.125][timestop,0.250] paramMacro.mac > output_01_log.txt &
Gate -a [timestart,0.250][timestop,0.375] paramMacro.mac > output_02_log.txt &
Gate -a [timestart,0.375][timestop,0.500] paramMacro.mac > output_03_log.txt &
Gate -a [timestart,0.500][timestop,0.625] paramMacro.mac > output_04_log.txt &
Gate -a [timestart,0.625][timestop,0.750] paramMacro.mac > output_05_log.txt &
Gate -a [timestart,0.750][timestop,0.875] paramMacro.mac > output_06_log.txt &
Gate -a [timestart,0.875][timestop,1.000] paramMacro.mac > output_07_log.txt &
wait
)
wait
# insert command to send email here
) &
htop



I hope that helps!
Josh





From: Gate-users <gate-users-bounces at lists.opengatecollaboration.org<mailto:gate-users-bounces at lists.opengatecollaboration.org>> On Behalf Of Mohammed REZZOUG
Sent: Wednesday, June 10, 2020 10:35 AM
To: gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>
Subject: [Gate-users] GATE IN MULTICORE PROCESSOR STAND ALONE WORKSTATION

Dear Gate users


I am using the a workstation with 24 cores. The problem at hand is that when I run the code
and analyze my processor, I find that only one core is being used. It takes a long time for
the simulation to get executed even for primitive problems.



In the manual there are instructions about parallel processing using

clusters but there is no mention about multi core systems.



Is it possible to divide the work among the cores of my system like in

clusters ?


---

Mohammed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20200613/03e6b3f9/attachment-0001.html>


More information about the Gate-users mailing list