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.don...@oracle.com>: > 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.don...@oracle.com>: > > 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.don...@oracle.com > > > > > _______________________________________________ > users mailing list > us...@open-mpi.org > 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.don...@oracle.com > > > > > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users -- ------------------ pozdrawiam Paweł Jaromin