Created
March 1, 2016 18:02
-
-
Save dotnwat/8798829dda9d7ad2707e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// gcc -Wall -DGASNET_PAR -I/usr/include/ibv-conduit -pthread -o gasnet_test gasnet_test.c -lgasnet-ibv-par -libverbs | |
// | |
#include <gasnet.h> | |
#include <stdio.h> | |
#define GASNET_SAFE(fncall) do { \ | |
int _retval; \ | |
if ((_retval = fncall) != GASNET_OK) { \ | |
fprintf(stderr, "ERROR calling: %s\n" \ | |
" at: %s:%i\n" \ | |
" error: %s (%s)\n", \ | |
#fncall, __FILE__, __LINE__, \ | |
gasnet_ErrorName(_retval), gasnet_ErrorDesc(_retval)); \ | |
fflush(stderr); \ | |
gasnet_exit(_retval); \ | |
} \ | |
} while(0) | |
int main(int argc, char **argv) | |
{ | |
gasnet_node_t rank; | |
gasnet_node_t size; | |
size_t segsz; | |
GASNET_SAFE(gasnet_init(&argc, &argv)); | |
rank = gasnet_mynode(); | |
size = gasnet_nodes(); | |
segsz = gasnet_getMaxLocalSegmentSize(); | |
GASNET_SAFE(gasnet_attach(NULL, 0, segsz, 0)); | |
printf("rank-%02d/%02d: seg size = %llu\n", | |
rank, size, (unsigned long long)segsz); | |
gasnet_barrier_notify(0,GASNET_BARRIERFLAG_ANONYMOUS); | |
gasnet_barrier_wait(0,GASNET_BARRIERFLAG_ANONYMOUS); | |
gasnet_exit(0); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment