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

Feedback 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)
Date: Feb 15, 15:59
From: Jonathan Madsen <Jonathan Madsen>

Yes you are not using the atomic properly, the value returned from file_pos++ is guaranteed to be unique but the value from file_pos.load() is not. Plus it needs to be static so that all the threads can see it.

This will work:

  static std::atomic<G4int> file_pos;
  auto my_pos = file_pos++;

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

1 Feedback: Re: How to split file reading between cores   (Volodymyr Rodin - Feb 15, 17:22)
(_ Ok: Re: How to split file reading between cores   (Volodymyr Rodin - Feb 16, 10:18)
(_ 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