Jean-Michel Batto 1 month ago
parent
commit
0948141b0c
4 changed files with 39 additions and 1 deletions
  1. 20 0
      Makefile
  2. 1 1
      README.md
  3. BIN
      para_hello_world
  4. 18 0
      para_hello_world.c

+ 20 - 0
Makefile

@@ -0,0 +1,20 @@
+CC=gcc
+XMPCC=xmpcc
+LIBS=-L/usr/lib -lmpi
+INCL=-I /usr/lib/openmpi/include
+
+OBJP=para_hello_world.o
+
+all: para_hello_world
+
+para_hello_world.o: para_hello_world.c
+	$(XMPCC) -c para_hello_world.c -fopenmp
+
+para_hello_world: $(OBJP)
+	$(XMPCC) -o para_hello_world $(OBJP) $(LIBS) 
+
+run: para_hello_world 
+	mpirun --mca orte_base_help_agregate 0 -x OMP_NUM_THREADS=4  -host mpihead,mpinode1 -n 2 /usr/local/var/mpishare/GLCS-CM9-TDXMP/para_hello_world
+	 
+clean:
+	rm *.o para_hello_world

+ 1 - 1
README.md

@@ -1,2 +1,2 @@
-# GLCS-CM9-TDXMP
+# xmpworkbench5
 

BIN
para_hello_world


+ 18 - 0
para_hello_world.c

@@ -0,0 +1,18 @@
+// programme pour GLCS-CM9
+// OpenMP et XMP
+#include <mpi.h>
+#include <omp.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <xmp.h>
+#pragma xmp nodes p(*)
+int main(int argc, char **argv) {
+  xmp_init_mpi(&argc, &argv);
+#pragma omp parallel
+  fprintf(stderr, "Hello from process: %d on node %d \n", omp_get_thread_num(),
+          xmpc_node_num());
+
+  xmp_finalize_mpi();
+
+  return 0;
+}