[Scons-users] OpenMP and MPI

Florian Lindner mailinglists at xgm.de
Mon Jan 26 04:22:46 EST 2015


I'm working on a program that uses both MPI and OpenMP. gcc and icc require 
different compiler flags -openmp / -fopenmp.

Furthermore when using MPI you usually use a compiler wrapper like mpicc / 
mpicxx / mpic++ where you don't see the compiler behind.

What's the best scons way to deal with that? Current idea is

if compiler = "g++":
  env.Append(CCFLAGS = ['-fopenmp'])
  env.Append(LINKFLAGS = ['-fopenmp'])
elif compiler = "icc"
  # likewise
elif compiler.startswith("mpi"):
  # execute $compiler -show with gives output like that
  # g++ -pthread -Wl,-rpath -Wl,/usr/lib/openmpi [...]
  # and parse that output

Is using subprocess to execute external processes ok? Any better way?


More information about the Scons-users mailing list