Open MP usage in root

When I try to use the omp.h headerfile, root says the file is not found.

It does not seem to be specifically a ROOT question. I just tried to google “omp.h” I got several links showing how to include it… Just try to google a bit … :slight_smile:

Please make sure that you add the appropriate flags to enable OpenMP in your compiler.
This is usually -fopenmp. In ROOT this may be added target by target, which means that
your user code may not have the flag enabled and therefore may not find the header file,
which should come with your compiler (i.e. it’s not in /usr/include).

I am sorry. I have fixed that. But when I run the code, there is a conflicting types error for the functions under omp.h. I did try googling, was not able to understand the error. Thank you for your time.

Hey there,

Once I needed to use root classes along with omp+MPI and I have managed to make it and I created a makefile capable of handling it. I am attaching the makefile to the post, hoping you can get some more information from that. Basically what I got is that whenever you want to run some omp+MPI routines using ROOT framework you should prefer to compile the whole thing outside of ROOT.

Hope it helps

Gabriele

#compiler definition
CC=clang++
MPICC=clang-omp++

#flags declaration
CFLAGS=-lncurses -O3
CFLAGSSEQ=`root-config --cflags --libs` -std=c++11  -O3
MPICFLAGS= -I/usr/local/Cellar/open-mpi/2.0.1_1/include -L/usr/local/opt/libevent/lib -L/usr/local/Cellar/open-mpi/2.0.1_1/lib -lmpi -fopenmp -I /usr/local/opt/libiomp/include/libiomp `root-config --cflags --libs` -std=c++11 -O3

all: VanAllen Monitor VanAllenSeq

VanAllen: MainWithFunc.cpp FunctionMaster.cpp FunctionWorker.cpp FunctionFinalizer.cpp FunctionMasterFinalizer.cpp socketcomm.cpp
	$(MPICC) $(MPICFLAGS) MainWithFunc.cpp FunctionMaster.cpp FunctionWorker.cpp FunctionFinalizer.cpp FunctionMasterFinalizer.cpp socketcomm.cpp -o VanAllen

Monitor: VanAllenMonitor.cpp socketcomm.cpp
	$(CC) $(CFLAGS) VanAllenMonitor.cpp socketcomm.cpp -o Monitor

VanAllenSeq: Sequential.cpp
	$(CC) $(CFLAGSSEQ) Sequential.cpp -o VanAllenSeq

clean:
	rm VanAllen Monitor VanAllenSeq

Thank you for your time

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.