Hello Jeff,

I could make the wrapper works. However, I found the the issue with the
link phase. The new wrapper is as following:

-----------------------------------------------------------------
#!/bin/bash

WORDTOREMOVE1="-static-intel"
WORDTOREMOVE2="-Wc,$WORDTOREMOVE1"

CMD="gcc"
for ARG in "$@" ; do
  ARGTOCMD="${ARG//$WORDTOREMOVE2/}"
  ARGTOCMD="${ARGTOCMD//$WORDTOREMOVE1/}"
  ARGTOCMD="${ARGTOCMD//\"/\\\"\"}"
  ARGTOCMD="${ARGTOCMD//=\\\"\"/=\"\\\"}"
  CMD="$CMD $ARGTOCMD"
done
eval "$CMD"
-------------------------------------------------------------------------

The wrapper implements well the "-static-intel" and "Wc,-static-intel" but
during the execution the link is dynamic.

The output of the library is:

-------------------------------------------------------------------------------
linux-vdso.so.1 (0x00007ffdef5ba000)
libopen-pal.so.40 => /usr/local/lib64/libopen-pal.so.40 (0x00007f0543969000)
librt.so.1 => /lib64/librt.so.1 (0x00007f0543760000)
libutil.so.1 => /lib64/libutil.so.1 (0x00007f054355d000)
libz.so.1 => /lib64/libz.so.1 (0x00007f0543347000)
libifport.so.5 => /opt/compiler/lib/intel64/libifport.so.5
(0x00007f0543117000)
libimf.so => /opt/compiler/lib/intel64/libimf.so (0x00007f0542c2a000)
libm.so.6 => /lib64/libm.so.6 (0x00007f054292d000)
libirc.so => /opt/compiler/lib/intel64/libirc.so (0x00007f05426c2000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f05424a5000)
libsvml.so => /opt/compiler/lib/intel64/libsvml.so (0x00007f0541587000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f054136f000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f054116b000)
libc.so.6 => /lib64/libc.so.6 (0x00007f0540dc8000)
libintlc.so.5 => /opt/compiler/lib/intel64/libintlc.so.5
(0x00007f0540b5c000)
/lib64/ld-linux-x86-64.so.2 (0x0000559572768000)

-------------------------------------------------------------------------------------------

If the implementation was correct, the parts where appear  libimf.so,
libifport.so, libsvml.so, libintlc.so and libirc.so will dissapear.

Thanks for your help.

Alvaro.


El lun, 1 feb 2021 a las 19:36, Jeff Squyres (jsquyres) (<jsquy...@cisco.com>)
escribió:

> Can you `make V=1` for that orte-info build?
>
> That will show us the exact command that was used to build orte-info (vs.
> just the abbreviated "CC    orte-info.o"
>
>
> On Feb 1, 2021, at 4:50 AM, Alvaro Payero Pinto <10alvaro...@gmail.com>
> wrote:
>
> Hi Jeff,
>
> First of all, this message was sent a week ago but I am not really sure if
> it was received or not.
> Sorry for the delay, I could not reach the office and try the solutions
> you proposed until today.
> The idea was to compile Open MPI itself with Intel Fortran libraries
> static linking. I’ve only
> found these dependencies in libmpi_usempi_ignore_tkr.so and
> libmpi_usempif08.so.
> Following the recommendation you gave in situation #2, I implemented a
> first version of the
> wrapper to strip “-static-intel” and “-Wc,-static-intel” appearances only
> for C/C++.
> ----- gcc_wrap in a folder in PATH -------------------------
> #!/bin/bash
> WORDTOREMOVE1=&quot;-static-intel&quot;
> WORDTOREMOVE2=&quot;-Wc,$WORDTOREMOVE1&quot;
> ARGS=$(echo ${*//$WORDTOREMOVE2/})
> ARGS=$(echo ${ARGS//$WORDTOREMOVE1/})
> gcc $ARGS
> ---------------------------------------------------------------------
> g++_wrap is pretty much the same but replacing gcc by g++. The call to
> configure now
> becomes:
> ./configure --prefix=/usr/local/ --libdir=/usr/local/lib64/
> --includedir=/usr/local/include/
> CC=gcc_wrap CXX=g++_wrap &#39;FLAGS=-O2 -m64&#39; &#39;CFLAGS=-O2
> -m64&#39; &#39;CXXFLAGS=-O2 -m64&#39;
> FC=ifort &#39;FCFLAGS=-O2 -m64&#39; LDFLAGS=-Wc,-static-intel
> Everything goes fine in the configure execution, but when the system tries
> to compile orte-info
> it crashes. I enclose the outputs again. configure.out contains both the
> outputs from configure
> and compilation.
> Kind regards,
> Álvaro
>
>
> El vie, 22 ene 2021 a las 16:09, Jeff Squyres (jsquyres) (<
> jsquy...@cisco.com>) escribió:
>
>> On Jan 22, 2021, at 9:49 AM, Alvaro Payero Pinto via users <
>> users@lists.open-mpi.org> wrote:
>> >
>> > I am trying to install Open MPI with Intel compiler suite for the
>> Fortran side and GNU compiler suite for the C side. For factors that don’t
>> depend upon me, I’m not allowed to change the C compiler suite to Intel one
>> since that would mean an additional license.
>>
>> Yoinks.  I'll say right off that this will be a challenge.
>>
>> > Problem arises with the fact that the installation should not
>> dynamically depend on Intel libraries, so the flag “-static-intel” (or
>> similar) should be passed to the Fortran compiler. I’ve seen in the FAQ
>> that this problem is solved by passing an Autotools option
>> “-Wc,-static-intel” to the variable LDFLAGS when invoking configure with
>> Intel compilers. This works if both C/C++ and Fortran compilers are from
>> Intel. However, it crashes if the compiler suite is mixed since GNU C/C++
>> does not recognise the “-static-intel” option.
>>
>> The problem is that the same LDFLAGS value is used for all 3 languages
>> (C, C++, Fortran), because they can all be compiled into a single
>> application.  So the Autotools don't separate out different LDFLAGS for the
>> different languages.
>>
>> > Is there any way to bypass this crash and to indicate that such option
>> should only be passed when using Fortran compiler?
>>
>> Keep in mind that there's also two different cases here:
>>
>> 1. When compiling Open MPI itself
>> 2. When compiling MPI applications
>>
>> You can customize the behavior of the mpifort wrapper compiler by editing
>> share/openmpi/mpifort-wrapper-data.txt.
>>
>> #1 is likely to be a bit more of a challenge.
>>
>> ...but the thought occurs to me that #2 may be sufficient.  You might
>> want to try it and see if your MPI applications have the Intel libraries
>> statically linked, and that's enough...?
>>
>> > Configure call to reproduce the crash is made as follows:
>> >
>> > ./configure --prefix=/usr/local/ --libdir=/usr/local/lib64/
>> --includedir=/usr/local/include/ CC=gcc CXX=g++ 'FLAGS=-O2 -m64'
>> 'CFLAGS=-O2 -m64' 'CXXFLAGS=-O2 -m64' FC=ifort 'FCFLAGS=-O2 -m64'
>> LDFLAGS=-Wc,-static-intel
>>
>> The other, slightly more invasive mechanism you could try if #2 is not
>> sufficient is to write your own wrapper compiler script that intercepts /
>> strips out -Wc,-static-intel for the C and C++ compilers.  For example:
>>
>> ./configure CC=my_gcc_wrapper.sh CXX=my_g++_wrapper.sh ...
>> LDFLAGS=-Wc,-static-intel
>>
>> Those two scripts are simple shell scripts that strip -Wc,-static-intel
>> if it sees it, but otherwise just invoke gcc/g++ with all other contents of
>> $*.
>>
>> It's a gross hack, but it might work.
>>
>> --
>> Jeff Squyres
>> jsquy...@cisco.com
>>
>> <outputs (1).tar.bz2>
>
>
>
> --
> Jeff Squyres
> jsquy...@cisco.com
>
>

Reply via email to