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
02c93554
Commit
02c93554
authored
Apr 14, 2016
by
Pietro Incardona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changing vcluster initialization
parent
8d4d2abd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
23 deletions
+54
-23
src/VCluster.cpp
src/VCluster.cpp
+1
-1
src/VCluster.hpp
src/VCluster.hpp
+38
-7
src/VCluster_semantic_unit_tests.hpp
src/VCluster_semantic_unit_tests.hpp
+4
-4
src/VCluster_unit_test_util.hpp
src/VCluster_unit_test_util.hpp
+5
-5
src/VCluster_unit_tests.hpp
src/VCluster_unit_tests.hpp
+4
-4
src/unit_test_init_cleanup.hpp
src/unit_test_init_cleanup.hpp
+2
-2
No files found.
src/VCluster.cpp
View file @
02c93554
#include "VCluster.hpp"
Vcluster
*
global_v_cluster
=
NULL
;
Vcluster
*
global_v_cluster
_private
=
NULL
;
// number of vcluster instances
size_t
n_vcluster
=
0
;
src/VCluster.hpp
View file @
02c93554
...
...
@@ -975,8 +975,7 @@ public:
// Function to initialize the global VCluster //
extern
Vcluster
*
global_v_cluster
;
extern
Vcluster
*
global_v_cluster_private
;
/*! \brief Initialize a global instance of Runtime Virtual Cluster Machine
*
...
...
@@ -984,15 +983,47 @@ extern Vcluster * global_v_cluster;
*
*/
static
inline
void
init_global_v_cluster
(
int
*
argc
,
char
***
argv
)
static
inline
void
init_global_v_cluster_private
(
int
*
argc
,
char
***
argv
)
{
if
(
global_v_cluster_private
==
NULL
)
global_v_cluster_private
=
new
Vcluster
(
argc
,
argv
);
}
static
inline
void
delete_global_v_cluster_private
()
{
delete
global_v_cluster_private
;
}
static
inline
Vcluster
&
create_vcluster
()
{
#ifdef SE_CLASS1
if
(
global_v_cluster_private
==
NULL
)
std
::
cerr
<<
__FILE__
<<
":"
<<
__LINE__
<<
" Error you must call openfpm_init before using any distributed data structures"
;
#endif
return
*
global_v_cluster_private
;
}
/*! \brief Initialize the library
*
* This function MUST be called before any other function
*
*/
static
inline
void
openfpm_init
(
int
*
argc
,
char
***
argv
)
{
if
(
global_v_cluster
==
NULL
)
global_v_cluster
=
new
Vcluster
(
argc
,
argv
);
init_global_v_cluster_private
(
argc
,
argv
);
}
static
inline
void
delete_global_v_cluster
()
/*! \brief Finalize the library
*
* This function MUST be called at the end of the program
*
*/
static
inline
void
openfpm_finalize
()
{
delete
global_v_cluster
;
delete
_global_v_cluster_private
()
;
}
#endif
...
...
src/VCluster_semantic_unit_tests.hpp
View file @
02c93554
...
...
@@ -22,7 +22,7 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_gather)
{
for
(
size_t
i
=
0
;
i
<
100
;
i
++
)
{
Vcluster
&
vcl
=
*
global_v_cluster
;
Vcluster
&
vcl
=
create_vcluster
()
;
if
(
vcl
.
getProcessingUnits
()
>=
32
)
return
;
...
...
@@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_struct_gather)
{
for
(
size_t
i
=
0
;
i
<
100
;
i
++
)
{
Vcluster
&
vcl
=
*
global_v_cluster
;
Vcluster
&
vcl
=
create_vcluster
()
;
if
(
vcl
.
getProcessingUnits
()
>=
32
)
return
;
...
...
@@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_scatter)
{
for
(
size_t
i
=
0
;
i
<
100
;
i
++
)
{
Vcluster
&
vcl
=
*
global_v_cluster
;
Vcluster
&
vcl
=
create_vcluster
()
;
if
(
vcl
.
getProcessingUnits
()
>=
32
)
return
;
...
...
@@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_struct_scatter)
{
for
(
size_t
i
=
0
;
i
<
100
;
i
++
)
{
Vcluster
&
vcl
=
*
global_v_cluster
;
Vcluster
&
vcl
=
create_vcluster
()
;
if
(
vcl
.
getProcessingUnits
()
>=
32
)
return
;
...
...
src/VCluster_unit_test_util.hpp
View file @
02c93554
...
...
@@ -40,8 +40,8 @@ void * msg_alloc(size_t msg_i ,size_t total_msg, size_t total_p, size_t i,size_t
{
openfpm
::
vector
<
openfpm
::
vector
<
unsigned
char
>>
*
v
=
static_cast
<
openfpm
::
vector
<
openfpm
::
vector
<
unsigned
char
>>
*>
(
ptr
);
if
(
global_v_cluster
->
getProcessingUnits
()
<=
8
)
{
if
(
totp_check
)
BOOST_REQUIRE_EQUAL
(
total_p
,
global_v_cluster
->
getProcessingUnits
()
-
1
);}
if
(
create_vcluster
().
getProcessingUnits
()
<=
8
)
{
if
(
totp_check
)
BOOST_REQUIRE_EQUAL
(
total_p
,
create_vcluster
().
getProcessingUnits
()
-
1
);}
else
{
if
(
totp_check
)
BOOST_REQUIRE_EQUAL
(
total_p
,(
size_t
)
8
);}
...
...
@@ -136,7 +136,7 @@ template <unsigned int ip> std::string method()
template
<
unsigned
int
ip
>
void
test_no_send_some_peer
()
{
Vcluster
&
vcl
=
*
global_v_cluster
;
Vcluster
&
vcl
=
create_vcluster
()
;
size_t
n_proc
=
vcl
.
getProcessingUnits
();
...
...
@@ -228,7 +228,7 @@ template<unsigned int ip> void test_no_send_some_peer()
template
<
unsigned
int
ip
>
void
test
()
{
Vcluster
&
vcl
=
*
global_v_cluster
;
Vcluster
&
vcl
=
create_vcluster
()
;
// send/recv messages
...
...
@@ -325,7 +325,7 @@ template<unsigned int ip> void test()
}
}
std
::
srand
(
global_v_cluster
->
getProcessUnitID
());
std
::
srand
(
create_vcluster
().
getProcessUnitID
());
std
::
default_random_engine
eg
;
std
::
uniform_int_distribution
<
int
>
d
(
0
,
n_proc
/
8
);
...
...
src/VCluster_unit_tests.hpp
View file @
02c93554
...
...
@@ -21,14 +21,14 @@ BOOST_AUTO_TEST_SUITE( VCluster_test )
BOOST_AUTO_TEST_CASE
(
Vcluster_robustness
)
{
Vcluster
&
vcl
=
*
global_v_cluster
;
Vcluster
&
vcl
=
create_vcluster
()
;
vcl
.
execute
();
}
BOOST_AUTO_TEST_CASE
(
VCluster_use_reductions
)
{
Vcluster
&
vcl
=
*
global_v_cluster
;
Vcluster
&
vcl
=
create_vcluster
()
;
unsigned
char
uc
=
1
;
char
c
=
1
;
...
...
@@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE( VCluster_use_reductions)
BOOST_AUTO_TEST_CASE
(
VCluster_send_recv
)
{
Vcluster
&
vcl
=
*
global_v_cluster
;
Vcluster
&
vcl
=
create_vcluster
()
;
test_send_recv_complex
(
N_V_ELEMENTS
,
vcl
);
test_send_recv_primitives
<
unsigned
char
>
(
N_V_ELEMENTS
,
vcl
);
...
...
@@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE(VCluster_send_recv)
BOOST_AUTO_TEST_CASE
(
VCluster_allgather
)
{
Vcluster
&
vcl
=
*
global_v_cluster
;
Vcluster
&
vcl
=
create_vcluster
()
;
if
(
vcl
.
getProcessingUnits
()
<
256
)
test_single_all_gather_primitives
<
unsigned
char
>
(
vcl
);
...
...
src/unit_test_init_cleanup.hpp
View file @
02c93554
...
...
@@ -13,11 +13,11 @@
struct
ut_start
{
ut_start
()
{
BOOST_TEST_MESSAGE
(
"Initialize global VCluster"
);
init_global_v_cluster
(
&
boost
::
unit_test
::
framework
::
master_test_suite
().
argc
,
&
boost
::
unit_test
::
framework
::
master_test_suite
().
argv
);
openfpm_init
(
&
boost
::
unit_test
::
framework
::
master_test_suite
().
argc
,
&
boost
::
unit_test
::
framework
::
master_test_suite
().
argv
);
}
~
ut_start
()
{
BOOST_TEST_MESSAGE
(
"Delete global VClster"
);
delete_global_v_cluster
();
}
openfpm_finalize
();
}
};
//____________________________________________________________________________//
...
...
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