Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
libcdi
Commits
c8829256
Commit
c8829256
authored
9 years ago
by
Thomas Jahns
Browse files
Options
Downloads
Patches
Plain Diff
Improve clarity of PRNG initialization.
* If pio_write -s switch is used, the effective seed is printed.
parent
6b33c038
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/pio_write.c
+12
-11
12 additions, 11 deletions
tests/pio_write.c
with
12 additions
and
11 deletions
tests/pio_write.c
+
12
−
11
View file @
c8829256
...
...
@@ -137,8 +137,8 @@ int main(int argc, char *argv[])
#endif
/* seed random generator */
unsigned
randSeed
;
{
unsigned
seed
;
#ifdef USE_MPI
if
(
rankGlob
==
0
)
#endif
...
...
@@ -150,13 +150,8 @@ int main(int argc, char *argv[])
perror
(
"failed seed generation!"
);
exit
(
1
);
}
seed
=
(
unsigned
)(
tv
.
tv_sec
^
tv
.
tv_usec
);
fprintf
(
stderr
,
"random seed=%u
\n
"
,
seed
);
randSeed
=
(
unsigned
)(
tv
.
tv_sec
^
tv
.
tv_usec
);
}
#ifdef USE_MPI
MPI_Bcast
(
&
seed
,
1
,
MPI_UNSIGNED
,
0
,
MPI_COMM_WORLD
);
#endif
srandom
(
seed
);
}
{
...
...
@@ -249,10 +244,7 @@ int main(int argc, char *argv[])
setup
.
compute_checksum
=
0
;
break
;
case
's'
:
{
unsigned
seed
=
parse_unsignedarg
(
"error parsing random seed"
);
srandom
(
seed
);
}
randSeed
=
parse_unsignedarg
(
"error parsing random seed"
);
break
;
default:
/* '?' */
fprintf
(
stderr
,
"Usage: %s "
...
...
@@ -266,6 +258,15 @@ int main(int argc, char *argv[])
}
#ifdef USE_MPI
MPI_Bcast
(
&
randSeed
,
1
,
MPI_UNSIGNED
,
0
,
MPI_COMM_WORLD
);
#endif
srandom
(
randSeed
);
#ifdef USE_MPI
if
(
rankGlob
==
0
)
#endif
fprintf
(
stderr
,
"random seed=%u
\n
"
,
randSeed
);
#ifdef USE_MPI
int
pioNamespace
;
commModel
=
pioInit
(
commGlob
,
nProcsIO
,
IOMode
,
&
pioNamespace
,
1
.
0
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment