Skip to content

Commit

Permalink
issue #10. Examples showing how to mix mfc and gfortran.
Browse files Browse the repository at this point in the history
  • Loading branch information
rupertford committed May 9, 2018
1 parent a7035ac commit 53c76c8
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ocean/nemo/nemolite2d_psykal_ompss/simple_tests/Makefile.mixed2
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
F90 = gfortran
F90FLAGS = -g
OMPSSF90 = mfc
OMPSSF90FLAGS = --ompss -g
FOBJ = field.o main.o psy_deref.o psy_target.o my_work1.o my_work2.o

test_example: ${FOBJ}
${OMPSSF90} -o $@ ${FOBJ} ${OMPSSF90FLAGS}

psy_target.o : psy_target.f90
${OMPSSF90} ${OMPSSF90FLAGS} -c $<
my_work1.o : my_work1.f90
${OMPSSF90} ${OMPSSF90FLAGS} -c $<
my_work2.o : my_work2.f90
${OMPSSF90} ${OMPSSF90FLAGS} -c $<

psy_target.o : my_work1.o my_work2.o
psy_deref.o : field.o
main.o : psy_deref.o field.o

%.o: %.f90
${F90} ${F90FLAGS} -c $<
clean:
rm -f *.o *.mod test_example
27 changes: 27 additions & 0 deletions ocean/nemo/nemolite2d_psykal_ompss/simple_tests/Makefile.mixed3
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
F90 = gfortran
F90FLAGS = -g
OMPSSF90 = mfc
OMPSSF90FLAGS = --ompss -g
FOBJ = field.o top.o main2.o psy_deref.o psy_target.o my_work1.o my_work2.o

test_example: ${FOBJ}
${OMPSSF90} -o $@ ${FOBJ} ${OMPSSF90FLAGS}

psy_target.o : psy_target.f90
${OMPSSF90} ${OMPSSF90FLAGS} -c $<
my_work1.o : my_work1.f90
${OMPSSF90} ${OMPSSF90FLAGS} -c $<
my_work2.o : my_work2.f90
${OMPSSF90} ${OMPSSF90FLAGS} -c $<
top.o : top.f90
${OMPSSF90} ${OMPSSF90FLAGS} -c $<

top.o : main2.o
psy_target.o : my_work1.o my_work2.o
psy_deref.o : field.o
main2.o : psy_deref.o field.o

%.o: %.f90
${F90} ${F90FLAGS} -c $<
clean:
rm -f *.o *.mod test_example
10 changes: 10 additions & 0 deletions ocean/nemo/nemolite2d_psykal_ompss/simple_tests/main2.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
subroutine algorithm
! example algorithm code
use field_mod, only : field
use psy_layer, only : psy
implicit none
type(field) :: a

call psy(a)

end subroutine algorithm
11 changes: 11 additions & 0 deletions ocean/nemo/nemolite2d_psykal_ompss/simple_tests/psy_deref.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module psy_layer
contains
subroutine psy(a)
use field_mod, only : field
implicit none
type(field) :: a

call psy_target(a%data)

end subroutine psy
end module psy_layer
30 changes: 30 additions & 0 deletions ocean/nemo/nemolite2d_psykal_ompss/simple_tests/psy_target.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
subroutine psy_target(a)
! full field dependencies with gocean data types and doubly nested
! loops
use kernel_work1, only : work1
use kernel_work2, only : work2
implicit none
integer :: i, j
real :: a(2,2)

a = 0.0

do j=1,2
do i=1,2
!$omp task out(a(i,j))
call work1(i,j,a)
!$omp end task
end do
end do

do j=1,2
do i=1,2
!$omp task in(a(i,j))
call work2(i,j,a)
!$omp end task
end do
end do

!$omp taskwait

end subroutine psy_target
3 changes: 3 additions & 0 deletions ocean/nemo/nemolite2d_psykal_ompss/simple_tests/top.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
program top
call algorithm()
end program top

0 comments on commit 53c76c8

Please sign in to comment.