Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Nektar
Nektar
Commits
1cfebed3
Commit
1cfebed3
authored
Jun 26, 2017
by
Spencer Sherwin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated the nprocs routine to run in parallel over a different number of processes
parent
6c9c0631
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
16 deletions
+35
-16
utilities/FieldConvert/FieldConvert.cpp
utilities/FieldConvert/FieldConvert.cpp
+35
-16
No files found.
utilities/FieldConvert/FieldConvert.cpp
View file @
1cfebed3
...
...
@@ -210,8 +210,15 @@ int main(int argc, char* argv[])
*/
FieldSharedPtr
f
=
boost
::
shared_ptr
<
Field
>
(
new
Field
());
int
nParts
=
1
;
int
MPInprocs
=
1
;
int
MPIrank
=
0
;
LibUtilities
::
CommSharedPtr
MPIComm
;
if
(
LibUtilities
::
GetCommFactory
().
ModuleExists
(
"ParallelMPI"
))
{
// get hold of parallel communicator first
MPIComm
=
LibUtilities
::
GetCommFactory
().
CreateInstance
(
"ParallelMPI"
,
argc
,
argv
);
if
(
vm
.
count
(
"nprocs"
))
{
int
nprocs
,
rank
;
...
...
@@ -222,6 +229,10 @@ int main(int argc, char* argv[])
}
else
{
//work out number of ranks an
MPInprocs
=
MPIComm
->
GetSize
();
MPIrank
=
MPIComm
->
GetRank
();
nParts
=
nprocs
;
rank
=
0
;
}
...
...
@@ -231,8 +242,7 @@ int main(int argc, char* argv[])
}
else
{
f
->
m_comm
=
LibUtilities
::
GetCommFactory
().
CreateInstance
(
"ParallelMPI"
,
argc
,
argv
);
f
->
m_comm
=
MPIComm
;
}
}
else
...
...
@@ -247,7 +257,6 @@ int main(int argc, char* argv[])
ModuleKey
module
;
ModuleSharedPtr
mod
;
if
(
vm
.
count
(
"verbose"
))
{
f
->
m_verbose
=
true
;
...
...
@@ -421,30 +430,34 @@ int main(int argc, char* argv[])
PrintExecutionSequence
(
modules
);
}
//
Loop on partitions when using nproc
s wit
h
out
procid
for
(
int
p
=
0
;
p
<
nParts
;
++
p
)
//
if nParts is specified then ensure output module
s w
r
it
e
out
mutipile files
if
(
nParts
>
1
)
{
if
(
verbose
&&
nParts
>
1
)
for
(
int
i
=
0
;
i
<
modules
.
size
();
++
i
)
{
cout
<<
endl
<<
"Processing partition: "
<<
p
<<
endl
;
if
(
modules
[
i
]
->
GetModulePriority
()
==
eOutput
)
{
modules
[
i
]
->
RegisterConfig
(
"writemultiplefiles"
,
"true"
);
}
}
}
if
(
nParts
>
0
)
// Loop on partitions if required
for
(
int
p
=
MPIrank
;
p
<
nParts
;
p
+=
MPInprocs
)
{
// write out which partition is being processed and defined a
// new serial communicator
if
(
nParts
>
1
)
{
cout
<<
endl
<<
"Processing partition: "
<<
p
<<
endl
;
int
rank
=
p
;
f
->
ClearField
();
f
->
m_comm
=
boost
::
shared_ptr
<
FieldConvertComm
>
(
new
FieldConvertComm
(
argc
,
argv
,
nParts
,
rank
));
for
(
int
i
=
0
;
i
<
modules
.
size
();
++
i
)
{
if
(
modules
[
i
]
->
GetModulePriority
()
==
eOutput
)
{
modules
[
i
]
->
RegisterConfig
(
"writemultiplefiles"
,
"true"
);
}
}
}
// Run field process.
for
(
int
n
=
0
;
n
<
SIZE_ModulePriority
;
++
n
)
{
...
...
@@ -469,6 +482,12 @@ int main(int argc, char* argv[])
cout
<<
"Total CPU Time: "
<<
setw
(
8
)
<<
left
<<
ss
.
str
()
<<
endl
;
}
if
(
nParts
>
1
)
{
MPIComm
->
Block
();
MPIComm
->
Finalise
();
}
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment