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

Josh Knowland jknowland at lucernodynamics.com
Sun Jun 14 17:15:37 CEST 2020


Great point, yes, use a random seed for each macro. I'm not sure if using a different timeslice for each would help or not also, but that's an option.

For example, macro 00 runs 0 sec to 0.1 sec, macro 01 runs from 0.1 sec to 0.2 sec, etc.


Josh






Sent from Outlook Mobile<https://aka.ms/blhgte>
________________________________
From: Gate-users <gate-users-bounces at lists.opengatecollaboration.org> on behalf of Zakaria Aboulbanine <zakaria.aboulbanine at gmail.com>
Sent: Sunday, June 14, 2020 10:34:42 AM
To: gate-users at lists.opengatecollaboration.org <gate-users at lists.opengatecollaboration.org>
Subject: Re: [Gate-users] GATE IN MULTICORE PROCESSOR STAND ALONE WORKSTATION

Dear Mohammed,

I think if you are using a single phase space source for multiple simulations and with the same seed number you will obviously get the same output file for all your separated maco.
In this particular case I suggest to use multiple phase space files, ench one for a simulation macro as explained by Josh Knowland in the last message. Eventually you have to change your seed number then merge your output and the end.

Regards.

--
Zakaria Aboulbanine




Le dim. 14 juin 2020 à 03:07, <gate-users-request at lists.opengatecollaboration.org<mailto:gate-users-request at lists.opengatecollaboration.org>> a écrit :
Send Gate-users mailing list submissions to
        gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.opengatecollaboration.org/mailman/listinfo/gate-users
or, via email, send a message with subject or body 'help' to
        gate-users-request at lists.opengatecollaboration.org<mailto:gate-users-request at lists.opengatecollaboration.org>

You can reach the person managing the list at
        gate-users-owner at lists.opengatecollaboration.org<mailto:gate-users-owner at lists.opengatecollaboration.org>

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Gate-users digest..."


Today's Topics:

   1. Re: GATE IN MULTICORE PROCESSOR STAND ALONE WORKSTATION
      (Josh Knowland)


----------------------------------------------------------------------

Message: 1
Date: Sat, 13 Jun 2020 17:51:11 +0000
From: Josh Knowland <jknowland at lucernodynamics.com<mailto:jknowland at lucernodynamics.com>>
To: Mohammed REZZOUG <nmedrezz at gmail.com<mailto:nmedrezz at gmail.com>>
Cc: "gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>"
        <gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>>
Subject: Re: [Gate-users] GATE IN MULTICORE PROCESSOR STAND ALONE
        WORKSTATION
Message-ID:
        <BN8PR15MB2676F0BEB4FF89704A8FFEC9AF9E0 at BN8PR15MB2676.namprd15.prod.outlook.com<mailto:BN8PR15MB2676F0BEB4FF89704A8FFEC9AF9E0 at BN8PR15MB2676.namprd15.prod.outlook.com>>

Content-Type: text/plain; charset="utf-8"

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<mailto:nmedrezz at gmail.com>>
Sent: Saturday, June 13, 2020 10:52 AM
To: Josh Knowland <jknowland at lucernodynamics.com<mailto: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><mailto: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><mailto: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><mailto: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><mailto:nmedrezz at gmail.com<mailto:nmedrezz at gmail.com>>>; gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org><mailto: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><mailto: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><mailto: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.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Gate-users mailing list
Gate-users at lists.opengatecollaboration.org<mailto:Gate-users at lists.opengatecollaboration.org>
http://lists.opengatecollaboration.org/mailman/listinfo/gate-users

------------------------------

End of Gate-users Digest, Vol 169, Issue 25
*******************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20200614/5d1edb34/attachment-0001.html>


More information about the Gate-users mailing list