Find the answer to your Linux question:
Results 1 to 5 of 5
Hi, I'm trying to run an example program provided at netlib site (example1.f at netlib.org/scalapack/examples) It's a Fortran program using Scalapack libraries. I installed Fedora 16 on VirtualBox and tried ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2012
    Posts
    3

    Need help getting compiling/running Fortran code with Scalapack


    Hi,

    I'm trying to run an example program provided at netlib site (example1.f at netlib.org/scalapack/examples)

    It's a Fortran program using Scalapack libraries. I installed Fedora 16 on VirtualBox and tried to compile the program with:

    Code:
    /usr/lib/openmpi/bin/mpif90 -o example1 example1.f
    The result:

    Code:
    /tmp/cclDDKX7.o: In function `matinit_':
    example1.f:(.text+0x32): undefined reference to `blacs_gridinfo_'
    /tmp/cclDDKX7.o: In function `sl_init_':
    example1.f:(.text+0x61d): undefined reference to `blacs_pinfo_'
    example1.f:(.text+0x64d): undefined reference to `blacs_setup_'
    example1.f:(.text+0x668): undefined reference to `blacs_get_'
    example1.f:(.text+0x691): undefined reference to `blacs_gridinit_'
    /tmp/cclDDKX7.o: In function `MAIN__':
    example1.f:(.text+0x6ec): undefined reference to `blacs_gridinfo_'
    example1.f:(.text+0x755): undefined reference to `descinit_'
    example1.f:(.text+0x7af): undefined reference to `descinit_'
    example1.f:(.text+0x847): undefined reference to `pdlacpy_'
    example1.f:(.text+0x8b3): undefined reference to `pdlacpy_'
    example1.f:(.text+0x923): undefined reference to `pdgesv_'
    example1.f:(.text+0xba7): undefined reference to `pdlamch_'
    example1.f:(.text+0xbfc): undefined reference to `pdlange_'
    example1.f:(.text+0xc51): undefined reference to `pdlange_'
    example1.f:(.text+0xd0c): undefined reference to `pdgemm_'
    example1.f:(.text+0xd5e): undefined reference to `pdlange_'
    example1.f:(.text+0xf6a): undefined reference to `blacs_gridexit_'
    example1.f:(.text+0xf79): undefined reference to `blacs_exit_'
    collect2: ld returned 1 exit status
    I presume the blacs libraries have not been installed properly or path was not set. I tried a bunch of different things but with no results. I'm a newbie on Linux so any help/pointers would be appreciated.

  2. #2
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris
    Posts
    1,283
    Hi.

    You usually need to specify libraries. For example, in the readme file at http://netlib.org/scalapack/examples/readme , the code is compiled and linked with:
    Code:
    f77 -f -o example1 example1.f scalapack_SUN4SOL2.a \
    blacsF77init_MPI-SUN4SOL2-0.a blacs_MPI-SUN4SOL2-0.a \
    blacsF77init_MPI-SUN4SOL2-0.a blas_SUN4SOL2.a \
    $MPI_ROOT/lib/solaris/ch_p4/libmpi.a -lnsl -lsocket
    and that was after the 5 steps that guide you through the process of installing the special libraries. The example was for the case of Sun architecture, so you may need to perform steps that are different but similar for your architecture.

    I noticed that there is a user guide at ScaLAPACK Users' Guide , which may also be of use.

    Best wishes ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  3. #3
    Just Joined!
    Join Date
    Feb 2012
    Posts
    3
    Thanks drl, appreciate the quick reply.

    I did follow Scalapack user guide initially on Ubuntu but got nowhere (for example the makefile did not generate from makefile.in at some point in the installation procedure so I could not proceed with the next steps or I could not get MPI installed properly etc., although I try to follow all instructions to the letter).

    Then I read somewhere that Fedora comes with scalapack installed and thought should give it a try. As I said I'm a Linux newbie but still do have a pretty good idea of how things work, just can't set everything up properly. I guess my problem narrows down to a few general installation procedure questions in Unix-like systems:

    1. When I use 'apt-get install' or 'yum install' to install any package out there, where do the libraries (to which I'll be linking later) get extracted? How do I link to those libraries later when compiling programs?

    For example, in the above compile command there is a reference to scalapack_SUN4SOL2.a and I presume this library got extracted somewhere during installation. Is it enough to just specify the name of the library or do I have to set the full path to it (if so, how would I do that)?

    2. I understand that when compiling programs Unix-like systems will look to a default location to locate the required libraries (e.g. in usr/include etc.). How do I tell the compiler to look for libraries at other locations too? I guess my logic is to somehow locate the required libraries on my system (wherever they may be) and then tell the compiler to link to them by specifying full path. I suppose that's not a pretty or standard way of doing things in Unix but at this point I just want to get something running and think of refinements later

    3. When installing any software package that I downloaded (e.g. scalapack.tar.gz) do I need to extract it somewhere in usr/include or can I store it anywhere?

    4. What are the typicall steps taken to install a typicall software package in Linux/Unix? I did check out some of the tutorials out there and I suppose every person has different preferences and ways of doing things in Linux. What do you normally do when installing either downloaded packages or calling the install command?

    I will continue playing around and trying to get this to work and if you could just provide a few more answers to the above questions I think those should help me out a lot. Thanks in advance!!

  4. #4
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Slackware, {Free, Open, Net}BSD, Solaris
    Posts
    1,283
    Hi.

    To see items related to scalapack in ubuntu:
    Code:
    apt-cache search scalapack

    Code:
           -lnamespec
           --library=namespec
               Add the archive or object file specified by namespec to the list of
               files to link.  This option may be used any number of times.
    -- from man ld
    The linker, "ld" (called automatically for compilations indicating that you want an executable, as opposed to object output) looks in "known places".

    The (very long) library list can be seen with:
    Code:
    /sbin/ldconfig -p
    909 libs found in cache `/etc/ld.so.cache' ...
    Your questions are good, but are likely answered by information in one or more of the following links to tutorials:

    Linux Programming Internals: Libraries - Your Own and The System's
    The above link showcases C code for examples, but the ideas are the same for Fortran. With an hour or two of working the examples, I think you'll acquire most of the knowledge of how libraries are handled.

    Program Library HOWTO
    The above is a long document, but will answer most questions.

    Please look them over. Best wishes ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  5. #5
    Just Joined!
    Join Date
    Feb 2012
    Posts
    3
    Great, looks like just what I need.. Thanks again, cheers!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •