Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MPI_Init(NULL, NULL);
- MPI_Comm_rank(MPI_COMM_WORLD, &rank);
- MPI_Comm_size(MPI_COMM_WORLD, &size);
- int i, j, k, v1, v2, vertices;
- struct Graph *g;
- int *n;
- int rank, size;
- // Build the Graph from the input file
- f = fopen(argv[1], "r");
- fscanf(f, "%d", &vertices);
- g = createGraph(vertices);
- while ((fscanf(f, "%d%d", &v1, &v2)) != EOF) {
- addEdge(g, v1, v2);
- }
- fclose(f);
- n = (int *)malloc(sizeof(int) * vertices);
- for (i = 0; i < vertices; i++) {
- n[i] = i;
- }
- createNeighborSets(g);
- printf("create graphn");
- int sendcount[size];
- int offset[size];
- int count = 0;
- int *localVertices;
- int localNum;
- MPI_Status status;
- MPI_Request request;
- if (rank == 0) {
- calculateDistribution(send count, offset);
- for (int i = 1; i < size; i++) {
- MPI_Send(&sendcount[i], 1, MPI_INT, i, 3, MPI_COMM_WORLD);
- }
- localNum = sendcount[0];
- } else {
- MPI_Recv(&localNum, 1, MPI_INT, 0, 3, MPI_COMM_WORLD, &status);
- }
- localVertices = (int *)malloc(sizeof(int) * localNum);
- MPI_Scatterv(n, sendcount, offset, MPI_INT, localVertices, localNum, MPI_INT, 0, MPI_COMM_WORLD);
- [MacBook-Pro-7:96512] *** Process received signal ***
- [MacBook-Pro-7:96512] Signal: Segmentation fault: 11 (11)
- [MacBook-Pro-7:96512] Signal code: (0)
- [MacBook-Pro-7:96512] Failing at address: 0x0
- [MacBook-Pro-7:96512] [ 0] [MacBook-Pro-7:96513] *** Process received signal ***
- [MacBook-Pro-7:96513] Signal: Segmentation fault: 11 (11)
- [MacBook-Pro-7:96513] Signal code: (0)
- [MacBook-Pro-7:96513] Failing at address: 0x0
- [MacBook-Pro-7:96513] [ 0] 0 libsystem_platform.dylib 0x00007fff633b4f5a _sigtramp + 26
- [MacBook-Pro-7:96513] [ 1] [MacBook-Pro-7:96510] *** Process received signal ***
- [MacBook-Pro-7:96510] Signal: Segmentation fault: 11 (11)
- [MacBook-Pro-7:96510] Signal code: (0)
- [MacBook-Pro-7:96510] Failing at address: 0x0
- [MacBook-Pro-7:96510] [ 0] 0 libsystem_platform.dylib 0x00007fff633b4f5a _sigtramp + 26
- [MacBook-Pro-7:96510] [ 1] 0 ??? 0x0000000000000001 0x0 + 1
Add Comment
Please, Sign In to add comment