Results 1 to 2 of 2

Thread: Fortran print statement inside action point

  1. #1
    Junior Member
    Join Date
    Jun 2009
    Posts
    1

    Fortran print statement inside action point


    Hello,

    1/ I am having difficulty setting a fortran EVAL point with Totalview8.6.0/linux-x86-64.

    Any of my expression using the print statement will always get :
    Error line 3: Syntax error at "," for instance : print *,5 fails.

    Setting similar action point in C works fine : printf ("%d \n"),5;
    I am using TotalView860 on a CRAY XT5.

    TV Userguide page 388 warns that some fortran intrinsics are not supported BUT nothing is said about the print statement.

    2/ I would also do the following call :
    call MPI_COMM_RANK ( MPI_COMM_WORLD,rank,code ) inside an eval point, but it fails.

    Thanks for any help, jg.



  2. #2

    Re: [jgphpc] Fortran print statement inside action point

    Sorry for the delay in responding. I've looked at this one a few times with the intent to respond, but other things came up.
    Print (and write) is indeed a Fortran intrinsic that we can't call. Maybe you can do it in gdb, but my quick test didn't work. But I'm more familiar with TotalView than gdb these days.

    There are 2 tricks you can use though. The first is to add a routine, or series of routines, that will take a variable and print it. Something like

    subroutine print_one_int(i)
    integer i
    print *, i
    return
    end

    and then, you can set an eval point like

    if (i .eq. 42) call print_one_int_(i);

    You may or may not have to add the trailing underscore, depending on the compiler and TotalView version. But this isn't too flexible, and requires adding extra, albeit trivial, code to your routine. A better option may be to trick the evaluation system entirely, and make it think it is looking at C code.

    Click on the button below the Expression box to change the language to C (or C++). Then enter a C expression like

    if (i == 42)
    {
    printf ("%d is the value of foo \n", foo);
    }

    in an earlier version of TotalView, I added an 'fflush(0);" after the printf statement, but that seemed to generate a segmentation fault with the latest TotalView. My issue was that the value wasn't getting printed out, so I had to flush the buffer. It may be that you won't need that, or that fflush() by itself would work (we want a 'NULL' to flush all the streams).

    I'm not having much luck with calling MPI_COMM_RANK either. it maybe be that the debug information is missing or stripped of debug information. Ot MPI may have been compiled with optimization which can remove symbols. I can actually find a

    mpi_comm_rank_f

    if I go to Tools->Program Browser and do a little searching on my mpi program. But if the debug info is missing, we likely won't be able to call it. If you build in debug mode, for the concerned MPI files (assuming you are building an MPI from source and have control over that). you might be able to find which source file contains this routine and make sure it is built in debug mode, and then see if it can be called.

    Hope that helps.

    Regards,
    Pete Thompson
    TotalView Customer Services

Posting Permissions

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