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.

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],
      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@oracle.com