Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
088af030
Commit
088af030
authored
6 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Define PASTIS_HAS_MPI when MPI is found and used
Use the macro in a crappy way to allow non MPI builds to compile
parent
2c903e7f
No related branches found
No related tags found
1 merge request
!11
Feature/mpi
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+2
-0
2 additions, 0 deletions
CMakeLists.txt
src/utils/PastisUtils.cpp
+10
-0
10 additions, 0 deletions
src/utils/PastisUtils.cpp
src/utils/pastis_config.hpp.in
+2
-0
2 additions, 0 deletions
src/utils/pastis_config.hpp.in
with
14 additions
and
0 deletions
CMakeLists.txt
+
2
−
0
View file @
088af030
...
@@ -94,6 +94,8 @@ elseif(PASTIS_ENABLE_MPI STREQUAL "ON")
...
@@ -94,6 +94,8 @@ elseif(PASTIS_ENABLE_MPI STREQUAL "ON")
message
(
FATAL_ERROR
"Could not find MPI library while requested"
)
message
(
FATAL_ERROR
"Could not find MPI library while requested"
)
endif
()
endif
()
set
(
PASTIS_HAS_MPI
${
MPI_FOUND
}
)
#------------------------------------------------------
#------------------------------------------------------
# setting Kokkos defaults to OpenMP when available
# setting Kokkos defaults to OpenMP when available
...
...
This diff is collapsed.
Click to expand it.
src/utils/PastisUtils.cpp
+
10
−
0
View file @
088af030
...
@@ -13,10 +13,14 @@
...
@@ -13,10 +13,14 @@
#include
<ConsoleManager.hpp>
#include
<ConsoleManager.hpp>
#include
<CLI/CLI.hpp>
#include
<CLI/CLI.hpp>
#ifdef PASTIS_HAS_MPI
#include
<mpi.h>
#include
<mpi.h>
#endif // PASTIS_HAS_MPI
std
::
string
initialize
(
int
&
argc
,
char
*
argv
[])
std
::
string
initialize
(
int
&
argc
,
char
*
argv
[])
{
{
#ifdef PASTIS_HAS_MPI
MPI_Init
(
&
argc
,
&
argv
);
MPI_Init
(
&
argc
,
&
argv
);
{
{
...
@@ -30,6 +34,7 @@ std::string initialize(int& argc, char* argv[])
...
@@ -30,6 +34,7 @@ std::string initialize(int& argc, char* argv[])
pout
.
setOutput
(
null_stream
);
pout
.
setOutput
(
null_stream
);
}
}
}
}
#endif // PASTIS_HAS_MPI
long
unsigned
number
=
10
;
long
unsigned
number
=
10
;
std
::
string
filename
;
std
::
string
filename
;
...
@@ -115,6 +120,7 @@ std::string initialize(int& argc, char* argv[])
...
@@ -115,6 +120,7 @@ std::string initialize(int& argc, char* argv[])
void
finalize
()
void
finalize
()
{
{
#ifdef PASTIS_HAS_MPI
MPI_Barrier
(
MPI_COMM_WORLD
);
MPI_Barrier
(
MPI_COMM_WORLD
);
const
int
mpi_rank
const
int
mpi_rank
=
[](){
=
[](){
...
@@ -133,7 +139,11 @@ void finalize()
...
@@ -133,7 +139,11 @@ void finalize()
pout
()
<<
rang
::
fgB
::
green
<<
"Terminating process "
<<
rang
::
fg
::
reset
pout
()
<<
rang
::
fgB
::
green
<<
"Terminating process "
<<
rang
::
fg
::
reset
<<
rang
::
fgB
::
yellow
<<
mpi_rank
<<
rang
::
fg
::
reset
<<
" of "
<<
rang
::
fgB
::
yellow
<<
mpi_rank
<<
rang
::
fg
::
reset
<<
" of "
<<
rang
::
style
::
bold
<<
mpi_size
<<
rang
::
style
::
reset
<<
'\n'
;;
<<
rang
::
style
::
bold
<<
mpi_size
<<
rang
::
style
::
reset
<<
'\n'
;;
#endif // PASTIS_HAS_MPI
Kokkos
::
finalize
();
Kokkos
::
finalize
();
#ifdef PASTIS_HAS_MPI
MPI_Finalize
();
MPI_Finalize
();
#endif // PASTIS_HAS_MPI
}
}
This diff is collapsed.
Click to expand it.
src/utils/pastis_config.hpp.in
+
2
−
0
View file @
088af030
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
#define PASTIS_CONFIG_HPP
#define PASTIS_CONFIG_HPP
#cmakedefine PASTIS_HAS_FENV_H
#cmakedefine PASTIS_HAS_FENV_H
#cmakedefine PASTIS_HAS_MPI
#cmakedefine SYSTEM_IS_LINUX
#cmakedefine SYSTEM_IS_LINUX
#cmakedefine SYSTEM_IS_DARWIN
#cmakedefine SYSTEM_IS_DARWIN
#cmakedefine SYSTEM_IS_WINDOWS
#cmakedefine SYSTEM_IS_WINDOWS
...
...
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