Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29274 Discussions

Compiling 32-bit executable of Fortran/MPI program with 64-bit compiler?

truedas
Beginner
1,254 Views
Hi,
our Fortran compiler and Intel MPI libraries are installed on a 64-bit Linux machine, so we have the 64-bit version of both. However, I need to use a 32-bit Linux machine to run my program. Is there a way to produce a 32-bit executable with the 64-bit compiler that has all libraries (i.e. MPI) statically linked, so that I could copy it over and use it? I seem to recall that there was an -m32 switch or so, but in the compiler versions I have now, I can't find anything to that effect.
Thanks,
Thomas
0 Kudos
1 Reply
TimP
Honored Contributor III
1,254 Views
The -m32 option in gnu compilers actually starts up a separate standard 32-bit counterpart of the compiler and binutils, so you must have installed those in addition to the basic 64-bit g++ development system. Likewise, Intel 32-bit "ia32" compilers must be installed separately, and depend on 32-bit g++; by contrast with gnu compilers, they are invoked by setting the 32-bit environment variables, e.g.
source /opt/intel/Compiler/11.1/069/ifortvars.csh ia32
If you are running a 32-bit application under MPI, as you hint, you need a complete 32-bit counterpart installation of your MPI to link against, but that same MPI must also be installed on your target machine. Linking static MPI libraries will not take the place of that MPI on the target cluster, which must have its own daemons etc.
With Intel MPI, e.g.
source /opt/intel/impi/4.0.0/bin/mpivars.csh
sets paths to the 32-bit MPI in the /bin/ directory (while /bin64/mpivars sets up 64-bit library paths).
You set up the Intel compiler and MPI paths separately, but they must be consistent with your 32-bit choice.
You could set the -static-mpi option for Intel MPI to get a static link, noting that this doesn't eliminate the dependence on target MPI installation.
With open source MPI, you would build and install a complete copy of the MPI, using 32-bit compilers, with its own directory (e.g. configure --prefix=/usr/local/your32bitmpi/) and set paths to that while building the application. If you want static libraries, you likely need to include them in your configure options, but again you need the same MPI installed on the target machines regardless of static or dynamic link.
All this complication points in the direction of installing compatible 64-bit OS for cluster computing, as all CPUs suitable for MPI in the last 5 years have been 64-bit capable, and 32-bit is a serious limitation on use of multi-core.
0 Kudos
Reply