diff --git a/src/Makefile.am b/src/Makefile.am index f346c17..72dbce2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -16,4 +16,4 @@ COMMON_SOURCES = \ lib_LTLIBRARIES = libmoc.la libmoc_la_SOURCES = $(COMMON_SOURCES) -libmoc_la_LIBADD = +libmoc_la_LIBADD = -lpmix -lmpi diff --git a/test/Makefile.devel b/test/Makefile.devel new file mode 100644 index 0000000..737d0db --- /dev/null +++ b/test/Makefile.devel @@ -0,0 +1,41 @@ +# Manually edit paths for OMPIX and LLVM include/lib dirs + +CC=clang +CFLAGS=-fopenmp -g +MPI_COMPILE_FLAGS=$(shell mpicc --showme:compile) +MPI_LINK_FLAGS=$(shell mpicc --showme:link) + +OMPIX_INC_DIR=/home/tjn/projects/ompi-ecp/install/include +OMPIX_LIB_DIR=/home/tjn/projects/ompi-ecp/install/lib + +LLVM_INC_DIR=/home/tjn/projects/ompi-ecp/source/llvm/release_50/install/debug/include +LLVM_LIB_DIR=/home/tjn/projects/ompi-ecp/source/llvm/release_50/install/debug/lib + +#all: dbg prod +all: dbg + +dbg: mpi_omp_hello_dbg + +#prod: mpi_omp_hello_prod + +# # Production build of LLVM +# mpi_omp_hello_prod: mpi_omp_hello.c +# $(CC) -I/home/tjn/projects/ompi-ecp/source/llvm/release_50/install/release/include \ +# -I/home/tjn/projects/ompi-ecp/install/include \ +# -L/home/tjn/projects/ompi-ecp/install/lib \ +# $(MPI_COMPILE_FLAGS) $(CFLAGS) $(MPI_LINK_FLAGS) \ +# -o mpi_omp_hello.prod mpi_omp_hello.c -lpmix -lmoc + +# Debug build of LLVM +mpi_omp_hello_dbg: mpi_omp_hello.c + $(CC) -I$(LLVM_INC_DIR) \ + -I$(OMPIX_INC_DIR) \ + -L$(LLVM_LIB_DIR) \ + -L$(OMPIX_LIB_DIR) \ + $(MPI_COMPILE_FLAGS) $(CFLAGS) $(MPI_LINK_FLAGS) \ + -o mpi_omp_hello.dbg mpi_omp_hello.c -lpmix -lmoc + +clean: + rm -f mpi_omp_hello + rm -f mpi_omp_hello.prod + rm -f mpi_omp_hello.dbg diff --git a/test/mpi_omp_hello.c b/test/mpi_omp_hello.c index 5df8823..d2650e1 100644 --- a/test/mpi_omp_hello.c +++ b/test/mpi_omp_hello.c @@ -25,11 +25,15 @@ main (int argc, char *argv[]) { int nthreads, tid; moc_info_t *moc_policy_info; + int rank; fprintf (stderr, "[%s:%s:%d] Calling MPI_Init()...\n", __FILE__, __func__, __LINE__); MPI_Init (&argc, &argv); fprintf (stderr, "[%s:%s:%d] MPI_Init() succeeded\n", __FILE__, __func__, __LINE__); + MPI_Comm_rank(MPI_COMM_WORLD, &rank); + fprintf (stderr, "[%s:%s:%d] HELLO PID: %d RANK: %d\n", __FILE__, __func__, __LINE__, (int)getpid(), rank); + MOC_Init (MPI_COMM_WORLD); MOC_INFO_CREATE (moc_policy_info, 1); @@ -51,7 +55,21 @@ main (int argc, char *argv[]) if (tid == 0) { nthreads = omp_get_num_threads(); - printf("Number of threads = %d\n", nthreads); + printf("[RANK:%d,TID:%d] Number of threads = %d\n", rank, tid, nthreads); + } + + { + int i, nprocs, procids, nplaces; + nplaces = omp_get_num_places(); + + printf("[RANK:%d,TID:%d] num_places = %d\n", rank, tid, nplaces); + for (i = 0; i < nplaces; i++) { + nprocs = omp_get_place_num_procs(i); + omp_get_place_proc_ids(i, &procids); + + printf(" [RANK:%d,TID:%d,PLACE:%d] num_places = %d, places_num_procs = %d, places_procids = %d\n", + rank, tid, i, nplaces, nprocs, procids); + } } } /* All threads join master thread and disband */