I have intel Parallel studio XE cluster edition 2015 on my 10 Node server connected with infiniband band. I wrote my code in C. My code consists of system commands with sprintf commands like below
system("cp metis_input.txt $HOME/metis-4.0/.");
sprintf(filename,"$HOME/metis-4.0/./partdmesh metis_input.txt %d",size-1);
sprintf(filename,"mv metis_input.txt.npart.%d nodes_proc.txt",size-1);
when i compile my code n run it without any opmization flag it runs smoothly but when i compile my code with "mpiicc -O" the above lines dont even seem to b executed. I c that the above lines are being skipped. only the printf's r executed. Do i need to add anything extra in my code to get these system commands runnning for INTEL mpi compiler with -O ?
I don't see anything suspicious in your code and unable to reproduce the described problem with the similar code. Could you please try this scenario with disabled SELinux?
Also you can check icc command line generated by mpiicc with '-show' option ('mpiicc -O ... -show').
when i compile my code n run it without any opmization flag it runs smoothly but when i compile my code with "mpiicc -O" the above lines dont even seem to b executed. I c that the above lines are being skipped. only the printf's r executed.
Could you please specify the command line and the environment used to run this scenario (not to compile)?
BTW you used '-ilp64' - this option is applicable for Fortran code only.
This the command i used to run the code
mpirun -n 32 -ppn 1 -hostfile hosts ./3D_TBL
To run the code i dint use any other flags other than this. I was using optimisation flags only for compiling dint use during execution.
First, to clarify something. The Intel MPI Library provides only wrappers scripts to the underlying compilers. What this means in your case is that the option -O that you use on the mpiicc command line is in fact being passed down to icc without any alterations. It seems like using the default optimization level for the Intel C++ Compiler is causing some print statements to not be executed for your code.
The default optimization level for the 2015 compiler is -O2. Can you try rerunning with -O1 and let me know if you see the same problem? If not, then the issue is with the level 2 optimizations performed by the compiler. Is your application an MPI application? If not, you can try compiling without the MPI library as follows:
icc -O -g -ilp64 -c -Wall main.c
If that works ok, then there's something wrong with our MPI wrapper. If this still exhibits the problem, then it's an issue with the compiler.