Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] sndlib problem by mpicc compiler
From: Pawe³ Jaromin (jaromin.pawel_at_[hidden])
Date: 2012-07-30 12:48:08


normal MPI compiling:

**** Build of configuration Debug for project snd_0.1 ****

make all
Building file: ../src/snd_0.1.c
Invoking: GCC C Compiler
mpicc -I/usr/include/mpi -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP
-MF"src/snd_0.1.d" -MT"src/snd_0.1.d" -o "src/snd_0.1.o"
"../src/snd_0.1.c"
../src/snd_0.1.c:24: warning: return type defaults to 'int'
../src/snd_0.1.c: In function 'main':
../src/snd_0.1.c:45: warning: unused variable 'outfile'
../src/snd_0.1.c:42: warning: unused variable 'FILE_OUT'
../src/snd_0.1.c:41: warning: unused variable 'FILE_NAME'
../src/snd_0.1.c:40: warning: unused variable 'AF_setup'
../src/snd_0.1.c:38: warning: unused variable 'snd_buffor'
../src/snd_0.1.c:37: warning: unused variable 'i'
../src/snd_0.1.c: In function 'print_usage':
../src/snd_0.1.c:29: warning: control reaches end of non-void function
Finished building: ../src/snd_0.1.c

Building target: snd_0.1
Invoking: GCC C Linker
mpicc -o "snd_0.1" ./src/snd_0.1.o -lsndfile -laudiofile
Finished building target: snd_0.1

**** Build Finished ****

MPI with option --showme:

**** Build of configuration Debug for project snd_0.1 ****

make all
Building file: ../src/snd_0.1.c
Invoking: GCC C Compiler
mpicc --showme -I/usr/include/mpi -O0 -g3 -Wall -c -fmessage-length=0
-MMD -MP -MF"src/snd_0.1.d" -MT"src/snd_0.1.d" -o "src/snd_0.1.o"
"../src/snd_0.1.c"
gcc -I/usr/lib/openmpi/include -I/usr/lib/openmpi/include/openmpi
-pthread -I/usr/include/mpi -O0 -g3 -Wall -c -fmessage-length=0 -MMD
-MP -MFsrc/snd_0.1.d -MTsrc/snd_0.1.d -o src/snd_0.1.o
../src/snd_0.1.c
gcc: ./src/snd_0.1.o: No file or directory
make: *** [libsnd_0.1] Error 1
Finished building: ../src/snd_0.1.c

Building target: libsnd_0.1
Invoking: GCC C Linker
mpicc -shared -o "libsnd_0.1" ./src/snd_0.1.o -lsndfile

**** Build Finished ****

no MPI -program which was based on

**** Build of configuration Debug for project snd_test ****

make all
Building file: ../main.c
Invoking: GCC C Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d"
-MT"main.d" -o "main.o" "../main.c"
Finished building: ../main.c

Building target: snd_test
Invoking: GCC C Linker
gcc -o "snd_test" ./main.o -lsndfile
Finished building target: snd_test

**** Build Finished ****

2012/7/30 TERRY DONTJE <terry.dontje_at_[hidden]>:
> Please show me how you are compiling the program under gcc and mpicc. Plus
> do a "mpicc --showme".
>
> --td
>
>
> On 7/30/2012 8:33 AM, Pawe³ Jaromin wrote:
>
> This situation is also strange for me, I spend 2 days to find a bug :(.
>
> Unfortunately I am not a professional C/C++ programmer, but I have
> to make this program. Please have a look in a picture from link below,
> maybe it will be more clear.
>
> http://vipjg.nazwa.pl/sndfile_error.png
>
>
>
>
>
>
>
>
>
> 2012/7/30 TERRY DONTJE <terry.dontje_at_[hidden]>:
>
> On 7/30/2012 6:11 AM, Pawe³ Jaromin wrote:
>
> Hello
>
> Thanks for fast answer, but the problem looks a little different.
>
> Of course, I use this code only for master node (rank 0), because only
> this node has an access to file.
>
> As You can see i use "if" clause to check sndFile for NULL:
>
> if (sndFile == NULL)
>
> and it returns not NULL value, so the code can run forward.
> I have found the problem during check array:
>
>
> long numFrames = sf_readf_float(sndFile, snd_buffor, sfinfo.frames);
>
> // Check correct number of samples loaded
> if (numFrames != sfinfo.frames) {
> fprintf(stderr, "Did not read enough frames for source\n");
> sf_close(sndFile);
> free(snd_buffor);
> MPI_Finalize();
> return 1;
> }
>
> So, after that I went to debuger to check variables (I use Eclipse PTP
> and sdm enviroment), then after inicjalization variable "sndFile" has
> "no value" not "NULL" . Unfortunatelly sndFile has still the same
> value to the end of program :(.
>
> What do you mean by sndFile has "no value"? There isn't a special "no
> value" value to a variable unless you are debugging a code that somehow had
> some variable optimized out at the particular line you are interested in.
>
> Declarations:
> FILE *outfile = NULL ;
> SF_INFO sfinfo ;
> SNDFILE *sndFile= NULL;
>
> Very interesting is , that "sfinfo" from the same library works perfect.
> At the end of this story, I modified the program without MPI , then
> compiled it by gcc (not mpicc) and it works fine (in debuger sndFile
> has proper value).
>
> So it seems you believe mpicc is doing something wrong when all mpicc is is
> a wrapper to a compiler. Maybe doing a "mpicc --showme" will give you an
> idea what compiler and options mpicc is passing to the compiler. This
> should give you an idea the difference between your gcc and mpicc
> compilation. I would suspect either mpicc is using a compiler significantly
> different than gcc or that mpicc might be passing some optimization
> parameter that is messing the code execution (just a guess).
>
>
> I hope, now is clear.
>
> Not really.
>
> --td
>
>
>
> 2012/7/30 TERRY DONTJE <terry.dontje_at_[hidden]>:
>
> I am not sure I am understanding the problem correctly so let me describe it
> back to you with a couple clarifications.
>
> So your program using sf_open compiles successfully when using gcc and
> mpicc. However, when you run the executable compiled using mpicc sndFile is
> null?
>
> If the above is right can you tell us how you ran the code?
> Will the code run ok if ran with "mpirun -np 1" on the same machine you run
> the gcc code normally?
> When the mpicc compiled code sf_open call returns NULL what does the
> successive sf_strerror report?
> My wild guess is when you run the mpicc compiled code one of the processes
> is on a node that doesn't have access to the file passed to sf_open.
>
> --td
>
> On 7/28/2012 1:08 PM, Pawe³ Jaromin wrote:
>
> Hello all
>
> Because I try make a program to parallel procesing sound files, I use
> libsndfile library to load and write wav files. Sytuation is strange,
> because when I compile the program by gcc is good (no parallel), but
> if I do it by mpicc is a problem with sndFile variable.
>
> // Open sound file
> SF_INFO sndInfo;
> SNDFILE *sndFile = sf_open(argv[1], SFM_READ, &sndInfo);
> if (sndFile == NULL) {
> fprintf(stderr, "Error reading source file '%s': %s\n", argv[1],
> sf_strerror(sndFile));
> return 1;
> }
>
> This code run witout an error, but variable is "No value"
>
> Maybe somone can help me ??
>
>
> --
> Terry D. Dontje | Principal Software Engineer
> Developer Tools Engineering | +1.781.442.2631
> Oracle - Performance Technologies
> 95 Network Drive, Burlington, MA 01803
> Email terry.dontje_at_[hidden]
>
>
>
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users
>
>
>
> --
> Terry D. Dontje | Principal Software Engineer
> Developer Tools Engineering | +1.781.442.2631
> Oracle - Performance Technologies
> 95 Network Drive, Burlington, MA 01803
> Email terry.dontje_at_[hidden]
>
>
>
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users
>
>
>
> --
> Terry D. Dontje | Principal Software Engineer
> Developer Tools Engineering | +1.781.442.2631
> Oracle - Performance Technologies
> 95 Network Drive, Burlington, MA 01803
> Email terry.dontje_at_[hidden]
>
>
>
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users

-- 
------------------
pozdrawiam
Pawe³ Jaromin