Message: Re: How to split file reading between cores Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Ok Re: How to split file reading between cores 

Forum: Multithreading
Re: Question How to split file reading between cores (Volodymyr Rodin)
Re: Feedback Re: How to split file reading between cores (Jonathan Madsen)
Re: Question Re: How to split file reading between cores (Volodymyr Rodin)
Re: Feedback Re: How to split file reading between cores (Jonathan Madsen)
Re: Feedback Re: How to split file reading between cores (Volodymyr Rodin)
Date: Feb 16, 10:18
From: Volodymyr Rodin <Volodymyr Rodin>

Fixed this avoiding atomic!

Header file:

 static G4int file_pos;
 static G4int GetNextValue()
     {
        G4int current_pos = file_pos++;
      return current_pos;
     }

CC file:
 G4int PrimaryGeneratorAction::file_pos(0);

 G4int pos=GetNextValue();
fParticleGun->SetParticleEnergy(E_vec[pos]*MeV);

G4WT1 > ### Run 0 starts on worker thread 1.
G4WT0 > ### Run 0 starts on worker thread 0.
G4WT2 > ### Run 0 starts on worker thread 2.
G4WT3 > ### Run 0 starts on worker thread 3.
G4WT1 > Going to create slave ntuples from main
G4WT1 > Line = 0 x = 0.0585731 y =1.0901 z =3.17355
 Px = 0.0050951 Py =0.0145987 Pz =3.17355 PDGid =11
G4WT2 > Going to create slave ntuples from main
G4WT2 > Line = 1 x = -1.7971 y =-0.18557 z =1.21998
 Px = -0.001731 Py =-0.003405 Pz =1.21998 PDGid =11
G4WT0 > Going to create slave ntuples from main
G4WT0 > Line = 2 x = 1.03159 y =-0.892959 z =0.21822
 Px = 0.0016013 Py =-0.001666 Pz =0.21822 PDGid =11
G4WT3 > Going to create slave ntuples from main
G4WT3 > Line = 3 x = -2.59682 y =1.14159 z =2.68172
 Px = 0.0005009 Py =-0.000795 Pz =2.68172 PDGid =11
G4WT1 > Line = 4 x = 0.9022625 y =-1.002452 z =3.6941686
 Px = 0.0048686 Py =0.0024817 Pz =3.6941686 PDGid =11
G4WT0 > Line = 5 x = -0.232088 y =-0.13199 z =1.0499
 Px = 0.0092164 Py =0.0050631 Pz =1.0499 PDGid =11
G4WT2 > Line = 6 x = -1.037834 y =-0.671373 z =3.906119
 Px = -0.004173 Py =0.0122775 Pz =3.906119 PDGid =11
G4WT3 > Line = 7 x = -0.38474 y =-0.283684 z =2.927444
....
G4WT1 > Thread-local run terminated.
G4WT0 > Thread-local run terminated.
G4WT3 > Line = 48 x = 1.1159412 y =-0.002993 z =0.1987785
 Px = 0.0019001 Py =-0.000852 Pz =0.1987785 PDGid =11
G4WT2 > Line = 49 x = 0.3875607 y =0.1792232 z =2.3510832
 Px = 0.0024739 Py =-0.008907 Pz =2.3510832 PDGid =11
G4WT1 > Run Summary
G4WT0 > Run Summary
G4WT0 >   Number of events processed : 12
G4WT0 >   User=0.030000s Real=0.049769s Sys=0.040000s [Cpu=140.6%]
G4WT1 >   Number of events processed : 12
G4WT1 >   User=0.030000s Real=0.051895s Sys=0.040000s [Cpu=134.9%]
G4WT2 > Thread-local run terminated.
G4WT3 > Thread-local run terminated.

Completely forgot about static methods)

Thanks for the help,

Volodymyr Rodin

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Question: Re: How to split file reading between cores   (Michael H. Kelsey - Feb 17, 10:22)
1 Ok: Re: How to split file reading between cores   (Volodymyr Rodin - Feb 18, 04:06)
1 Feedback: Re: How to split file reading between cores   (Jonathan Madsen - Feb 18, 07:24)
2 Feedback: Re: How to split file reading between cores   (Jonathan Madsen - Feb 18, 07:57)
 Add Message Add Message
to: "Re: How to split file reading between cores"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews