I am trying to use the OpenMPI library for parallelizing a script. I am using an M1 Macbook Pro which has arm64 architecture. When I try to compile the following code with mpicc
#include<iostream>
#include<stdlib.h>
#include<time.h>
#include<vector>
#include<random>
#include<mpi.h>
#include<stdio.h>
int main(int argc, char **argv) {
int size, rank;
MPI_Init(NULL, NULL);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
printf("Hello: rank %d, world: %d\n", rank, size);
MPI_Finalize();
}
I get Undefined symbols for architecture arm64:... ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please let me know how I can fix this issue, I am using OpenMPI version 4.1.4