Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
O
openfpm_vcluster
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openfpm
openfpm_vcluster
Commits
0c6528bd
Commit
0c6528bd
authored
May 28, 2015
by
incardon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing MPI_Init and Finalize
parent
d8b66a8a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
15 deletions
+23
-15
src/VCluster.cpp
src/VCluster.cpp
+4
-12
src/VCluster.hpp
src/VCluster.hpp
+16
-0
src/main.cpp
src/main.cpp
+3
-3
No files found.
src/VCluster.cpp
View file @
0c6528bd
...
...
@@ -14,16 +14,8 @@ void init_global_v_cluster(int *argc, char ***argv)
global_v_cluster
=
new
Vcluster
(
argc
,
argv
);
}
// Deallocator object, it deallocate the global_v_cluster at the end of the program
class
init_glob_v_cluster
{
public:
~
init_glob_v_cluster
()
{
delete
global_v_cluster
;
};
};
// Global MPI initialization
bool
global_mpi_init
=
false
;
//
Deallocate at the end
init_glob_v_cluster
v_cls
;
//
number of vcluster instances
size_t
n_vcluster
=
0
;
src/VCluster.hpp
View file @
0c6528bd
...
...
@@ -22,6 +22,9 @@
}\
}
extern
size_t
n_vcluster
;
extern
bool
global_mpi_init
;
///////////////////// Post functions /////////////
template
<
typename
T
>
void
assign
(
T
*
ptr1
,
T
*
ptr2
)
...
...
@@ -125,11 +128,24 @@ public:
// Finalize the MPI program
~
Vcluster
()
{
n_vcluster
--
;
// if there are no other vcluster instances finalize
if
(
n_vcluster
==
0
)
MPI_Finalize
();
}
//! \brief Virtual cluster constructor
Vcluster
(
int
*
argc
,
char
***
argv
)
{
n_vcluster
++
;
// Check if MPI is already initialized
if
(
global_mpi_init
==
false
)
{
MPI_Init
(
argc
,
argv
);
global_mpi_init
=
true
;
}
//! Get the total number of process
//! and the rank of this process
...
...
src/main.cpp
View file @
0c6528bd
...
...
@@ -3,12 +3,12 @@
#include <boost/test/included/unit_test.hpp>
#include "VCluster.hpp"
struct
MPIFixture
{
/*
struct MPIFixture {
MPIFixture() { MPI_Init(&boost::unit_test::framework::master_test_suite().argc,&boost::unit_test::framework::master_test_suite().argv);}
~MPIFixture() { MPI_Finalize(); }
};
BOOST_GLOBAL_FIXTURE
(
MPIFixture
);
BOOST_GLOBAL_FIXTURE(MPIFixture);*/
#include "unit_test_init_cleanup.hpp"
#include "VCluster_unit_tests.hpp"
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