4 Replies Latest reply on Dec 18, 2008 4:32 PM by chipf

    undefined reference to `_mp_preinit'

    polach

      I am trying to compile Molcas 7.2 with ACML 4.2.0 and PGI 7.1-4. Whatever I do, I always get

       

      <path>/libacml.so: undefined reference to `_mp_preinit'

       

      when linking seward.exe. Is there anybody here having an idea what is the reason of such message? The strange thing is that even Google does not find anything about this message. I must have done something really unusual.

       

        • undefined reference to `_mp_preinit'
          brockp

          When compiling with ACML and PGI make sure you have the PGI version of the library and that you link with the pgi libraries,

           

          pgf90 -L/opt/acml/4.2.0/pgi64/lib  -lacml -pgf90libs -lpgftnrtl

           

          I think -pgf90libs is only needed when using the parallel version of acml,  (pgi64_mp) but not sure.

           

          Try that and let us know if it works.

           

          Brock Palen

            • undefined reference to `_mp_preinit'
              polach

              Thank you for a tip, but it did not help. Linking with ACML is somehow mysterious:

              1. The linker always complains about missing libpgftnrtl.so and libpgmp.so, so I have to specify rpath (to /libso) explicitly.

              2. Whatever I do, linking seward always ends with

              /usr/local/programs/acml/4.2.0/arch/pgi64_mp/lib/libacml_mp.so: undefined reference to `_mp_preinit'

              Where should the '_mp_preinit' be defined?

              The complete link command for seward.exe is:

              pgf77 -o ../../bin/seward.exe main.o -L../../lib -lseward -L../../lib -lmolcas -L../../g/lib/LINUX64 -ltcgmsg-mpi -lglobal -larmci -lpario -lma -L/usr/local/programs/openmpi/openmpi-1.2.6/arch/amd64-pgi70/lib -lmpi -L../../g/lib/LINUX64 -ltcgmsg-mpi -lglobal -larmci -lpario -lma -L/usr/local/programs/openmpi/openmpi-1.2.6/arch/amd64-pgi70/lib -lmpi -lmolcas -pgf77libs -lpgftnrtl -lpgmp -L/usr/local/programs/acml/4.2.0/arch/pgi64_mp/lib -lacml_mp -lpthread -Wl,-rpath -Wl,/usr/pgi/linux86-64/current/lib -Wl,-rpath -Wl,/usr/pgi/linux86-64/current/libso

               

                • undefined reference to `_mp_preinit'
                  brockp

                  Order matters many times,  try:

                   

                  pgf77 -o ../../bin/seward.exe main.o -L../../lib -lseward -L../../lib -lmolcas -L../../g/lib/LINUX64 -ltcgmsg-mpi -lglobal -larmci -lpario -lma -L/usr/local/programs/openmpi/openmpi-1.2.6/arch/amd64-pgi70/lib -lmpi -L../../g/lib/LINUX64 -ltcgmsg-mpi -lglobal -larmci -lpario -lma -L/usr/local/programs/openmpi/openmpi-1.2.6/arch/amd64-pgi70/lib -lmpi -lmolcas  -lpgmp -L/usr/local/programs/acml/4.2.0/arch/pgi64_mp/lib -lacml_mp -pgf77libs -lpgftnrtl -lpthread -Wl,-rpath -Wl,/usr/pgi/linux86-64/current/lib -Wl,-rpath -Wl,/usr/pgi/linux86-64/current/libso

                   

                   

                  Do you have an example source file that this happens for you?  I also have a version of openmpi/1.2.6 with PGI 7.x,  so I should be able to build the code.

                   

                  Also when using OpenMPI  shouldn't you be using the mpicc/mpif90 wrappers?

                    • undefined reference to `_mp_preinit'
                      chipf
                      The latest ACML, 4.2.0, is built with PGI 7.2-5. All of the release testing was done with that compiler version.

                      The __mp_preinit label is being requested because you are linking with the OpenMP ACML library. But you haven't specified -mp on the command line. Try adding that, it will tell the compiler to include the OpenMP runtime libraries it needs.


                      You might try just building and running the examples included with ACML. The command lines they use may help you solve the problem. For instance the examples do not have to specify where libpgftnrtl is when using a fortran compiler for the compile and link steps. And the OpenMP examples do have the -mp switch in use.


                      Are you using the OpenMP ACML on purpose? You are building a MPI application. MPI and OpenMP can work together, but you might want to compare performance when using the single threaded and multithreaded ACML versions. Often when an application is already using multiple processors via MPI or OpenMP, it is better for performance to use the single threaded ACML.

                      I also notice that you link in the pthread library. If this really is necessary, then the OpenMP ACML may not work properly.