[hpct] Example with hpm-fortran

Vitali Morozov morozov at anl.gov
Tue Oct 21 15:14:00 CDT 2008


      implicit none
      
      include 'mpif.h'
!      include 'f_hpm.h'

      integer SIZE
      parameter ( SIZE = 1024 )
      real(8) A(SIZE,SIZE), B(SIZE,SIZE), C(SIZE,SIZE)
      real(8) w, multiply
      integer ierr

      call MPI_Init( ierr )
      
      call f_hpminit( 0, "Mult" )
      call f_hpmstart( 0, "BLAS" )
      w = multiply( SIZE, A, B, C )
      call f_hpmstop( 0 )
      call f_hpmterminate( 0 )

      call MPI_Finalize( ierr )
      stop
      end


      real(8) function multiply( N, A, B, C )
      implicit none
      integer N
      real(8) A(1), B(1), C(1)

      call dgemm( 'N', 'N', N, N, N, 1d0, A, N, B, N, 0d0, C, N );

      multiply = C(1)

      return
      end
====================

F77     = mpixlf77
#F77     = mpif90
LD      = $(F77)
FFLAGS = -g #-x f77-cpp-input -std=gnu -Wp,-DHPM
LDFLAGS = -g # -dynamic

TARGET = dgemm_main
OBJS =  $(TARGET).o

IHPCT_BASE = $(HOME)/software/hpct_bgp
INCLUDE=-I$(IHPCT_BASE)/include
LIB=-L$(IHPCT_BASE)/lib -lhpm.xl -llicense

BLAS_BASE=/soft/apps/blas-lapack-lib
BLAS_LIB=-L$(BLAS_BASE) -lgoto

#MPITRACE_LIB = -L/soft/apps/hpct_bgp/lib/ -lhpm -llicense
#MPITRACE_LIB = -L$(HOME)/soft/hpct_bgp/lib/ -lhpm -llicense
#MPITRACE_LIB = -L$(HOME)/soft/hpct_bgp/lib/ -lhpm -llicense 
-qnostaticlink -L/bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/lib 
-ldl

all: grid

%.o : %.f
    $(F77) $(FFLAGS) $(INCLUDE) -c $<

grid: $(OBJS)
    $(LD) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIB) $(BLAS_LIB)
       
clean:
    rm -f $(TARGET) $(TARGET).o mpi_profile.* send_bytes.* single_trace  
mpi_profile_*.viz

=========================




More information about the hpct mailing list