pgi compiler and parallel make

I’m using PGI C++ compiler and I need to compile my large library using parallel make. When I try to build without the parallel option, the compiling process goes smoothly with no problem, but very slowly. When I run in parallel however, I get “undefined reference” problems. I’m sure the problem is related to the naming conflicts of intermediate object files. I guess each execution of the compiler tries to write to the same set of object files during linking and optimization (e.g. all try to write to myexec.o and myexec.oo even though the final outputs are myexec1 and myexec2). I use macros to compile the same files with different options.

Is there a way to control how the intermediate files are named such that I can compile my library in parallel?

Thanks in advance.

Here is the compiler version:

pgcpp 14.4-0 64-bit target on x86-64 Linux -tp bulldozer 
The Portland Group - PGI Compilers and Tools
Copyright (c) 2014, NVIDIA CORPORATION.  All rights reserved.

and this is one example of how I compile one program:

mpic++ src/atsgyread.cpp obj/atlib.o -o bin/atsgyread -I./inc  -w -fast --no_exceptions  -mp=numa -Mvect=prefetch  -fma -Minline -Mfcon -Msmartalloc=huge -fastsse -Mipa=fast,inline -Mconcur –Mprefetch=d:16,n:8

Is there a way to control how the intermediate files are named such that I can compile my library in parallel?

You can use “-o ” to specify the name of the output file to use.

Though, it doesn’t sound you have your makefiles set up correctly. Are you using dependencies?

  • Mat

I use explicit rules and dependencies in my Makefile for the shared object files. However, I don’t have explicit rules to generate.o files for executables as the compiler can automatically compile the source code and link to other object files in one go. For example,

mylib.o: mylib.cpp mylib.hpp
  mpic++ mylib.cpp -o mylib.o
myexec1: myexec.cpp mylib.o
  mpic++ mylib.o myexec -o myexec1 -DFLAG1
myexec2: myexec.cpp mylib.o
  mpic++ mylib.o myexec -o myexec2 -DFLAG2

[/code]
I never faced this problem with intel or gnu compilers as they generate temp object files possibly with semi-random names, which avoids possible name conflicts. I have over 400 rules for executables in my Makefile and I’m trying to avoid writing a rule for an object file for every executable. In addition, there are also conflict when generating .oo files, which show up when using certain optimization flags. I’m not sure how I can control the naming for those too!!

Hi abdul900,

All of our intermediary file do have random names. Adding “-v” (verbose) to a compilation will show you the various phases as well as the naming of the intermediary files.

What’s the actual error you’re seeing? From what you describe, you’re encountering collisions in the generated “.o” files, which is user controlled.

  • Mat

Below is the output for a fresh make (after removing all the target files), and you can see the error message. This is if I make in parallel. When I make without using the parallel option, everything goes smoothly and I get no error messages.

$ make -j2
mpic++ -c src/atlib.cpp -o obj/atlib.o -I./inc  -w -fast --no_exceptions  -mp=numa -Mvect=prefetch  -fma -Minline -Mfcon -Msmartalloc=huge -fastsse -Mipa=fast,inline -Mconcur –Mprefetch=d:16,n:8 
mpic++ src/atl2b.cpp -o bin/atl2b -I./inc  -w -fast --no_exceptions  -mp=numa -Mvect=prefetch  -fma -Minline -Mfcon -Msmartalloc=huge -fastsse -Mipa=fast,inline -Mconcur –Mprefetch=d:16,n:8 
IPA: Recompiling atl2b.o: stale object file
mpic++ -c src/atwave.cpp -o obj/atwave.o -I./inc  -w -fast --no_exceptions  -mp=numa -Mvect=prefetch  -fma -Minline -Mfcon -Msmartalloc=huge -fastsse -Mipa=fast,inline -Mconcur –Mprefetch=d:16,n:8 
mpic++ -c src/monodft_eng.cpp -o obj/monodft_eng.o -I./inc  -w -fast --no_exceptions  -mp=numa -Mvect=prefetch  -fma -Minline -Mfcon -Msmartalloc=huge -fastsse -Mipa=fast,inline -Mconcur –Mprefetch=d:16,n:8 
mpic++ -c src/attable.cpp -o obj/attable.o -I./inc  -w -fast --no_exceptions  -mp=numa -Mvect=prefetch  -fma -Minline -Mfcon -Msmartalloc=huge -fastsse -Mipa=fast,inline -Mconcur –Mprefetch=d:16,n:8 
mpic++ -c src/atvecop.cpp -o obj/atvecop.o -I./inc  -w -fast --no_exceptions  -mp=numa -Mvect=prefetch  -fma -Minline -Mfcon -Msmartalloc=huge -fastsse -Mipa=fast,inline -Mconcur –Mprefetch=d:16,n:8 
mpic++ src/atwlet1.cpp obj/atlib.o -o bin/atwlet1 -I./inc  -w -fast --no_exceptions  -mp=numa -Mvect=prefetch  -fma -Minline -Mfcon -Msmartalloc=huge -fastsse -Mipa=fast,inline -Mconcur –Mprefetch=d:16,n:8 
src/atwlet1.cpp:
IPA: Recompiling atwlet1.o: stale object file
mpic++ src/atwlet2.cpp obj/atlib.o -o bin/atwlet2 -I./inc  -w -fast --no_exceptions  -mp=numa -Mvect=prefetch  -fma -Minline -Mfcon -Msmartalloc=huge -fastsse -Mipa=fast,inline -Mconcur –Mprefetch=d:16,n:8 
src/atwlet2.cpp:
IPA: Recompiling obj/atlib.o: new IPA information
IPA: Recompiling atwlet2.o: stale object file
IPA: Recompiling obj/atlib.o: new IPA information
mpic++ src/atsgyhdr.cpp obj/atlib.o -o bin/atsgyhdr -I./inc  -w -fast --no_exceptions  -mp=numa -Mvect=prefetch  -fma -Minline -Mfcon -Msmartalloc=huge -fastsse -Mipa=fast,inline -Mconcur –Mprefetch=d:16,n:8 
src/atsgyhdr.cpp:
.IPPINFO append for object file obj/atlib_ipa7_atwlet2.oo failed with code: -1
obj/atlib_ipa7_atwlet2.oo: file not recognized: File format not recognized
child process exit status 1: /usr/bin/ld
make: *** [bin/atwlet2] Error 2
make: *** Waiting for unfinished jobs....
IPA: Recompiling atsgyhdr.o: stale object file
IPA: Recompiling obj/atlib.o: new IPA information

Thanks abdul900. While I don’t think this being caused by a file name collision since the name “atlib_ipa7_atwlet2.oo” is unique, something is causing the file to get corrupted. I’ll need to ask some folks for ideas.

In the mean time, do you mind adding the flag “-v” (verbose) and then sending the full log to PGI Customer Service (trs@pgroup.com)?

  • Mat

I didn’t realize that we are on page 2 of the discussion :). I just sent the output to the email as you requested.

I did some investigation on my part and I found the errors go away when I remove this flag -Mipa=fast,inline

I hope this helps.