Commit dd442b80 authored by Francois Tessier's avatar Francois Tessier

Fortran example using TAPIOCA

parent 9cfc0941
MPIF90 = mpixlf90 MPIF90 = mpif90
FLAGS = -g FLAGS = -g -I$(HOME)/install/$(ARCHI)/include/ -I ../../bindings/ -DBGQ -DDBG -DCOLOR
LDFLAGS = LDFLAGS = -L$(HOME)/install/$(ARCHI)/lib/ -ltapioca -lstdc++
all: simple_array all: simple_array
simple_array:simple_array.f90 simple_array:simple_array.o ../../bindings/tapioca_f90api.o
$(MPIF90) $(FLAGS) $? -o $@ $(LDFLAGS) $(MPIF90) $(FLAGS) $? -o $@ $(LDFLAGS)
simple_array.o:simple_array.f90
$(MPIF90) $(FLAGS) -c $? $(LDFLAGS)
clean: clean:
rm simple_array rm simple_array simple_array.o
MPIF90 = mpif90
FLAGS = -g
LDFLAGS =
all: simple_array
simple_array:simple_array.f90
$(MPIF90) $(FLAGS) $? -o $@ $(LDFLAGS)
clean:
rm simple_array
#!/bin/bash
NODES=8
PPN=12
NPROCS=$((NODES*PPN))
TARGET="/projects/visualization/ftessier/debug"
cd $HOME/TAPIOCA/examples/Fortran
export TAPIOCA_DEVNULL=false
export TAPIOCA_COMMSPLIT=true
export TAPIOCA_STRATEGY=TOPOLOGY_AWARE
export TAPIOCA_NBAGGR=2
export TAPIOCA_BUFFERSIZE=4194304
export TAPIOCA_PIPELINING=true
rm $TARGET/*
mpirun -f $COBALT_NODEFILE -n $NPROCS ./simple_array
! http://www.mcs.anl.gov/research/projects/mpi/usingmpi2/examples/starting/io3f_f90.htm ! http://www.mcs.anl.gov/research/projects/mpi/usingmpi2/examples/starting/io3f_f90.htm
PROGRAM main PROGRAM main
use mpi use mpi
use iso_c_binding
integer ierr, i, myrank, mysize, BUFSIZE, filehandle integer ierr, i, myrank, mysize, filehandle
parameter (BUFSIZE=100) integer*8 BUFSIZE, TOTSIZE, SCANSIZE
integer buf(BUFSIZE) integer buf(20000)
integer(kind=MPI_OFFSET_KIND) disp integer(kind=MPI_OFFSET_KIND) disp
integer status(MPI_STATUS_SIZE)
integer*8 chunkcount(1)
integer chunksize(1)
integer*8 chunkoffset(1)
BUFSIZE = 20000
SCANSIZE = 0
call MPI_INIT(ierr) call MPI_INIT(ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD, myrank, ierr) call MPI_COMM_RANK(MPI_COMM_WORLD, myrank, ierr)
...@@ -17,16 +26,19 @@ PROGRAM main ...@@ -17,16 +26,19 @@ PROGRAM main
buf(i) = myrank * BUFSIZE + i buf(i) = myrank * BUFSIZE + i
enddo enddo
call MPI_FILE_OPEN(MPI_COMM_WORLD, '/projects/visualization/ftessier/debug/f90_HACC.dat', & call MPI_ALLREDUCE ( BUFSIZE, TOTSIZE, 1, MPI_LONG_LONG, MPI_SUM, MPI_COMM_WORLD, ierr )
MPI_MODE_WRONLY + MPI_MODE_CREATE, & call MPI_EXSCAN ( BUFSIZE, SCANSIZE, 1, MPI_LONG_LONG, MPI_SUM, MPI_COMM_WORLD, ierr )
MPI_INFO_NULL, filehandle, ierr)
disp = myrank * BUFSIZE * 4 chunkcount (1) = BUFSIZE
chunksize (1) = 4
chunkoffset (1) = SCANSIZE * chunksize (1)
call tapioca_init ( chunkcount, chunksize, chunkoffset, %VAL(1), %VAL(0), %VAL(mpi_comm_world) )
call tapioca_write ( %VAL(chunkoffset(1)), buf, %VAL(BUFSIZE), %VAL(MPI_INT), status )
call MPI_FILE_WRITE_AT_ALL(filehandle, disp, buf, BUFSIZE, MPI_INTEGER, & call tapioca_finalize ( )
MPI_STATUS_IGNORE, ierr)
call MPI_FILE_CLOSE(filehandle, ierr)
call MPI_FINALIZE(ierr) call MPI_FINALIZE(ierr)
END PROGRAM main END PROGRAM main
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment