8 #ifndef VCLUSTER_UNIT_TEST_UTIL_HPP_ 9 #define VCLUSTER_UNIT_TEST_UTIL_HPP_ 11 #include "Point_test.hpp" 12 #include "VCluster_base.hpp" 13 #include "Vector/vector_test_util.hpp" 14 #include "VCluster/VCluster.hpp" 16 constexpr
int RECEIVE_UNKNOWN = 1;
17 constexpr
int RECEIVE_SIZE_UNKNOWN = 2;
19 constexpr
int NBX = 1;
20 constexpr
int NBX_ASYNC = 2;
21 constexpr
int KNOWN_PRC = 3;
23 constexpr
int N_TRY = 2;
24 constexpr
int N_LOOP = 67108864;
25 constexpr
int BUFF_STEP = 524288;
26 constexpr
int P_STRIDE = 17;
29 size_t global_step = 0;
44 int mod(
int x,
int m) {
52 void * msg_alloc(
size_t msg_i ,
size_t total_msg,
size_t total_p,
size_t i,
size_t ri,
size_t tag,
void * ptr)
60 if (create_vcluster().getProcessingUnits() <= 8)
61 {
if (totp_check) BOOST_REQUIRE_EQUAL(total_p,create_vcluster().getProcessingUnits()-1);}
63 {
if (totp_check) BOOST_REQUIRE_EQUAL(total_p,(
size_t)8);}
65 BOOST_REQUIRE_EQUAL(msg_i, global_step);
72 v->get(i).resize(msg_i);
75 return &(v->get(i).get(0));
85 void * msg_alloc2(
size_t msg_i ,
size_t total_msg,
size_t total_p,
size_t i,
size_t ri,
void * ptr)
90 prc_recv.resize(total_p);
92 BOOST_REQUIRE_EQUAL(msg_i, global_step);
95 v->get(
id-1).resize(msg_i);
96 prc_recv.get(
id-1) = i;
97 return &(v->get(
id-1).get(0));
100 void * msg_alloc3(
size_t msg_i ,
size_t total_msg,
size_t total_p,
size_t i,
size_t ri,
size_t tag,
void * ptr)
108 BOOST_REQUIRE_EQUAL(msg_i, global_step);
110 v->last().resize(msg_i);
112 return &(v->last().get(0));
115 void * msg_alloc4(
size_t msg_i ,
size_t total_msg,
size_t total_p,
size_t i,
size_t ri,
size_t tag,
void * ptr)
117 rcv_rm * v = static_cast<rcv_rm *>(ptr);
119 v->recv_message->add();
123 BOOST_REQUIRE_EQUAL(msg_i, global_step);
125 v->recv_message->last().resize(msg_i);
126 v->prc_recv->last() = i;
127 return &(v->recv_message->last().get(0));
130 template<
unsigned int ip,
typename T>
void commFunc(
Vcluster<> & vcl,
openfpm::vector< size_t > & prc,
openfpm::vector< T > & data,
void * (* msg_alloc)(
size_t,
size_t,
size_t,
size_t,
size_t,
size_t,
void *),
void * ptr_arg)
152 template<
unsigned int ip>
155 void * (* msg_alloc)(
size_t,
size_t,
size_t,
size_t,
size_t,
size_t,
void *),
160 &ptr.get(0),prc_recv.
size(),&prc_recv.get(0),msg_alloc,ptr_arg);
163 template<
unsigned int ip,
typename T>
164 void commFunc_null_odd(
Vcluster<> & vcl,
openfpm::vector< size_t > & prc,
openfpm::vector< T > & data,
void * (* msg_alloc)(
size_t,
size_t,
size_t,
size_t,
size_t,
size_t,
void *),
void * ptr_arg)
175 template<
unsigned int ip>
202 template<
unsigned int ip>
213 ptr.resize(message.size());
214 sz.resize(message.size());
216 for (
size_t i = 0 ; i < ptr.
size() ; i++)
218 ptr.get(i) = message.get(i).getPointer();
219 sz.get(i) = message.get(i).
size();
225 prc_recv.
size(),(
size_t *)prc_recv.getPointer(),msg_alloc,ptr_arg);
230 prc_recv.
size(),(
size_t *)prc_recv.getPointer(),msg_alloc,ptr_arg);
245 template <
unsigned int ip> std::string method()
247 return std::string(
"NBX");
250 template<
unsigned int ip>
void test_no_send_some_peer()
262 long int ps = n_proc / (8 + 1);
275 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
282 std::ostringstream msg;
284 std::string str(msg.str());
285 message.last().resize(j);
286 memset(message.last().getPointer(),0,j);
287 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message.last().get(0)));
292 recv_message.resize(n_proc);
299 commFunc_null_odd<ip>(vcl,prc,message,msg_alloc,&recv_message);
304 double clk_max = clk;
306 size_t size_send_recv = 2 * j * (prc.
size());
307 vcl.
sum(size_send_recv);
312 std::cout <<
"(Long pattern: " << method<ip>() <<
")Buffer size: " << j <<
" Bandwidth (Average): " << size_send_recv / vcl.
getProcessingUnits() / clk / 1e6 <<
" MB/s " <<
" Bandwidth (Total): " << size_send_recv / clk / 1e6 <<
" MB/s Clock: " << clk <<
" Clock MAX: " << clk_max <<
"\n";
316 for (
long int i = 0 ; i < 8 && i < (
long int)n_proc ; i++)
322 p_id = p_id % n_proc;
330 std::ostringstream msg;
332 std::string str(msg.str());
333 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message.get(p_id).get(0))),
true);
337 BOOST_REQUIRE_EQUAL((
size_t)0,recv_message.get(p_id).size());
342 template<
unsigned int ip>
void test_known(
size_t opt)
353 for (
size_t s = 0 ; s < N_TRY ; s++)
355 for (
size_t j = 32 ; j < N_LOOP ; j*=2)
362 recv_message.reserve(n_proc);
369 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
376 std::ostringstream msg;
378 std::string str(msg.str());
379 message.last().resize(j);
380 memset(message.last().getPointer(),0,j);
381 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message.last().get(0)));
385 recv_message.resize(n_proc);
387 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
393 p_id = p_id % n_proc;
398 recv_message.get(p_id).resize(j);
408 if (opt == KNOWN_PRC)
409 {commFunc_kn_prc<ip>(vcl,prc,message,prc_recv,recv_sz,&recv_message);}
411 {commFunc_kn<ip>(vcl,prc,message,prc_recv,recv_sz,&recv_message);}
417 double clk_max = clk;
419 size_t size_send_recv = 2 * j * (prc.
size());
420 vcl.
sum(size_send_recv);
425 std::cout <<
"(Short pattern: " << method<ip>() <<
")Buffer size: " << j <<
" Bandwidth (Average): " << size_send_recv / vcl.
getProcessingUnits() / clk / 1e6 <<
" MB/s " <<
" Bandwidth (Total): " << size_send_recv / clk / 1e6 <<
" MB/s Clock: " << clk <<
" Clock MAX: " << clk_max <<
"\n";
429 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
435 p_id = p_id % n_proc;
439 std::ostringstream msg;
441 std::string str(msg.str());
442 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message.get(p_id).get(0))),
true);
446 BOOST_REQUIRE_EQUAL((
size_t)0,recv_message.get(p_id).size());
453 template<
unsigned int ip>
void test_known_multiple(
size_t opt)
464 for (
size_t s = 0 ; s < N_TRY ; s++)
466 for (
size_t j = 32 ; j < N_LOOP ; j*=2)
483 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
489 for (
size_t k = 0 ; k < NQUEUE ; k++)
492 std::ostringstream msg;
493 msg <<
"Hello " << k <<
" from " << vcl.
getProcessUnitID() <<
" to " << p_id;
494 std::string str(msg.str());
495 message[k].last().resize(j);
496 memset(message[k].last().getPointer(),0,j);
497 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message[k].last().get(0)));
502 for (
size_t k = 0 ; k < NQUEUE ; k++)
504 recv_message[k].resize(n_proc);
506 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
512 p_id = p_id % n_proc;
516 prc_recv[k].add(p_id);
517 recv_message[k].get(p_id).resize(j);
528 for (
size_t k = 0 ; k < NQUEUE ; k++)
530 if (opt == KNOWN_PRC)
532 ptr[k].resize(message[k].size());
533 sz[k].resize(message[k].size());
535 for (
size_t i = 0 ; i < ptr[k].
size() ; i++)
537 ptr[k].get(i) = message[k].get(i).getPointer();
538 sz[k].get(i) = message[k].get(i).
size();
542 prc_recv[k].
size(),(
size_t *)prc_recv[k].getPointer(),msg_alloc,&recv_message[k]);
567 double clk_max = clk;
569 size_t size_send_recv = 2 * j * (prc.
size());
570 vcl.
sum(size_send_recv);
575 std::cout <<
"(Short pattern: " << method<ip>() <<
")Buffer size: " << j <<
" Bandwidth (Average): " << size_send_recv / vcl.
getProcessingUnits() / clk / 1e6 <<
" MB/s " <<
" Bandwidth (Total): " << size_send_recv / clk / 1e6 <<
" MB/s Clock: " << clk <<
" Clock MAX: " << clk_max <<
"\n";
578 for (
size_t k = 0 ; k < NQUEUE ; k++)
581 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
587 p_id = p_id % n_proc;
591 std::ostringstream msg;
592 msg <<
"Hello " << k <<
" from " << p_id <<
" to " << vcl.
getProcessUnitID();
593 std::string str(msg.str());
594 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message[k].get(p_id).get(0))),
true);
598 BOOST_REQUIRE_EQUAL((
size_t)0,recv_message[k].get(p_id).size());
606 template<
unsigned int ip>
void test_short(
unsigned int opt)
617 for (
size_t s = 0 ; s < N_TRY ; s++)
619 for (
size_t j = 32 ; j < N_LOOP ; j*=2)
638 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
648 std::ostringstream msg;
650 std::string str(msg.str());
651 message.last().resize(j);
652 memset(message.last().getPointer(),0,j);
653 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message.last().get(0)));
658 recv_message.resize(n_proc);
661 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
667 p_id = p_id % n_proc;
670 recv_message.get(p_id).resize(j);
673 if (opt == RECEIVE_UNKNOWN)
676 commFunc<ip>(vcl,prc,message,msg_alloc,&recv_message);
680 else if (opt == RECEIVE_SIZE_UNKNOWN)
687 sz_send.resize(prc.
size());
688 ptr.resize(prc.
size());
690 for (
size_t i = 0 ; i < prc.
size() ; i++)
692 sz_send.get(i) = message.get(i).
size();
693 ptr.get(i) = &message.get(i).get(0);
699 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
705 {p_id = p_id % n_proc;}
715 commFunc_low<ip>(vcl,prc,sz_send,ptr,prc_recv,msg_alloc,&recv_message);
728 double clk_max = clk;
730 size_t size_send_recv = 2 * j * (prc.
size());
731 vcl.
sum(size_send_recv);
736 {std::cout <<
"(Short pattern: " << method<ip>() <<
")Buffer size: " << j <<
" Bandwidth (Average): " << size_send_recv / vcl.
getProcessingUnits() / clk / 1e6 <<
" MB/s " <<
" Bandwidth (Total): " << size_send_recv / clk / 1e6 <<
" MB/s Clock: " << clk <<
" Clock MAX: " << clk_max <<
"\n";}
740 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
746 p_id = p_id % n_proc;
750 std::ostringstream msg;
752 std::string str(msg.str());
753 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message.get(p_id).get(0))),
true);
757 BOOST_REQUIRE_EQUAL((
size_t)0,recv_message.get(p_id).
size());
764 template<
unsigned int ip>
void test_short_multiple(
unsigned int opt)
775 for (
size_t s = 0 ; s < N_TRY ; s++)
777 for (
size_t j = 32 ; j < N_LOOP ; j*=2)
792 for (
size_t i = 0 ; i < NQUEUE ; i++)
793 {recv_message[i].resize(n_proc);}
800 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
809 for (
size_t k = 0 ; k < NQUEUE ; k++)
812 std::ostringstream msg;
814 std::string str(msg.str());
815 message[k].last().resize(j);
816 memset(message[k].last().getPointer(),0,j);
817 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message[k].last().get(0)));
828 for (
size_t k = 0 ; k < NQUEUE ; k++)
830 recv_message[k].resize(n_proc);
833 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
839 p_id = p_id % n_proc;
842 recv_message[k].get(p_id).resize(j);
845 if (opt == RECEIVE_UNKNOWN)
850 else if (opt == RECEIVE_SIZE_UNKNOWN)
852 sz_send[k].resize(prc.
size());
853 ptr[k].resize(prc.
size());
855 for (
size_t i = 0 ; i < prc.
size() ; i++)
857 sz_send[k].get(i) = message[k].get(i).
size();
858 ptr[k].get(i) = &message[k].get(i).get(0);
864 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
870 {p_id = p_id % n_proc;}
874 prc_recv[k].add(p_id);
881 &ptr[k].get(0),prc_recv[k].
size(),&prc_recv[k].get(0),msg_alloc,&recv_message[k]);
907 double clk_max = clk;
909 size_t size_send_recv = 2 * j * (prc.
size());
910 vcl.
sum(size_send_recv);
915 {std::cout <<
"(Short pattern: " << method<ip>() <<
")Buffer size: " << j <<
" Bandwidth (Average): " << size_send_recv / vcl.
getProcessingUnits() / clk / 1e6 <<
" MB/s " <<
" Bandwidth (Total): " << size_send_recv / clk / 1e6 <<
" MB/s Clock: " << clk <<
" Clock MAX: " << clk_max <<
"\n";}
918 for (
size_t k = 0 ; k < NQUEUE ; k++)
921 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
927 p_id = p_id % n_proc;
931 std::ostringstream msg;
933 std::string str(msg.str());
934 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message[k].get(p_id).get(0))),
true);
938 BOOST_REQUIRE_EQUAL((
size_t)0,recv_message[k].get(p_id).size());
946 template<
unsigned int ip>
void test_random(
unsigned int opt)
955 for (
size_t s = 0 ; s < N_TRY ; s++)
957 if (opt == RECEIVE_SIZE_UNKNOWN)
960 std::srand(create_vcluster().getProcessUnitID());
961 std::default_random_engine eg;
962 std::uniform_int_distribution<int> d(0,n_proc/8);
966 for (
size_t j = 32 ; j < N_LOOP && n_proc < 16 ; j*=2)
979 for (
size_t i = 0 ; i < n_proc ; i++)
987 message.last().fill(0);
988 std::ostringstream msg;
990 std::string str(msg.str());
991 message.last().resize(str.size());
992 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message.last().get(0)));
993 message.last().resize(j);
1006 commFunc<ip>(vcl,prc,message,msg_alloc3,&recv_message);
1011 double clk_max = clk;
1013 size_t size_send_recv = (prc.
size() + recv_message.
size()) * j;
1014 vcl.
sum(size_send_recv);
1021 std::cout <<
"(Random Pattern: " << method<ip>() <<
") Buffer size: " << j <<
" Bandwidth (Average): " << size_send_recv / vcl.
getProcessingUnits() / clk / 1e6 <<
" MB/s " <<
" Bandwidth (Total): " << size_send_recv / clk / 1e6 <<
" MB/s Clock: " << clk <<
" Clock MAX: " << clk_max <<
"\n";
1026 for (
size_t i = 0 ; i < recv_message.
size() ; i++)
1028 std::ostringstream msg;
1029 msg <<
"Hello from " << prc_recv.get(i) <<
" to " << vcl.
getProcessUnitID();
1030 std::string str(msg.str());
1031 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message.get(i).get(0))),
true);
1040 for (
size_t i = 0 ; i < prc_recv.
size() ; i++)
1042 prc.add(prc_recv.get(i));
1044 std::ostringstream msg;
1046 std::string str(msg.str());
1047 message.last().resize(str.size());
1048 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message.last().get(0)));
1049 message.last().resize(j);
1054 recv_message.clear();
1056 commFunc<ip>(vcl,prc,message,msg_alloc3,&recv_message);
1060 BOOST_REQUIRE_EQUAL(o_send.
size(),prc_recv.
size());
1062 for (
size_t i = 0 ; i < o_send.
size() ; i++)
1065 for ( ; j < prc_recv.
size() ; j++)
1067 if (o_send.get(i) == prc_recv.get(j))
1071 std::ostringstream msg;
1073 std::string str(msg.str());
1074 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message.get(i).get(0))),
true);
1079 BOOST_REQUIRE_EQUAL(j != prc_recv.
size(),
true);
1085 for (
size_t j = 32 ; j < N_LOOP ; j*=2)
1089 long int ps = n_proc / (8 + 1);
1098 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
1105 std::ostringstream msg;
1107 std::string str(msg.str());
1108 message.last().resize(j);
1109 memset(message.last().getPointer(),0,j);
1110 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message.last().get(0)));
1114 recv_message.resize(n_proc);
1116 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
1122 p_id = p_id % n_proc;
1125 recv_message.get(p_id).resize(j);
1133 commFunc<ip>(vcl,prc,message,msg_alloc,&recv_message);
1138 double clk_max = clk;
1140 size_t size_send_recv = 2 * j * (prc.
size());
1141 vcl.
sum(size_send_recv);
1146 std::cout <<
"(Long pattern: " << method<ip>() <<
")Buffer size: " << j <<
" Bandwidth (Average): " << size_send_recv / vcl.
getProcessingUnits() / clk / 1e6 <<
" MB/s " <<
" Bandwidth (Total): " << size_send_recv / clk / 1e6 <<
" MB/s Clock: " << clk <<
" Clock MAX: " << clk_max <<
"\n";
1150 for (
long int i = 0 ; i < 8 && i < (
long int)n_proc ; i++)
1156 p_id = p_id % n_proc;
1160 std::ostringstream msg;
1162 std::string str(msg.str());
1163 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message.get(p_id).get(0))),
true);
1167 BOOST_REQUIRE_EQUAL((
size_t)0,recv_message.get(p_id).
size());
1174 template<
unsigned int ip>
void test_random_multiple(
unsigned int opt)
1183 for (
size_t s = 0 ; s < N_TRY ; s++)
1185 if (opt == RECEIVE_SIZE_UNKNOWN)
1188 std::srand(create_vcluster().getProcessUnitID());
1189 std::default_random_engine eg;
1190 std::uniform_int_distribution<int> d(0,n_proc/8);
1196 for (
size_t j = 32 ; j < N_LOOP && n_proc < 16 ; j*=2)
1210 for (
size_t i = 0 ; i < n_proc ; i++)
1216 for (
size_t k = 0 ; k < NQUEUE ; k++)
1220 message[k].last().fill(0);
1221 std::ostringstream msg;
1223 std::string str(msg.str());
1224 message[k].last().resize(str.size());
1225 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message[k].last().get(0)));
1226 message[k].last().resize(j);
1239 for (
size_t k = 0 ; k < NQUEUE ; k++)
1241 rcv[k].prc_recv = &prc_recv[k];
1242 rcv[k].recv_message = &recv_message[k];
1250 double clk_max = clk;
1252 size_t size_send_recv = (prc.
size() + recv_message.
size()) * j;
1253 vcl.
sum(size_send_recv);
1260 std::cout <<
"(Random Pattern: " << method<ip>() <<
") Buffer size: " << j <<
" Bandwidth (Average): " << size_send_recv / vcl.
getProcessingUnits() / clk / 1e6 <<
" MB/s " <<
" Bandwidth (Total): " << size_send_recv / clk / 1e6 <<
" MB/s Clock: " << clk <<
" Clock MAX: " << clk_max <<
"\n";
1274 for (
size_t k = 0 ; k < NQUEUE ; k++)
1278 for (
size_t i = 0 ; i < recv_message[k].
size() ; i++)
1280 std::ostringstream msg;
1281 msg <<
"H" << k <<
" from " << prc_recv[k].get(i) <<
" to " << vcl.
getProcessUnitID();
1282 std::string str(msg.str());
1283 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message[k].get(i).get(0))),
true);
1292 for (
size_t i = 0 ; i < prc_recv[k].
size() ; i++)
1294 prc.add(prc_recv[k].get(i));
1296 std::ostringstream msg;
1297 msg <<
"H" << k <<
" from " << vcl.
getProcessUnitID() <<
" to " << prc_recv[k].get(i);
1298 std::string str(msg.str());
1299 message[k].last().resize(str.size());
1300 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message[k].last().get(0)));
1301 message[k].last().resize(j);
1305 prc_recv[k].clear();
1306 recv_message[k].clear();
1309 rr.prc_recv = &prc_recv[k];
1310 rr.recv_message = &recv_message[k];
1327 BOOST_REQUIRE_EQUAL(o_send[k].size(),prc_recv[k].size());
1329 for (
size_t i = 0 ; i < o_send[k].
size() ; i++)
1332 for ( ; j < prc_recv[k].
size() ; j++)
1334 if (o_send[k].get(i) == prc_recv[k].get(j))
1338 std::ostringstream msg;
1339 msg <<
"H" << k <<
" from " << prc_recv[k].get(i) <<
" to " << vcl.
getProcessUnitID();
1340 std::string str(msg.str());
1341 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message[k].get(i).get(0))),
true);
1346 BOOST_REQUIRE_EQUAL(j != prc_recv[k].size(),
true);
1359 void test_send_recv_complex(
const size_t n,
Vcluster<> & vcl)
1369 for (
size_t i = 0 ; i < 8 ; i++)
1376 for (
size_t i = 0 ; i < 8 ; i++)
1378 pt_buf.get(i).resize(n);
1387 for (
size_t i = 0 ; i < 8 ; i++)
1389 for (
size_t j = 0 ; j < n ; j++)
1395 BOOST_REQUIRE_EQUAL(pt.template get<p::x>(),p_recv);
1396 BOOST_REQUIRE_EQUAL(pt.template get<p::y>(),p_recv);
1397 BOOST_REQUIRE_EQUAL(pt.template get<p::z>(),p_recv);
1398 BOOST_REQUIRE_EQUAL(pt.template get<p::s>(),p_recv);
1399 BOOST_REQUIRE_EQUAL(pt.template get<p::v>()[0],p_recv);
1400 BOOST_REQUIRE_EQUAL(pt.template get<p::v>()[1],p_recv);
1401 BOOST_REQUIRE_EQUAL(pt.template get<p::v>()[2],p_recv);
1402 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[0][0],p_recv);
1403 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[0][1],p_recv);
1404 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[0][2],p_recv);
1405 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[1][0],p_recv);
1406 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[1][1],p_recv);
1407 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[1][2],p_recv);
1408 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[2][0],p_recv);
1409 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[2][1],p_recv);
1410 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[2][2],p_recv);
1422 template<
typename T>
void test_send_recv_primitives(
size_t n,
Vcluster<> & vcl)
1430 for (
size_t i = 0 ; i < 8 ; i++)
1437 for (
size_t i = 0 ; i < 8 ; i++)
1439 pt_buf.get(i).resize(n);
1448 for (
size_t i = 0 ; i < 8 ; i++)
1450 for (
size_t j = 0 ; j < n ; j++)
1452 T pt = pt_buf.get(i).get(j);
1456 BOOST_REQUIRE_EQUAL(pt,p_recv);
1466 for (
size_t i = 0 ; i < 8 ; i++)
1473 for (
size_t i = 0 ; i < 8 ; i++)
1475 pt_buf.get(i).resize(n);
1484 for (
size_t i = 0 ; i < 8 ; i++)
1486 for (
size_t j = 0 ; j < n ; j++)
1488 T pt = pt_buf.get(i).get(j);
1492 BOOST_REQUIRE_EQUAL(pt,p_recv);
1499 template<
typename T>
void test_single_all_gather_primitives(
Vcluster<> & vcl)
1510 BOOST_REQUIRE_EQUAL(i,(
size_t)clt.get(i));
void progressCommunication()
In case of Asynchonous communications like sendrecvMultipleMessagesNBXAsync this function progress th...
size_t getProcessUnitID()
Get the process unit id.
void sendrecvMultipleMessagesNBX(openfpm::vector< size_t > &prc, openfpm::vector< T > &data, openfpm::vector< size_t > &prc_recv, openfpm::vector< size_t > &recv_sz, void *(*msg_alloc)(size_t, size_t, size_t, size_t, size_t, size_t, void *), void *ptr_arg, long int opt=NONE)
Send and receive multiple messages.
bool allGather(T &send, openfpm::vector< T, Mem, gr > &v)
Gather the data from all processors.
bool send(size_t proc, size_t tag, const void *mem, size_t sz)
Send data to a processor.
double getwct()
Return the elapsed real time.
Implementation of VCluster class.
void execute()
Execute all the requests.
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data
void start()
Start the timer.
bool recv(size_t proc, size_t tag, void *v, size_t sz)
Recv data from a processor.
size_t getProcessingUnits()
Get the total number of processors.
void sum(T &num)
Sum the numbers across all processors and get the result.
void sendrecvMultipleMessagesNBXAsync(openfpm::vector< size_t > &prc, openfpm::vector< T > &data, openfpm::vector< size_t > &prc_recv, openfpm::vector< size_t > &recv_sz, void *(*msg_alloc)(size_t, size_t, size_t, size_t, size_t, size_t, void *), void *ptr_arg, long int opt=NONE)
Send and receive multiple messages asynchronous version.
void sendrecvMultipleMessagesNBXWait()
Send and receive multiple messages wait NBX communication to complete.
void max(T &num)
Get the maximum number across all processors (or reduction with infinity norm)
Test structure used for several test.
Class for cpu time benchmarking.
void stop()
Stop the timer.