7 Replies Latest reply on Sep 7, 2012 4:31 AM by santosh.zanjurne

    Compiling programs which utilize ACML 5.x

    yurtesen

      I have tried to follow the example at:

      http://developer.amd.com/tools/open64/AppsAndLibraries/Documents/building_with_acml.html

      but it just wouldnt work. I have to add -lfortran and -lffio . So my question is, why do I have to add -lfortran and -lffio to the command line? (and why not with gcc etc. but only with opencc?

       

      -bash-4.1$ opencc -O3 matrixmult_double.c matrixutil.o -o matrixmult_double -I$ACML_INCLUDE -lacml 
      /export/modules/devel/ACML/5.1.0/amd/open64_64/lib/libacml.so: undefined reference to `_TRANSFER'
      /export/modules/devel/ACML/5.1.0/amd/open64_64/lib/libacml.so: undefined reference to `_index90'
      /export/modules/devel/ACML/5.1.0/amd/open64_64/lib/libacml.so: undefined reference to `_F90_STOP'
      /export/modules/devel/ACML/5.1.0/amd/open64_64/lib/libacml.so: undefined reference to `_FRF'
      /export/modules/devel/ACML/5.1.0/amd/open64_64/lib/libacml.so: undefined reference to `s_cmp'
      /export/modules/devel/ACML/5.1.0/amd/open64_64/lib/libacml.so: undefined reference to `s_copy'
      /export/modules/devel/ACML/5.1.0/amd/open64_64/lib/libacml.so: undefined reference to `s_cat'
      /export/modules/devel/ACML/5.1.0/amd/open64_64/lib/libacml.so: undefined reference to `__powri'
      /export/modules/devel/ACML/5.1.0/amd/open64_64/lib/libacml.so: undefined reference to `_FWF'
      /export/modules/devel/ACML/5.1.0/amd/open64_64/lib/libacml.so: undefined reference to `_DEALLOC'
      /export/modules/devel/ACML/5.1.0/amd/open64_64/lib/libacml.so: undefined reference to `__powii'
      /export/modules/devel/ACML/5.1.0/amd/open64_64/lib/libacml.so: undefined reference to `__powdi'
      collect2: ld returned 1 exit status
      -bash-4.1$ opencc -O3 matrixmult_double.c matrixutil.o -o matrixmult_double -I$ACML_INCLUDE -lacml -lfortran -lffio
      -bash-4.1$ 
      

       

      Thanks,

      Evren

        • Re: Compiling programs which utilize ACML 5.x
          santosh.zanjurne

          Normally while linking fortran object files, fortran linker should be used; same as for c++.  Try using openf90, let me know if this helps.

           

          Regards,

          Santosh

          • Re: Compiling programs which utilize ACML 5.x
            jmbeuken

            Hi,

             

            there is a solution for this problem ?

            I have the same problem with open64 4.5.2 and acml 5.2.0 with a simple c program

            the solution is to link with static library...or with gfortran64 version

             

            my test program :

            cat conftest.c

            int

            main ()

            {

              ;

              return 0;

            }

             

            opencc --version

            Open64 Compiler Suite: Version 4.5.2

            Built on: 2012-08-03 03:24:51 -0700

            Thread model: posix

            GNU gcc version 4.2.0 (Open64 4.5.2 driver)

             

            compilation with shared lib :

            opencc -m64  -o conftext.x  conftest.c -L/opt/acml5.2.0/open64_64/lib -lacml

            /opt/acml5.2.0/open64_64/lib/libacml.so: undefined reference to `_TRANSFER'

            /opt/acml5.2.0/open64_64/lib/libacml.so: undefined reference to `_index90'

            /opt/acml5.2.0/open64_64/lib/libacml.so: undefined reference to `_F90_STOP'

            /opt/acml5.2.0/open64_64/lib/libacml.so: undefined reference to `_FRF'

            /opt/acml5.2.0/open64_64/lib/libacml.so: undefined reference to `s_cmp'

            /opt/acml5.2.0/open64_64/lib/libacml.so: undefined reference to `s_copy'

            /opt/acml5.2.0/open64_64/lib/libacml.so: undefined reference to `s_cat'

            /opt/acml5.2.0/open64_64/lib/libacml.so: undefined reference to `__powri'

            /opt/acml5.2.0/open64_64/lib/libacml.so: undefined reference to `_FWF'

            /opt/acml5.2.0/open64_64/lib/libacml.so: undefined reference to `_DEALLOC'

            /opt/acml5.2.0/open64_64/lib/libacml.so: undefined reference to `__powii'

            /opt/acml5.2.0/open64_64/lib/libacml.so: undefined reference to `__powdi'

            collect2: ld returned 1 exit status

             

            compilation with static lib :

            opencc -m64  -o conftext.x  conftest.c /opt/acml5.2.0/open64_64/lib/libacml.a

             

            the solution to add -lfortran and -lffio doesn't work for me :

            opencc -m64  -o conftext.x  conftest.c -L/opt/acml5.2.0/open64_64/lib -lacml -lfortran -lffio

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastsincos'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastcosh'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fasttanhf'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastatan2'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastcos'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastexpf'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastexp'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastsinh'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fasttanh'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastsinhf'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastlog'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastsin'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fasttan'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastlogf'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastatanf'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastsinf'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastatan2f'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fasttanf'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastcosf'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastsincosf'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastatan'

            /opt/x86_open64-4.5.2//lib/gcc-lib/x86_64-open64-linux/4.5.2/libfortran.so: undefined reference to `fastcoshf'

            collect2: ld returned 1 exit status

             

            and finally, with acml 5.2.0 but with gfortran64 version, it works :

            opencc -m64  -o conftext.x  conftest.c -L /opt/acml5.2.0/gfortran64/lib -lacml

            regards

             

            jmb

              • Re: Compiling programs which utilize ACML 5.x
                santosh.zanjurne

                Can you try following command ?

                opencc -m64 -c -o conftext.o conftest.c

                openf90 -m64  -o conftext.x  conftest.o -L/opt/acml5.2.0/open64_64/lib -lacml

                 

                We have different compiler drivers opencc, openCC, openf90 for C,C++,Fortran respectively.  One important job of the driver is to provide all the required libraries in the final part of the compilation.  Since libacml has many fortran related references, the error message you are seeing are those of unresolved ones.  you can add "-show" to see the internals.

                 

                Regards,

                Santosh

                  • Re: Compiling programs which utilize ACML 5.x
                    jmbeuken

                    Hi,

                    Can you try following command ?

                    opencc -m64 -c -o conftext.o conftest.c

                    openf90 -m64  -o conftext.x  conftest.o -L/opt/acml5.2.0/open64_64/lib -lacml

                     

                    I had already tried and it worked...

                    but it's difficult for me to integrate in a "configure" setup of a big projet ( with c and f90 sources ) that the linker for .c is openf90...

                     

                    the solutions ( as mentionned in my previous post )  to use static linking or gfortran64 libraries are potentially a problem ?

                     

                    regards

                     

                    jmb

                      • Re: Compiling programs which utilize ACML 5.x
                        santosh.zanjurne

                        Since open64 compiler libraries are build with open64 compiler, you need to specify the open64 compiler libraries present in your lib folder at "open64-binaries/lib/gcc-lib/x86_64-open64-linux/4.5" on the command line.

                         

                        For shared linking you can try adding '-lm -lmv' to your opencc linker command line and add other required libraries from above mentioned folder when needed.

                        e.g.

                        opencc -O3 matrixmult_double.c matrixutil.o -o matrixmult_double -I$ACML_INCLUDE -Lopen64-binaries/lib/gcc-lib/x86_64-open64-linux/4.5 -lacml -lfortran -lffio  -lm -lmv
                        

                         

                        Also static linking should not be a problem.

                         

                        Let me know if this helps.

                         

                        Regards,

                        Santosh