1
1

Applying Jeff`s comments about proper SHMEM fortran organization of files.

Refs: 3870

This commit was SVN r29651.
Этот коммит содержится в:
Mike Dubman 2013-11-11 14:26:25 +00:00
родитель 01333813a9
Коммит ab796052b4
12 изменённых файлов: 135 добавлений и 176 удалений

Просмотреть файл

@ -112,7 +112,6 @@ AS_IF([test $OSHMEM_WANT_FORTRAN_BINDINGS -eq 1],
[AC_MSG_RESULT([no])])
])
AC_DEFUN([OSHMEM_SETUP_CFLAGS],[

Просмотреть файл

@ -50,8 +50,8 @@ EXAMPLES = \
hello_mpifh \
hello_usempi \
hello_usempif08 \
hello_shmem \
hello_shmemfh \
hello_shmem \
hello_shmemfh \
Hello.class \
ring_c \
ring_cxx \
@ -60,14 +60,16 @@ EXAMPLES = \
ring_usempif08 \
ring_shmem \
ring_shmemfh \
ring_shmemf90 \
Ring.class \
connectivity_c
# Default target. Always build the C example. Only build the others
# if Open MPI was build with the relevant language bindings.
# Default target.
all: hello_c ring_c connectivity_c
# Always build the C example. Only build the others
# if Open MPI was build with the relevant language bindings.
mpi:
@ if ompi_info --parsable | grep bindings:cxx:yes >/dev/null; then \
$(MAKE) hello_cxx ring_cxx; \
fi
@ -83,12 +85,17 @@ all: hello_c ring_c connectivity_c
@ if ompi_info --parsable | grep bindings:java:yes >/dev/null; then \
$(MAKE) Hello.class Ring.class; \
fi
@ if ompi_info --parsable | grep mca:shmem >/dev/null; then \
# Only build if we built OSHMEM support.
# Only build the Fortran examples if we have Fortran OSHMEM support.
shmem:
@ if oshmem_info --parsable | grep oshmem:bindings:c >/dev/null; then \
$(MAKE) hello_shmem; \
$(MAKE) hello_shmemfh; \
$(MAKE) ring_shmem; \
fi
@ if oshmem_info --parsable | grep oshmem:bindings:fort >/dev/null; then \
$(MAKE) hello_shmemfh; \
$(MAKE) ring_shmemfh; \
$(MAKE) ring_shmemf90; \
fi
# The usual "clean" target
@ -120,13 +127,11 @@ Ring.class: Ring.java
hello_shmem: hello_shmem_c.c
$(SHMEMCC) $(CFLAGS) $^ -o $@
hello_shmemfh: hello_shmemfh.f
hello_shmemfh: hello_shmemfh.f90
$(SHMEMFC) $(FCFLAGS) $^ -o $@
ring_shmem: ring_shmem_c.c
$(SHMEMCC) $(CFLAGS) $^ -o $@
ring_shmemfh: ring_shmemfh.f
$(SHMEMFC) $(FCFLAGS) $^ -o $@
ring_shmemf90: ring_shmem.f90
ring_shmemfh: ring_shmemfh.f90
$(SHMEMFC) $(FCFLAGS) $^ -o $@

Просмотреть файл

@ -39,15 +39,14 @@ EXTRA_DIST += \
examples/hello_usempi.f90 \
examples/hello_usempif08.f90 \
examples/hello_shmem_c.c \
examples/hello_shmemfh.f \
examples/hello_shmemfh.f90 \
examples/ring_c.c \
examples/ring_cxx.cc \
examples/ring_mpifh.f \
examples/ring_usempi.f90 \
examples/ring_usempif08.f90 \
examples/ring_shmem_c.c \
examples/ring_shmemfh.f \
examples/ring_shmem.f90 \
examples/ring_shmemfh.f90 \
examples/connectivity_c.c \
examples/Hello.java \
examples/Ring.java

Просмотреть файл

@ -31,7 +31,7 @@ different MPI interfaces:
Fortran use mpi_f08: hello_usempif08.f90
Java: Hello.java
C shmem.h: hello_shmem_c.c
Fortran shmemfh.f: hello_shmemfh.f
Fortran shmem.fh: hello_shmemfh.f90
- Send a trivial message around in a ring
C: ring_c.c
@ -41,8 +41,7 @@ different MPI interfaces:
Fortran use mpi_f08: ring_usempif08.f90
Java: Ring.java
C shmem.h: ring_shmem_c.c
Fortran shmemfh.f: ring_shmemfh.f
F90 shmemfh.f: ring_shmem.f90
Fortran shmem.fh: ring_shmemfh.f90
Additionally, there's one further example application, but this one
only uses the MPI C bindings:

Просмотреть файл

@ -1,19 +0,0 @@
C *
C * Copyright (c) 2013 Mellanox Technologies, Inc.
C * All rights reserved.
C * $COPYRIGHT$
C *
C * Additional copyrights may follow
C *
C * $HEADER$
C *
program main
integer proc, nproc
call START_PES(0)
proc = MY_PE()
nproc = NUM_PES()
write(*, '("Hello, world, I am ", i2, " of ", i2)')
& proc, nproc
end

22
examples/hello_shmemfh.f90 Обычный файл
Просмотреть файл

@ -0,0 +1,22 @@
!
! Copyright (c) 2013 Mellanox Technologies, Inc.
! All rights reserved.
! $COPYRIGHT$
!
! Additional copyrights may follow
!
! $HEADER$
!
program hello_shmem
implicit none
include 'shmem.fh'
integer proc, nproc
call START_PES(0)
proc = MY_PE()
nproc = NUM_PES()
write(*, '("Hello, world, I am ", i2, " of ", i2)') proc, nproc
end program hello_shmem

Просмотреть файл

@ -1,64 +0,0 @@
!
! Copyright (c) 2013 Mellanox Technologies, Inc.
! All rights reserved.
! $COPYRIGHT$
!
! Additional copyrights may follow
!
! $HEADER$
!
program ring_shmem_f90
implicit none
include 'shmem.fh'
integer*8, save :: rbuf
integer*8 :: message
integer :: proc, nproc, next
! func definitions
integer :: my_pe, num_pes
rbuf = -1
message = 10
call start_pes(0)
proc = my_pe()
nproc = num_pes()
! Calculate the PE number of the next process in the ring. Use the
! modulus operator so that the last process "wraps around" to PE 0.
next = mod((proc + 1), nproc)
if (proc == 0) then
write(*, '("Process 0 sending ", i2, " to", i2, " (", i2, " processes in ring)")') message, next, nproc
call shmem_put8(rbuf, message, 1, next)
write(*, '("Process 0 sent to ", i2)') next
end if
! Pass the message around the ring. The exit mechanism works as
! follows: the message (a positive integer) is passed around the
! ring. Each time it passes PE 0, it is decremented. When each
! processes receives a message containing a 0 value, it passes the
! message on to the next process and then quits. By passing the 0
! message first, every process gets the 0 message and can quit
! normally.
do while(message > 0)
call shmem_int8_wait_until(rbuf, SHMEM_CMP_EQ, message)
if (proc == 0) then
message = message - 1
write(*, '("Process 0 decremented value:", i2)') message
else
message = rbuf
end if
call shmem_put8(rbuf, message, 1, next)
end do
! All done
write(*, '("Process", i2," exiting.")') proc
end program

Просмотреть файл

@ -1,71 +0,0 @@
C
C Copyright (c) 2013 Mellanox Technologies, Inc.
C All rights reserved.
C $COPYRIGHT$
C
C Additional copyrights may follow
C
C $HEADER$
C
program ring_shmem_f77
implicit none
include 'shmem.fh'
integer*8 rbuf
save rbuf
integer*8 message
integer proc, nproc, next
C func definitions
integer my_pe, num_pes
rbuf = -1
message = 10
call start_pes(0)
proc = my_pe()
nproc = num_pes()
C Calculate the PE number of the next process in the ring. Use the
C modulus operator so that the last process "wraps around" to PE 0.
next = mod((proc + 1), nproc)
if (proc .eq. 0) then
write(*, '("Process 0 sending ", i2, " to ", i2,
& " (", i2, " processes in ring)")')
& message, next, nproc
call shmem_put8(rbuf, message, 1, next)
write(*, '("Process 0 sent to ", i2)') next
end if
C Pass the message around the ring. The exit mechanism works as
C follows: the message (a positive integer) is passed around the
C ring. Each time it passes PE 0, it is decremented. When each
C processes receives a message containing a 0 value, it passes the
C message on to the next process and then quits. By passing the 0
C message first, every process gets the 0 message and can quit
C normally.
10 call shmem_int8_wait_until(rbuf, SHMEM_CMP_EQ, message)
if (proc .eq. 0) then
message = message - 1
write(*, '("Process 0 decremented value:", i2)') message
else
message = rbuf
end if
call shmem_put8(rbuf, message, 1, next)
if (message .gt. 0) then
goto 10
else
goto 20
end if
C All done
20 write(*, '("Process", i2," exiting.")') proc
end

62
examples/ring_shmemfh.f90 Обычный файл
Просмотреть файл

@ -0,0 +1,62 @@
!
! Copyright (c) 2013 Mellanox Technologies, Inc.
! All rights reserved.
! $COPYRIGHT$
!
! Additional copyrights may follow
!
! $HEADER$
!
program ring_shmem
implicit none
include 'shmem.fh'
integer*8, save :: rbuf
integer*8 :: message
integer :: proc, nproc, next
rbuf = -1
message = 10
call start_pes(0)
proc = my_pe()
nproc = num_pes()
! Calculate the PE number of the next process in the ring. Use the
! modulus operator so that the last process "wraps around" to PE 0.
next = mod((proc + 1), nproc)
if (proc == 0) then
write(*, '("Process 0 sending ", i2, " to", i2, " (", i2, " processes in ring)")') message, next, nproc
call shmem_put8(rbuf, message, 1, next)
write(*, '("Process 0 sent to ", i2)') next
end if
! Pass the message around the ring. The exit mechanism works as
! follows: the message (a positive integer) is passed around the
! ring. Each time it passes PE 0, it is decremented. When each
! processes receives a message containing a 0 value, it passes the
! message on to the next process and then quits. By passing the 0
! message first, every process gets the 0 message and can quit
! normally.
do while(message > 0)
call shmem_int8_wait_until(rbuf, SHMEM_CMP_EQ, message)
if (proc == 0) then
message = message - 1
write(*, '("Process 0 decremented value:", i2)') message
else
message = rbuf
end if
call shmem_put8(rbuf, message, 1, next)
end do
! All done
write(*, '("Process", i2," exiting.")') proc
end program

Просмотреть файл

@ -48,6 +48,8 @@
integer SHMEM_CMP_GE
parameter ( SHMEM_CMP_GE = 5 )
integer my_pe
integer num_pes
logical shmem_pe_accessible
logical shmem_addr_accessible

Просмотреть файл

@ -25,6 +25,17 @@ AM_CFLAGS = \
-DOMPI_BUILD_LIBS="\"@LIBS@\"" \
-DOPAL_CC_ABSOLUTE="\"@OPAL_CC_ABSOLUTE@\"" \
-DOMPI_CXX_ABSOLUTE="\"@OMPI_CXX_ABSOLUTE@\""
if OSHMEM_PROFILING
AM_CFLAGS += -DOSHMEM_PROFILING=1
else
AM_CFLAGS += -DOSHMEM_PROFILING=0
endif
if OSHMEM_WANT_FORTRAN_BINDINGS
AM_CFLAGS += -DOSHMEM_WANT_FORTRAN_BINDINGS=1
else
AM_CFLAGS += -DOSHMEM_WANT_FORTRAN_BINDINGS=0
endif
include $(top_srcdir)/Makefile.man-page-rules

Просмотреть файл

@ -116,7 +116,7 @@ void oshmem_info_do_config(bool want_all)
char *crdebug_support;
char *topology_support;
char *vt_support;
/* Do a little preprocessor trickery here to figure opal_info_out the
* tri-state of MPI_PARAM_CHECK (which will be either 0, 1, or
* ompi_mpi_param_check). The preprocessor will only allow
@ -602,5 +602,19 @@ void oshmem_info_do_config(bool want_all)
opal_info_out("MPI_MAX_DATAREP_STRING", "options:mpi-max-datarep-string",
"IO interface not provided");
#endif
/* This block displays all the options with which the current
* installation of oshmem was configured. */
{
char *oshmem_fortran = OSHMEM_WANT_FORTRAN_BINDINGS ? "yes" : "no";
char *oshmem_compat = OSHMEM_SPEC_COMPAT ? "yes" : "no";
char *oshmem_param_check = OSHMEM_PARAM_CHECK ? "yes" : "no";
char *oshmem_profiling = OSHMEM_PROFILING ? "yes" : "no";
opal_info_out("OSHMEM C bindings", "oshmem:bindings:c", "yes");
opal_info_out("OSHMEM Fort shmem.fh", "oshmem:bindings:fort", oshmem_fortran);
opal_info_out("OSHMEM SGI/Quadrix compatibility mode", "oshmem:options:spec_compat", oshmem_compat);
opal_info_out("OSHMEM API functions parameter checking", "oshmem:options:param_check", oshmem_param_check);
opal_info_out("OSHMEM profiling support", "oshmem:options:profiling", oshmem_profiling);
}
}