Zoltan is added as thirdParty package

This commit is contained in:
Hamidreza
2025-05-15 21:58:43 +03:30
parent 83a6e4baa1
commit d7479cf1bd
3392 changed files with 318142 additions and 1 deletions

View File

@ -0,0 +1,38 @@
IF(${PROJECT_NAME}_ENABLE_Fortran AND BUILD_ZOLTAN_F90_INTERFACE)
SET(ZFDRIVE_SOURCES
fdr_migrate.f90
fdr_sort.f90
fdr_main.f90
fdr_loadbal.f90
fdr_input.f90
fdr_param_file.f90
fdr_chaco_io.f90
fdr_mm_io.f90
fdr_const.f90
mmio.f
mpi_h.f
)
if(${CMAKE_Fortran_COMPILER_ID} MATCHES "NAG")
APPEND_SET(ZFDRIVE_SOURCES farg_nagf95.f)
ELSE()
APPEND_SET(ZFDRIVE_SOURCES farg_typical.f)
ENDIF()
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
TRIBITS_ADD_EXECUTABLE(
zfdrive
NOEXEPREFIX
SOURCES ${ZFDRIVE_SOURCES}
LINKER_LANGUAGE Fortran
COMM serial mpi
)
# What is a good location for executables zdrive and zCPPdrive?
# When should they be moved there? During install? Or build?
#INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/zfdrive.exe DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
ENDIF()

View File

@ -0,0 +1,102 @@
# @HEADER
#
########################################################################
#
# Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
# Copyright 2012 Sandia Corporation
#
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the Corporation nor the names of the
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Questions? Contact Karen Devine kddevin@sandia.gov
# Erik Boman egboman@sandia.gov
#
########################################################################
#
# @HEADER
include $(top_builddir)/Makefile.export.zoltan
F77=$(FC)
AM_FFLAGS=$(FCFLAGS)
#if USING_GNUMAKE
#EXPORT_LIBS = $(shell $(PERL_EXE) $(top_srcdir)/config/strip_dup_libs.pl $(ZOLTAN_LIBS))
#EXPORT_INC_PATH = $(shell $(PERL_EXE) $(top_srcdir)/config/strip_dup_incl_paths.pl $(ZOLTAN_INCLUDES))
#else
EXPORT_LIBS = $(ZOLTAN_LIBS)
EXPORT_INC_PATH = $(ZOLTAN_INCLUDES)
#endif
AM_CPPFLAGS = $(EXPORT_INC_PATH)
EXEEXT = .exe
noinst_PROGRAMS = zfdrive
if NAG_F90_COMPILER
FARG_SRC = $(srcdir)/farg_nagf95.f
else
FARG_SRC = $(srcdir)/farg_typical.f
endif
zfdrive_SOURCES = \
$(srcdir)/mpi_h.f \
$(FARG_SRC) \
$(srcdir)/mmio.f \
$(srcdir)/fdr_sort.f90 \
$(srcdir)/fdr_const.f90 \
$(srcdir)/fdr_input.f90 \
$(srcdir)/fdr_chaco_io.f90 \
$(srcdir)/fdr_param_file.f90 \
$(srcdir)/fdr_mm_io.f90 \
$(srcdir)/fdr_migrate.f90 \
$(srcdir)/fdr_loadbal.f90 \
$(srcdir)/fdr_main.f90
zfdrive_DEPENDENCIES = \
$(ZOLTAN_DEPS)
zfdrive_CPPFLAGS = $(EXPORT_INC_PATH) -I$(srcdir)/ -I$(top_srcdir)/src/ch/
zfdrive_LDADD = $(EXPORT_LIBS)
EXTRA_DIST = $(srcdir)/CMakeLists.txt \
$(srcdir)/Makefile.am \
$(srcdir)/Makefile.in \
$(srcdir)/README.mpich \
$(srcdir)/farg_nagf95.f \
$(srcdir)/farg_typical.f \
$(srcdir)/makefile \
$(srcdir)/zoltan_user_data.f90.old
MOSTLYCLEANFILES = *.mod
.NOTPARALLEL:

View File

@ -0,0 +1,650 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# @HEADER
#
########################################################################
#
# Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
# Copyright 2012 Sandia Corporation
#
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the Corporation nor the names of the
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Questions? Contact Karen Devine kddevin@sandia.gov
# Erik Boman egboman@sandia.gov
#
########################################################################
#
# @HEADER
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
noinst_PROGRAMS = zfdrive$(EXEEXT)
subdir = src/fdriver
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/config/ax_f90_module_case.m4 \
$(top_srcdir)/config/ax_f90_module_flag.m4 \
$(top_srcdir)/config/tac_arg_check_mpi.m4 \
$(top_srcdir)/config/tac_arg_enable_export-makefiles.m4 \
$(top_srcdir)/config/tac_arg_enable_feature.m4 \
$(top_srcdir)/config/tac_arg_enable_feature_sub.m4 \
$(top_srcdir)/config/tac_arg_enable_feature_sub_check.m4 \
$(top_srcdir)/config/tac_arg_enable_option.m4 \
$(top_srcdir)/config/tac_arg_with_3pl_sub.m4 \
$(top_srcdir)/config/tac_arg_with_ar.m4 \
$(top_srcdir)/config/tac_arg_with_flags.m4 \
$(top_srcdir)/config/tac_arg_with_incdirs.m4 \
$(top_srcdir)/config/tac_arg_with_libdirs.m4 \
$(top_srcdir)/config/tac_arg_with_libs.m4 \
$(top_srcdir)/config/tac_arg_with_package.m4 \
$(top_srcdir)/config/tac_arg_with_perl.m4 \
$(top_srcdir)/config/wk_fc_get_vendor.m4 \
$(top_srcdir)/config/zac_arg_config_mpi.m4 \
$(top_srcdir)/config/zac_arg_with_id.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/include/Zoltan_config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am__zfdrive_SOURCES_DIST = $(srcdir)/mpi_h.f $(srcdir)/farg_typical.f \
$(srcdir)/farg_nagf95.f $(srcdir)/mmio.f \
$(srcdir)/fdr_sort.f90 $(srcdir)/fdr_const.f90 \
$(srcdir)/fdr_input.f90 $(srcdir)/fdr_chaco_io.f90 \
$(srcdir)/fdr_param_file.f90 $(srcdir)/fdr_mm_io.f90 \
$(srcdir)/fdr_migrate.f90 $(srcdir)/fdr_loadbal.f90 \
$(srcdir)/fdr_main.f90
@NAG_F90_COMPILER_FALSE@am__objects_1 = farg_typical.$(OBJEXT)
@NAG_F90_COMPILER_TRUE@am__objects_1 = farg_nagf95.$(OBJEXT)
am_zfdrive_OBJECTS = mpi_h.$(OBJEXT) $(am__objects_1) mmio.$(OBJEXT) \
fdr_sort.$(OBJEXT) fdr_const.$(OBJEXT) fdr_input.$(OBJEXT) \
fdr_chaco_io.$(OBJEXT) fdr_param_file.$(OBJEXT) \
fdr_mm_io.$(OBJEXT) fdr_migrate.$(OBJEXT) \
fdr_loadbal.$(OBJEXT) fdr_main.$(OBJEXT)
zfdrive_OBJECTS = $(am_zfdrive_OBJECTS)
am__DEPENDENCIES_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src/include
F77COMPILE = $(F77) $(AM_FFLAGS) $(FFLAGS)
F77LD = $(F77)
F77LINK = $(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \
$@
FCCOMPILE = $(FC) $(AM_FCFLAGS) $(FCFLAGS)
FCLD = $(FC)
FCLINK = $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \
$@
SOURCES = $(zfdrive_SOURCES)
DIST_SOURCES = $(am__zfdrive_SOURCES_DIST)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALTERNATE_AR = @ALTERNATE_AR@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EXEEXT = .exe
FC = @FC@
FCFLAGS = @FCFLAGS@
FCFLAGS_f = @FCFLAGS_f@
FCFLAGS_f90 = @FCFLAGS_f90@
FCLIBS = @FCLIBS@
FC_MAJOR_VERSION = @FC_MAJOR_VERSION@
FC_MODNAME = @FC_MODNAME@
FC_MODNAME_Q = @FC_MODNAME_Q@
FC_VENDOR = @FC_VENDOR@
FC_VERSION = @FC_VERSION@
FC_VERSION_STRING = @FC_VERSION_STRING@
HAVE_PERL = @HAVE_PERL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
MPI_CC = @MPI_CC@
MPI_CXX = @MPI_CXX@
MPI_FC = @MPI_FC@
MPI_RECV_LIMIT_FLAG = @MPI_RECV_LIMIT_FLAG@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL_EXE = @PERL_EXE@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_aux_dir = @ac_aux_dir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_FC = @ac_ct_FC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
F77 = $(FC)
AM_FFLAGS = $(FCFLAGS)
#if USING_GNUMAKE
#EXPORT_LIBS = $(shell $(PERL_EXE) $(top_srcdir)/config/strip_dup_libs.pl $(ZOLTAN_LIBS))
#EXPORT_INC_PATH = $(shell $(PERL_EXE) $(top_srcdir)/config/strip_dup_incl_paths.pl $(ZOLTAN_INCLUDES))
#else
EXPORT_LIBS = $(ZOLTAN_LIBS)
EXPORT_INC_PATH = $(ZOLTAN_INCLUDES)
#endif
AM_CPPFLAGS = $(EXPORT_INC_PATH)
@NAG_F90_COMPILER_FALSE@FARG_SRC = $(srcdir)/farg_typical.f
@NAG_F90_COMPILER_TRUE@FARG_SRC = $(srcdir)/farg_nagf95.f
zfdrive_SOURCES = \
$(srcdir)/mpi_h.f \
$(FARG_SRC) \
$(srcdir)/mmio.f \
$(srcdir)/fdr_sort.f90 \
$(srcdir)/fdr_const.f90 \
$(srcdir)/fdr_input.f90 \
$(srcdir)/fdr_chaco_io.f90 \
$(srcdir)/fdr_param_file.f90 \
$(srcdir)/fdr_mm_io.f90 \
$(srcdir)/fdr_migrate.f90 \
$(srcdir)/fdr_loadbal.f90 \
$(srcdir)/fdr_main.f90
zfdrive_DEPENDENCIES = \
$(ZOLTAN_DEPS)
zfdrive_CPPFLAGS = $(EXPORT_INC_PATH) -I$(srcdir)/ -I$(top_srcdir)/src/ch/
zfdrive_LDADD = $(EXPORT_LIBS)
EXTRA_DIST = $(srcdir)/CMakeLists.txt \
$(srcdir)/Makefile.am \
$(srcdir)/Makefile.in \
$(srcdir)/README.mpich \
$(srcdir)/farg_nagf95.f \
$(srcdir)/farg_typical.f \
$(srcdir)/makefile \
$(srcdir)/zoltan_user_data.f90.old
MOSTLYCLEANFILES = *.mod
all: all-am
.SUFFIXES:
.SUFFIXES: .f .f90 .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/fdriver/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu src/fdriver/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstPROGRAMS:
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
zfdrive$(EXEEXT): $(zfdrive_OBJECTS) $(zfdrive_DEPENDENCIES) $(EXTRA_zfdrive_DEPENDENCIES)
@rm -f zfdrive$(EXEEXT)
$(F77LINK) $(zfdrive_OBJECTS) $(zfdrive_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
.f.o:
$(F77COMPILE) -c -o $@ $<
.f.obj:
$(F77COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
mpi_h.o: $(srcdir)/mpi_h.f
$(F77) $(AM_FFLAGS) $(FFLAGS) -c -o mpi_h.o `test -f '$(srcdir)/mpi_h.f' || echo '$(srcdir)/'`$(srcdir)/mpi_h.f
mpi_h.obj: $(srcdir)/mpi_h.f
$(F77) $(AM_FFLAGS) $(FFLAGS) -c -o mpi_h.obj `if test -f '$(srcdir)/mpi_h.f'; then $(CYGPATH_W) '$(srcdir)/mpi_h.f'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/mpi_h.f'; fi`
farg_typical.o: $(srcdir)/farg_typical.f
$(F77) $(AM_FFLAGS) $(FFLAGS) -c -o farg_typical.o `test -f '$(srcdir)/farg_typical.f' || echo '$(srcdir)/'`$(srcdir)/farg_typical.f
farg_typical.obj: $(srcdir)/farg_typical.f
$(F77) $(AM_FFLAGS) $(FFLAGS) -c -o farg_typical.obj `if test -f '$(srcdir)/farg_typical.f'; then $(CYGPATH_W) '$(srcdir)/farg_typical.f'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/farg_typical.f'; fi`
farg_nagf95.o: $(srcdir)/farg_nagf95.f
$(F77) $(AM_FFLAGS) $(FFLAGS) -c -o farg_nagf95.o `test -f '$(srcdir)/farg_nagf95.f' || echo '$(srcdir)/'`$(srcdir)/farg_nagf95.f
farg_nagf95.obj: $(srcdir)/farg_nagf95.f
$(F77) $(AM_FFLAGS) $(FFLAGS) -c -o farg_nagf95.obj `if test -f '$(srcdir)/farg_nagf95.f'; then $(CYGPATH_W) '$(srcdir)/farg_nagf95.f'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/farg_nagf95.f'; fi`
mmio.o: $(srcdir)/mmio.f
$(F77) $(AM_FFLAGS) $(FFLAGS) -c -o mmio.o `test -f '$(srcdir)/mmio.f' || echo '$(srcdir)/'`$(srcdir)/mmio.f
mmio.obj: $(srcdir)/mmio.f
$(F77) $(AM_FFLAGS) $(FFLAGS) -c -o mmio.obj `if test -f '$(srcdir)/mmio.f'; then $(CYGPATH_W) '$(srcdir)/mmio.f'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/mmio.f'; fi`
.f90.o:
$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $<
.f90.obj:
$(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'`
fdr_sort.o: $(srcdir)/fdr_sort.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_sort.o $(FCFLAGS_f90) `test -f '$(srcdir)/fdr_sort.f90' || echo '$(srcdir)/'`$(srcdir)/fdr_sort.f90
fdr_sort.obj: $(srcdir)/fdr_sort.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_sort.obj $(FCFLAGS_f90) `if test -f '$(srcdir)/fdr_sort.f90'; then $(CYGPATH_W) '$(srcdir)/fdr_sort.f90'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/fdr_sort.f90'; fi`
fdr_const.o: $(srcdir)/fdr_const.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_const.o $(FCFLAGS_f90) `test -f '$(srcdir)/fdr_const.f90' || echo '$(srcdir)/'`$(srcdir)/fdr_const.f90
fdr_const.obj: $(srcdir)/fdr_const.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_const.obj $(FCFLAGS_f90) `if test -f '$(srcdir)/fdr_const.f90'; then $(CYGPATH_W) '$(srcdir)/fdr_const.f90'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/fdr_const.f90'; fi`
fdr_input.o: $(srcdir)/fdr_input.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_input.o $(FCFLAGS_f90) `test -f '$(srcdir)/fdr_input.f90' || echo '$(srcdir)/'`$(srcdir)/fdr_input.f90
fdr_input.obj: $(srcdir)/fdr_input.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_input.obj $(FCFLAGS_f90) `if test -f '$(srcdir)/fdr_input.f90'; then $(CYGPATH_W) '$(srcdir)/fdr_input.f90'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/fdr_input.f90'; fi`
fdr_chaco_io.o: $(srcdir)/fdr_chaco_io.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_chaco_io.o $(FCFLAGS_f90) `test -f '$(srcdir)/fdr_chaco_io.f90' || echo '$(srcdir)/'`$(srcdir)/fdr_chaco_io.f90
fdr_chaco_io.obj: $(srcdir)/fdr_chaco_io.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_chaco_io.obj $(FCFLAGS_f90) `if test -f '$(srcdir)/fdr_chaco_io.f90'; then $(CYGPATH_W) '$(srcdir)/fdr_chaco_io.f90'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/fdr_chaco_io.f90'; fi`
fdr_param_file.o: $(srcdir)/fdr_param_file.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_param_file.o $(FCFLAGS_f90) `test -f '$(srcdir)/fdr_param_file.f90' || echo '$(srcdir)/'`$(srcdir)/fdr_param_file.f90
fdr_param_file.obj: $(srcdir)/fdr_param_file.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_param_file.obj $(FCFLAGS_f90) `if test -f '$(srcdir)/fdr_param_file.f90'; then $(CYGPATH_W) '$(srcdir)/fdr_param_file.f90'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/fdr_param_file.f90'; fi`
fdr_mm_io.o: $(srcdir)/fdr_mm_io.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_mm_io.o $(FCFLAGS_f90) `test -f '$(srcdir)/fdr_mm_io.f90' || echo '$(srcdir)/'`$(srcdir)/fdr_mm_io.f90
fdr_mm_io.obj: $(srcdir)/fdr_mm_io.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_mm_io.obj $(FCFLAGS_f90) `if test -f '$(srcdir)/fdr_mm_io.f90'; then $(CYGPATH_W) '$(srcdir)/fdr_mm_io.f90'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/fdr_mm_io.f90'; fi`
fdr_migrate.o: $(srcdir)/fdr_migrate.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_migrate.o $(FCFLAGS_f90) `test -f '$(srcdir)/fdr_migrate.f90' || echo '$(srcdir)/'`$(srcdir)/fdr_migrate.f90
fdr_migrate.obj: $(srcdir)/fdr_migrate.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_migrate.obj $(FCFLAGS_f90) `if test -f '$(srcdir)/fdr_migrate.f90'; then $(CYGPATH_W) '$(srcdir)/fdr_migrate.f90'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/fdr_migrate.f90'; fi`
fdr_loadbal.o: $(srcdir)/fdr_loadbal.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_loadbal.o $(FCFLAGS_f90) `test -f '$(srcdir)/fdr_loadbal.f90' || echo '$(srcdir)/'`$(srcdir)/fdr_loadbal.f90
fdr_loadbal.obj: $(srcdir)/fdr_loadbal.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_loadbal.obj $(FCFLAGS_f90) `if test -f '$(srcdir)/fdr_loadbal.f90'; then $(CYGPATH_W) '$(srcdir)/fdr_loadbal.f90'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/fdr_loadbal.f90'; fi`
fdr_main.o: $(srcdir)/fdr_main.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_main.o $(FCFLAGS_f90) `test -f '$(srcdir)/fdr_main.f90' || echo '$(srcdir)/'`$(srcdir)/fdr_main.f90
fdr_main.obj: $(srcdir)/fdr_main.f90
$(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o fdr_main.obj $(FCFLAGS_f90) `if test -f '$(srcdir)/fdr_main.f90'; then $(CYGPATH_W) '$(srcdir)/fdr_main.f90'; else $(CYGPATH_W) '$(srcdir)/$(srcdir)/fdr_main.f90'; fi`
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstPROGRAMS ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am
include $(top_builddir)/Makefile.export.zoltan
.NOTPARALLEL:
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,58 @@
# @HEADER
#
########################################################################
#
# Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
# Copyright 2012 Sandia Corporation
#
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the Corporation nor the names of the
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Questions? Contact Karen Devine kddevin@sandia.gov
# Erik Boman egboman@sandia.gov
#
########################################################################
#
# @HEADER
I had the darndest time getting MPICH to work on Linux because they use command
line arguments, which is not standard in Fortran. I do not yet know how much
this effects other operating systems with one f90. Under the default build of
MPICH 1.1.2, using g77 as the Fortran compiler, it generates routines for
iargc and getarg which work when g77 compiles the application, but not with
any of the Fortran 90 compilers. Finally I did a build with -f95nag (as well
as --disable-c++ -opt=-g -noromio -rsh=ssh), with /usr/local/bin/f95 being
the NAG compiler. This does not create the routines, which gives unresolved
references, but lets us add them in with the application. (Also it creates
some bad PARAMETER statements in mpif.h, which can be commented out.) The
farg*.f files contain the iargc and getarg routines for various compilers.
I should also note that using mpif77 or mpif90 for the compile or link doesn't
work, either.
William F. Mitchell, October 5, 1999

View File

@ -0,0 +1,63 @@
!!
!! @HEADER
!!
!!!!**********************************************************************
!!
!! Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
!! Copyright 2012 Sandia Corporation
!!
!! Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
!! the U.S. Government retains certain rights in this software.
!!
!! Redistribution and use in source and binary forms, with or without
!! modification, are permitted provided that the following conditions are
!! met:
!!
!! 1. Redistributions of source code must retain the above copyright
!! notice, this list of conditions and the following disclaimer.
!!
!! 2. Redistributions in binary form must reproduce the above copyright
!! notice, this list of conditions and the following disclaimer in the
!! documentation and/or other materials provided with the distribution.
!!
!! 3. Neither the name of the Corporation nor the names of the
!! contributors may be used to endorse or promote products derived from
!! this software without specific prior written permission.
!!
!! THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
!! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
!! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
!! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
!! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
!! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
!! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
!! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
!! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
!! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
!! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!!
!! Questions? Contact Karen Devine kddevin@sandia.gov
!! Erik Boman egboman@sandia.gov
!!
!!!!**********************************************************************
!!
!! @HEADER
!!
! Command line argument functions for NAGWare f95 4.0
integer function mpir_iargc()
use f90_unix_env
mpir_iargc = iargc()
return
end
subroutine mpir_getarg( i, s )
use f90_unix_env
integer i
character*(*) s
integer lenarg, ierr
call getarg(i,s,lenarg,ierr)
return
end

View File

@ -0,0 +1,59 @@
!!
!! @HEADER
!!
!!!!**********************************************************************
!!
!! Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
!! Copyright 2012 Sandia Corporation
!!
!! Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
!! the U.S. Government retains certain rights in this software.
!!
!! Redistribution and use in source and binary forms, with or without
!! modification, are permitted provided that the following conditions are
!! met:
!!
!! 1. Redistributions of source code must retain the above copyright
!! notice, this list of conditions and the following disclaimer.
!!
!! 2. Redistributions in binary form must reproduce the above copyright
!! notice, this list of conditions and the following disclaimer in the
!! documentation and/or other materials provided with the distribution.
!!
!! 3. Neither the name of the Corporation nor the names of the
!! contributors may be used to endorse or promote products derived from
!! this software without specific prior written permission.
!!
!! THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
!! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
!! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
!! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
!! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
!! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
!! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
!! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
!! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
!! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
!! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!!
!! Questions? Contact Karen Devine kddevin@sandia.gov
!! Erik Boman egboman@sandia.gov
!!
!!!!**********************************************************************
!!
!! @HEADER
!!
! Command line argument functions for typical iargc, getarg implementations
integer function mpir_iargc()
mpir_iargc = iargc()
return
end
subroutine mpir_getarg( i, s )
integer i
character*(*) s
call getarg(i,s)
return
end

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,211 @@
!!
!! @HEADER
!!
!!!!**********************************************************************
!!
!! Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
!! Copyright 2012 Sandia Corporation
!!
!! Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
!! the U.S. Government retains certain rights in this software.
!!
!! Redistribution and use in source and binary forms, with or without
!! modification, are permitted provided that the following conditions are
!! met:
!!
!! 1. Redistributions of source code must retain the above copyright
!! notice, this list of conditions and the following disclaimer.
!!
!! 2. Redistributions in binary form must reproduce the above copyright
!! notice, this list of conditions and the following disclaimer in the
!! documentation and/or other materials provided with the distribution.
!!
!! 3. Neither the name of the Corporation nor the names of the
!! contributors may be used to endorse or promote products derived from
!! this software without specific prior written permission.
!!
!! THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
!! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
!! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
!! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
!! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
!! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
!! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
!! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
!! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
!! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
!! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!!
!! Questions? Contact Karen Devine kddevin@sandia.gov
!! Erik Boman egboman@sandia.gov
!!
!!!!**********************************************************************
!!
!! @HEADER
!!
!--------------------------------------------------------------------
! File dr_const.h translated to Fortran by William F. Mitchell
!
! Revision History:
!
! 1 September 1999: Translated to Fortran
!--------------------------------------------------------------------
module dr_const
use zoltan
use zoltan_user_data
implicit none
private
public :: DRIVER_NAME, VER_STR, PROB_INFO, MESH_INFO, Mesh, ELEM_INFO, &
FILENAME_MAX, MAX_PARAMETER_LEN, Parameter_Pair
public :: Test_Multi_Callbacks
public :: Test_Graph_Callbacks
public :: Test_Hypergraph_Callbacks
public :: Test_Local_Partitions
public :: Test_Drops
public :: Test_Gen_Files
public :: Driver_Action
!****************************************************************************
! * Definitions for the Zoltan library driver program.
! ****************************************************************************
character(len=7), parameter :: DRIVER_NAME = "zfdrive"
character(len=3), parameter :: VER_STR = "1.0"
! A global variable indicating whether list-based (multi) query functions
! should be registered. Default is 0.
integer(Zoltan_INT) :: Test_Multi_Callbacks = 0
integer(Zoltan_INT) :: Test_Graph_Callbacks = 1
integer(Zoltan_INT) :: Test_Hypergraph_Callbacks = 0
integer(Zoltan_INT) :: Test_Local_Partitions = 0
integer(Zoltan_INT) :: Test_Drops = 0
integer(Zoltan_INT) :: Test_Gen_Files = 0
integer(Zoltan_INT) :: Driver_Action = 1
! If it doesn't get defined in stdio.h then use this as a default
integer(Zoltan_INT), parameter :: FILENAME_MAX = 1024
integer(Zoltan_INT), parameter :: MAX_NP_ELEM = 27 ! max nodes per element
integer(Zoltan_INT), parameter :: MAX_DIM = 3 ! max number of dimensions
integer(Zoltan_INT), parameter :: MAX_PARAMETER_LEN = 128 ! chars in parameter
integer(Zoltan_INT), parameter :: MAX_EB_NAME_LEN = 32 ! chars for element block
!
! * Structure used to describe an element. Each processor will
! * allocate an array of these structures.
! Moved here from dr_consts.f90 so that User_Data can use it
!
type ELEM_INFO
integer(Zoltan_INT) :: border ! set to 1 if this element is a border element
integer(Zoltan_INT) :: globalID ! Global ID of this element; local ID is the
! position in the array of elements
integer(Zoltan_INT) :: elem_blk ! elem block number which this element is in
integer(Zoltan_INT) :: my_part ! partition to which this element is assigned
integer(Zoltan_INT) :: perm_value ! permutation value
integer(Zoltan_INT) :: invperm_value ! inverse permutation value
real(Zoltan_FLOAT) :: cpu_wgt ! computational weight associated with elem
real(Zoltan_FLOAT) :: mem_wgt ! the memory weight associated with the elem
real(Zoltan_FLOAT), pointer :: coord(:,:) ! array for the coordinates of the
! element. For Nemesis meshes, nodal
! coordinates are stored; for Chaco
! graphs with geometry, one set of
! coords is stored.
integer(Zoltan_INT), pointer :: connect(:) ! list of nodes that make up this
! element, the node numbers in this
! list are global and not local
integer(Zoltan_INT), pointer :: adj(:) ! list of adjacent elements .
! For Nemesis input, the list is ordered by
! side number, to encode side-number info needed to
! rebuild communication maps. Value -1 represents
! sides with no neighboring element (e.g., along mesh
! boundaries). Chaco doesn't have "sides," so the
! ordering is irrelevent for Chaco input.
integer(Zoltan_INT), pointer :: adj_proc(:) ! list of processors for adjacent
! elements
real(Zoltan_FLOAT), pointer :: edge_wgt(:) ! edge weights for adj elements
integer(Zoltan_INT) :: nadj ! number of entries in adj
integer(Zoltan_INT) :: adj_len ! allocated length of adj/adj_proc/edge_wgt
! arrays
end type
!
! * structure for general mesh information
!
! Structure used to store information about the mesh
type MESH_INFO
integer(Zoltan_INT) :: num_nodes ! number of nodes on this processor
integer(Zoltan_INT) :: num_elems ! number of elements on this processor
integer(Zoltan_INT) :: num_dims ! number of dimensions for the mesh
integer(Zoltan_INT) :: num_el_blks ! number of element blocks in the mesh
integer(Zoltan_INT) :: num_node_sets ! number of node sets in the mesh
integer(Zoltan_INT) :: num_side_sets ! number of side sets in the mesh
character(len=MAX_EB_NAME_LEN), pointer :: eb_names(:) ! element block element
! names
integer(Zoltan_INT), pointer :: eb_ids(:) ! element block ids
integer(Zoltan_INT), pointer :: eb_cnts(:) ! number of elements in each elem
! block
integer(Zoltan_INT), pointer :: eb_nnodes(:) ! number of nodes per elt in each
! element block
! for Nemesis meshes, this value
! depends on element type;
! for Chaco graphs, only one "node"
! per element.
integer(Zoltan_INT), pointer :: eb_nattrs(:) ! number of attributes per elt in
! each element block
integer(Zoltan_INT) :: elem_array_len ! length that the ELEM_INFO array is
! allocated for. Need to know this when array
! is not completely filled during migration
integer(Zoltan_INT) :: necmap ! number of elemental communication maps.
integer(Zoltan_INT), pointer :: ecmap_id(:) ! IDs of each elemental
! communication map.
integer(Zoltan_INT), pointer :: ecmap_cnt(:) ! number of elements in each
! elemental communication map.
integer(Zoltan_INT), pointer :: ecmap_elemids(:) ! element ids of elts for
! all elemental communication
! maps. (local numbering)
integer(Zoltan_INT), pointer :: ecmap_sideids(:) ! side ids of elts for all
! elemental communication maps.
integer(Zoltan_INT), pointer :: ecmap_neighids(:) ! elt ids of neighboring
! elements for all elemental
! communication maps.
! (global numbering)
type(ELEM_INFO), pointer :: elements(:) ! array of elements in the mesh.
integer(Zoltan_INT) :: nhedges ! # of hyperedges
integer(Zoltan_INT), pointer :: hgid(:) ! gids of hyperedges
integer(Zoltan_INT), pointer :: hindex(:) ! index of hyperedges
integer(Zoltan_INT), pointer :: hvertex(:) ! pins of hyperedges
!integer(Zoltan_INT) :: henumwgts ! #edges with given weights
integer(Zoltan_FLOAT), pointer :: hewgts(:) ! the hyperedge weights
end type
type(MESH_INFO),pointer :: Mesh
! typedef for parameter strings.
! Parameters are specified as pairs
! of strings:
! param_str = value_str
type Parameter_Pair
character(len=MAX_PARAMETER_LEN) :: str(0:1)
end type Parameter_Pair
! Structure for the problem description.
type PROB_INFO
character(len=32) :: method ! this is the method string that will
! be passed unchanged to Zoltan
integer(Zoltan_INT) :: num_params ! number of parameters read.
type(Parameter_Pair), pointer :: params(:) ! parameter array to be passed to
! Zoltan. Parameters are specified
! as pairs of strings:
! param_str = value_str
character(len=FILENAME_MAX) :: ztnPrm_file ! param file to be read
end type
end module dr_const

View File

@ -0,0 +1,577 @@
!!
!! @HEADER
!!
!!!!**********************************************************************
!!
!! Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
!! Copyright 2012 Sandia Corporation
!!
!! Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
!! the U.S. Government retains certain rights in this software.
!!
!! Redistribution and use in source and binary forms, with or without
!! modification, are permitted provided that the following conditions are
!! met:
!!
!! 1. Redistributions of source code must retain the above copyright
!! notice, this list of conditions and the following disclaimer.
!!
!! 2. Redistributions in binary form must reproduce the above copyright
!! notice, this list of conditions and the following disclaimer in the
!! documentation and/or other materials provided with the distribution.
!!
!! 3. Neither the name of the Corporation nor the names of the
!! contributors may be used to endorse or promote products derived from
!! this software without specific prior written permission.
!!
!! THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
!! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
!! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
!! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
!! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
!! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
!! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
!! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
!! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
!! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
!! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!!
!! Questions? Contact Karen Devine kddevin@sandia.gov
!! Erik Boman egboman@sandia.gov
!!
!!!!**********************************************************************
!!
!! @HEADER
!!
module dr_input
use zoltan
use dr_const
use mpi_h
implicit none
private
public :: read_cmd_file, check_inp, brdcst_cmd_info, gen_par_filename, &
PARIO_INFO, NEMESIS_FILE, CHACO_FILE, MM_FILE
!--------------------------------------------------------------------------
! Purpose: Determine file types for command files and read in the parallel
! ExodusII command file.
! Taken from nemesis utilites nem_spread and nem_join.
!--------------------------------------------------------------------------
! Author(s): Matthew M. St.John (9226)
! Translated to Fortran by William F. Mitchell
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! Revision History:
! 14 April 1999: Date of creation.
! 02 September 1999: Fortran translation
!--------------------------------------------------------------------------
integer(Zoltan_INT), parameter :: NEMESIS_FILE = 0, &
CHACO_FILE = 1, &
MM_FILE = 2
integer(Zoltan_INT), parameter :: MAX_INPUT_STR_LN = 4096 ! maximum string length
! for read_string()
! Structure used to store the information necessary for parallel I/O.
type PARIO_INFO
integer(Zoltan_INT) :: init_dist_pins
integer(Zoltan_INT) :: dsk_list_cnt
integer(Zoltan_INT), pointer :: dsk_list(:)
integer(Zoltan_INT) :: rdisk
integer(Zoltan_INT) :: num_dsk_ctrlrs ! The number of disk controllers.
integer(Zoltan_INT) :: pdsk_add_fact ! The offset from zero used by the
! the target machine.
integer(Zoltan_INT) :: zeros
! 1 - if the target machine uses leading zeros when
! designating the disk number (eg - the paragon
! uses /pfs/io_01)
! 0 - if it does not (eg - the tflop uses
! /pfs/tmp_1)
integer(Zoltan_INT) :: file_type ! input file type
! The root location of the parallel disks
character(len=FILENAME_MAX+1) :: pdsk_root
! The subdirectory to write files to
character(len=FILENAME_MAX+1) :: pdsk_subdir
! The base name of the input file.
character(len=FILENAME_MAX+1) :: pexo_fname
end type PARIO_INFO
contains
function lowercase(string)
character(len=*), intent(in) :: string
character(len=len(string)) :: lowercase
! returns the string converted to lower case
integer, parameter :: int_A = iachar("A"), &
int_Z = iachar("Z"), &
a_A_diff = iachar("a") - iachar("A")
integer :: i, int_char
do i=1,len(string)
int_char = iachar(string(i:i))
if (int_char >= int_A .and. int_char <= int_Z) then
lowercase(i:i) = achar(int_char + a_A_diff)
else
lowercase(i:i) = string(i:i)
endif
end do
end function lowercase
!***************************************************************************
!***************************************************************************
logical function read_cmd_file(filename, prob, pio_info)
character(len=*) :: filename
type(PROB_INFO) :: prob
type(PARIO_INFO) :: pio_info
!
! * This function reads the ASCII parallel-exodus command file.
! *
! * Input
! * -----
! * filename - The name of the command file.
! * pio_info - parallel I/O information.
!
! I'm really coping out here. This was written for debugging and initial
! testing of the Fortran interface, and doesn't need the full capability
! of reading the command files. So currently it assumes the command file
! looks like the Chaco test files that existed at the time it was written.
! WFM 9/1/99
! local declarations
integer, parameter :: file_cmd = 11
character(len=MAX_INPUT_STR_LN + 1) :: inp_line, command, temp_string
integer :: iostat
logical :: more_params
!**************************** BEGIN EXECUTION *****************************
! Open the file
open(unit=file_cmd,file=filename,action='read',iostat=iostat)
if (iostat /= 0) then
read_cmd_file = .false.
return
endif
! assume no more than 15 parameters
allocate(prob%params(0:15))
prob%num_params = 1
prob%params(0)%str(0) = "DEBUG_MEMORY"
prob%params(0)%str(1) = "1"
! Begin parsing the input file
do ! while not end of data
read(unit=file_cmd,fmt="(a)",iostat=iostat) inp_line
if (iostat /= 0) exit ! end of data
! skip any line that is a comment
if (inp_line == '') cycle
if (inp_line(1:1) == '#') cycle
! find what is before the equal sign
command = inp_line(1:index(inp_line,"=")-1)
! if there is a tab, take what is before the tab
if (index(command," ") /= 0) then ! "tab"
command = command(1:index(command," ")-1) ! "tab"
endif
! ****** File Name ******
if (lowercase(trim(command)) == "file name") then
! assumes there is one blank between "=" and the file name
pio_info%pexo_fname = trim(inp_line(index(inp_line,"=")+2:))
endif
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! hacks to allow more of input file to be read (KDD, 10/2000) !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if (lowercase(trim(command)) == "decomposition method") then
! assumes there is one blank between "=" and the method
prob%method = trim(inp_line(index(inp_line,"=")+2:))
endif
if (lowercase(trim(command)) == "file type") then
! assumes there is one blank between "=" and the file type
if (lowercase(trim(inp_line(index(inp_line,"=")+2:))) == "chaco") then
pio_info%file_type = CHACO_FILE
else if (lowercase(trim(inp_line(index(inp_line,"=")+2:))) == "matrixmarket") then
pio_info%file_type = MM_FILE
else
print *, "Error: zfdrive can read only Chaco or MatrixMarket format files."
read_cmd_file = .false.
endif
endif
if ((lowercase(trim(command)) == "zoltan parameters").or. &
(lowercase(trim(command)) == "zoltan parameter")) then
! assumes there is one blank between "=" and the parameter name
temp_string = lowercase(trim(inp_line(index(inp_line,"=")+2:)))
! assumes no blanks between second "=" and the parameter name
! skip the input line if there are no parameters specified on it.
if (index(temp_string,"=").gt.0) then
more_params = .true.
do while (more_params)
if (index(temp_string, ",").gt.0) then
more_params = .true.
prob%params(prob%num_params)%str(1) = &
temp_string(index(temp_string,"=")+1:index(temp_string,",")-1)
else
more_params = .false.
prob%params(prob%num_params)%str(1) = &
temp_string(index(temp_string,"=")+1:)
endif
prob%params(prob%num_params)%str(0) = &
temp_string(1:index(temp_string,"=")-1)
prob%num_params = prob%num_params+1
if (more_params) then
temp_string = temp_string(index(temp_string,",")+1:)
do while (temp_string(1:1).eq." ") !skip white space
temp_string = temp_string(2:)
enddo
endif
enddo
endif
endif
if (lowercase(trim(command)) == "test multi callbacks") then
! assumes there is one blank between "=" and the input value
Test_Multi_Callbacks = iachar(trim(inp_line(index(inp_line,"= ")+2:))) - iachar('0')
endif
if (lowercase(trim(command)) == "test graph callbacks") then
Test_Graph_Callbacks = iachar(trim(inp_line(index(inp_line,"= ")+2:))) - iachar('0')
endif
if (lowercase(trim(command)) == "test hypergraph callbacks") then
Test_Hypergraph_Callbacks = iachar(trim(inp_line(index(inp_line,"= ")+2:))) - iachar('0')
endif
if (lowercase(trim(command)) == "test local partitions") then
! assumes there is one blank between "=" and the input value
Test_Local_Partitions = iachar(trim(inp_line(index(inp_line,"=")+2:))) - iachar('0')
endif
if (lowercase(trim(command)) == "test generate files") then
! assumes there is one blank between "=" and the input value
Test_Gen_Files = iachar(trim(inp_line(index(inp_line,"= ")+2:))) - iachar('0')
endif
if (lowercase(trim(command)) == "test drops") then
! assumes there is one blank between "=" and the input value
Test_Drops = iachar(trim(inp_line(index(inp_line,"= ")+2:))) - iachar('0')
endif
if (lowercase(trim(command)) == "zdrive action") then
! assumes there is one blank between "=" and the input value
Driver_Action = iachar(trim(inp_line(index(inp_line,"= ")+2:))) - iachar('0')
endif
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! end of hacks to allow more of input file to be read (KDD, 10/2000) !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Added JDT 3/2007 to save the zoltanparams file name
! Note: we assume a good format here:
! zoltanparams file = thefile.name
if (lowercase(trim(command)) == "zoltanparams file") then
prob%ztnPrm_file = lowercase(trim(inp_line(index(inp_line,"=")+2:)))
endif
!
! The other commands are not processed. In the initial tests they either
! always have the same value (in which case they are set after this loop)
! or they do not appear.
end do ! while not end of data
! Assume parallel disk info is number=0
pio_info%num_dsk_ctrlrs = 0
! Close the command file
close(file_cmd)
read_cmd_file = .true.
end function read_cmd_file
!***************************************************************************
!***************************************************************************
!***************************************************************************
logical function check_inp(prob, pio_info)
type(PROB_INFO) :: prob
type(PARIO_INFO) :: pio_info
!**************************** BEGIN EXECUTION *****************************
! check for the parallel Nemesis file for proc 0
if (len_trim(pio_info%pexo_fname) <= 0) then
print *, "fatal: must specify file base name"
check_inp = .false.
return
endif
! Not supporting NEMESIS
! default file type is nemesis
! if (pio_info->file_type < 0) pio_info->file_type = NEMESIS_FILE;
!
!#ifndef ZOLTAN_NEMESIS
!
! * if compiling without the ZOLTAN_NEMESIS flag (i.e., not linking with
! * Nemesis library), can't use NEMESIS_FILE file type.
!
!
! if (pio_info->file_type == NEMESIS_FILE) {
! Gen_Error(0, "fatal: must link with Nemesis libraries for Nemesis "
! "file types");
! return 0;
! }
!#endif !ZOLTAN_NEMESIS
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! Check the parallel IO specifications
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! check that there is a list of disks, or a number of raids
if ((pio_info%dsk_list_cnt <= 0) .and. (pio_info%num_dsk_ctrlrs < 0)) then
pio_info%num_dsk_ctrlrs = 0 ! default to single directory
endif
! default is not to have preceeding 0's in the disk names
if (pio_info%zeros < 0) pio_info%zeros = 0
! most systems that we deal with start their files systems with 1 not 0
if (pio_info%pdsk_add_fact < 0) pio_info%pdsk_add_fact = 1
!
! * if there are parallel disks, then the root and subdir locations must
! * be specified
!
if (pio_info%num_dsk_ctrlrs > 0 .or. pio_info%dsk_list_cnt > 0) then
if (len_trim(pio_info%pdsk_root) == 0) then
print *, "fatal: must specify parallel disk root name"
check_inp = .false.
return
endif
if (len_trim(pio_info%pdsk_subdir) == 0) then
print *, "fatal: must specify parallel disk subdirectory"
check_inp = .false.
return
endif
else
if (len_trim(pio_info%pdsk_root) == 0) then
pio_info%pdsk_root = "." ! default is execution directory
endif
endif
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! Check the Zoltan specifications
!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
!
! * Make sure a load-balancing method was provided.
!
if (len_trim(prob%method) == 0) then
print *, "fatal: load balance method must be specified"
check_inp = .false.
return
endif
check_inp = .true.
end function check_inp
!***************************************************************************
!***************************************************************************
!***************************************************************************
subroutine brdcst_cmd_info(Proc, prob, pio_info)
integer(Zoltan_INT) :: Proc
type(PROB_INFO) :: prob
type(PARIO_INFO) :: pio_info
! local declarations
integer(Zoltan_INT) :: ctrl_id
integer(Zoltan_INT) :: size
integer(Zoltan_INT) :: ierr, i
!**************************** BEGIN EXECUTION *****************************
call MPI_Bcast(Test_Multi_Callbacks, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(Test_Local_Partitions, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(Test_Drops, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(Test_Gen_Files, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(Driver_Action, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(pio_info%dsk_list_cnt, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(pio_info%rdisk, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(pio_info%num_dsk_ctrlrs, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(pio_info%pdsk_add_fact, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(pio_info%zeros, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(pio_info%file_type, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(pio_info%pdsk_root, len(pio_info%pdsk_root), MPI_CHARACTER, &
0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(pio_info%pdsk_subdir, len(pio_info%pdsk_root), MPI_CHARACTER, &
0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(pio_info%pexo_fname, len(pio_info%pdsk_root), MPI_CHARACTER, &
0, MPI_COMM_WORLD, ierr)
if(pio_info%dsk_list_cnt > 0) then
if(Proc /= 0) then
allocate(pio_info%dsk_list(0:pio_info%dsk_list_cnt-1))
endif
call MPI_Bcast(pio_info%dsk_list, pio_info%dsk_list_cnt, MPI_INTEGER, &
0, MPI_COMM_WORLD, ierr)
endif
! broadcast the param file name
call MPI_Bcast(prob%ztnPrm_file, len(prob%ztnPrm_file), MPI_CHARACTER, &
0, MPI_COMM_WORLD, ierr)
! and broadcast the problem specifications
call MPI_Bcast(prob%method, len(prob%method), MPI_CHARACTER, 0,MPI_COMM_WORLD,ierr)
call MPI_Bcast(prob%num_params, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
if (prob%num_params > 0) then
size = len(prob%params(0)%str(0))
if (Proc /= 0) then
allocate(prob%params(0:prob%num_params-1))
endif
do i=0,prob%num_params-1
call MPI_Bcast(prob%params(i)%str(0), size, MPI_CHARACTER, 0, &
MPI_COMM_WORLD, ierr)
call MPI_Bcast(prob%params(i)%str(1), size, MPI_CHARACTER, 0, &
MPI_COMM_WORLD, ierr)
end do
endif
! now calculate where the file for this processor is
if(pio_info%dsk_list_cnt <= 0) then
if (pio_info%num_dsk_ctrlrs > 0) then
ctrl_id = mod(Proc,pio_info%num_dsk_ctrlrs)
pio_info%rdisk = ctrl_id + pio_info%pdsk_add_fact
endif
else
ctrl_id = mod(Proc,pio_info%dsk_list_cnt)
pio_info%rdisk = pio_info%dsk_list(ctrl_id)
endif
end subroutine brdcst_cmd_info
!***************************************************************************
!***************************************************************************
!***************************************************************************
subroutine gen_par_filename(scalar_fname, par_fname, pio_info, proc_for, nprocs)
character(len=*) :: scalar_fname, par_fname
type(PARIO_INFO) :: pio_info
integer(Zoltan_INT) :: proc_for, nprocs
!----------------------------------------------------------------------------
! *
! * Author(s): Gary Hennigan (1421)
! Translated to Fortran by William F. Mitchell
! *----------------------------------------------------------------------------
! * Function which generates the name of a parallel file for a
! * particular processor. The function does this by appending
! * "N.p" to the end of the input parameter "scalar_fname", where:
! *
! * N - The number of processors utilized
! * p - The processor ID.
! *
! * In addition, the location of the parallel disk system is prepended
! * to each file name.
! *---------------------------------------------------------------------------
! * Example:
! *
! * scalar_fname = "Parallel-exoII-" (Input)
! * par_fname = "/raid/io_01/tmp/rf_crew/Parallel-exoII-8.0" (Output)
! *
! * where, for this example:
! *
! * N = 8 processors
! * p = 0 particular processor ID
! *---------------------------------------------------------------------------
! * Revision History:
! *
! * 05 November 1993: Date of Creation
! 02 September 1999: Fortran translation
! *---------------------------------------------------------------------------
!
! Local variables
integer(Zoltan_INT) :: iTemp1
integer(Zoltan_INT) :: iMaxDigit, iMyDigit
character(len=FILENAME_MAX) :: cTemp
character(len=6) :: frmat
character(len=32) :: nproc_str, myproc_str
character(len=2) :: rdisk_str
!************************ EXECUTION BEGINS ******************************
!
! * Find out the number of digits needed to specify the processor ID.
! * This allows numbers like 01-99, i.e., prepending zeros to the
! * name to preserve proper alphabetic sorting of the files.
!
iMaxDigit = 0
iTemp1 = nprocs
do while (iTemp1 >= 1)
iTemp1 = iTemp1/10
iMaxDigit = iMaxDigit + 1
end do
iMyDigit = 0
iTemp1 = proc_for
do while (iTemp1 >= 1)
iTemp1 = iTemp1/10
iMyDigit = iMyDigit + 1
end do
! create the character strings containing the numbers
frmat=""
write(frmat,"(a2,i1,a1)") "(I",iMaxDigit,")"
write(nproc_str,frmat) nprocs
frmat=""
write(frmat,"(a2,i1,a1,i1,a1)") "(I",iMaxDigit,".",iMaxDigit,")"
write(myproc_str,frmat) proc_for
! create the filename with the digit suffixes
cTemp = trim(scalar_fname)//"."//trim(nproc_str)//"."//trim(myproc_str)
!
! * Finally, generate the complete file specification for the parallel
! * file used by this processor.
!
if (pio_info%num_dsk_ctrlrs > 0) then
if(pio_info%zeros /= 0) then
write(rdisk_str,"(I2.2)") pio_info%rdisk
else
write(rdisk_str,"(I2)") pio_info%rdisk
rdisk_str = adjustl(rdisk_str)
endif
par_fname = trim(pio_info%pdsk_root)//trim(rdisk_str)//"/"//&
trim(pio_info%pdsk_subdir)//trim(cTemp)
else
par_fname = trim(pio_info%pdsk_root)//"/"//trim(cTemp)
endif
end subroutine gen_par_filename
end module dr_input

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,483 @@
!!
!! @HEADER
!!
!!!!**********************************************************************
!!
!! Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
!! Copyright 2012 Sandia Corporation
!!
!! Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
!! the U.S. Government retains certain rights in this software.
!!
!! Redistribution and use in source and binary forms, with or without
!! modification, are permitted provided that the following conditions are
!! met:
!!
!! 1. Redistributions of source code must retain the above copyright
!! notice, this list of conditions and the following disclaimer.
!!
!! 2. Redistributions in binary form must reproduce the above copyright
!! notice, this list of conditions and the following disclaimer in the
!! documentation and/or other materials provided with the distribution.
!!
!! 3. Neither the name of the Corporation nor the names of the
!! contributors may be used to endorse or promote products derived from
!! this software without specific prior written permission.
!!
!! THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
!! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
!! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
!! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
!! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
!! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
!! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
!! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
!! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
!! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
!! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!!
!! Questions? Contact Karen Devine kddevin@sandia.gov
!! Erik Boman egboman@sandia.gov
!!
!!!!**********************************************************************
!!
!! @HEADER
!!
!--------------------------------------------------------------------------
! Purpose: Driver for dynamic load-balance library, ZOLTAN.
!
!--------------------------------------------------------------------------
! Author(s): Matthew M. St.John (9226)
! Translated to Fortran by William F. Mitchell
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! Revision History:
!
! 30 March 1999: Date of creation
! 1 September 1999: Fortran translation
!--------------------------------------------------------------------------
!**************************************************************************
!**************************************************************************
!**************************************************************************
program fdriver
use zoltan
use mpi_h
use zoltan_user_data
use dr_const
use dr_input
use dr_chaco_io
use dr_loadbal
use dr_mm_io
use dr_sort
implicit none
! Local declarations.
character(len=64) :: cmd_file
real(Zoltan_FLOAT) :: version
integer(Zoltan_INT) :: Proc, Num_Proc
integer(Zoltan_INT) :: error, i
type(PARIO_INFO) :: pio_info
type(PROB_INFO) :: prob
character(len=MPI_MAX_PROCESSOR_NAME) :: procname
integer(Zoltan_INT) :: namelen
integer(Zoltan_INT) :: alloc_stat
! KDDKDD
! character(len=32) :: filename
! character(len=10) :: mystring
! integer :: fp
! KDDKDD
! interface blocks for external procedures
interface
logical function read_mesh(Proc, Num_Proc, prob, pio_info)
use zoltan
use zoltan_user_data
use dr_const
use dr_input
integer(Zoltan_INT) :: Proc, Num_Proc
type(PROB_INFO) :: prob
type(PARIO_INFO) :: pio_info
end function read_mesh
subroutine print_input_info(fp, Num_Proc, prob)
use zoltan
use dr_const
integer(Zoltan_INT) :: fp
integer(Zoltan_INT) :: Num_Proc
type(PROB_INFO) :: prob
end subroutine print_input_info
logical function output_results(cmd_file, Proc, Num_Proc, prob, pio_info, &
elements)
use zoltan
use dr_const
use dr_input
use zoltan_user_data
character(len=*) :: cmd_file
integer(Zoltan_INT) :: Proc, Num_Proc
type(PROB_INFO) :: prob
type(PARIO_INFO) :: pio_info
type(ELEM_INFO), pointer :: elements(:)
end function output_results
end interface
!**************************** BEGIN EXECUTION *****************************
! initialize MPI
call MPI_Init(error)
! get some machine information
call MPI_Comm_rank(MPI_COMM_WORLD, Proc, error)
call MPI_Comm_size(MPI_COMM_WORLD, Num_Proc, error)
call MPI_Get_processor_name(procname, namelen, error)
print *,"Processor ",Proc," of ",Num_Proc," on host ",procname(1:namelen)
! Set the input file
cmd_file = "zdrive.inp"
! initialize Zoltan
error = Zoltan_Initialize(version)
if (error /= ZOLTAN_OK) then
print *, "fatal: Zoltan_Initialize returned error code, ", error
goto 9999
endif
! initialize some variables
allocate(Mesh, stat=alloc_stat)
if (alloc_stat /= 0) then
print *, "fatal: insufficient memory"
goto 9999
endif
nullify(Mesh%eb_names,Mesh%eb_ids,Mesh%eb_cnts,Mesh%eb_nnodes, &
Mesh%eb_nattrs,Mesh%ecmap_id,Mesh%ecmap_cnt,Mesh%ecmap_elemids,&
Mesh%ecmap_sideids,Mesh%ecmap_neighids,Mesh%elements, &
Mesh%hgid,Mesh%hindex,Mesh%hvertex)
Mesh%necmap = 0
Mesh%nhedges = 0
pio_info%init_dist_pins = 1 !INITIAL_LINEAR
pio_info%dsk_list_cnt = -1
pio_info%num_dsk_ctrlrs = -1
pio_info%pdsk_add_fact = -1
pio_info%zeros = -1
pio_info%file_type = -1
pio_info%pdsk_root = ''
pio_info%pdsk_subdir = ''
pio_info%pexo_fname = ''
prob%method = ''
prob%num_params = 0
prob%ztnPrm_file = ''
nullify(prob%params)
! Read in the ascii input file
if(Proc == 0) then
print *
print *
print *,"Reading the command file, ", cmd_file
if(.not. read_cmd_file(cmd_file, prob, pio_info)) then
print *, 'fatal: Could not read in the command file "',cmd_file,'"!'
goto 9999
endif
if (.not. check_inp(prob, pio_info)) then
print *, "fatal: Error in user specified parameters."
goto 9999
endif
call print_input_info(6, Num_Proc, prob)
endif
! broadcast the command info to all of the processor
call brdcst_cmd_info(Proc, prob, pio_info)
!
! * now read in the mesh and element information.
! * This is the only function call to do this. Upon return,
! * the mesh struct and the elements array should be filled.
!
if (.not. read_mesh(Proc, Num_Proc, prob, pio_info)) then
print *, "fatal: Error returned from read_mesh"
goto 9999
endif
! KDDKDD TEMPORARY OUTPUT
! if (Mesh%nhedges > 0) then
! write (mystring, "(i1)" ) Proc
! filename = "helpme."//mystring
! open(unit=fp,file=filename,action="write")
! write(fp,*) "Hyperedges:"
! do i = 0, Mesh%nhedges-1
! write(fp,*) "Edge ", Mesh%hgid(i)
! do j = Mesh%hindex(i), Mesh%hindex(i+1)-1
! write(fp, *) " ", Mesh%hvertex(j)
! enddo
! enddo
! close(unit=fp)
! endif
! KDDKDD END TEMPORARY OUTPUT
!
! * now run zoltan to get a new load balance and perform
! * the migration
!
if (.not. run_zoltan(Proc, prob, pio_info)) then
print *, "fatal: Error returned from run_zoltan"
goto 9999
endif
!
! * output the results
!
if (.not. output_results(cmd_file, Proc, Num_Proc, prob, pio_info, Mesh%elements)) then
print *, "fatal: Error returned from output_results"
goto 9999
endif
9999 continue
if (associated(Mesh%elements)) then
do i = 0, Mesh%elem_array_len-1
call free_element_arrays(Mesh%elements(i))
end do
deallocate(Mesh%elements)
endif
if (associated(Mesh%hgid)) deallocate(Mesh%hgid)
if (associated(Mesh%hindex)) deallocate(Mesh%hindex)
if (associated(Mesh%hvertex)) deallocate(Mesh%hvertex)
if (associated(Mesh)) deallocate(Mesh)
if (associated(prob%params)) deallocate(prob%params)
call Zoltan_Memory_Stats()
call MPI_Finalize(error)
end program fdriver
!***************************************************************************
!***************************************************************************
!***************************************************************************
! This function determines which input file type is being used,
! * and calls the appropriate read function. If a new type of input
! * file is added to the driver, then a section needs to be added for
! * it here.
! *---------------------------------------------------------------------------
logical function read_mesh(Proc, Num_Proc, prob, pio_info)
use zoltan
use zoltan_user_data
use dr_const
use dr_input
use dr_chaco_io
use dr_mm_io
implicit none
integer(Zoltan_INT) :: Proc
integer(Zoltan_INT) :: Num_Proc
type(PROB_INFO) :: prob
type(PARIO_INFO) :: pio_info
! local declarations
!-----------------------------Execution Begins------------------------------
if (pio_info%file_type == CHACO_FILE) then
if (.not. read_chaco_mesh(Proc, Num_Proc, prob, pio_info, Mesh%elements)) then
print *, "fatal: Error returned from read_chaco_mesh"
read_mesh = .false.
return
endif
else if (pio_info%file_type == MM_FILE) then
if (.not. read_mm_file(Proc, Num_Proc, prob, pio_info)) then
print *, "fatal: Error returned from read_mm_file"
read_mesh = .false.
return
endif
! not supporting NEMESIS yet
! else if (pio_info->file_type == NEMESIS_FILE) {
! if (!read_exoII_mesh(Proc, Num_Proc, prob, pio_info, elements)) {
! Gen_Error(0, "fatal: Error returned from read_exoII_mesh\n");
! return 0;
! }
! }
else
print *, "fatal: Input file type not supported."
read_mesh = .false.
return
endif
read_mesh = .true.
return
end function read_mesh
!***************************************************************************
!***************************************************************************
subroutine print_input_info(fp, Num_Proc, prob)
use zoltan
use dr_const
implicit none
integer(Zoltan_INT) :: fp
integer(Zoltan_INT) :: Num_Proc
type(PROB_INFO) :: prob
integer :: i
write(fp,*) "Input values:"
write(fp,*) " ",DRIVER_NAME," version ", VER_STR
write(fp,*) " Total number of Processors = ", Num_Proc
write(fp,*)
write(fp,*)
write(fp,*) " Performing load balance using ", prob%method
write(fp,*) " Parameters:"
do i = 0, prob%num_params-1
write(fp,*) " ",trim(prob%params(i)%str(0))," ",trim(prob%params(i)%str(1))
end do
write(fp,*) "##########################################################"
end subroutine print_input_info
!************************************************************************
logical function output_results(cmd_file, Proc, Num_Proc, prob, pio_info, &
elements)
use zoltan
use dr_const
use dr_input
use zoltan_user_data
use dr_sort
character(len=*) :: cmd_file
integer(Zoltan_INT) :: Proc, Num_Proc
type(PROB_INFO) :: prob
type(PARIO_INFO) :: pio_info
type(ELEM_INFO), pointer :: elements(:)
!
! * For the first swipe at this, don't try to create a new
! * exodus/nemesis file or anything. Just get the global ids,
! * sort them, and print them to a new ascii file.
!
! Local declarations.
character(len=FILENAME_MAX+1) :: par_out_fname, ctemp
integer(Zoltan_INT), allocatable :: global_ids(:), parts(:), index(:)
integer(Zoltan_INT), allocatable :: orders(:), iperms(:)
integer(Zoltan_INT) :: i, j, alloc_stat
integer :: fp=21
interface
subroutine echo_cmd_file(fp, cmd_file)
character(len=*) :: cmd_file
integer :: fp
end subroutine echo_cmd_file
end interface
!**************************** BEGIN EXECUTION *****************************
allocate(global_ids(0:Mesh%num_elems),stat=alloc_stat)
if (alloc_stat /= 0) then
print *, "fatal: insufficient memory"
output_results = .false.
return
endif
allocate(parts(0:Mesh%num_elems),stat=alloc_stat)
if (alloc_stat /= 0) then
print *, "fatal: insufficient memory"
output_results = .false.
return
endif
allocate(index(0:Mesh%num_elems),stat=alloc_stat)
if (alloc_stat /= 0) then
print *, "fatal: insufficient memory"
output_results = .false.
return
endif
allocate(orders(0:Mesh%num_elems),stat=alloc_stat)
if (alloc_stat /= 0) then
print *, "fatal: insufficient memory"
output_results = .false.
return
endif
allocate(iperms(0:Mesh%num_elems),stat=alloc_stat)
if (alloc_stat /= 0) then
print *, "fatal: insufficient memory"
output_results = .false.
return
endif
j = 0
do i = 0, Mesh%elem_array_len-1
if (elements(i)%globalID >= 0) then
global_ids(j) = elements(i)%globalID
parts(j) = elements(i)%my_part
orders(j) = elements(i)%perm_value;
iperms(j) = elements(i)%invperm_value;
index(j) = j
j = j+1
endif
end do
call dr_sort_index(0, Mesh%num_elems-1, global_ids, index)
! generate the parallel filename for this processor
ctemp = pio_info%pexo_fname(1:len_trim(pio_info%pexo_fname))//".out"
call gen_par_filename(ctemp, par_out_fname, pio_info, Proc, Num_Proc)
open(unit=fp,file=par_out_fname,action="write")
if (Proc == 0) then
call echo_cmd_file(fp, cmd_file)
endif
write(fp,*) "Global element ids assigned to processor ", Proc
write(fp,*) "GID Part Perm IPerm"
do i = 0, Mesh%num_elems-1
j = index(i)
write(fp,*) global_ids(j)," ", parts(j), " ", orders(j), " ", iperms(j)
end do
close(fp)
deallocate(global_ids)
deallocate(parts)
deallocate(index)
deallocate(orders)
deallocate(iperms)
output_results = .true.
end function output_results
!************************************************************************
subroutine echo_cmd_file(fp, cmd_file)
character(len=*) :: cmd_file
integer :: fp
integer, parameter :: file_cmd = 11
character(len=4096+1) :: inp_line
! Routine to echo the input file into the output results (so that
! we know what conditions were used to produce a given result).
! Open the file
open(unit=file_cmd,file=cmd_file,action='read',iostat=iostat)
if (iostat /= 0) then
print *, "Error: Could not find command file ", cmd_file
return
endif
do
read(unit=file_cmd,fmt="(a)",iostat=iostat) inp_line
if (iostat /= 0) exit ! end of data
write(fp, *) trim(inp_line)
end do
close(file_cmd)
end subroutine echo_cmd_file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,401 @@
!!
!! @HEADER
!!
!!!!**********************************************************************
!!
!! Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
!! Copyright 2012 Sandia Corporation
!!
!! Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
!! the U.S. Government retains certain rights in this software.
!!
!! Redistribution and use in source and binary forms, with or without
!! modification, are permitted provided that the following conditions are
!! met:
!!
!! 1. Redistributions of source code must retain the above copyright
!! notice, this list of conditions and the following disclaimer.
!!
!! 2. Redistributions in binary form must reproduce the above copyright
!! notice, this list of conditions and the following disclaimer in the
!! documentation and/or other materials provided with the distribution.
!!
!! 3. Neither the name of the Corporation nor the names of the
!! contributors may be used to endorse or promote products derived from
!! this software without specific prior written permission.
!!
!! THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
!! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
!! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
!! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
!! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
!! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
!! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
!! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
!! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
!! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
!! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!!
!! Questions? Contact Karen Devine kddevin@sandia.gov
!! Erik Boman egboman@sandia.gov
!!
!!!!**********************************************************************
!!
!! @HEADER
!!
module dr_mm_io
use zoltan
use zoltan_user_data
use mpi_h
use dr_const
use dr_input
use dr_chaco_io
use dr_sort
implicit none
private
public :: read_mm_file
! Pin distribution is assumed to be linear always.
contains
!**************************************************************************
!**************************************************************************
!**************************************************************************
! Function to read MatrixMarket input; for now, reads only standard
! MatrixMarket, not MatrixMarket+.
logical function read_mm_file(Proc, Num_Proc, prob, pio_info)
integer(Zoltan_INT) :: Proc, Num_Proc
type(PROB_INFO) :: prob
type(PARIO_INFO) :: pio_info
! Local declarations.
character(len=FILENAME_MAX+8) :: mm_fname
character(len=10) :: mm_rep
character(len=7) :: mm_field
character(len=19) :: mm_symm
integer :: i, rest, cnt, sum, n, share, pin, p, itmp, mynext
integer :: prev_edge, pincnt, edgecnt
! Values read from matrix market
integer :: mm_nrow, mm_ncol, mm_nnz, mm_max
integer, pointer :: mm_iidx(:), mm_jidx(:)
integer, pointer :: mm_ival(:)
double precision, pointer :: mm_rval(:)
complex, pointer :: mm_cval(:)
integer(Zoltan_INT) :: fp, iostat, allocstat, ierr
integer :: status(MPI_STATUS_SIZE)
integer(Zoltan_INT), pointer :: vtxdist(:) ! vertex distribution data
integer(Zoltan_INT), pointer :: pindist(:) ! pin distribution data
integer :: sendsize
! Local values
integer(Zoltan_INT) :: npins, nedges, nvtxs
integer(Zoltan_INT), allocatable :: iidx(:) ! pin data
integer(Zoltan_INT), allocatable :: jidx(:) ! pin data
integer(Zoltan_INT), allocatable :: idx(:) ! temp index
integer(Zoltan_INT), allocatable :: tmp(:) ! temp values
integer :: prev_i, prev_j, temp
logical :: sorted
!**************************** BEGIN EXECUTION *****************************
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Set appropriate callbacks for this file type.
Test_Hypergraph_Callbacks = 1
Test_Graph_Callbacks = 0
! Read the MatrixMarket file.
if (Proc == 0) then
! Open and read the MatrixMarket file.
! Use the MatrixMarket reader from NIST.
fp = 12
mm_fname = pio_info%pexo_fname(1:len_trim(pio_info%pexo_fname))//".mtx"
open(unit=fp,file=mm_fname,action='read',iostat=iostat)
if (iostat /= 0) then
print *, "fatal: Could not open MatrixMarket file ", mm_fname
read_mm_file = .false.
return
endif
call mminfo(fp, mm_rep, mm_field, mm_symm, mm_nrow, mm_ncol, mm_nnz)
! read the matrix in on processor 0.
nullify(mm_ival, mm_cval)
!KDD Valgrind reports some errors if mm_ival and mm_cval are not allocated,
!KDD but we don't need them. 32-bit runs fail on the Mac if we don't
!KDD allocate them. The error seems to occur in gfortran as it prepares
!KDD to call mmread. So we'll allocate them and then deallocate them below.
!KDD It may be possible to allocate them smaller if needed, but these sizes
!KDD are OK for our nightly tests.
allocate(mm_ival(0:mm_nnz-1), stat=allocstat) !KDD
allocate(mm_cval(0:mm_nnz-1), stat=allocstat) !KDD
allocate(mm_iidx(0:mm_nnz-1), stat=allocstat)
allocate(mm_jidx(0:mm_nnz-1), stat=allocstat)
allocate(mm_rval(0:mm_nnz-1), stat=allocstat)
allocate(idx(0:mm_nnz-1), stat=allocstat)
allocate(tmp(0:mm_nnz-1), stat=allocstat)
if (allocstat /= 0) then
print *, "fatal: insufficient memory"
read_mm_file = .false.
return
endif
mm_max = mm_nnz
call mmread(fp, mm_rep, mm_field, mm_symm, mm_nrow, mm_ncol, mm_nnz, &
mm_max, mm_iidx, mm_jidx, mm_ival, mm_rval, mm_cval)
if (associated(mm_ival)) deallocate(mm_ival) !KDD
if (associated(mm_cval)) deallocate(mm_cval) !KDD
! Don't need the numerical values.
if (associated(mm_rval)) deallocate(mm_rval)
! Check if pins are sorted by (i,j) values, with row (i) the major index.
! We could alternatively skip this test and always sort.
sorted = .true.
prev_i = 0
prev_j = 0
do i = 0, mm_nnz-1
if ((mm_iidx(i) < prev_i) .or. ((mm_iidx(i) == prev_i) .and. &
mm_jidx(i) < prev_j)) then
sorted = .false.
exit
endif
prev_i = mm_iidx(i)
prev_j = mm_jidx(i)
enddo
! If not sorted by (i,j), then sort and permute arrays.
if (.not. sorted) then
do i = 0, mm_nnz-1
idx(i) = i
! EBEB For large matrices, the formula below may cause overflow!
tmp(i) = mm_ncol*mm_iidx(i)+mm_jidx(i) ! Row major, column minor
enddo
!print *, 'Before sort (i):', mm_iidx(0), mm_iidx(1), mm_iidx(2)
!print *, 'Before sort (j):', mm_jidx(0), mm_jidx(1), mm_jidx(2)
call dr_sort_index(0, mm_nnz-1, tmp, idx) ! TEST
! Permute mm_iidx and mm_jidx
do i = 0, mm_nnz-1
tmp(i) = mm_iidx(idx(i))
enddo
do i = 0, mm_nnz-1
mm_iidx(i) = tmp(i)
enddo
do i = 0, mm_nnz-1
tmp(i) = mm_jidx(idx(i))
enddo
do i = 0, mm_nnz-1
mm_jidx(i) = tmp(i)
enddo
!print *, 'After sort (i):', mm_iidx(0), mm_iidx(1), mm_iidx(2)
!print *, 'After sort (j):', mm_jidx(0), mm_jidx(1), mm_jidx(2)
endif
do i = 0, mm_nnz-1 ! Decrement edge IDs to match C version
mm_iidx(i) = mm_iidx(i) - 1
enddo
deallocate(idx)
deallocate(tmp)
endif ! Proc == 0
! BCast pertinent info to all procs.
call MPI_Bcast(mm_ncol, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(mm_nrow, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_Bcast(mm_nnz, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Assume linear distribution of vertices.
! Calculate uniform vertex distribution.
if (.not. associated(vtxdist)) then
allocate(vtxdist(0:Num_Proc), stat=allocstat)
if (allocstat /= 0) then
print *, "fatal: insufficient memory"
read_mm_file = .false.
return
endif
endif
vtxdist(0) = 0
rest = mm_ncol
do i=0, Num_Proc-1
n = rest/(Num_Proc-i)
vtxdist(i+1) = vtxdist(i) + n
rest = rest - n
end do
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Create elements associated with owned vertices.
! Initialize Mesh structure for MM mesh.
nvtxs = vtxdist(Proc+1) - vtxdist(Proc)
Mesh%num_elems = nvtxs
Mesh%elem_array_len = Mesh%num_elems + 5
Mesh%num_dims = 0
Mesh%num_el_blks = 1
allocate(Mesh%eb_ids(0:Mesh%num_el_blks-1), &
Mesh%eb_cnts(0:Mesh%num_el_blks-1), &
Mesh%eb_nnodes(0:Mesh%num_el_blks-1), &
Mesh%eb_nattrs(0:Mesh%num_el_blks-1), stat=allocstat)
if (allocstat /= 0) then
print *, "fatal: insufficient memory"
read_mm_file = .false.
return
endif
allocate(Mesh%eb_names(0:Mesh%num_el_blks-1),stat=allocstat)
if (allocstat /= 0) then
print *, "fatal: insufficient memory"
read_mm_file = .false.
return
endif
Mesh%eb_ids(0) = 1
Mesh%eb_cnts(0) = nvtxs
! Assume no coordinates for MatrixMarket vertices.
Mesh%eb_nnodes(0) = 0
Mesh%eb_nattrs(0) = 0
Mesh%eb_names(0) = "mm"
! allocate the element structure array.
allocate(Mesh%elements(0:Mesh%elem_array_len-1), stat=allocstat)
if (allocstat /= 0) then
print *, "fatal: insufficient memory"
read_mm_file = .false.
return
endif
! intialize all of the element structs as unused by
! setting the globalID to -1
do i = 0, Mesh%elem_array_len-1
call initialize_element(Mesh%elements(i))
end do
do i = 0,nvtxs-1
Mesh%elements(i)%globalID = 1 + vtxdist(Proc) + i
Mesh%elements(i)%elem_blk = 0
Mesh%elements(i)%my_part = Proc
Mesh%elements(i)%perm_value = -1
Mesh%elements(i)%invperm_value = -1
Mesh%elements(i)%cpu_wgt = 1
Mesh%elements(i)%mem_wgt = 1
enddo
if (associated(vtxdist)) deallocate(vtxdist)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Calculate edge and pin distribution
! Send pins for those edges to owning processor
allocate(pindist(0:Num_Proc))
! ONLY INITIAL_LINEAR edge distribution is supported.
if (Proc == 0) then
! Assuming pins are sorted by edge number.
do i = 0, Num_Proc
pindist(i) = 0
enddo
do i = 0, mm_nnz-1
! Compute the processor to which the edge goes.
p = int(float(mm_iidx(i) * Num_Proc) / float(mm_nrow));
pindist(p) = pindist(p)+1
enddo
! Compute prefix sum.
sum = 0
do i = 0, Num_Proc-1
itmp = pindist(i)
pindist(i) = sum
sum = sum + itmp
enddo
pindist(Num_Proc) = sum
endif
! Allocate arrays to receive pins.
call MPI_Bcast(pindist, Num_Proc+1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr);
npins = pindist(Proc+1) - pindist(Proc)
allocate(iidx(0:npins-1),stat=allocstat)
allocate(jidx(0:npins-1),stat=allocstat)
if (Proc == 0) then
! Fill communication buffer with pins to be sent.
! Assume INITIAL_LINEAR edge distribution.
do i = 1, Num_Proc-1
sendsize = pindist(i+1)-pindist(i)
call MPI_Send(mm_iidx(pindist(i)), sendsize, MPI_INTEGER, &
i, 1, MPI_COMM_WORLD, ierr)
call MPI_Send(mm_jidx(pindist(i)), sendsize, MPI_INTEGER, &
i, 2, MPI_COMM_WORLD, ierr)
enddo
! Copy Proc zero's pins.
do i = 0, pindist(1)-1
iidx(i) = mm_iidx(i)
jidx(i) = mm_jidx(i)
enddo
else
call MPI_Recv(iidx, npins, MPI_INTEGER, 0, 1, MPI_COMM_WORLD, &
status, ierr)
call MPI_Recv(jidx, npins, MPI_INTEGER, 0, 2, MPI_COMM_WORLD, &
status, ierr)
endif
if (associated(pindist)) deallocate(pindist)
if (Proc == 0) then
if (associated(mm_iidx)) deallocate(mm_iidx)
if (associated(mm_jidx)) deallocate(mm_jidx)
endif
! KDDKDD We assume the MatrixMarket file is sorted by row numbers.
! KDDKDD This sort was done on a single processor.
! Count number of unique edge IDs on this processor.
prev_edge = -1
nedges = 0
do i = 0, npins-1
if (iidx(i) .ne. prev_edge) nedges = nedges + 1
if (iidx(i) < prev_edge) then
! KDDKDD see note above.
print *, "Error in MatrixMarket file. Entries are not sorted by I index."
read_mm_file = .false.
return
endif
prev_edge = iidx(i)
enddo
Mesh%nhedges = nedges
! Allocate the index and pin arrays.
allocate(Mesh%hgid(0:nedges-1),Mesh%hindex(0:nedges), &
Mesh%hvertex(0:npins-1),stat=allocstat)
! Fill the index and pin arrays.
pincnt = 0
edgecnt = 0
prev_edge = -1
do i = 0, npins-1
if (iidx(i) .ne. prev_edge) then
Mesh%hindex(edgecnt) = pincnt
Mesh%hgid(edgecnt) = iidx(i)
edgecnt = edgecnt + 1
prev_edge = iidx(i)
endif
Mesh%hvertex(pincnt) = jidx(i)
pincnt = pincnt + 1
enddo
Mesh%hindex(nedges) = npins
! Almost done.
! if (associated(iidx)) deallocate(iidx)
! if (associated(jidx)) deallocate(jidx)
deallocate(iidx)
deallocate(jidx)
read_mm_file = .true.
end function read_mm_file
end module dr_mm_io

View File

@ -0,0 +1,762 @@
!!
!! @HEADER
!!
!!!!**********************************************************************
!!
!! Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
!! Copyright 2012 Sandia Corporation
!!
!! Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
!! the U.S. Government retains certain rights in this software.
!!
!! Redistribution and use in source and binary forms, with or without
!! modification, are permitted provided that the following conditions are
!! met:
!!
!! 1. Redistributions of source code must retain the above copyright
!! notice, this list of conditions and the following disclaimer.
!!
!! 2. Redistributions in binary form must reproduce the above copyright
!! notice, this list of conditions and the following disclaimer in the
!! documentation and/or other materials provided with the distribution.
!!
!! 3. Neither the name of the Corporation nor the names of the
!! contributors may be used to endorse or promote products derived from
!! this software without specific prior written permission.
!!
!! THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
!! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
!! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
!! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
!! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
!! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
!! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
!! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
!! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
!! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
!! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!!
!! Questions? Contact Karen Devine kddevin@sandia.gov
!! Erik Boman egboman@sandia.gov
!!
!!!!**********************************************************************
!!
!! @HEADER
!!
! ***************************************************************************
!
! Code imported to Zoltan zdrive from
!
! zoltanParams_read_file.c
!
! Read Zoltan parameters from a file, call Zoltan to set the parameters
!
! zoltanParams library
!
! Jim Teresco
!
! Department of Computer Science
! Williams College
!
! and
!
! Computer Science Research Institute
! Sandia National Laboratories
!
!
! Translated to Fortran by Bill Mitchell, NIST, March 2007
module dr_param_file
!#include <stdio.h>
!#include <mpi.h>
!#include <stdlib.h>
!#include "zoltan.h"
use zoltan
use mpi_h
implicit none
private
! Are other routines public? If so, add them separated by commas. Use
! an amperstand at the end of the line to continue on another line.
public ztnPrm_read_file
! standard error and standard out are not standardized in Fortran 90, but most
! compilers use units 0 (most) and 6 (universal). Change here if necessary.
integer, parameter :: stderr = 0, stdout = 6
!#define DEBUG 1
logical, parameter :: DEBUG = .false.
!struct zoltanParams_list_entry {
! char *param;
! char *value;
! struct zoltanParams_list_entry *next;
!};
! unknown length character strings are tricky in Fortran, just pick a
! length that is hopefully big enough. Change it here if necessary.
integer, parameter :: MAX_CHAR_LEN = 128
type ztnPrm_list_entry
character(len=MAX_CHAR_LEN) :: param
character(len=MAX_CHAR_LEN) :: value
type (ztnPrm_list_entry), pointer :: next
end type ztnPrm_list_entry
!struct zoltanParams_hier_struct {
! int partition;
! struct zoltanParams_list_entry *first;
!};
type ztnPrm_hier_struct
integer :: partition
type (ztnPrm_list_entry), pointer :: first
end type ztnPrm_hier_struct
!static struct zoltanParams_hier_struct **zph = NULL;
!static int num_levels = 0;
!static MPI_Comm comm;
! I think the use of **zph is as an allocatable array
type(ztnPrm_hier_struct), save, allocatable :: zph(:)
integer :: num_levels = 0
integer :: comm
contains
!static void check_level(int level) {
!
! if (!zph) {
! fprintf(stderr,"check_level: must set number of levels first\n");
! return;
! }
!
! if (level >= num_levels) {
! fprintf(stderr,"check_level: invalid level\n");
! }
!}
subroutine check_level(level)
integer :: level
if (.not. allocated(zph)) then
write(stderr,*) "check_level: must set number of levels first"
return
endif
if (level >= num_levels) then
write(stderr,*) "check_level: invalid level"
endif
end subroutine check_level
!void zoltanParams_hier_free() {
! int i;
!
! if (!zph) {
! fprintf(stderr, "zoltanParams_hier_free warning: not allocated\n");
! return;
! }
!
! for (i=0; i<num_levels; i++) {
! free(zph[i]);
! }
!
! free(zph);
!}
subroutine ztnPrm_hier_free()
integer :: i
if (.not. allocated(zph)) then
write(stderr,*) "ztnPrm_hier_free warning: not allocated"
return
endif
deallocate(zph)
end subroutine ztnPrm_hier_free
!void zoltanParams_hier_set_num_levels(int levels) {
! int i;
subroutine ztnPrm_hier_set_num_levels(levels)
integer :: levels
integer :: i, astat
!#ifdef DEBUG
! printf("(zoltanParams_hier_set_num_levels) setting to %d\n", levels);
!#endif
if (DEBUG) then
write(stdout,*) "(ztnPrm_hier_set_num_levels) setting to ",levels
endif
! if (zph) {
! fprintf(stderr,"zoltanParams_hier_set_num_levels warning: already initialized, reinitializing\n");
! zoltanParams_hier_free();
! }
if (allocated(zph)) then
write(stderr,*) "ztnPrm_hier_set_num_levels warning: already initialized, reinitializing"
call ztnPrm_hier_free()
endif
! if (levels <= 0) {
! fprintf(stderr, "(zoltanParams_hier_set_num_levels) num levels must be positive\n");
! return;
! }
if (levels <= 0) then
write(stderr,*) "(ztnPrm_hier_set_num_levels) num levels must be positive"
return
endif
! num_levels = levels;
!
! SAFE_MALLOC(zph, struct zoltanParams_hier_struct **,
! sizeof(struct zoltanParams_hier_struct *) * levels);
!
! for (i=0; i<levels; i++) {
! SAFE_MALLOC(zph[i], struct zoltanParams_hier_struct *,
! sizeof (struct zoltanParams_hier_struct));
! zph[i]->partition = 0;
! zph[i]->first = NULL;
! }
num_levels = levels
allocate(zph(0:levels-1),stat=astat)
if (astat /= 0) then
write(stderr,*) "allocation failed in ztnPrm_hier_set_num_level"
stop
endif
do i=0,levels-1
zph(i)%partition = 0
nullify(zph(i)%first)
end do
!}
end subroutine ztnPrm_hier_set_num_levels
!void zoltanParams_hier_set_partition(int level, int partition) {
!
!#ifdef DEBUG
! int mypid;
! MPI_Comm_rank(comm, &mypid);
!
! printf("[%d] will compute partition %d at level %d\n",
! mypid, partition, level);
!#endif
!
! check_level(level);
!
! zph[level]->partition = partition;
!}
subroutine ztnPrm_hier_set_partition(level,partition)
integer :: level, partition
integer :: mypid, ierr
if (DEBUG) then
call MPI_Comm_rank(comm,mypid,ierr)
write(stdout,*) "[",mypid,"] will compute partition ",partition," at level ",level
endif
call check_level(level)
zph(level)%partition = partition
end subroutine ztnPrm_hier_set_partition
!void zoltanParams_hier_set_param(int level, char *param, char *value) {
! struct zoltanParams_list_entry *newparam, *nextparam;
subroutine ztnPrm_hier_set_param(level,param,value)
integer :: level
character(len=*) :: param, value
type(ztnPrm_list_entry), pointer :: newparam, nextparam
integer :: mypid, ierr, astat
!#ifdef DEBUG
! int mypid;
! MPI_Comm_rank(comm, &mypid);
! printf("[%d] will set param <%s> to <%s> at level %d\n",
! mypid, param, value, level);
!#endif
if (DEBUG) then
call MPI_Comm_rank(comm,mypid,ierr)
write(stdout,*) "[",mypid,"] will set param ",trim(param)," to ",trim(value)," at level ",level
endif
! check_level(level);
!
! SAFE_MALLOC(newparam, struct zoltanParams_list_entry *,
! sizeof(struct zoltanParams_list_entry));
call check_level(level)
allocate(newparam,stat=astat)
if (astat /= 0) then
write(stderr,*) "allocation failed in ztnPrm_hier_set_param"
stop
endif
! newparam->param = strdup(param);
! newparam->value = strdup(value);
! newparam->next = NULL;
newparam%param = param
newparam%value = value
nullify(newparam%next)
! if (!zph[level]->first) {
! zph[level]->first = newparam;
! return;
! }
if (.not. associated(zph(level)%first)) then
zph(level)%first => newparam
return
endif
! nextparam = zph[level]->first;
! while (nextparam->next) nextparam=nextparam->next;
! nextparam->next = newparam;
nextparam => zph(level)%first
do while (associated(nextparam%next))
nextparam => nextparam%next
end do
nextparam%next => newparam
!}
end subroutine ztnPrm_hier_set_param
!int zoltanParams_hier_get_num_levels() {
!
! return num_levels;
!}
function ztnPrm_hier_get_num_levels()
integer :: ztnPrm_hier_get_num_levels
ztnPrm_hier_get_num_levels = num_levels
end function ztnPrm_hier_get_num_levels
!int zoltanParams_hier_get_part(int level) {
!
! check_level(level);
!
! return zph[level]->partition;
!}
function ztnPrm_hier_get_part(level)
integer :: level
integer :: ztnPrm_hier_get_part
call check_level(level)
ztnPrm_hier_get_part = zph(level)%partition
end function ztnPrm_hier_get_part
!void zoltanParams_hier_use_params(int level, struct Zoltan_Struct *zz, int *ierr) {
! struct zoltanParams_list_entry *nextparam;
!
! *ierr = ZOLTAN_OK;
! check_level(level);
!
! nextparam = zph[level]->first;
!
! while (nextparam) {
! *ierr = Zoltan_Set_Param(zz, nextparam->param, nextparam->value);
! if (*ierr != ZOLTAN_OK) return;
! nextparam = nextparam->next;
! }
!
!}
subroutine ztnPrm_hier_use_params(level,zz,ierr)
integer :: level
type(Zoltan_Struct), pointer :: zz
integer :: ierr
type(ztnPrm_list_entry), pointer :: nextparam
ierr = ZOLTAN_OK
call check_level(level)
nextparam => zph(level)%first
do while (associated(nextparam))
ierr = Zoltan_Set_Param(zz, nextparam%param, nextparam%value)
if (ierr /= ZOLTAN_OK) return
nextparam => nextparam%next
end do
end subroutine ztnPrm_hier_use_params
!static int get_num_levels(void *data, int *ierr) {
!
! *ierr = ZOLTAN_OK;
! return zoltanParams_hier_get_num_levels();
!}
function get_num_levels(data, ierr)
integer(Zoltan_INT), intent(in) :: data(*)
integer(Zoltan_INT), intent(out) :: ierr
integer(Zoltan_INT) :: get_num_levels
ierr = ZOLTAN_OK
get_num_levels = ztnPrm_hier_get_num_levels()
end function get_num_levels
!static int get_part(void *data, int level, int *ierr) {
!
! *ierr = ZOLTAN_OK;
!
! return ztnPrm_hier_get_part(level);
!}
function get_part(data, level, ierr)
integer(Zoltan_INT), intent(in) :: data(*)
integer(Zoltan_INT), intent(in) :: level
integer(Zoltan_INT), intent(out) :: ierr
integer(Zoltan_INT) :: get_part
ierr = ZOLTAN_OK
get_part = ztnPrm_hier_get_part(level)
end function get_part
!static void get_method(void *data, int level, struct Zoltan_Struct *zz,
! int *ierr) {
!
! zoltanParams_hier_use_params(level, zz, ierr);
!}
subroutine get_method(data,level,azz,ierr)
integer(Zoltan_INT), intent(in) :: data(*)
integer(Zoltan_INT), intent(in) :: level
type(Zoltan_Struct), intent(in), target :: azz
integer(Zoltan_INT), intent(out) :: ierr
type(Zoltan_Struct), pointer :: zz
zz => azz
call ztnPrm_hier_use_params(level, zz, ierr)
end subroutine get_method
!void zoltanParams_set_comm(MPI_Comm thecomm) {
!
! remember the comm passed in
! MPI_Comm_dup(thecomm, &comm);
!}
subroutine ztnPrm_set_comm(thecomm)
integer :: thecomm
integer :: ierr
! remember the comm passed in
call MPI_Comm_dup(thecomm, comm, ierr)
end subroutine ztnPrm_set_comm
!void zoltanParams_hier_setup(struct Zoltan_Struct *zz) {
!
! make sure the hierarchical balancing callbacks are in place
! if (Zoltan_Set_Fn(zz, ZOLTAN_HIER_NUM_LEVELS_FN_TYPE,
! (void (*)()) get_num_levels, NULL) == ZOLTAN_FATAL) {
! fprintf(stderr,"zoltanParams_hier_setup: set NUM_LEVELS callback failed\n");
! }
!
! if (Zoltan_Set_Fn(zz, ZOLTAN_HIER_PARTITION_FN_TYPE,
! (void (*)()) get_part, NULL) == ZOLTAN_FATAL) {
! fprintf(stderr,"zoltanParams_hier_setup: set PARTITION callback failed\n");
! }
!
! if (Zoltan_Set_Fn(zz, ZOLTAN_HIER_METHOD_FN_TYPE,
! (void (*)()) get_method, NULL) == ZOLTAN_FATAL) {
! fprintf(stderr,"zoltanParams_hier_setup: set METHOD callback failed\n");
! }
!}
subroutine ztnPrm_hier_setup(zz)
type(Zoltan_Struct), pointer :: zz
integer(Zoltan_INT) :: dummy(1) = (/0/)
! make sure the hierarchical balancing callbacks are in place
if (Zoltan_Set_Hier_Num_Levels_Fn(zz, get_num_levels, dummy) == &
ZOLTAN_FATAL) then
write(stderr,*) "ztnPrm_hier_setup: set NUM_LEVELS callback failed"
endif
if (Zoltan_Set_Hier_Part_Fn(zz, get_part, dummy) == &
ZOLTAN_FATAL) then
write(stderr,*) "ztnPrm_hier_setup: set PARTITION callback failed"
endif
if (Zoltan_Set_Hier_Method_Fn(zz, get_method, dummy) == &
ZOLTAN_FATAL) then
write(stderr,*) "ztnPrm_hier_setup: set METHOD callback failed"
endif
end subroutine ztnPrm_hier_setup
!
!
! zoltanParams_read_file
!
! Set up the given Zoltan_Struct with parameters as specified
! in the given file.
!
! File format:
!
! Lines of the format:
! ZOLTAN_PARAM PARAM_VALUE
!
! If the parameter is LB_METHOD set to HIER, the next part of the file
! is interpreted as hierarchical balancing parameters:
!
! num_levels
! level 0 partitions for each proc
! level 0 parameters
! end with LEVEL END
! level 1 partitions for each proc
! level 1 parameters
! end with LEVEL END
! ...
!
! End file with EOF
!
!
!void zoltanParams_read_file(struct Zoltan_Struct *lb, char *file,
! MPI_Comm thecomm) {
! FILE *fp;
! char str1[500], str2[500];
! int numlevels, level, partition, proc;
! int ierr;
! int mypid, numprocs;
subroutine ztnPrm_read_file(lb, file, thecomm)
type(Zoltan_Struct), pointer :: lb
character(len=*) :: file
integer :: thecomm
integer :: fp
character(len=500) :: str1, str2
integer :: numlevels, level, proc
integer :: ierr
integer :: mypid, numprocs
logical :: not2
integer, allocatable :: partition(:)
! remember the comm passed in
! MPI_Comm_dup(thecomm, &comm);
!
! MPI_Comm_rank(comm, &mypid);
! MPI_Comm_size(comm, &numprocs);
! remember the comm passed in
call MPI_Comm_dup(thecomm, comm, ierr)
call MPI_Comm_rank(comm, mypid, ierr)
call MPI_Comm_size(comm, numprocs, ierr)
! fp = fopen(file, "r");
! if (!fp) {
! fprintf(stderr,"Cannot open file %s for reading", file);
! return;
! }
! Assume unit 9 is available. If it isn't, an error will be reported and
! you can change it to some other positive integer, not too big.
fp = 9
open(unit=fp,file=trim(file),action="read",iostat=ierr)
if (ierr /= 0) then
write(stderr,*) "cannot open file ",trim(file)," for reading"
return
endif
!#ifdef DEBUG
! if (mypid == 0) {
! printf("Reading Zoltan parameters from file %s\n", file);
! }
!#endif
if (DEBUG) then
if (mypid == 0) then
write(stdout,*) "Reading Zoltan parameters from file ",trim(file)
endif
endif
! while (fscanf(fp, "%s %s\n", str1, str2) == 2) {
do
call myread(fp, str1, str2, not2)
if (not2) exit
! ierr = Zoltan_Set_Param(lb, str1, str2);
! if (ierr != ZOLTAN_OK) {
! fprintf(stderr,"Zoltan_Set_Param failed to set param <%s> to <%s>",str1,str2);
! }
!#ifdef DEBUG
! else {
! if (mypid == 0) {
! printf("Set Zoltan parameter <%s> to <%s>\n", str1, str2);
! }
! }
!#endif
! get rid of the leading space left on str2
str2 = adjustl(str2)
ierr = Zoltan_Set_Param(lb, trim(str1), trim(str2))
if (ierr /= ZOLTAN_OK) then
write(stderr,*) "Zoltan_Set_Param failed to set param ",trim(str1)," to ",trim(str2)
endif
if (DEBUG) then
if (ierr == ZOLTAN_OK) then
if (mypid == 0) then
write(stdout,*) "Set Zoltan parameter ",trim(str1)," to ",trim(str2)
endif
endif
endif
! if (strcmp(str1,"LB_METHOD") == 0 && strcmp(str2,"HIER") == 0) {
if (trim(str1) == "LB_METHOD" .and. trim(str2) == "HIER") then
! zoltanParams_hier_setup(lb);
call ztnPrm_hier_setup(lb)
! the rest of the file contains hierarchical balancing parameters
! fscanf(fp, "%d", &numlevels);
! the rest of the file contains hierarchical balancing parameters
! The line containing numlevels is already in str1 (NO - it's next in the file)
read(fp,*) numlevels
!#ifdef DEBUG
! printf("[%d] read in numlevels=%d\n", mypid, numlevels);
!#endif
if (DEBUG) then
write(stdout,*) "[",mypid,"] read in numlevels=",numlevels
endif
! zoltanParams_hier_set_num_levels(numlevels);
call ztnPrm_hier_set_num_levels(numlevels)
! for (level=0; level<numlevels; level++) {
! first, a list of partitions for each proc should be in the file
! for (proc=0; proc<numprocs; proc++) {
! fscanf(fp, "%d", &partition);
! if (proc == mypid) zoltanParams_hier_set_partition(level, partition);
! }
allocate(partition(0:numprocs-1))
! probably should check that allocate succeeded
do level=0,numlevels-1
read(fp,*) partition ! assumes the line has exactly numprocs numbers
call ztnPrm_hier_set_partition(level,partition(mypid))
! then parameters until we get LEVEL END
! while ((fscanf(fp, "%s %s\n", str1, str2) == 2) &&
! (strcmp(str1, "LEVEL") != 0) &&
! (strcmp(str2, "END") != 0)) {
!
! zoltanParams_hier_set_param(level, str1, str2);
! }
! }
! then parameters until we get LEVEL END
do
read(fp,*) str1, str2
str2 = adjustl(str2)
if (trim(str1) == "LEVEL" .and. trim(str2) == "END") exit
call ztnPrm_hier_set_param(level, str1, str2)
end do
end do
deallocate(partition)
! }
endif
! }
end do
! fclose(fp);
close(fp)
!}
end subroutine ztnPrm_read_file
! Fortran will generate an error if we try to read 2 strings and there is
! only 1 there. So we have to read the whole line into a string and
! see if there are 1 or 2 strings in there. Then read the individual
! strings and return them with a flag indicating if there are 1 or 2.
subroutine myread(runit,str1,str2,not2)
integer :: runit
character(len=*) :: str1, str2
logical :: not2
integer :: iostat
! assume 1000 is plenty long for an input line.
character(len=1000) :: line
! read the whole input line
read(runit,"(A)",iostat=iostat) line
! end of file?
if (iostat /= 0) then
not2 = .true.
else
! remove leading blanks
line = adjustl(line)
! read the first string
read(line,*) str1
! if the length of the whole line with leading and trailing blanks removed
! is the same as the length of the first string, then there is only 1 string
if (len_trim(line) == len_trim(str1)) then
not2 = .true.
! otherwise, read the second line
else
not2 = .false.
read(line(len_trim(str1)+1:),"(A)") str2
endif
endif
end subroutine myread
end module dr_param_file

View File

@ -0,0 +1,173 @@
!!
!! @HEADER
!!
!!!!**********************************************************************
!!
!! Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
!! Copyright 2012 Sandia Corporation
!!
!! Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
!! the U.S. Government retains certain rights in this software.
!!
!! Redistribution and use in source and binary forms, with or without
!! modification, are permitted provided that the following conditions are
!! met:
!!
!! 1. Redistributions of source code must retain the above copyright
!! notice, this list of conditions and the following disclaimer.
!!
!! 2. Redistributions in binary form must reproduce the above copyright
!! notice, this list of conditions and the following disclaimer in the
!! documentation and/or other materials provided with the distribution.
!!
!! 3. Neither the name of the Corporation nor the names of the
!! contributors may be used to endorse or promote products derived from
!! this software without specific prior written permission.
!!
!! THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
!! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
!! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
!! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
!! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
!! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
!! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
!! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
!! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
!! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
!! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!!
!! Questions? Contact Karen Devine kddevin@sandia.gov
!! Erik Boman egboman@sandia.gov
!!
!!!!**********************************************************************
!!
!! @HEADER
!!
!--------------------------------------------------------------------------
! Purpose: Driver for dynamic load-balance library, ZOLTAN.
!
!--------------------------------------------------------------------------
! Author(s): Matthew M. St.John (9226)
! Translated to Fortran by William F. Mitchell
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! Revision History:
!
! 30 March 1999: Date of creation
! 1 September 1999: Fortran translation
!--------------------------------------------------------------------------
!**************************************************************************
!**************************************************************************
!**************************************************************************
module dr_sort
use zoltan
implicit none
public :: dr_sort_index
public :: dr_sort2_index
contains
subroutine dr_sort_index_sub(sorted, val1, starti, endi, equal, larger)
use zoltan
integer(Zoltan_INT) :: starti, endi, equal, larger
integer(Zoltan_INT) :: sorted(0:)
integer(Zoltan_INT) :: val1(0:)
integer(Zoltan_INT) :: i, key, next, key_next
i = (endi + starti) / 2
key = val1(sorted(i))
equal = starti
larger = starti
do i = starti, endi
next = sorted(i)
key_next = val1(next)
if (key_next < key) then
sorted(i) = sorted(larger)
sorted(larger) = sorted(equal)
larger = larger + 1
sorted(equal) = next
equal = equal + 1
else
if (key_next == key) then
sorted(i) = sorted(larger)
sorted(larger) = next
larger = larger + 1
endif
endif
end do
end subroutine dr_sort_index_sub
recursive subroutine dr_sort_index(starti, endi, ra, indx)
use zoltan
integer(Zoltan_INT) :: starti, endi
integer(Zoltan_INT) :: ra(0:)
integer(Zoltan_INT) :: indx(0:)
integer(Zoltan_INT) :: equal, larger
if (starti < endi) then
call dr_sort_index_sub(indx,ra,starti,endi,equal,larger)
call dr_sort_index(starti, equal-1, ra, indx)
call dr_sort_index(larger, endi, ra, indx)
endif
end subroutine dr_sort_index
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine dr_sort2_index_sub(sorted, val1, val2, starti, endi, equal, larger)
use zoltan
integer(Zoltan_INT) :: starti, endi, equal, larger
integer(Zoltan_INT) :: sorted(0:)
integer(Zoltan_INT) :: val1(0:)
integer(Zoltan_INT) :: val2(0:)
integer(Zoltan_INT) :: i, key1, next, key1_next, key2, key2_next
i = (endi + starti) / 2
key1 = val1(sorted(i))
key2 = val2(sorted(i))
equal = starti
larger = starti
do i = starti, endi
next = sorted(i)
key1_next = val1(next)
key2_next = val2(next)
if ((key1_next < key1) .or. ((key1_next == key1) .and. (key2_next < key2))) then
sorted(i) = sorted(larger)
sorted(larger) = sorted(equal)
larger = larger + 1
sorted(equal) = next
equal = equal + 1
else
if ((key1_next == key1) .and. (key2_next == key2)) then
sorted(i) = sorted(larger)
sorted(larger) = next
larger = larger + 1
endif
endif
end do
end subroutine dr_sort2_index_sub
recursive subroutine dr_sort2_index(starti, endi, val1, val2, indx)
use zoltan
integer(Zoltan_INT) :: starti, endi
integer(Zoltan_INT) :: val1(0:)
integer(Zoltan_INT) :: val2(0:)
integer(Zoltan_INT) :: indx(0:)
integer(Zoltan_INT) :: equal, larger
if (starti < endi) then
call dr_sort2_index_sub(indx,val1,val2,starti,endi,equal,larger)
call dr_sort2_index(starti, equal-1, val1, val2, indx)
call dr_sort2_index(larger, endi, val1, val2, indx)
endif
end subroutine dr_sort2_index
end module dr_sort

153
thirdParty/Zoltan/src/fdriver/makefile vendored Normal file
View File

@ -0,0 +1,153 @@
# @HEADER
#
########################################################################
#
# Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
# Copyright 2012 Sandia Corporation
#
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the Corporation nor the names of the
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Questions? Contact Karen Devine kddevin@sandia.gov
# Erik Boman egboman@sandia.gov
#
########################################################################
#
# @HEADER
ZOD = ../$(ZOLTAN_OBJ_DIR)
ZOM = $(F90_MODULE_PREFIX)$(ZOD)
COMPILE = $(F90) -g
COMPILE_LIB = -lm
# To use purify with zfdrive (yes, it really works!), replace the COMPILE and
# COMPILE_LIB macros with the two macros below and compile on paunchy.
# (FYI: dbx told me which libraries are automatically linked using $(F90);
# these libraries must be explicitly specified when using cc.)
#COMPILE = purify -best-effort -follow-child-processes=yes \
# -cache-dir=/Net/local/proj/zoltan/tmp/purify \
# -chain-length=12 /Net/local/bin/cc
#COMPILE_LIB = -lc -lm -lfui -lfai -lfai2 -lfsumai -lfprodai \
# -lfminlai -lfmaxlai -lfminvai -lfmaxvai \
# -lfsu -lsunmath -lmp -lm
zfdrive: $(ZOD)/fdr_migrate.o \
$(ZOD)/farg.o \
$(ZOD)/mpistring.o \
$(ZOD)/lampmpi.o \
$(ZOD)/fdr_sort.o \
$(ZOD)/fdr_main.o \
$(ZOD)/fdr_loadbal.o \
$(ZOD)/fdr_input.o \
$(ZOD)/fdr_param_file.o \
$(ZOD)/fdr_chaco_io.o \
$(ZOD)/fdr_mm_io.o \
$(ZOD)/fdr_const.o \
$(ZOD)/mmio.o \
$(ZOD)/libzoltan.a
$(COMPILE) $(LDFLAGS) -o zfdrive $(ZOD)/fdr_main.o \
$(ZOD)/fdr_loadbal.o $(ZOD)/fdr_input.o \
$(ZOD)/fdr_sort.o $(ZOD)/fdr_param_file.o \
$(ZOD)/fdr_mm_io.o $(ZOD)/mmio.o \
$(ZOD)/fdr_chaco_io.o $(ZOD)/fdr_const.o \
$(ZOD)/fdr_migrate.o $(ZOD)/farg.o \
$(ZOD)/mpistring.o $(ZOD)/lampmpi.o \
-L$(ZOD) -lzoltan $(LNK_LIBS) $(COMPILE_LIB)
/bin/mv zfdrive $(ZOD)
$(ZOD)/farg.o: $(FARG).f
$(F90) -o $(ZOD)/farg.o -c $(FARG).f
$(ZOD)/fdr_main.o: fdr_main.f90 $(ZOD)/mpi_h.o $(ZOD)/fdr_const.o \
$(ZOD)/fdr_input.o $(ZOD)/fdr_chaco_io.o \
$(ZOD)/fdr_mm_io.o $(ZOD)/mmio.o \
$(ZOD)/fdr_loadbal.o $(ZOD)/fdr_sort.o
$(F90) $(ZOM) -c fdr_main.f90
/bin/mv *.o $(ZOD)
$(ZOD)/fdr_migrate.o: fdr_migrate.f90 $(ZOD)/mpi_h.o $(ZOD)/fdr_const.o \
$(ZOD)/fdr_chaco_io.o \
$(ZOD)/fdr_mm_io.o $(ZOD)/mmio.o
$(F90) $(ZOM) -c fdr_migrate.f90
/bin/mv *.o *.mod $(ZOD)
$(ZOD)/fdr_loadbal.o: fdr_loadbal.f90 $(ZOD)/mpi_h.o $(ZOD)/fdr_const.o \
$(ZOD)/fdr_migrate.o $(ZOD)/fdr_input.o \
$(ZOD)/fdr_param_file.o
$(F90) $(ZOM) -c fdr_loadbal.f90
/bin/mv *.o *.mod $(ZOD)
$(ZOD)/fdr_sort.o: fdr_sort.f90
$(F90) $(ZOM) -c fdr_sort.f90
/bin/mv *.o *.mod $(ZOD)
$(ZOD)/fdr_input.o: fdr_input.f90 $(ZOD)/mpi_h.o $(ZOD)/fdr_const.o
$(F90) $(ZOM) -c fdr_input.f90
/bin/mv *.o *.mod $(ZOD)
$(ZOD)/fdr_param_file.o: fdr_param_file.f90 $(ZOD)/mpi_h.o
$(F90) $(ZOM) -c fdr_param_file.f90
/bin/mv *.o *.mod $(ZOD)
$(ZOD)/fdr_chaco_io.o: fdr_chaco_io.f90 $(ZOD)/mpi_h.o $(ZOD)/fdr_const.o \
$(ZOD)/fdr_input.o
$(F90) $(ZOM) -c fdr_chaco_io.f90
/bin/mv *.o *.mod $(ZOD)
$(ZOD)/fdr_mm_io.o: fdr_mm_io.f90 $(ZOD)/mmio.o $(ZOD)/mpi_h.o $(ZOD)/fdr_const.o $(ZOD)/fdr_sort.o \
$(ZOD)/fdr_input.o
$(F90) $(ZOM) -c fdr_mm_io.f90
/bin/mv *.o *.mod $(ZOD)
$(ZOD)/mmio.o: mmio.f
$(F90) -o $(ZOD)/mmio.o -c mmio.f
$(ZOD)/fdr_const.o: fdr_const.f90
$(F90) $(ZOM) -c fdr_const.f90
/bin/mv *.o *.mod $(ZOD)
$(ZOD)/mpi_h.o: mpi_h.f
$(F90) $(ZOLTAN_INC_PATH) -c mpi_h.f
/bin/mv *.o *.mod $(ZOD)
$(ZOD)/lampmpi.o: lampmpi.f90
$(F90) -c lampmpi.f90
/bin/mv *.o $(ZOD)
$(ZOD)/mpistring.o: mpistring.c
$(CC) -c mpistring.c
/bin/mv *.o $(ZOD)
clean:
@rm -f $(ZOD)/libzoltan.a $(ZOD)/fdr*.o $(ZOD)/farg.o \
$(ZOD)/mpi_h.o $(ZOD)/lampmpi.o $(ZOD)/mpistring.o\
$(ZOD)/*.mod debug V* *.vo *.dbg $(ZOD)/zfdrive
@rm -Rf album

824
thirdParty/Zoltan/src/fdriver/mmio.f vendored Normal file
View File

@ -0,0 +1,824 @@
subroutine mmread(iunit,rep,field,symm,rows,cols,nnz,nnzmax,
* indx,jndx,ival,rval,cval)
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c This routine will read data from a matrix market formatted file.
c The data may be either sparse coordinate format, or dense array format.
c
c The unit iunit must be open, and the file will be rewound on return.
c
c 20-Sept-96 Karin A. Remington, NIST ACMD (karin@cam.nist.gov)
c 18-Oct-96 Change in routine name to match C and Matlab routines.
c 30-Oct-96 Bug fixes in mmio.f:
c -looping for comment lines
c -fixed non-ansi zero stringlength
c -incorrect size calculation for skew-symmetric arrays
c Other changes in mmio.f:
c -added integer value parameter to calling sequences
c -enforced proper count in size info line
c -added routine to count words in string (countwd)
c (Thanks to G.P.Leendetse and H.Oudshoom for their review
c of the initial version and suggested fixes.)
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c Arguments:
c
c name type in/out description
c ---------------------------------------------------------------
c
c iunit integer in Unit identifier for the file
c containing the data to be read.
c Must be open prior to call.
c Will be rewound on return.
c
c rep character*10 out Matrix Market 'representation'
c indicator. On return:
c
c coordinate (for sparse data)
c array (for dense data)
c elemental (to be added)
c
c field character*7 out Matrix Market 'field'. On return:
c
c real
c complex
c integer
c pattern
c
c symm character*19 out Matrix Market 'field'. On return:
c
c symmetric
c hermitian
c skew-symmetric
c general
c
c rows integer out Number of rows in matrix.
c
c cols integer out Number of columns in matrix.
c
c nnz integer out Number of nonzero entries required to
c store matrix.
c
c nnzmax integer in Maximum dimension of data arrays.
c
c indx integer(nnz)out Row indices for coordinate format.
c Undefined for array format.
c
c jndx integer(nnz)out Column indices for coordinate format.
c Undefined for array format.
c
c ival integer(nnz) out Integer data (if applicable, see 'field')
c
c rval double(nnz) out Real data (if applicable, see 'field')
c
c cval complex(nnz)out Complex data (if applicable, see 'field')
c
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c Declarations:
c
integer ival(*)
double precision rval(*)
complex cval(*)
double precision rpart,ipart
integer indx(*)
integer jndx(*)
integer i, rows, cols, nnz, nnzreq, nnzmax, iunit
integer count
character mmhead*15
character mmtype*6
character rep*10
character field*7
character symm*19
character tmp1*1024
character tmp2*2
c
c Read header line and check validity:
c
read (iunit,end=1000,fmt=5) tmp1
5 format(1024A)
call getwd(mmhead,tmp1,1024,1,next,count)
if ( count .eq. 0 ) go to 5000
call getwd(mmtype,tmp1,1024,next,next,count)
if ( count .eq. 0 ) go to 5000
call getwd(rep,tmp1,1024,next,next,count)
if ( count .eq. 0 ) go to 5000
call getwd(field,tmp1,1024,next,next,count)
if ( count .eq. 0 ) go to 5000
call getwd(symm,tmp1,1024,next,next,count)
if ( count .eq. 0 ) go to 5000
if ( mmhead .ne. '%%MatrixMarket' ) go to 5000
c
c Convert type code to lower case for easier comparisons:
c
call lowerc(mmtype,1,6)
if ( mmtype .ne. 'matrix' ) then
print *,'Invalid matrix type: ',mmtype
print *,'This reader only understands type ''matrix''.'
stop
else
call lowerc(rep,1,10)
call lowerc(field,1,7)
call lowerc(symm,1,19)
endif
c
c Test input qualifiers:
c
if (rep .ne. 'coordinate' .and. rep .ne. 'array' )
* go to 6000
if (rep .eq. 'coordinate' .and. field .ne. 'integer' .and.
* field .ne. 'real' .and. field .ne. 'complex' .and.
* field .ne. 'pattern') go to 7000
if (rep .eq. 'array' .and. field .ne. 'integer' .and.
* field .ne. 'real' .and. field .ne. 'complex' ) go to 8000
if (symm .ne. 'general' .and. symm .ne. 'symmetric' .and.
* symm .ne. 'hermitian' .and. symm .ne. 'skew-symmetric')
* go to 9000
c
c Read through comment lines, ignoring content:
c
read (iunit,end=2000,fmt=200) tmp2
200 format(1a)
10 continue
if ( tmp2(1:1) .ne. '%' ) then
go to 20
endif
read (iunit,end=2000,fmt=200) tmp2
go to 10
20 continue
c
c Just read a non-comment.
c Now, back up a line, and read for first int, and back up
c again. This will set pointer to just before apparent size
c info line.
c Before continuing with free form input, count the number of
c words on the size info line to ensure there is the right amount
c of info (2 words for array matrices, 3 for coordinate matrices).
c
backspace (iunit)
read (iunit,end=1000,fmt=5) tmp1
call countwd(tmp1,1024,1,count)
if ( rep .eq. 'array' .and. count .ne. 2 ) go to 3000
if ( rep .eq. 'coordinate' .and. count .ne. 3 ) go to 3500
c
c Correct number of words are present, now back up and read them.
c
backspace (iunit)
c
if ( rep .eq. 'coordinate' ) then
c
c Read matrix in sparse coordinate format
c
read (iunit,fmt=*) rows,cols,nnz
c
c Check to ensure adequate storage is available
c
if ( nnz .gt. nnzmax ) then
print *,'insufficent array lengths for matrix of ',nnz,
* ' nonzeros.'
print *,'resize nnzmax to at least ',nnz,'. (currently ',
* nnzmax,')'
stop
endif
c
c Read data according to data type (real,integer,complex, or pattern)
c
if ( field .eq. 'integer' ) then
do 30 i=1,nnz
read (iunit,fmt=*,end=4000) indx(i),jndx(i),ival(i)
30 continue
elseif ( field .eq. 'real' ) then
do 35 i=1,nnz
read (iunit,fmt=*,end=4000) indx(i),jndx(i),rval(i)
35 continue
elseif ( field .eq. 'complex' ) then
do 40 i=1,nnz
read (iunit,fmt=*,end=4000) indx(i),jndx(i),rpart,ipart
cval(i) = cmplx(rpart,ipart)
40 continue
elseif ( field .eq. 'pattern' ) then
do 50 i=1,nnz
read (iunit,fmt=*,end=4000) indx(i),jndx(i)
50 continue
else
print *,'''',field,''' data type not recognized.'
stop
endif
rewind(iunit)
return
c
elseif ( rep .eq. 'array' ) then
c
c Read matrix in dense column-oriented array format
c
read (iunit,fmt=*) rows,cols
c
c Check to ensure adequate storage is available
c
if ( symm .eq. 'symmetric' .or. symm .eq. 'hermitian' ) then
nnzreq = (rows*cols - rows)/2 + rows
nnz = nnzreq
elseif ( symm .eq. 'skew-symmetric' ) then
nnzreq = (rows*cols - rows)/2
nnz = nnzreq
else
nnzreq = rows*cols
nnz = nnzreq
endif
if ( nnzreq .gt. nnzmax ) then
print *,'insufficent array length for ',rows, ' by ',
* cols,' dense ',symm,' matrix.'
print *,'resize nnzmax to at least ',nnzreq,'. (currently ',
* nnzmax,')'
stop
endif
c
c Read data according to data type (real,integer,complex, or pattern)
c
if ( field .eq. 'integer' ) then
do 60 i=1,nnzreq
read (iunit,fmt=*,end=4000) ival(i)
60 continue
elseif ( field .eq. 'real' ) then
do 65 i=1,nnzreq
read (iunit,fmt=*,end=4000) rval(i)
65 continue
elseif ( field .eq. 'complex' ) then
do 70 i=1,nnzreq
read (iunit,fmt=*,end=4000) rpart,ipart
cval(i) = cmplx(rpart,ipart)
70 continue
else
print *,'''pattern'' data not consistant with type ''array'''
stop
endif
rewind(iunit)
return
else
print *,'''',rep,''' representation not recognized.'
print *, 'Recognized representations:'
print *, ' array'
print *, ' coordinate'
stop
endif
c
c Various error conditions:
c
1000 print *,'Premature end-of-file.'
print *,'No lines found.'
stop
2000 print *,'Premature end-of-file.'
print *,'No data lines found.'
stop
3000 print *,'Size info inconsistant with representation.'
print *,'Array matrices need exactly 2 size descriptors.'
print *, count,' were found.'
stop
3500 print *,'Size info inconsistant with representation.'
print *,'Coordinate matrices need exactly 3 size descriptors.'
print *, count,' were found.'
stop
4000 print *,'Premature end-of-file.'
print *,'Check that the data file contains ',nnz,
* ' lines of i,j,[val] data.'
print *,'(it appears there are only ',i,' such lines.)'
stop
5000 print *,'Invalid matrix header: ',tmp1
print *,'Correct header format:'
print *,'%%MatrixMarket type representation field symmetry'
print *
print *,'Check specification and try again.'
6000 print *,'''',rep,''' representation not recognized.'
print *, 'Recognized representations:'
print *, ' array'
print *, ' coordinate'
stop
7000 print *,'''',field,''' field is not recognized.'
print *, 'Recognized fields:'
print *, ' real'
print *, ' complex'
print *, ' integer'
print *, ' pattern'
stop
8000 print *,'''',field,''' arrays are not recognized.'
print *, 'Recognized fields:'
print *, ' real'
print *, ' complex'
print *, ' integer'
stop
9000 print *,'''',symm,''' symmetry is not recognized.'
print *, 'Recognized symmetries:'
print *, ' general'
print *, ' symmetric'
print *, ' hermitian'
print *, ' skew-symmetric'
stop
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
end
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c End of subroutine mmread
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
subroutine mminfo(iunit,rep,field,symm,rows,cols,nnz)
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c This routine will read header information from a Matrix Market
c formatted file.
c
c The unit iunit must be open, and the file will be rewound on return.
c
c 20-Sept-96 Karin A. Remington, NIST ACMD (karin@cam.nist.gov)
c 18-Oct-96 Change in routine name to match C and Matlab routines.
c 30-Oct-96 Bug fixes in mmio.f:
c -looping for comment lines
c -fixed non-ansi zero stringlength
c -incorrect size calculation for skew-symmetric arrays
c Other changes in mmio.f:
c -added integer value parameter to calling sequences
c -enforced proper count in size info line
c -added routine to count words in string (countwd)
c (Thanks to G.P.Leendetse and H.Oudshoom for their review
c of the initial version and suggested fixes.)
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c Arguments:
c
c name type in/out description
c ---------------------------------------------------------------
c
c iunit integer in Unit identifier for the open file
c containing the data to be read.
c
c rep character*10 out Matrix Market 'representation'
c indicator. On return:
c
c coordinate (for sparse data)
c array (for dense data)
c elemental (to be added)
c
c field character*7 out Matrix Market 'field'. On return:
c
c real
c complex
c integer
c pattern
c
c symm character*19 out Matrix Market 'field'. On return:
c
c symmetric
c hermitian
c skew-symmetric
c general
c
c rows integer out Number of rows in matrix.
c
c cols integer out Number of columns in matrix.
c
c nnz integer out Number of nonzero entries required to store
c the matrix.
c
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c Declarations:
c
integer i, rows, cols, nnz, iunit
integer count
character mmhead*14
character mmtype*6
character rep*10
character field*7
character symm*19
character tmp1*1024
character tmp2*2
c
c Read header line and check validity:
c
read (iunit,end=1000,fmt=5) tmp1
5 format(1024A)
c
c Parse words from header line:
c
call getwd(mmhead,tmp1,1024,1,next,count)
if ( count .eq. 0 ) go to 5000
call getwd(mmtype,tmp1,1024,next,next,count)
if ( count .eq. 0 ) go to 5000
call getwd(rep,tmp1,1024,next,next,count)
if ( count .eq. 0 ) go to 5000
call getwd(field,tmp1,1024,next,next,count)
if ( count .eq. 0 ) go to 5000
call getwd(symm,tmp1,1024,next,next,count)
if ( count .eq. 0 ) go to 5000
if ( mmhead .ne. '%%MatrixMarket' ) go to 5000
c
c Convert type code to upper case for easier comparisons:
c
call lowerc(mmtype,1,6)
if ( mmtype .ne. 'matrix' ) then
print *,'Invalid matrix type: ',mmtype
print *,'This reader only understands type ''matrix''.'
stop
else
call lowerc(rep,1,10)
call lowerc(field,1,7)
call lowerc(symm,1,19)
endif
c
c Test input qualifiers:
c
if (rep .ne. 'coordinate' .and. rep .ne. 'array' )
* go to 6000
if (rep .eq. 'coordinate' .and. field .ne. 'integer' .and.
* field .ne. 'real' .and. field .ne. 'complex' .and.
* field .ne. 'pattern') go to 7000
if (rep .eq. 'array' .and. field .ne. 'integer' .and.
* field .ne. 'real' .and. field .ne. 'complex' ) go to 8000
if (symm .ne. 'general' .and. symm .ne. 'symmetric' .and.
* symm .ne. 'hermitian' .and. symm .ne. 'skew-symmetric')
* go to 9000
c
c Read through comment lines, ignoring content:
c
read (iunit,end=2000,fmt=200) tmp2
200 format(1a)
c KDDKDD Changed max number of comment lines j from 2 to 50, as "do 10" loop
c KDDKDD wasn't working with j=2
j = 50
do 10 i=1,j
if ( tmp2(1:1) .ne. '%' ) then
go to 20
endif
read (iunit,end=2000,fmt=200) tmp2
j = j + 1
10 continue
20 continue
c
c Just read a non-comment.
c Now, back up a line, and read for first int, and back up
c again. This will set pointer to just before apparent size
c info line.
c Before continuing with free form input, count the number of
c words on the size info line to ensure there is the right amount
c of info (2 words for array matrices, 3 for coordinate matrices).
c
backspace (iunit)
read (iunit,end=1000,fmt=5) tmp1
call countwd(tmp1,1024,1,count)
if ( rep .eq. 'array' .and. count .ne. 2 ) go to 3000
if ( rep .eq. 'coordinate' .and. count .ne. 3 ) go to 3500
c
c Correct number of words are present, now back up and read them.
c
backspace (iunit)
c
if ( rep .eq. 'coordinate' ) then
c
c Read matrix in sparse coordinate format
c
read (iunit,fmt=*) rows,cols,nnz
c
c Rewind before returning
c
rewind(iunit)
return
c
elseif ( rep .eq. 'array' ) then
c
c Read matrix in dense column-oriented array format
c
read (iunit,fmt=*) rows,cols
if ( symm .eq. 'symmetric' .or. symm .eq. 'hermitian' ) then
nnz = (rows*cols - rows)/2 + rows
elseif ( symm .eq. 'skew-symmetric' ) then
nnz = (rows*cols - rows)/2
else
nnz = rows*cols
endif
c
c Rewind before returning
c
rewind(iunit)
return
else
print *,'''',rep,''' representation not recognized.'
print *, 'Recognized representations:'
print *, ' array'
print *, ' coordinate'
stop
endif
c
c Various error conditions:
c
1000 print *,'Premature end-of-file.'
print *,'No lines found.'
stop
2000 print *,'Premature end-of-file.'
print *,'No data found.'
stop
3000 print *,'Size info inconsistant with representation.'
print *,'Array matrices need exactly 2 size descriptors.'
print *, count,' were found.'
stop
3500 print *,'Size info inconsistant with representation.'
print *,'Coordinate matrices need exactly 3 size descriptors.'
print *, count,' were found.'
stop
5000 print *,'Invalid matrix header: ',tmp1
print *,'Correct header format:'
print *,'%%MatrixMarket type representation field symmetry'
print *
print *,'Check specification and try again.'
stop
6000 print *,'''',rep,''' representation not recognized.'
print *, 'Recognized representations:'
print *, ' array'
print *, ' coordinate'
stop
7000 print *,'''',field,''' field is not recognized.'
print *, 'Recognized fields:'
print *, ' real'
print *, ' complex'
print *, ' integer'
print *, ' pattern'
stop
8000 print *,'''',field,''' arrays are not recognized.'
print *, 'Recognized fields:'
print *, ' real'
print *, ' complex'
print *, ' integer'
stop
9000 print *,'''',symm,''' symmetry is not recognized.'
print *, 'Recognized symmetries:'
print *, ' general'
print *, ' symmetric'
print *, ' hermitian'
print *, ' skew-symmetric'
stop
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
end
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c End of subroutine mmread
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
subroutine mmwrite(ounit,rep,field,symm,rows,cols,nnz,
* indx,jndx,ival,rval,cval)
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c This routine will write data to a matrix market formatted file.
c The data may be either sparse coordinate format, or dense array format.
c
c The unit ounit must be open.
c
c 20-Sept-96 Karin A. Remington, NIST ACMD (karin@cam.nist.gov)
c 18-Oct-96 Change in routine name to match C and Matlab routines.
c 30-Oct-96 Bug fixes in mmio.f:
c -looping for comment lines
c -fixed non-ansi zero stringlength
c -incorrect size calculation for skew-symmetric arrays
c Other changes in mmio.f:
c -added integer value parameter to calling sequences
c -enforced proper count in size info line
c -added routine to count words in string (countwd)
c (Thanks to G.P.Leendetse and H.Oudshoom for their review
c of the initial version and suggested fixes.)
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c Arguments:
c
c name type in/out description
c ---------------------------------------------------------------
c
c ounit integer in Unit identifier for the file
c to which the data will be written.
c Must be open prior to call.
c
c rep character* in Matrix Market 'representation'
c indicator. Valid inputs:
c
c coordinate (for sparse data)
c array (for dense data)
c *elemental* (to be added)
c
c field character* in Matrix Market 'field'. Valid inputs:
c
c real
c complex
c integer
c pattern (not valid for dense arrays)
c
c symm character* in Matrix Market 'field'. Valid inputs:
c
c symmetric
c hermitian
c skew-symmetric
c general
c
c rows integer in Number of rows in matrix.
c
c cols integer in Number of columns in matrix.
c
c nnz integer in Number of nonzero entries in matrix.
c (rows*cols for array matrices)
c
c indx integer(nnz)in Row indices for coordinate format.
c Undefined for array format.
c
c jndx integer(nnz)in Column indices for coordinate format.
c Undefined for array format.
c
c ival integer(nnz) in Integer data (if applicable, see 'field')
c
c rval double(nnz) in Real data (if applicable, see 'field')
c
c cval complex(nnz)in Complex data (if applicable, see 'field')
c
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
c Declarations:
c
integer ival(*)
double precision rval(*)
complex cval(*)
integer indx(*)
integer jndx(*)
integer i, rows, cols, nnz, nnzreq, ounit
character*(*)rep,field,symm
c
c Test input qualifiers:
c
if (rep .ne. 'coordinate' .and. rep .ne. 'array' )
* go to 1000
if (rep .eq. 'coordinate' .and. field .ne. 'integer' .and.
* field .ne. 'real' .and. field .ne. 'complex' .and.
* field .ne. 'pattern') go to 2000
if (rep .eq. 'array' .and. field .ne. 'integer' .and.
* field .ne. 'real' .and. field .ne. 'complex' ) go to 3000
if (symm .ne. 'general' .and. symm .ne. 'symmetric' .and.
* symm .ne. 'hermitian' .and. symm .ne. 'skew-symmetric')
* go to 4000
c
c Write header line:
c
write(unit=ounit,fmt=5)rep,' ',field,' ',symm
5 format('%%MatrixMarket matrix ',11A,1A,8A,1A,20A)
c
c Write size information:
c
if ( rep .eq. 'coordinate' ) then
nnzreq=nnz
write(unit=ounit,fmt=*) rows,cols,nnz
if ( field .eq. 'integer' ) then
do 10 i=1,nnzreq
write(unit=ounit,fmt=*)indx(i),jndx(i),ival(i)
10 continue
elseif ( field .eq. 'real' ) then
do 20 i=1,nnzreq
write(unit=ounit,fmt=*)indx(i),jndx(i),rval(i)
20 continue
elseif ( field .eq. 'complex' ) then
do 30 i=1,nnzreq
write(unit=ounit,fmt=*)indx(i),jndx(i),
* real(cval(i)),aimag(cval(i))
30 continue
else
c field .eq. 'pattern'
do 40 i=1,nnzreq
write(unit=ounit,fmt=*)indx(i),jndx(i)
40 continue
endif
else
c rep .eq. 'array'
if ( symm .eq. 'general' ) then
nnzreq = rows*cols
elseif ( symm .eq. 'symmetric' .or.
* symm .eq. 'hermitian' ) then
nnzreq = (rows*cols - rows)/2 + rows
else
c symm .eq. 'skew-symmetric'
nnzreq = (rows*cols - rows)/2
endif
write(unit=ounit,fmt=*)rows,cols
if ( field .eq. 'integer' ) then
do 50 i=1,nnzreq
write(unit=ounit,fmt=*)ival(i)
50 continue
elseif ( field .eq. 'real' ) then
do 60 i=1,nnzreq
write(unit=ounit,fmt=*)rval(i)
60 continue
else
c field .eq. 'complex'
do 70 i=1,nnzreq
write(unit=ounit,fmt=*)real(cval(i)),aimag(cval(i))
70 continue
endif
endif
return
c
c Various errors
c
1000 print *,'''',rep,''' representation not recognized.'
print *, 'Recognized representations:'
print *, ' array'
print *, ' coordinate'
stop
2000 print *,'''',field,''' field is not recognized.'
print *, 'Recognized fields:'
print *, ' real'
print *, ' complex'
print *, ' integer'
print *, ' pattern'
stop
3000 print *,'''',field,''' arrays are not recognized.'
print *, 'Recognized fields:'
print *, ' real'
print *, ' complex'
print *, ' integer'
stop
4000 print *,'''',symm,''' symmetry is not recognized.'
print *, 'Recognized symmetries:'
print *, ' general'
print *, ' symmetric'
print *, ' hermitian'
print *, ' skew-symmetric'
stop
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
end
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c End of subroutine mmwrite
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
subroutine lowerc(string,pos,len)
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c Convert uppercase letters to lowercase letters in string with
c starting postion pos and length len.
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
integer pos, len
character*(*) string
character*26 lcase, ucase
save lcase,ucase
data lcase/'abcdefghijklmnopqrstuvwxyz'/
data ucase/'ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
do 10 i=pos,len
k = index(ucase,string(i:i))
if (k.ne.0) string(i:i) = lcase(k:k)
10 continue
return
end
subroutine getwd(word,string,slen,start,next,wlen)
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c Getwd extracts the first word from string starting
c at position start. On return, next is the position
c of the blank which terminates the word in string.
c If the found word is longer than the allocated space
c for the word in the calling program, the word will be
c truncated to fit.
c Count is set to the length of the word found.
c
c 30-Oct-96 Bug fix: fixed non-ansi zero stringlength
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
integer slen, start, next, begin, space, wlen
character*(*) word
character*(*) string
begin = start
do 5 i=start,slen
space = index(string(i:slen),' ')
if ( space .gt. 1) then
next = i+space-1
go to 100
endif
begin=begin+1
5 continue
100 continue
wlen=next-begin
if ( wlen .le. 0 ) then
wlen = 0
word = ' '
return
endif
word=string(begin:begin+wlen)
return
end
subroutine countwd(string,slen,start,count)
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c Countwd counts the number of words in string starting
c at position start. On return, count is the number of words.
c 30-Oct-96 Routine added
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
character*(*) string
integer slen, start, next, wordlength, count
character tmp2*2
count = 0
next = 1
10 call getwd(tmp2,string,1024,next,next,wordlength)
if ( wordlength .gt. 0 ) then
count = count + 1
go to 10
endif
return
end

59
thirdParty/Zoltan/src/fdriver/mpi_h.f vendored Normal file
View File

@ -0,0 +1,59 @@
!!
!! @HEADER
!!
!!!!**********************************************************************
!!
!! Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
!! Copyright 2012 Sandia Corporation
!!
!! Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
!! the U.S. Government retains certain rights in this software.
!!
!! Redistribution and use in source and binary forms, with or without
!! modification, are permitted provided that the following conditions are
!! met:
!!
!! 1. Redistributions of source code must retain the above copyright
!! notice, this list of conditions and the following disclaimer.
!!
!! 2. Redistributions in binary form must reproduce the above copyright
!! notice, this list of conditions and the following disclaimer in the
!! documentation and/or other materials provided with the distribution.
!!
!! 3. Neither the name of the Corporation nor the names of the
!! contributors may be used to endorse or promote products derived from
!! this software without specific prior written permission.
!!
!! THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
!! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
!! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
!! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
!! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
!! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
!! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
!! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
!! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
!! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
!! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!!
!! Questions? Contact Karen Devine kddevin@sandia.gov
!! Erik Boman egboman@sandia.gov
!!
!!!!**********************************************************************
!!
!! @HEADER
!!
!--------------------------------------------------------------------------
! Purpose: Provide the MPI include file as a module.
!--------------------------------------------------------------------------
! Author(s): William F. Mitchell
!--------------------------------------------------------------------------
!--------------------------------------------------------------------------
! Revision History:
! 2 September 1999: Date of creation.
!--------------------------------------------------------------------------
module mpi_h
include "mpif.h"
end module mpi_h

View File

@ -0,0 +1,161 @@
!!
!! @HEADER
!!
!!!!**********************************************************************
!!
!! Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
!! Copyright 2012 Sandia Corporation
!!
!! Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
!! the U.S. Government retains certain rights in this software.
!!
!! Redistribution and use in source and binary forms, with or without
!! modification, are permitted provided that the following conditions are
!! met:
!!
!! 1. Redistributions of source code must retain the above copyright
!! notice, this list of conditions and the following disclaimer.
!!
!! 2. Redistributions in binary form must reproduce the above copyright
!! notice, this list of conditions and the following disclaimer in the
!! documentation and/or other materials provided with the distribution.
!!
!! 3. Neither the name of the Corporation nor the names of the
!! contributors may be used to endorse or promote products derived from
!! this software without specific prior written permission.
!!
!! THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
!! EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
!! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
!! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
!! CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
!! EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
!! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
!! PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
!! LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
!! NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
!! SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
!!
!! Questions? Contact Karen Devine kddevin@sandia.gov
!! Erik Boman egboman@sandia.gov
!!
!!!!**********************************************************************
!!
!! @HEADER
!!
module zoltan_user_data
use zoltan_types
implicit none
! User defined data types for passing data to the query functions. These can
! be used any way you want, but one suggestion is to use them as "wrapper"
! types for your own user defined types, e.g.
! type Zoltan_User_Data_1
! type(your_type), pointer :: ptr
! end type
! Exactly four data types must be defined, but you don't have to use them.
integer(Zoltan_INT), parameter :: MAX_EB_NAME_LEN = 32 ! chars for element block
!
! Structure used to describe an element. Each processor will
! allocate an array of these structures.
! Moved here from dr_consts.f90 so that User_Data can use it
!
type ELEM_INFO
integer(Zoltan_INT) :: border ! set to 1 if this element is a border element
integer(Zoltan_INT) :: globalID ! Global ID of this element; local ID is the
! position in the array of elements
integer(Zoltan_INT) :: elem_blk ! elem block number which this element is in
integer(Zoltan_INT) :: my_part ! partition to which this element is assigned
integer(Zoltan_INT) :: perm_value ! permutation value
integer(Zoltan_INT) :: invperm_value ! inverse permutation value
real(Zoltan_FLOAT) :: cpu_wgt ! computational weight associated with elem
real(Zoltan_FLOAT) :: mem_wgt ! the memory weight associated with the elem
real(Zoltan_FLOAT), pointer :: coord(:,:) ! array for the coordinates of the
! element. For Nemesis meshes, nodal
! coordinates are stored; for Chaco
! graphs with geometry, one set of
! coords is stored.
integer(Zoltan_INT), pointer :: connect(:) ! list of nodes that make up this
! element, the node numbers in this
! list are global and not local
integer(Zoltan_INT), pointer :: adj(:) ! list of adjacent elements .
! For Nemesis input, the list is ordered by
! side number, to encode side-number info needed to
! rebuild communication maps. Value -1 represents
! sides with no neighboring element (e.g., along mesh
! boundaries). Chaco doesn't have "sides," so the
! ordering is irrelevent for Chaco input.
integer(Zoltan_INT), pointer :: adj_proc(:) ! list of processors for adjacent
! elements
real(Zoltan_FLOAT), pointer :: edge_wgt(:) ! edge weights for adjacent elements
integer(Zoltan_INT) :: nadj ! number of entries in adj
integer(Zoltan_INT) :: adj_len ! allocated length of adj/adj_proc/edge_wgt arrays
end type
!
! Structure used to store information about the mesh
type MESH_INFO
integer(Zoltan_INT) :: num_nodes ! number of nodes on this processor
integer(Zoltan_INT) :: num_elems ! number of elements on this processor
integer(Zoltan_INT) :: num_dims ! number of dimensions for the mesh
integer(Zoltan_INT) :: num_el_blks ! number of element blocks in the mesh
integer(Zoltan_INT) :: num_node_sets ! number of node sets in the mesh
integer(Zoltan_INT) :: num_side_sets ! number of side sets in the mesh
character(len=MAX_EB_NAME_LEN), pointer :: eb_names(:) ! element block element
! names
integer(Zoltan_INT), pointer :: eb_ids(:) ! element block ids
integer(Zoltan_INT), pointer :: eb_cnts(:) ! number of elements in each element
! block
integer(Zoltan_INT), pointer :: eb_nnodes(:) ! number of nodes per element in each
! element block
! for Nemesis meshes, this value
! depends on element type;
! for Chaco graphs, only one "node"
! per element.
integer(Zoltan_INT), pointer :: eb_nattrs(:) ! number of attributes per element in
! each element block
integer(Zoltan_INT) :: elem_array_len ! length that the ELEM_INFO array is
! allocated for. Need to know this when array
! is not completely filled during migration
integer(Zoltan_INT) :: necmap ! number of elemental communication maps.
integer(Zoltan_INT), pointer :: ecmap_id(:) ! IDs of each elemental
! communication map.
integer(Zoltan_INT), pointer :: ecmap_cnt(:) ! number of elements in each
! elemental communication map.
integer(Zoltan_INT), pointer :: ecmap_elemids(:) ! element ids of elements for
! all elemental communication
! maps. (local numbering)
integer(Zoltan_INT), pointer :: ecmap_sideids(:) ! side ids of elements for all
! elemental communication maps.
integer(Zoltan_INT), pointer :: ecmap_neighids(:) ! elements ids of neighboring
! elements for all elemental
! communication maps.
! (global numbering)
type(ELEM_INFO), pointer :: elements(:) ! array of elements in the mesh.
integer(Zoltan_INT) :: nhedges ! # of hyperedges
integer(Zoltan_INT), pointer :: hgid(:) ! gids of hyperedges
integer(Zoltan_INT), pointer :: hindex(:) ! index of hyperedges
integer(Zoltan_INT), pointer :: hvertex(:) ! pins of hyperedges
!integer(Zoltan_INT) :: henumwgts ! #edges with given weights
integer(Zoltan_FLOAT), pointer :: hewgts(:) ! the hyperedge weights
end type
type Zoltan_User_Data_1
type(ELEM_INFO), pointer :: ptr(:)
end type Zoltan_User_Data_1
type Zoltan_User_Data_2
type(MESH_INFO), pointer :: ptr
end type Zoltan_User_Data_2
type Zoltan_User_Data_3
integer :: dummy
end type Zoltan_User_Data_3
type Zoltan_User_Data_4
integer :: dummy
end type Zoltan_User_Data_4
end module zoltan_user_data