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)
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);
303 double clk = t.getwct();
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());
343 template<
unsigned int ip>
void test_known_vcl(
size_t opt,
Vcluster<> &vcl)
352 for (
size_t s = 0 ; s < N_TRY ; s++)
354 for (
size_t j = 32 ; j < N_LOOP ; j*=2)
361 recv_message.reserve(n_proc);
368 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
375 std::ostringstream msg;
377 std::string str(msg.str());
378 message.last().resize(j);
379 memset(message.last().getPointer(),0,j);
380 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message.last().get(0)));
384 recv_message.resize(n_proc);
386 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
392 p_id = p_id % n_proc;
397 recv_message.get(p_id).resize(j);
407 if (opt == KNOWN_PRC)
408 {commFunc_kn_prc<ip>(vcl,prc,message,prc_recv,recv_sz,&recv_message);}
410 {commFunc_kn<ip>(vcl,prc,message,prc_recv,recv_sz,&recv_message);}
415 double clk = t.getwct();
416 double clk_max = clk;
418 size_t size_send_recv = 2 * j * (prc.
size());
419 vcl.
sum(size_send_recv);
424 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";
428 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
434 p_id = p_id % n_proc;
438 std::ostringstream msg;
440 std::string str(msg.str());
441 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message.get(p_id).get(0))),
true);
445 BOOST_REQUIRE_EQUAL((
size_t)0,recv_message.get(p_id).size());
452 template<
unsigned int ip>
void test_known(
size_t opt)
455 test_known_vcl<ip>(opt, vcl);
458 template<
unsigned int ip>
void test_known_multiple(
size_t opt)
469 for (
size_t s = 0 ; s < N_TRY ; s++)
471 for (
size_t j = 32 ; j < N_LOOP ; j*=2)
488 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
494 for (
size_t k = 0 ; k < NQUEUE ; k++)
497 std::ostringstream msg;
498 msg <<
"Hello " << k <<
" from " << vcl.
getProcessUnitID() <<
" to " << p_id;
499 std::string str(msg.str());
500 message[k].last().resize(j);
501 memset(message[k].last().getPointer(),0,j);
502 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message[k].last().get(0)));
507 for (
size_t k = 0 ; k < NQUEUE ; k++)
509 recv_message[k].resize(n_proc);
511 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
517 p_id = p_id % n_proc;
521 prc_recv[k].add(p_id);
522 recv_message[k].get(p_id).resize(j);
533 for (
size_t k = 0 ; k < NQUEUE ; k++)
535 if (opt == KNOWN_PRC)
537 ptr[k].resize(message[k].size());
538 sz[k].resize(message[k].size());
540 for (
size_t i = 0 ; i < ptr[k].
size() ; i++)
542 ptr[k].get(i) = message[k].get(i).getPointer();
543 sz[k].get(i) = message[k].get(i).
size();
547 prc_recv[k].
size(),(
size_t *)prc_recv[k].getPointer(),msg_alloc,&recv_message[k]);
571 double clk = t.getwct();
572 double clk_max = clk;
574 size_t size_send_recv = 2 * j * (prc.
size());
575 vcl.
sum(size_send_recv);
580 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";
583 for (
size_t k = 0 ; k < NQUEUE ; k++)
586 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
592 p_id = p_id % n_proc;
596 std::ostringstream msg;
597 msg <<
"Hello " << k <<
" from " << p_id <<
" to " << vcl.
getProcessUnitID();
598 std::string str(msg.str());
599 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message[k].get(p_id).get(0))),
true);
603 BOOST_REQUIRE_EQUAL((
size_t)0,recv_message[k].get(p_id).size());
611 template<
unsigned int ip>
void test_short(
unsigned int opt)
622 for (
size_t s = 0 ; s < N_TRY ; s++)
624 for (
size_t j = 32 ; j < N_LOOP ; j*=2)
643 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
653 std::ostringstream msg;
655 std::string str(msg.str());
656 message.last().resize(j);
657 memset(message.last().getPointer(),0,j);
658 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message.last().get(0)));
663 recv_message.resize(n_proc);
666 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
672 p_id = p_id % n_proc;
675 recv_message.get(p_id).resize(j);
678 if (opt == RECEIVE_UNKNOWN)
681 commFunc<ip>(vcl,prc,message,msg_alloc,&recv_message);
685 else if (opt == RECEIVE_SIZE_UNKNOWN)
692 sz_send.resize(prc.
size());
693 ptr.resize(prc.
size());
695 for (
size_t i = 0 ; i < prc.
size() ; i++)
697 sz_send.get(i) = message.get(i).
size();
698 ptr.get(i) = &message.get(i).get(0);
704 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
710 {p_id = p_id % n_proc;}
720 commFunc_low<ip>(vcl,prc,sz_send,ptr,prc_recv,msg_alloc,&recv_message);
732 double clk = t.getwct();
733 double clk_max = clk;
735 size_t size_send_recv = 2 * j * (prc.
size());
736 vcl.
sum(size_send_recv);
741 {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";}
745 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
751 p_id = p_id % n_proc;
755 std::ostringstream msg;
757 std::string str(msg.str());
758 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message.get(p_id).get(0))),
true);
762 BOOST_REQUIRE_EQUAL((
size_t)0,recv_message.get(p_id).
size());
769 template<
unsigned int ip>
void test_short_multiple(
unsigned int opt)
780 for (
size_t s = 0 ; s < N_TRY ; s++)
782 for (
size_t j = 32 ; j < N_LOOP ; j*=2)
797 for (
size_t i = 0 ; i < NQUEUE ; i++)
798 {recv_message[i].resize(n_proc);}
805 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
814 for (
size_t k = 0 ; k < NQUEUE ; k++)
817 std::ostringstream msg;
819 std::string str(msg.str());
820 message[k].last().resize(j);
821 memset(message[k].last().getPointer(),0,j);
822 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message[k].last().get(0)));
833 for (
size_t k = 0 ; k < NQUEUE ; k++)
835 recv_message[k].resize(n_proc);
838 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
844 p_id = p_id % n_proc;
847 recv_message[k].get(p_id).resize(j);
850 if (opt == RECEIVE_UNKNOWN)
855 else if (opt == RECEIVE_SIZE_UNKNOWN)
857 sz_send[k].resize(prc.
size());
858 ptr[k].resize(prc.
size());
860 for (
size_t i = 0 ; i < prc.
size() ; i++)
862 sz_send[k].get(i) = message[k].get(i).
size();
863 ptr[k].get(i) = &message[k].get(i).get(0);
869 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
875 {p_id = p_id % n_proc;}
879 prc_recv[k].add(p_id);
886 &ptr[k].get(0),prc_recv[k].
size(),&prc_recv[k].get(0),msg_alloc,&recv_message[k]);
911 double clk = t.getwct();
912 double clk_max = clk;
914 size_t size_send_recv = 2 * j * (prc.
size());
915 vcl.
sum(size_send_recv);
920 {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";}
923 for (
size_t k = 0 ; k < NQUEUE ; k++)
926 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
932 p_id = p_id % n_proc;
936 std::ostringstream msg;
938 std::string str(msg.str());
939 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message[k].get(p_id).get(0))),
true);
943 BOOST_REQUIRE_EQUAL((
size_t)0,recv_message[k].get(p_id).size());
951 template<
unsigned int ip>
void test_random(
unsigned int opt)
960 for (
size_t s = 0 ; s < N_TRY ; s++)
962 if (opt == RECEIVE_SIZE_UNKNOWN)
965 std::srand(create_vcluster().getProcessUnitID());
966 std::default_random_engine eg;
967 std::uniform_int_distribution<int> d(0,n_proc/8);
971 for (
size_t j = 32 ; j < N_LOOP && n_proc < 16 ; j*=2)
984 for (
size_t i = 0 ; i < n_proc ; i++)
992 message.last().fill(0);
993 std::ostringstream msg;
995 std::string str(msg.str());
996 message.last().resize(str.size());
997 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message.last().get(0)));
998 message.last().resize(j);
1011 commFunc<ip>(vcl,prc,message,msg_alloc3,&recv_message);
1015 double clk = t.getwct();
1016 double clk_max = clk;
1018 size_t size_send_recv = (prc.
size() + recv_message.
size()) * j;
1019 vcl.
sum(size_send_recv);
1026 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";
1031 for (
size_t i = 0 ; i < recv_message.
size() ; i++)
1033 std::ostringstream msg;
1034 msg <<
"Hello from " << prc_recv.get(i) <<
" to " << vcl.
getProcessUnitID();
1035 std::string str(msg.str());
1036 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message.get(i).get(0))),
true);
1045 for (
size_t i = 0 ; i < prc_recv.
size() ; i++)
1047 prc.add(prc_recv.get(i));
1049 std::ostringstream msg;
1051 std::string str(msg.str());
1052 message.last().resize(str.size());
1053 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message.last().get(0)));
1054 message.last().resize(j);
1059 recv_message.clear();
1061 commFunc<ip>(vcl,prc,message,msg_alloc3,&recv_message);
1065 BOOST_REQUIRE_EQUAL(o_send.
size(),prc_recv.
size());
1067 for (
size_t i = 0 ; i < o_send.
size() ; i++)
1070 for ( ; j < prc_recv.
size() ; j++)
1072 if (o_send.get(i) == prc_recv.get(j))
1076 std::ostringstream msg;
1078 std::string str(msg.str());
1079 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message.get(i).get(0))),
true);
1084 BOOST_REQUIRE_EQUAL(j != prc_recv.
size(),
true);
1090 for (
size_t j = 32 ; j < N_LOOP ; j*=2)
1094 long int ps = n_proc / (8 + 1);
1103 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
1110 std::ostringstream msg;
1112 std::string str(msg.str());
1113 message.last().resize(j);
1114 memset(message.last().getPointer(),0,j);
1115 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message.last().get(0)));
1119 recv_message.resize(n_proc);
1121 for (
size_t i = 0 ; i < 8 && i < n_proc ; i++)
1127 p_id = p_id % n_proc;
1130 recv_message.get(p_id).resize(j);
1138 commFunc<ip>(vcl,prc,message,msg_alloc,&recv_message);
1142 double clk = t.getwct();
1143 double clk_max = clk;
1145 size_t size_send_recv = 2 * j * (prc.
size());
1146 vcl.
sum(size_send_recv);
1151 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";
1155 for (
long int i = 0 ; i < 8 && i < (
long int)n_proc ; i++)
1161 p_id = p_id % n_proc;
1165 std::ostringstream msg;
1167 std::string str(msg.str());
1168 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message.get(p_id).get(0))),
true);
1172 BOOST_REQUIRE_EQUAL((
size_t)0,recv_message.get(p_id).
size());
1179 template<
unsigned int ip>
void test_random_multiple(
unsigned int opt)
1188 for (
size_t s = 0 ; s < N_TRY ; s++)
1190 if (opt == RECEIVE_SIZE_UNKNOWN)
1193 std::srand(create_vcluster().getProcessUnitID());
1194 std::default_random_engine eg;
1195 std::uniform_int_distribution<int> d(0,n_proc/8);
1201 for (
size_t j = 32 ; j < N_LOOP && n_proc < 16 ; j*=2)
1215 for (
size_t i = 0 ; i < n_proc ; i++)
1221 for (
size_t k = 0 ; k < NQUEUE ; k++)
1225 message[k].last().fill(0);
1226 std::ostringstream msg;
1228 std::string str(msg.str());
1229 message[k].last().resize(str.size());
1230 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message[k].last().get(0)));
1231 message[k].last().resize(j);
1244 for (
size_t k = 0 ; k < NQUEUE ; k++)
1246 rcv[k].prc_recv = &prc_recv[k];
1247 rcv[k].recv_message = &recv_message[k];
1254 double clk = t.getwct();
1255 double clk_max = clk;
1257 size_t size_send_recv = (prc.
size() + recv_message.
size()) * j;
1258 vcl.
sum(size_send_recv);
1265 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";
1279 for (
size_t k = 0 ; k < NQUEUE ; k++)
1283 for (
size_t i = 0 ; i < recv_message[k].
size() ; i++)
1285 std::ostringstream msg;
1286 msg <<
"H" << k <<
" from " << prc_recv[k].get(i) <<
" to " << vcl.
getProcessUnitID();
1287 std::string str(msg.str());
1288 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message[k].get(i).get(0))),
true);
1297 for (
size_t i = 0 ; i < prc_recv[k].
size() ; i++)
1299 prc.add(prc_recv[k].get(i));
1301 std::ostringstream msg;
1302 msg <<
"H" << k <<
" from " << vcl.
getProcessUnitID() <<
" to " << prc_recv[k].get(i);
1303 std::string str(msg.str());
1304 message[k].last().resize(str.size());
1305 std::copy(str.c_str(),&(str.c_str())[msg.str().size()],&(message[k].last().get(0)));
1306 message[k].last().resize(j);
1310 prc_recv[k].clear();
1311 recv_message[k].clear();
1314 rr.prc_recv = &prc_recv[k];
1315 rr.recv_message = &recv_message[k];
1332 BOOST_REQUIRE_EQUAL(o_send[k].size(),prc_recv[k].size());
1334 for (
size_t i = 0 ; i < o_send[k].
size() ; i++)
1337 for ( ; j < prc_recv[k].
size() ; j++)
1339 if (o_send[k].get(i) == prc_recv[k].get(j))
1343 std::ostringstream msg;
1344 msg <<
"H" << k <<
" from " << prc_recv[k].get(i) <<
" to " << vcl.
getProcessUnitID();
1345 std::string str(msg.str());
1346 BOOST_REQUIRE_EQUAL(std::equal(str.c_str(),str.c_str() + str.size() ,&(recv_message[k].get(i).get(0))),
true);
1351 BOOST_REQUIRE_EQUAL(j != prc_recv[k].size(),
true);
1364 void test_send_recv_complex(
const size_t n,
Vcluster<> & vcl)
1374 for (
size_t i = 0 ; i < 8 ; i++)
1381 for (
size_t i = 0 ; i < 8 ; i++)
1383 pt_buf.get(i).resize(n);
1392 for (
size_t i = 0 ; i < 8 ; i++)
1394 for (
size_t j = 0 ; j < n ; j++)
1400 BOOST_REQUIRE_EQUAL(pt.template get<p::x>(),p_recv);
1401 BOOST_REQUIRE_EQUAL(pt.template get<p::y>(),p_recv);
1402 BOOST_REQUIRE_EQUAL(pt.template get<p::z>(),p_recv);
1403 BOOST_REQUIRE_EQUAL(pt.template get<p::s>(),p_recv);
1404 BOOST_REQUIRE_EQUAL(pt.template get<p::v>()[0],p_recv);
1405 BOOST_REQUIRE_EQUAL(pt.template get<p::v>()[1],p_recv);
1406 BOOST_REQUIRE_EQUAL(pt.template get<p::v>()[2],p_recv);
1407 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[0][0],p_recv);
1408 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[0][1],p_recv);
1409 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[0][2],p_recv);
1410 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[1][0],p_recv);
1411 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[1][1],p_recv);
1412 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[1][2],p_recv);
1413 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[2][0],p_recv);
1414 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[2][1],p_recv);
1415 BOOST_REQUIRE_EQUAL(pt.template get<p::t>()[2][2],p_recv);
1427 template<
typename T>
void test_send_recv_primitives(
size_t n,
Vcluster<> & vcl)
1435 for (
size_t i = 0 ; i < 8 ; i++)
1442 for (
size_t i = 0 ; i < 8 ; i++)
1444 pt_buf.get(i).resize(n);
1453 for (
size_t i = 0 ; i < 8 ; i++)
1455 for (
size_t j = 0 ; j < n ; j++)
1457 T pt = pt_buf.get(i).get(j);
1461 BOOST_REQUIRE_EQUAL(pt,p_recv);
1471 for (
size_t i = 0 ; i < 8 ; i++)
1478 for (
size_t i = 0 ; i < 8 ; i++)
1480 pt_buf.get(i).resize(n);
1489 for (
size_t i = 0 ; i < 8 ; i++)
1491 for (
size_t j = 0 ; j < n ; j++)
1493 T pt = pt_buf.get(i).get(j);
1497 BOOST_REQUIRE_EQUAL(pt,p_recv);
1504 template<
typename T>
void test_single_all_gather_primitives(
Vcluster<> & vcl)
1515 BOOST_REQUIRE_EQUAL(i,(
size_t)clt.get(i));
Test structure used for several test.
void progressCommunication()
In case of Asynchonous communications like sendrecvMultipleMessagesNBXAsync this function progress th...
void execute()
Execute all the requests.
void sum(T &num)
Sum the numbers across all processors and get the result.
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.
size_t getProcessUnitID()
Get the process unit id.
size_t getProcessingUnits()
Get the total number of processors.
bool recv(size_t proc, size_t tag, void *v, size_t sz)
Recv data from a processor.
void sendrecvMultipleMessagesNBXWait()
Send and receive multiple messages wait NBX communication to complete.
bool allGather(T &send, openfpm::vector< T, Mem, gr > &v)
Gather the data from all processors.
void max(T &num)
Get the maximum number across all processors (or reduction with infinity norm)
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.
bool send(size_t proc, size_t tag, const void *mem, size_t sz)
Send data to a processor.
Implementation of VCluster class.
Class for cpu time benchmarking.
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data