diff --git a/hello_world.def b/hello_world.def new file mode 100644 index 0000000..df3c71d --- /dev/null +++ b/hello_world.def @@ -0,0 +1,33 @@ +Bootstrap: docker +From: ubuntu:20.04 + +%post + echo America/Buenos_Aires > /etc/localtime + apt-get update + apt-get install -y libopenmpi-dev + apt-get clean + rm -rf /var/lib/apt/lists/* + + cd /opt + cat << EOF > hello_mpi.c + #include + #include + #include + + int main(int argc, char** argv) { + int world_size, world_rank; + char processor_name[MPI_MAX_PROCESSOR_NAME]; + + MPI_Init(NULL, NULL); + MPI_Comm_size(MPI_COMM_WORLD, &world_size); + MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); + int name_len; + MPI_Get_processor_name(processor_name, &name_len); + + printf("Hello world! Processor %s, Rank %d of %d\n", processor_name, world_rank, world_size); + + MPI_Finalize(); + } +EOF + + mpicc -o hello_mpi hello_mpi.c