int main(int argc,char *argv[]){ gaspi_rank_t rank,num; gaspi_return_t ret; float vers; signal(SIGINT,signal_handler); gaspi_print_affinity_mask(); ret = gaspi_proc_init(GPI2_TOUT); if(ret!=GASPI_SUCCESS){ printf("gaspi_init failed ! [%s]\n",ret==-1 ? "GASPI_ERROR":"GASPI_TIMEOUT"); gaspi_proc_term(GPI2_TOUT); exit(-1); } gaspi_version(&vers); gaspi_proc_rank(&rank); gaspi_proc_num(&num); gaspi_printf("rank: %d num: %d (vers: %.2f)\n",rank,num,vers); srand(time(NULL)*(rank+1)); const int dst = rand(); if( gaspi_sn_ping(dst%num,1000) != GASPI_SUCCESS) printf("gaspi_sn_ping failed ! [%s]\n",ret==-1 ? "GASPI_ERROR":"GASPI_TIMEOUT"); //tmp workaround, we have no barrier yet gaspi_barrier(GASPI_GROUP_ALL, GASPI_BLOCK); gaspi_proc_term(GPI2_TOUT); return 0; }
int main(int argc,char *argv[]) { gaspi_rank_t rank,tnc; gaspi_float vers; gaspi_config_t gconf; char mtype[16]; int i; mcycles_t t0, t1; mcycles_t delta[1024]; gaspi_float cpu_freq; gaspi_config_get(&gconf); gconf.mtu = 4096; gconf.queue_num = 1; gaspi_config_set(gconf); GPI2_ASSERT(gaspi_proc_init(GASPI_BLOCK)); GPI2_ASSERT( gaspi_version(&vers) ); GPI2_ASSERT( gaspi_proc_rank(&rank) ); GPI2_ASSERT( gaspi_proc_num(&tnc) ); GPI2_ASSERT( gaspi_machine_type(mtype) ); GPI2_ASSERT( gaspi_cpu_frequency(&cpu_freq)); if ( 0 == rank) printf("my rank: %d tnc: %d (vers: %.2f) machine:%s\n",rank,tnc,vers,mtype); GPI2_ASSERT(gaspi_barrier(GASPI_GROUP_ALL,GASPI_BLOCK)); if(0 == rank) printf("cpu freq: %.2f\n",cpu_freq); //benchmark for(i = 0; i < 1000; i++) { t0 = get_mcycles(); GPI2_ASSERT(gaspi_barrier(GASPI_GROUP_ALL,GASPI_BLOCK)); t1 = get_mcycles(); delta[i] = (t1 - t0); } if(0 == rank) { qsort(delta,1000,sizeof *delta,mcycles_compare); const double div = 1.0 / cpu_freq; const double ts = (double)delta[500] * div; printf("time: %f usec\n",ts); } fflush(stdout); GPI2_ASSERT(gaspi_barrier(GASPI_GROUP_ALL, GASPI_BLOCK)); GPI2_ASSERT(gaspi_proc_term(GASPI_BLOCK)); return 0; }
int main(int argc,char *argv[]) { gaspi_rank_t rank,tnc; gaspi_return_t ret; gaspi_float vers; gaspi_config_t gconf; char mtype[16]; int commSize=1,cnt=0; gaspi_number_t queueSize; void *pret; int i,l; mcycles_t t0,t1,dt; mcycles_t stamp[1024], stamp2[1024], delta[1024]; int amount_work = 1000; gaspi_float cpu_freq; gaspi_config_get(&gconf); gconf.mtu = 4096; gconf.queue_num = 1; gaspi_config_set(gconf); GPI2_ASSERT(gaspi_proc_init(GASPI_BLOCK)); GPI2_ASSERT( gaspi_version(&vers) ); GPI2_ASSERT( gaspi_proc_rank(&rank) ); GPI2_ASSERT( gaspi_proc_num(&tnc) ); GPI2_ASSERT( gaspi_machine_type(mtype) ); GPI2_ASSERT( gaspi_cpu_frequency(&cpu_freq)); if(0 == rank) { printf("cpu freq: %.2f\n", cpu_freq); printf("my rank: %d tnc: %d (vers: %.2f) machine:%s\n",rank, tnc, vers, mtype); } GPI2_ASSERT(gaspi_barrier(GASPI_GROUP_ALL,GASPI_BLOCK)); //benchmark for(i = 0; i < 1000; i++) { t0=t1=dt=0; do { t0 = get_mcycles(); ret = gaspi_barrier(GASPI_GROUP_ALL,GASPI_TEST); t1 = get_mcycles(); dt += (t1-t0); usleep(amount_work); //useful work here.. }while(ret!=GASPI_SUCCESS); delta[i]=dt; } if(0 == rank) { qsort(delta,1000,sizeof *delta,mcycles_compare); const double div = 1.0 / cpu_freq; const double ts = (double)delta[500] * div; printf("time: %f usec\n",ts); } GPI2_ASSERT(gaspi_barrier(GASPI_GROUP_ALL, GASPI_BLOCK)); GPI2_ASSERT(gaspi_proc_term(GASPI_BLOCK)); return 0; }