Commit 82a87d7f authored by incardon's avatar incardon

Small fixes

parent c65f4730
......@@ -109,6 +109,26 @@ INCLUDES_PATH+=" -I/usr/local/include -I. -Iconfig -I../../openfpm_devices/src -
########
###### Checking for compiler flags -fext-numeric-literals
AC_LANG_PUSH([C++])
my_save_cflags="$CXXFLAGS"
CXXFLAGS=-fext-numeric-literals
AC_MSG_CHECKING([whether CXX supports -fext-numeric-literals])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])
AM_CXXFLAGS="-fext-numeric-literals"
],
[
AC_MSG_RESULT([no])
]
)
AC_LANG_POP([C++])
CXXFLAGS="$my_save_cflags"
AC_SUBST([AM_CXXFLAGS])
## Enable scan coverty
AC_MSG_CHECKING(whether to build for scan coverty compilation)
......
......@@ -3,13 +3,13 @@ LINKLIBS = $(DEFAULT_LIB) $(PTHREAD_LIBS) $(OPT_LIBS) $(HDF5_LDFLAGS) $(HDF5_LIB
noinst_PROGRAMS = vcluster
vcluster_SOURCES = main.cpp VCluster.cpp ../../openfpm_devices/src/memory/HeapMemory.cpp ../../openfpm_devices/src/memory/PtrMemory.cpp
vcluster_CXXFLAGS = $(INCLUDES_PATH) $(BOOST_CPPFLAGS)
vcluster_CXXFLAGS = $(AM_CXXFLAGS) $(INCLUDES_PATH) $(BOOST_CPPFLAGS)
vcluster_CFLAGS = $(CUDA_CFLAGS)
vcluster_LDADD = $(LINKLIBS)
lib_LIBRARIES = libvcluster.a
libvcluster_a_SOURCES = VCluster.cpp
libvcluster_a_CXXFLAGS = $(INCLUDES_PATH) $(BOOST_CPPFLAGS)
libvcluster_a_CXXFLAGS = $(AM_CXXFLAGS) $(INCLUDES_PATH) $(BOOST_CPPFLAGS)
libvcluster_a_CFLAGS =
nobase_include_HEADERS = MPI_wrapper/MPI_IallreduceW.hpp MPI_wrapper/MPI_IrecvW.hpp MPI_wrapper/MPI_IsendW.hpp MPI_wrapper/MPI_util.hpp MPI_wrapper/MPI_IAllGather.hpp \
......
......@@ -49,9 +49,11 @@ template<typename T> void assign(T * ptr1, T * ptr2)
*ptr1 = *ptr2;
};
//! Helper class to add data without serialization
template<bool sr>
struct op_ssend_recv_add_sr
{
//! Add data
template<typename T, typename D, typename S, int ... prp> static void execute(D & recv,S & v2, size_t i)
{
// Merge the information
......@@ -59,9 +61,11 @@ struct op_ssend_recv_add_sr
}
};
//! Helper class to add data with serialization
template<>
struct op_ssend_recv_add_sr<true>
{
//! Add data
template<typename T, typename D, typename S, int ... prp> static void execute(D & recv,S & v2, size_t i)
{
// Merge the information
......@@ -69,10 +73,11 @@ struct op_ssend_recv_add_sr<true>
}
};
//! Helper class to add data
template<typename op>
struct op_ssend_recv_add
{
//! Add data
template<bool sr, typename T, typename D, typename S, int ... prp> static void execute(D & recv,S & v2, size_t i)
{
// Merge the information
......@@ -80,19 +85,46 @@ struct op_ssend_recv_add
}
};
//! Helper class to merge data without serialization
template<bool sr,template<typename,typename> class op>
struct op_ssend_recv_merge_impl
{
//! Merge the
template<typename T, typename D, typename S, int ... prp> inline static void execute(D & recv,S & v2,size_t i,openfpm::vector<openfpm::vector<aggregate<size_t,size_t>>> & opart)
{
// Merge the information
recv.template merge_prp_v<op,typename T::value_type, PtrMemory, openfpm::grow_policy_identity, prp...>(v2,opart.get(i));
}
};
//! Helper class to merge data with serialization
template<template<typename,typename> class op>
struct op_ssend_recv_merge_impl<true,op>
{
//! merge the data
template<typename T, typename D, typename S, int ... prp> inline static void execute(D & recv,S & v2,size_t i,openfpm::vector<openfpm::vector<aggregate<size_t,size_t>>> & opart)
{
// Merge the information
recv.template merge_prp_v<op,typename T::value_type, HeapMemory, openfpm::grow_policy_double, prp...>(v2,opart.get(i));
}
};
//! Helper class to merge data
template<template<typename,typename> class op>
struct op_ssend_recv_merge
{
//! For each processor contain the list of the particles with which I must merge the information
openfpm::vector<openfpm::vector<aggregate<size_t,size_t>>> & opart;
//! constructor
op_ssend_recv_merge(openfpm::vector<openfpm::vector<aggregate<size_t,size_t>>> & opart)
:opart(opart)
{}
//! execute the merge
template<bool sr, typename T, typename D, typename S, int ... prp> void execute(D & recv,S & v2,size_t i)
{
// Merge the information
recv.template merge_prp_v<op,typename T::value_type, PtrMemory, openfpm::grow_policy_identity, prp...>(v2,opart.get(i));
op_ssend_recv_merge_impl<sr,op>::template execute<T,D,S,prp...>(recv,v2,i,opart);
}
};
......@@ -119,19 +151,6 @@ union red
double d;
};
/*! \brief Virtual Cluster exception
*
* This a a class that signal an exception on MPI_WaitAll
*
*/
class exec_exception: public std::exception
{
virtual const char* what() const throw()
{
return "One or more request has failed or reported an error";
}
};
/*! \brief This class virtualize the cluster of PC as a set of processes that communicate
*
......@@ -228,14 +247,19 @@ class Vcluster
//! Receive buffers
openfpm::vector<BHeapMemory> recv_buf;
// barrier request
//! barrier request
MPI_Request bar_req;
// barrier status
//! barrier status
MPI_Status bar_stat;
//! disable operator=
Vcluster & operator=(const Vcluster &) {return *this;};
Vcluster(const Vcluster &) {};
//! disable copy constructor
Vcluster(const Vcluster &)
:NBX_cnt(0)
{};
public:
......@@ -464,7 +488,7 @@ public:
*
* \param prc list of processors you should communicate with [1,1,6,7,8]
*
* \param v vector containing the data to send [v=vector<vector<int>>, v.size()=4, T=vector<int>], T at the moment
* \param data vector containing the data to send [v=vector<vector<int>>, v.size()=4, T=vector<int>], T at the moment
* is only tested for vectors of 0 or more generic elements (without pointers)
*
* \param msg_alloc This is a call-back with the purpose to allocate space
......@@ -480,6 +504,8 @@ public:
* every time message_alloc is called)
* * void pointer, parameter for additional data to pass to the call-back
*
* \param ptr_arg data passed to the call-back function specified
*
* \param opt options, only NONE supported
*
*/
......@@ -515,7 +541,7 @@ public:
*
* \param prc list of processors you should communicate with [1,1,6,7,8]
*
* \param v vector containing the data to send [v=vector<vector<int>>, v.size()=4, T=vector<int>], T at the moment
* \param data vector containing the data to send [v=vector<vector<int>>, v.size()=4, T=vector<int>], T at the moment
* is only tested for vectors of 0 or more generic elements (without pointers)
*
* \param msg_alloc This is a call-back with the purpose to allocate space
......@@ -531,6 +557,8 @@ public:
* every time message_alloc is called)
* * void pointer, parameter for additional data to pass to the call-back
*
* \param ptr_arg data passed to the call-back function specified
*
* \param opt options, only NONE supported
*
*/
......@@ -597,6 +625,8 @@ public:
* every time message_alloc is called)
* * void pointer, parameter for additional data to pass to the call-back
*
* \param ptr_arg data passed to the call-back function specified
*
* \param opt options, NONE (ignored in this moment)
*
*/
......@@ -742,6 +772,8 @@ public:
* every time message_alloc is called)
* * void pointer, parameter for additional data to pass to the call-back
*
* \param ptr_arg pointer passed to the call-back function
*
* \param opt options, NONE (ignored in this moment)
*
*/
......
......@@ -15,14 +15,8 @@ private:
{
template<typename op, int ... prp> static void call_unpack(S & recv, openfpm::vector<BHeapMemory> & recv_buf, openfpm::vector<size_t> * sz, op & op_param)
{
#ifdef DEBUG
std::cout << "Sz.size(): " << sz->size() << std::endl;
#endif
for (size_t i = 0 ; i < recv_buf.size() ; i++)
{
#ifdef DEBUG
std::cout << "Recv_buf.get(i).size(): " << recv_buf.get(i).size() << std::endl;
#endif
T unp;
ExtPreAlloc<HeapMemory> & mem = *(new ExtPreAlloc<HeapMemory>(recv_buf.get(i).size(),recv_buf.get(i)));
......@@ -116,17 +110,12 @@ private:
if (has_pack_gen<typename T::value_type>::value == false && is_vector<T>::value == true)
//if (has_pack<typename T::value_type>::type::value == false && has_pack_agg<typename T::value_type>::result::value == false && is_vector<T>::value == true)
{
#ifdef DEBUG
std::cout << "Inside SGather pack request (has prp) (vector case) " << std::endl;
#endif
sz.add(send.size()*sizeof(typename T::value_type));
}
else
{
call_serialize_variadic<ind_prop_to_pack>::call_pr(send,tot_size);
#ifdef DEBUG
std::cout << "Inside SGather pack request (has prp) (general case) " << std::endl;
#endif
sz.add(tot_size);
}
}
......@@ -137,17 +126,11 @@ private:
if (has_pack_gen<typename T::value_type>::value == false && is_vector<T>::value == true)
//if (has_pack<typename T::value_type>::type::value == false && has_pack_agg<typename T::value_type>::result::value == false && is_vector<T>::value == true)
{
#ifdef DEBUG
std::cout << "Inside SGather pack (has prp) (vector case) " << std::endl;
#endif
//std::cout << demangle(typeid(T).name()) << std::endl;
send_buf.add(send.getPointer());
}
else
{
#ifdef DEBUG
std::cout << "Inside SGather pack (has prp) (general case) " << std::endl;
#endif
send_buf.add(mem.getPointerEnd());
call_serialize_variadic<ind_prop_to_pack>::call_pack(mem,send,sts);
}
......@@ -563,7 +546,9 @@ void reorder_buffer(openfpm::vector<size_t> & prc, openfpm::vector<size_t> & sz_
size_t pos;
//! default constructor
recv_buff_reorder() {};
recv_buff_reorder()
:proc(0),pos(0)
{};
//! needed to reorder
bool operator<(const recv_buff_reorder & rd) const
......
......@@ -1372,6 +1372,47 @@ BOOST_AUTO_TEST_CASE (Vcluster_semantic_sendrecv_6)
}
}
BOOST_AUTO_TEST_CASE (Vcluster_semantic_bench_all_all)
{
Vcluster & vcl = create_vcluster();
if (vcl.getProcessingUnits() >= 32)
return;
openfpm::vector<size_t> prc_recv2;
openfpm::vector<size_t> prc_recv3;
openfpm::vector<size_t> prc_send;
openfpm::vector<size_t> sz_recv2;
openfpm::vector<size_t> sz_recv3;
openfpm::vector<openfpm::vector<Box<3,size_t>>> v1;
openfpm::vector<Box<3,size_t>> v2;
openfpm::vector<openfpm::vector<Box<3,size_t>>> v3;
v1.resize(vcl.getProcessingUnits());
for(size_t i = 0 ; i < v1.size() ; i++)
{
for (size_t j = 0 ; j < 1000000 ; j++)
{
Box<3,size_t> b({j,j,j},{j,j,j});
v1.get(i).add(b);
}
prc_send.add(i);
}
timer comm_time;
comm_time.start();
vcl.SSendRecv(v1,v2,prc_send,prc_recv2,sz_recv2);
comm_time.stop();
std::cout << "Communication time " << comm_time.getwct() << std::endl;
std::cout << "END" << std::endl;
}
BOOST_AUTO_TEST_SUITE_END()
#endif /* OPENFPM_VCLUSTER_SRC_VCLUSTER_SEMANTIC_UNIT_TESTS_HPP_ */
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