mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 08:34:42 +08:00
Update mpi test program.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
EXECS=hellompi
|
||||
MPICC=/usr/lib64/mpi/gcc/openmpi4/bin/mpicc
|
||||
#MPICC=/usr/lib64/mpi/gcc/openmpi4/bin/mpicc
|
||||
MPI=/usr/lib64/mpi/gcc/mpich
|
||||
|
||||
all: ${EXECS}
|
||||
|
||||
hellompi: hellompi.c
|
||||
${MPICC} -g -o hellompi hellompi.c
|
||||
hellompi: hellompi.cpp
|
||||
g++ -g -I${MPI}/include -L${MPI}/lib64 -lmpi -o hellompi hellompi.cpp
|
||||
|
||||
clean:
|
||||
rm ${EXECS}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include <mpi.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
@@ -20,7 +22,13 @@ int main(int argc, char** argv) {
|
||||
MPI_Get_processor_name(processor_name, &name_len);
|
||||
|
||||
// Print off a hello world message
|
||||
printf("Hello world from processor %s, rank %d out of %d processors\n", processor_name, world_rank, world_size);
|
||||
std::cout << "Hello world from processor " << processor_name << " rank " << world_rank << " size " << world_size << std::endl;
|
||||
|
||||
std::cout << "Waiting for debugger to be attached, PID: " << getpid() << std::endl;
|
||||
|
||||
bool attached = false;
|
||||
|
||||
while (!attached) sleep(1);
|
||||
|
||||
// Finalize the MPI environment.
|
||||
MPI_Finalize();
|
||||
Reference in New Issue
Block a user