-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restructure reading of simulation input #188
Conversation
src/run_part.F90
Outdated
! initialize RNG with random seed for UUID generation | ||
call pmc_srand(0, pmc_mpi_rank()) | ||
|
||
if (.not. do_restart) then | ||
call uuid4_str(run_part_opt%uuid) | ||
end if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether this code would be better outside of spec_file_read_run_part()
? It doesn't really seem to be strictly related to reading the spec file. In particular, I don't like having RNG initialization hidden inside a spec-file-reading function because a caller might not expect to have their RNG state reset just because they read a spec file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, i can see this. This RNG is purely for the creation of a UUID (which has more to do with the starting of a simulation and not necessarily reading a main spec file). Would it make sense to move the UUID generation outside the spec file reading but before the MPI calls/new suggested broadcast call? To borrow the code suggestion from above:
if (pmc_mpi_rank() == 0) then
call spec_file_read_run_part()
call uuid_generate()
end if
call spec_file_broadcast_run_part()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I think that structure is a good idea, with a call to pmc_srand()
above that code block (or maybe immediately before uuid_generate()
) with a comment saying that we are initializing it for UUID generation.
One thing that was a bit unclear with the previous code was that it would generate a UUID on all processes, but then overwrite them all by broadcasting from process 0. Your new structure above makes this clearer 🎉
Addressing #184 by moving input file reading and setting of
run_part_opt
options intorun_part.F90
.