[Scons-users] OpenMP and MPI
Russel Winder
russel at winder.org.uk
Mon Jan 26 06:39:27 EST 2015
On Mon, 2015-01-26 at 10:22 +0100, Florian Lindner wrote:
> Hello,
>
> 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
Are you using specific SCons tools or just the default tool set? I am
guessing the latter.
For MPI, I always explicitly set compiler to mpic++.
Put this together and I am not sure I would advocate the if you have.
Is there a small project that we could bandy about to iterate to a "best
practice"?
>
> Is using subprocess to execute external processes ok? Any better way?
It is, but it shouldn't be needed.
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
More information about the Scons-users
mailing list