Commit 9f274001 authored by incardon's avatar incardon

Added shared memory support

parent 05bd067e
......@@ -206,7 +206,7 @@ struct bcast_inte_impl
inline bcast_inte_impl(vect & send,
openfpm::vector<MPI_Request> & req,
size_t root,
ext_comm)
MPI_Comm ext_comm)
:send(send),req(req),root(root),ext_comm(ext_comm)
{};
......
......@@ -337,7 +337,7 @@ class Vcluster: public Vcluster_base<InternalMemory>
*
*/
Vcluster(int *argc, char ***argv,MPI_Comm ext_comm = MPI_COMM_WORLD)
:Vcluster_base(argc,argv,ext_comm)
:Vcluster_base<InternalMemory>(argc,argv,ext_comm)
{
}
......@@ -893,7 +893,8 @@ extern Vcluster<CudaMemory> * global_v_cluster_private_cuda;
static inline void delete_global_v_cluster_private()
{
delete global_v_cluster_private;
delete global_v_cluster_private_heap;
delete global_v_cluster_private_cuda;
}
......@@ -904,22 +905,31 @@ static inline void delete_global_v_cluster_private()
*/
static inline void openfpm_finalize()
{
if (global_option == init_options::in_situ_visualization)
{
MPI_Request bar_req;
MPI_Ibarrier(MPI_COMM_WORLD,&bar_req);
}
if (global_option == init_options::in_situ_visualization)
{
MPI_Request bar_req;
MPI_Ibarrier(MPI_COMM_WORLD,&bar_req);
}
#ifdef HAVE_PETSC
PetscFinalize();
PetscFinalize();
#endif
delete_global_v_cluster_private();
ofp_initialized = false;
delete_global_v_cluster_private();
ofp_initialized = false;
#ifdef CUDA_GPU
// Release memory
mem_tmp.destroy();
mem_tmp.decRef();
#endif
}
/*! \brief Initialize a global instance of Runtime Virtual Cluster Machine
*
* Initialize a global instance of Runtime Virtual Cluster Machine
......@@ -949,11 +959,11 @@ static inline void init_global_v_cluster_private(int *argc, char ***argv, init_o
if (rank != 0 )
{
if (global_v_cluster_private == NULL)
{global_v_cluster_private = new Vcluster(argc,argv,com_compute);}
if (global_v_cluster_private_heap == NULL)
{global_v_cluster_private_heap = new Vcluster<>(argc,argv,com_compute);}
if (global_v_cluster_private_cuda == NULL)
{global_v_cluster_private_cuda = new Vcluster<CudaMemory>(argc,argv,comm_compute);}
{global_v_cluster_private_cuda = new Vcluster<CudaMemory>(argc,argv,com_compute);}
}
else
{
......@@ -984,11 +994,6 @@ static inline void init_global_v_cluster_private(int *argc, char ***argv, init_o
}
}
static inline void delete_global_v_cluster_private()
{
delete global_v_cluster_private_heap;
delete global_v_cluster_private_cuda;
}
template<typename Memory>
struct get_vcl
......@@ -1084,30 +1089,6 @@ static inline void openfpm_init(int *argc, char ***argv, init_options option = i
}
/*! \brief Finalize the library
*
* This function MUST be called at the end of the program
*
*/
static inline void openfpm_finalize()
{
#ifdef HAVE_PETSC
PetscFinalize();
#endif
delete_global_v_cluster_private();
ofp_initialized = false;
#ifdef CUDA_GPU
// Release memory
mem_tmp.destroy();
mem_tmp.decRef();
#endif
}
#endif
......
......@@ -262,7 +262,7 @@ public:
// We try to get the local processors rank
MPI_Comm shmcomm;
MPI_Comm_split_type(MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED, 0,
MPI_Comm_split_type(ext_comm, MPI_COMM_TYPE_SHARED, 0,
MPI_INFO_NULL, &shmcomm);
MPI_Comm_rank(shmcomm, &shmrank);
......
......@@ -217,10 +217,8 @@ template<unsigned int ip> void test_no_send_some_peer()
}
}
template<unsigned int ip> void test_known(Vcluster & vcl)
template<unsigned int ip> void test_known(Vcluster<> & vcl)
{
Vcluster<> & vcl = create_vcluster();
// send/recv messages
global_rank = vcl.getProcessUnitID();
......@@ -325,10 +323,8 @@ template<unsigned int ip> void test_known(Vcluster & vcl)
}
}
template<unsigned int ip> void test(Vcluster & vcl, unsigned int opt)
template<unsigned int ip> void test(Vcluster<> & vcl, unsigned int opt)
{
Vcluster<> & vcl = create_vcluster();
// send/recv messages
global_rank = vcl.getProcessUnitID();
......
......@@ -239,7 +239,7 @@ BOOST_AUTO_TEST_CASE( VCluster_communicator_with_external_communicator )
if (rank != 0 )
{
Vcluster v_cl(&boost::unit_test::framework::master_test_suite().argc,&boost::unit_test::framework::master_test_suite().argv,com_compute);
Vcluster<> v_cl(&boost::unit_test::framework::master_test_suite().argc,&boost::unit_test::framework::master_test_suite().argv,com_compute);
test_known<NBX>(v_cl);
test<NBX>(v_cl,RECEIVE_SIZE_UNKNOWN);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment