From: Arnaud Legrand Date: Wed, 18 Feb 2015 09:05:16 +0000 (+0100) Subject: Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot//simgrid/simgrid X-Git-Tag: v3_12~760 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5a97de8c98502af9f74cfceb924fa02e0fd80925?hp=89edccc4eb98274e36279f5940ce8b4a0e887f4b Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot//simgrid/simgrid --- diff --git a/.cproject b/.cproject index f9a184c573..e21cad4b5b 100644 --- a/.cproject +++ b/.cproject @@ -1,42 +1,42 @@ - + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - diff --git a/.gitignore b/.gitignore index 88e47be110..2770b2ca3e 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ *.trace *.class \#* +.attach_pid* ### cmake CTestCustom.cmake @@ -240,6 +241,7 @@ examples/smpi/sendrecv examples/smpi/mc_bugged1 examples/smpi/mc_bugged2 examples/smpi/smpi_traced_simple +examples/smpi/replay_multiple/replay_multiple examples/msg/mc/bugged1_liveness examples/msg/mc/bugged1_stateful examples/msg/mc/bugged2_liveness @@ -252,6 +254,7 @@ examples/smpi/mc/bugged2 src/replay/replay src/testall teshsuite/bug-17132/bug-17132 +teshsuite/java/sleep_host_off/java_sleep_host_off_compiled teshsuite/smpi/isp/umpire/abort teshsuite/smpi/isp/umpire/abort1 teshsuite/smpi/isp/umpire/abort2 @@ -389,7 +392,6 @@ teshsuite/smpi/isp/umpire/remote_group-no-error teshsuite/smpi/isp/umpire/send-recv-ok teshsuite/smpi/isp/umpire/sendrecv-deadlock teshsuite/smpi/isp/umpire/temp.txt -teshsuite/smpi/isp/umpire/tmpzLRJML teshsuite/smpi/isp/umpire/type-commit-twice teshsuite/smpi/isp/umpire/type-no-error teshsuite/smpi/isp/umpire/type-no-error-exhaustive @@ -401,7 +403,6 @@ teshsuite/smpi/isp/umpire/type-no-free3 teshsuite/smpi/isp/umpire/wait-deadlock teshsuite/smpi/isp/umpire/waitall-deadlock teshsuite/smpi/isp/umpire/waitany-deadlock -teshsuite/smpi/bcast/bcast_coll teshsuite/smpi/compute/compute2 teshsuite/smpi/compute/compute3 teshsuite/smpi/pingpong/dsend @@ -580,6 +581,35 @@ teshsuite/smpi/mpich-test/pt2pt/waitall2 teshsuite/smpi/mpich-test/pt2pt/waitall3 teshsuite/smpi/mpich-test/pt2pt/waitall4 teshsuite/smpi/mpich-test/pt2pt/waitany +teshsuite/smpi/mpich3-test/f77/info/infotest2f +teshsuite/smpi/mpich3-test/f77/info/infotestf +teshsuite/smpi/mpich3-test/f90/info/infotest2f90 +teshsuite/smpi/mpich3-test/f90/info/infotestf90 +teshsuite/smpi/bcast/bcast_coll +teshsuite/smpi/mpich3-test/coll/allred +teshsuite/smpi/mpich3-test/datatype/dataalign +teshsuite/smpi/mpich3-test/datatype/sendrecvt2 +teshsuite/smpi/mpich3-test/datatype/sendrecvt4 +teshsuite/smpi/mpich3-test/f77/rma/c2f2cwinf +teshsuite/smpi/mpich3-test/f77/rma/winaccf +teshsuite/smpi/mpich3-test/f77/rma/winfencef +teshsuite/smpi/mpich3-test/f77/rma/wingetf +teshsuite/smpi/mpich3-test/f77/rma/winnamef +teshsuite/smpi/mpich3-test/f77/topo/cartcrf +teshsuite/smpi/mpich3-test/f90/rma/c2f2cwinf90 +teshsuite/smpi/mpich3-test/f90/rma/winaccf90 +teshsuite/smpi/mpich3-test/f90/rma/winfencef90 +teshsuite/smpi/mpich3-test/f90/rma/wingetf90 +teshsuite/smpi/mpich3-test/f90/rma/winnamef90 +teshsuite/smpi/mpich3-test/perf/commcreatep +teshsuite/smpi/mpich3-test/perf/non_zero_root +teshsuite/smpi/mpich3-test/perf/sendrecvl +teshsuite/smpi/mpich3-test/perf/timer +teshsuite/smpi/mpich3-test/perf/transp-datatype +teshsuite/smpi/mpich3-test/perf/twovec +teshsuite/smpi/mpich3-test/pt2pt/issendselfcancel +teshsuite/smpi/mpich3-test/rma/getgroup +teshsuite/smpi/mpich3-test/rma/manyrma3 teshsuite/smpi/mpich3-test/attr/attr2type teshsuite/smpi/mpich3-test/attr/attrend teshsuite/smpi/mpich3-test/attr/attrend2 @@ -832,6 +862,13 @@ teshsuite/smpi/mpich3-test/group/grouptest teshsuite/smpi/mpich3-test/group/grouptest2 teshsuite/smpi/mpich3-test/group/gtranks teshsuite/smpi/mpich3-test/group/gtranksperf +teshsuite/smpi/mpich3-test/info/infodel +teshsuite/smpi/mpich3-test/info/infodup +teshsuite/smpi/mpich3-test/info/infomany +teshsuite/smpi/mpich3-test/info/infomany2 +teshsuite/smpi/mpich3-test/info/infoorder +teshsuite/smpi/mpich3-test/info/infotest +teshsuite/smpi/mpich3-test/info/infovallen teshsuite/smpi/mpich3-test/init/attrself teshsuite/smpi/mpich3-test/init/exitst1 teshsuite/smpi/mpich3-test/init/exitst2 @@ -1008,3 +1045,22 @@ examples/java/reservationSurfPlugin/java_reservation_surf_plugin_compiled examples/java/surfCpuModel/java_surf_cpu_model_compiled examples/java/surfPlugin/java_surf_plugin_compiled /CMakeCache.txt +teshsuite/mc/dwarf/dwarf +teshsuite/mc/dwarf_expression/dwarf-expression +src/bindings/java/org/simgrid/surf/surfJAVA_wrap.cxx +src/bindings/java/org/simgrid/surf/surfJAVA_wrap.h +examples/smpi/mc/smpi_bugged1 +examples/smpi/mc/smpi_bugged1_liveness +examples/smpi/mc/smpi_bugged2 +examples/smpi/mc/smpi_mutual_exclusion +examples/smpi/mc/smpi_non_deterministic +examples/smpi/mc/smpi_send_deterministic +simgrid.jar_finalized +simgrid_full.jar +src/mc_page_store_unit.cpp +src/bindings/java/MANIFEST.MF +NATIVE/ +VERSION +examples/msg/exception/exception +include/smpi/mpif.h +a.out diff --git a/.project b/.project index a3b80ff503..30eb9741b0 100644 --- a/.project +++ b/.project @@ -5,6 +5,11 @@ + + org.python.pydev.PyDevBuilder + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder clean,full,incremental, @@ -23,5 +28,6 @@ org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.python.pydev.pythonNature diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..8572822ea1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,27 @@ +language: cpp +compiler: + - gcc +# - clang # does not work for us on debian stable (boost is too old there) +before_install: + - sudo apt-get update -qq + - sudo apt-get install -qq doxygen valgrind default-jdk gfortran liblua5.1-dev lua5.1 libboost-dev transfig ghostscript texlive-font-utils +script: + - cmake -Denable_documentation=OFF -Denable_coverage=OFF -Denable_java=ON -Denable_model-checking=OFF -Denable_lua=ON -Denable_compile_optimizations=ON -Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=ON -Denable_compile_warnings=ON . && make && ctest --output-on-failure --timeout 100 +branches: + only: + - master +notifications: + recipients: + - martin.quinson@loria.fr + email: + on_success: change + on_failure: always + irc: + channels: + - "irc.debian.org#simgrid" + template: + - "%{repository}/%{branch} (%{commit} - %{author}): %{message}" +os: + - linux + - osx + - windows \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index a97eb9670b..3e0141146f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,9 @@ endif() enable_language(CXX) +INCLUDE(CheckCCompilerFlag) +CHECK_C_COMPILER_FLAG(-fstack-cleaner HAVE_C_STACK_CLEANER) + if (APPLE) #MAC set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) @@ -63,7 +66,7 @@ set(SIMGRID_VERSION_MINOR "12") set(SIMGRID_VERSION_PATCH "0") set(SIMGRID_VERSION_EXTRA "-devel") # Extra words to add to version string (e.g. -rc1) -set(SIMGRID_VERSION_DATE "2014") # Year for copyright information +set(SIMGRID_VERSION_DATE "2015") # Year for copyright information if(${SIMGRID_VERSION_PATCH} EQUAL "0") set(release_version "${SIMGRID_VERSION_MAJOR}.${SIMGRID_VERSION_MINOR}") diff --git a/COPYING b/COPYING index a7c05048f3..80daaf1ee6 100644 --- a/COPYING +++ b/COPYING @@ -416,3 +416,15 @@ 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. +========================================================================== + +Torus Cluster support is based on the works of Christian Heinrich + +/* Copyright (c) 2012 + * Christian Heinrich, National Center for Supercomputing Applications + * University of Illinois + * All rights reserved + */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ diff --git a/ChangeLog b/ChangeLog index ad6b503f35..5cdf3a6b5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,13 +3,67 @@ SimGrid (3.12) NOT RELEASED; urgency=low cMSG: * Interface improvement: - Rename MSG_host_is_avail(h) to MSG_host_is_on(h) + - Massive cleanups in the functions related to the energy jMSG: * Interface improvement: - Rename Host.isAvail() to Host.isOn() + SIMIX: * New functions - SIMIX_process_throw: raises an exception in a remote process - + * Refactoring: Separate submodules + - libsmx: the public interface, as libc in a real system + - popping: the strange dance that converts a user request into a kernel handling + - smx_context_*: the virtualization mechanisms that embeed the user code + - smx_*: the handling of each simcalls + * Rename smx_action_t into smx_synchro_t, making explicit that these + things are used to synchronize processes with their environment. + For example, a communication is a sort of synchronization involving + the communicating processes (that may block until the exchange) and + the platform. The same can be said from computations, etc. + + SMPI: + * New functions + - Onesided early support for : MPI_Win_(create, free, fence, get_name, set_name, get_group), MPI_Get, MPI_Put, MPI_Accumulate, MPI_Alloc_mem, MPI_Free_mem. + - MPI_Keyval*, MPI_Attr* functions, as well as MPI_Comm_attr*, MPI_Type_attr* variants (C only, no Fortran support yet) + - MPI_Type_set_name, MPI_Type_get_name + - MPI_*_c2f and MPI_*_f2c functions + - MPI_Info_* functions (beware, get_nthkey may not follow the insertion order) + - MPI_Pack, MPI_Unpack and MPI_Pack_size functions + - Activate a lot of new tests from the mpich 3 testsuite + * Features + - Constant times can be injected inside MPI_Wtime and MPI_Test through options smpi/wtime and smpi/test + - InfiniBand network model added : Based on the works of Jerome Vienne (http://mescal.imag.fr/membres/jean-marc.vincent/index.html/PhD/Vienne.pdf ) + - When smpi/display_timing is set, also display global simulation time and application times + - Have smpirun, smpicc and friends display the simgrid git hash version on --git-version + * Collective communications + - SMP-aware algorithms are now dynamically handled. An internal communicator is created for each node, and an external one to handle communications between "leaders" of each node + - MVAPICH2 (1.9) collective algorithms selector : normal and SMP algorithms are handled, and selection logic is based on the one used on TACC's Stampede cluster (https://www.tacc.utexas.edu/stampede/). + - Support for Rabenseifner Reduce/Allreduce algorithms (https://fs.hlrs.de/projects/par/mpi//myreduce.html) + * Replay + - Replay now uses algorithms from wanted collective selector + - Replay can be used with SMP-aware algorithms + - Memory occupation of replay should now be contained (temporary buffers allocated in collective algorithms should be shared between processes) + - Replay can now replay several traces at the same time (check examples/smpi/replay_multiple example), to simulate interactions between several applications on a given platform. User can specify the start time of each instance. This should also allow replay + actual applications to run. + * Bug fixes + - [#17799] : have mpi_group_range_incl and mpi_group_range_excl better test some corner cases + - Correctly use loopback on fat-tree clusters + - Asynchronous small messages shouldn't trigger deadlocks anymore + SURF + * Bug fixes + - "Full" network optimization flag was broken since Surf++ + - Better handling of precision flags in maxmin + - Fix bug causing sometimes "Impossible" errors + - Properly pass cluster properties to included hosts + * Improvement of the Energy plugin. + - Always update the consumption before returning that value + - New property: watt_off to denote the disipation when the host is off + XBT + * New functions + - Add a xbt_heap_update function, to avoid costly xbt_heap_remove+xbt_heap_insert use + - Add a xbt wrapper for simcall_mutex_trylock (asked in [#17878]) + - Add two new log appenders : rollfile and splitfile. Patch by Fabien Chaix. + -- $date Da SimGrid team diff --git a/README b/README index d1d40b9caf..cd8a33d635 100644 --- a/README +++ b/README @@ -21,3 +21,6 @@ feedback. Cheers, Da SimGrid Team. + + +https://travis-ci.org/mquinson/simgrid.svg?branch=master \ No newline at end of file diff --git a/README.java b/README.java index 66af8b5eb9..a8b3d19dc4 100644 --- a/README.java +++ b/README.java @@ -1,7 +1,4 @@ -On Debian-like systems (which includes ubuntu), you need the following -packages: sun-java6-jdk libgcj10-dev. If you cannot find the -libgcj10-dev, try another version, like libgcj9-dev (on Ubuntu before -9.10) or libgcj11-dev (not released yet, but certainly one day). -Please note that you need to activate the contrib and non-free -repositories in Debian, and the universe ones in Ubuntu. Java comes at -this price... +On Debian, Ubuntu and similar systems, you need the following packages: + + openjdk-7-jdk (or higher) + libgcj14-dev (or higher) diff --git a/buildtools/Cmake/AddTests.cmake b/buildtools/Cmake/AddTests.cmake index b659eb44f6..e7c1838c4e 100644 --- a/buildtools/Cmake/AddTests.cmake +++ b/buildtools/Cmake/AddTests.cmake @@ -84,16 +84,6 @@ IF(NOT enable_memcheck) ADD_TESH(tesh-self-catch-signal --cd "${CMAKE_BINARY_DIR}/bin" ${CMAKE_HOME_DIRECTORY}/tools/tesh/catch-signal.tesh) ENDIF() -IF(enable_java) - IF(WIN32) - SET(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/teshsuite/java/\;${SIMGRID_FULL_JAR}") - STRING(REPLACE "\;" "§" TESH_CLASSPATH "${TESH_CLASSPATH}") - ELSE() - SET(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/teshsuite/java/:${SIMGRID_FULL_JAR}") - ENDIF() - ADD_TESH(tesh-java-sleep-host-off --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/teshsuite/java ${CMAKE_HOME_DIRECTORY}/teshsuite/java/sleep_host_off/sleep_host_off.tesh) -ENDIF() - ### GENERIC ### # BEGIN TESH TESTS # test for code coverage @@ -105,18 +95,30 @@ ENDIF() ENDIF() # END TESH TESTS + ADD_TESH(mc-replay-random-bug --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/mc/replay --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/mc/replay --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/mc/replay random_bug_replay.tesh) + ### MC ### IF(HAVE_MC) ADD_TESH(tesh-mc-dwarf --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/mc/dwarf --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/mc/dwarf dwarf.tesh) ADD_TESH(tesh-mc-dwarf-expression --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/mc/dwarf_expression --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/mc/dwarf_expression dwarf_expression.tesh) + ADD_TESH(mc-record-random-bug --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/mc/replay --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/mc/replay --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/mc/replay random_bug.tesh) + ADD_TESH_FACTORIES(mc-bugged1 "ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1.tesh) ADD_TESH_FACTORIES(mc-bugged2 "ucontext;raw" --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged2.tesh) IF(CONTEXT_UCONTEXT AND PROCESSOR_x86_64) # liveness model-checking works only on 64bits (for now ...) - ADD_TESH(mc-bugged1-liveness-ucontext --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness.tesh) - ADD_TESH(mc-bugged1-liveness-ucontext-sparse --cfg contexts/factory:ucontext --cfg model-check/sparse-checkpoint:yes --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness_sparse.tesh) - ADD_TESH(mc-bugged1-liveness-visited-ucontext --cfg contexts/factory:ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness_visited.tesh) - ADD_TESH(mc-bugged1-liveness-visited-ucontext-sparse --cfg contexts/factory:ucontext --cfg model-check/sparse-checkpoint:yes --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness_visited_sparse.tesh) + ADD_TESH(mc-bugged1-liveness-ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness.tesh) + ADD_TESH(mc-bugged1-liveness-ucontext-sparse --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness_sparse.tesh) + ADD_TESH(mc-bugged1-liveness-visited-ucontext --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness_visited.tesh) + ADD_TESH(mc-bugged1-liveness-visited-ucontext-sparse --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg/mc --cd ${CMAKE_HOME_DIRECTORY}/examples/msg/mc bugged1_liveness_visited_sparse.tesh) + if(HAVE_C_STACK_CLEANER) + # This test checks if the stack cleaner is makign a difference: + add_test(mc-bugged1-liveness-stack-cleaner + ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/bugged1_liveness_stack_cleaner + ${CMAKE_HOME_DIRECTORY}/examples/msg/mc/ + ${CMAKE_BINARY_DIR}/examples/msg/mc/ + ) + endif() ENDIF() ENDIF() @@ -458,8 +460,9 @@ ENDIF() ADD_TEST(test-smpi-mpich3-pt2pt-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/pt2pt perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/pt2pt -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatize_global_variables:yes) ADD_TEST(test-smpi-mpich3-topo-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/topo perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/topo -tests=testlist -execarg=--cfg=contexts/factory:raw) ADD_TEST(test-smpi-mpich3-rma-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/rma perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/rma -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatize_global_variables:yes) + ADD_TEST(test-smpi-mpich3-info-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/info perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/info -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/privatize_global_variables:yes) ADD_TEST(test-smpi-mpich3-perf-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/perf perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/perf -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/running_power:-1) - SET_TESTS_PROPERTIES(test-smpi-mpich3-attr-raw test-smpi-mpich3-comm-raw test-smpi-mpich3-init-raw test-smpi-mpich3-datatype-raw test-smpi-mpich3-group-raw test-smpi-mpich3-pt2pt-raw test-smpi-mpich3-topo-raw test-smpi-mpich3-rma-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") + SET_TESTS_PROPERTIES(test-smpi-mpich3-attr-raw test-smpi-mpich3-comm-raw test-smpi-mpich3-init-raw test-smpi-mpich3-datatype-raw test-smpi-mpich3-group-raw test-smpi-mpich3-pt2pt-raw test-smpi-mpich3-topo-raw test-smpi-mpich3-rma-raw test-smpi-mpich3-info-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!") ENDIF() IF(SMPI_FORTRAN) ADD_TEST(test-smpi-mpich3-thread-f77 ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/f77/ perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/ -tests=testlist -execarg=--cfg=contexts/stack_size:8000 -execarg=--cfg=smpi/privatize_global_variables:yes) @@ -516,10 +519,10 @@ ENDIF() ### JAVA ### IF(enable_java) IF(WIN32) - SET(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/java/\;${SIMGRID_FULL_JAR}") + SET(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/java/\;${CMAKE_BINARY_DIR}/teshsuite/java/\;${SIMGRID_FULL_JAR}") STRING(REPLACE "\;" "§" TESH_CLASSPATH "${TESH_CLASSPATH}") ELSE() - SET(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/java/:${SIMGRID_FULL_JAR}") + SET(TESH_CLASSPATH "${CMAKE_BINARY_DIR}/examples/java/:${CMAKE_BINARY_DIR}/teshsuite/java/:${SIMGRID_FULL_JAR}") ENDIF() ADD_TESH(java-async --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/async/async.tesh) ADD_TESH(java-bittorrent --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/bittorrent/bittorrent.tesh) @@ -543,6 +546,9 @@ ENDIF() IF(HAVE_TRACING) ADD_TESH(java-tracing --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java ${CMAKE_HOME_DIRECTORY}/examples/java/tracing/tracingPingPong.tesh) ENDIF() + + # teshsuite ones + ADD_TESH(tesh-java-sleep-host-off --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/java --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/teshsuite/java ${CMAKE_HOME_DIRECTORY}/teshsuite/java/sleep_host_off/sleep_host_off.tesh) ENDIF() @@ -588,7 +594,13 @@ FOREACH (tesh no-error3 no-error ) - ADD_TESH(umpire_${tesh} --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/isp/umpire ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/isp/umpire/${tesh}.tesh) + IF(HAVE_MC) + ADD_TESH(mc-umpire-${tesh} + --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/isp/umpire + --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/isp/umpire + --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/isp/umpire + ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/isp/umpire/${tesh}.tesh) + ENDIF() ENDFOREACH() endif() diff --git a/buildtools/Cmake/CTestConfig.cmake b/buildtools/Cmake/CTestConfig.cmake index 04854c2c57..bb6e9fa94a 100644 --- a/buildtools/Cmake/CTestConfig.cmake +++ b/buildtools/Cmake/CTestConfig.cmake @@ -10,9 +10,7 @@ else() endif() endif() -if(enable_memcheck) - set(CTEST_TIMEOUT "300") #TIMEOUT FOR EACH TEST -endif() + set(DART_TESTING_TIMEOUT "300") #TIMEOUT FOR EACH TEST if(enable_compile_warnings AND enable_compile_optimizations) SET(BUILDNAME "FULL_FLAGS" CACHE TYPE INTERNAL FORCE) diff --git a/buildtools/Cmake/CompleteInFiles.cmake b/buildtools/Cmake/CompleteInFiles.cmake index b0a4b7c5c4..786550e17e 100644 --- a/buildtools/Cmake/CompleteInFiles.cmake +++ b/buildtools/Cmake/CompleteInFiles.cmake @@ -549,6 +549,14 @@ if(EXISTS ${CMAKE_HOME_DIRECTORY}/.git/) string(REPLACE "\n" "" GIT_DATE "${GIT_DATE}") message(STATUS "Git date: ${GIT_DATE}") string(REGEX REPLACE " .*" "" GIT_VERSION "${GIT_VERSION}") + + execute_process(COMMAND git --git-dir=${CMAKE_HOME_DIRECTORY}/.git log --pretty=format:%H -1 + WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY}/.git/ + OUTPUT_VARIABLE SIMGRID_GITHASH + RESULT_VARIABLE ret + ) + string(REPLACE "\n" "" SIMGRID_GITHASH "${SIMGRID_GITHASH}") + endif() elseif(EXISTS ${CMAKE_HOME_DIRECTORY}/.gitversion) FILE(STRINGS ${CMAKE_HOME_DIRECTORY}/.gitversion GIT_VERSION) @@ -913,8 +921,7 @@ set(generated_files_to_clean ${CMAKE_BINARY_DIR}/examples/smpi/tracing/smpi_traced.trace ) -if("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}") -else() +if(NOT "${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_HOME_DIRECTORY}") configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions0.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions0.txt COPYONLY) configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions1.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions1.txt COPYONLY) configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_allReduce.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allReduce.txt COPYONLY) @@ -928,6 +935,42 @@ else() configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_gather.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_gather.txt COPYONLY) configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay/actions_allgatherv.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allgatherv.txt COPYONLY) configure_file(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/hostfile ${CMAKE_BINARY_DIR}/teshsuite/smpi/hostfile COPYONLY) + + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/description_file ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/description_file COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/README ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/README COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/smpi_replay.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/smpi_replay.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt COPYONLY) + configure_file(${CMAKE_HOME_DIRECTORY}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt COPYONLY) set(generated_files_to_clean ${generated_files_to_clean} @@ -940,7 +983,45 @@ else() ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoall.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_alltoallv.txt ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_waitall.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_gather.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_allgatherv.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay/actions_reducescatter.txt ${CMAKE_BINARY_DIR}/teshsuite/smpi/hostfile + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/description_file + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/README + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/smpi_replay.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace0.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace1.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace2.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace3.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace4.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace5.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace6.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace7.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace8.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace9.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace10.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace11.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace12.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace13.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace14.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace15.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace16.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace17.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace18.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace19.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace20.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace21.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace22.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace23.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace24.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace25.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace26.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace27.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace28.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace29.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace30.txt + ${CMAKE_BINARY_DIR}/examples/smpi/replay_multiple/ti_traces_32_1/ti_trace31.txt ) endif() diff --git a/buildtools/Cmake/DefinePackages.cmake b/buildtools/Cmake/DefinePackages.cmake index 24f231297d..790a06d452 100644 --- a/buildtools/Cmake/DefinePackages.cmake +++ b/buildtools/Cmake/DefinePackages.cmake @@ -7,6 +7,7 @@ set(EXTRA_DIST src/include/mc/mc.h src/mc/mc_mmu.h src/mc/mc_page_store.h + src/mc/mc_record.h src/include/simgrid/platf_interface.h src/include/simgrid/sg_config.h src/include/smpi/smpi_interface.h @@ -23,24 +24,23 @@ set(EXTRA_DIST src/msg/msg_mailbox.h src/msg/msg_private.h src/portable.h + src/probes.tp src/simdag/dax.dtd src/simdag/dax_dtd.c src/simdag/dax_dtd.h src/simdag/private.h src/simix/simcalls.in src/simix/simcalls.py - src/simix/simcalls_generated_args_getter_setter.h - src/simix/simcalls_generated_body.c - src/simix/simcalls_generated_case.c - src/simix/simcalls_generated_enum.h - src/simix/simcalls_generated_res_getter_setter.h - src/simix/simcalls_generated_string.c + src/simix/popping_private.h + src/simix/popping_bodies.c + src/simix/popping_generated.c + src/simix/popping_enum.h + src/simix/popping_accessors.h src/simix/smx_host_private.h src/simix/smx_io_private.h src/simix/smx_network_private.h src/simix/smx_private.h src/simix/smx_process_private.h - src/simix/smx_smurf_private.h src/simix/smx_synchro_private.h src/smpi/README src/smpi/colls/coll_tuned_topo.h @@ -123,6 +123,7 @@ set(EXTRA_DIST src/xbt/mmalloc/mmprivate.h src/xbt/mmalloc/mmtrace.awk src/xbt/mmalloc/mrealloc.c + src/xbt/probes.h src/xbt/setset_private.h src/xbt/win32_ucontext.c tools/tesh/run_context.h @@ -360,7 +361,11 @@ set(SURF_SRC src/xbt/xbt_sg_stubs.c ) +set(SIMIX_GENERATED_SRC + src/simix/popping_generated.c + ) set(SIMIX_SRC + src/simix/libsmx.c src/simix/smx_context.c src/simix/smx_context_base.c src/simix/smx_context_raw.c @@ -371,10 +376,10 @@ set(SIMIX_SRC src/simix/smx_io.c src/simix/smx_network.c src/simix/smx_process.c - src/simix/smx_smurf.c src/simix/smx_synchro.c - src/simix/smx_user.c src/simix/smx_vm.c + src/simix/popping.c + ${SIMIX_GENERATED_SRC} ) set(SIMGRID_SRC @@ -399,23 +404,6 @@ set(MSG_SRC src/msg/msg_vm.c ) -#* ****************************************************************************************** *# -#* TUTORIAL: New API *# - -set(MSG_SRC - ${MSG_SRC} - src/msg/msg_new_api.c - ) -set(EXTRA_DIST - ${EXTRA_DIST} - src/simix/smx_new_api_private.h - ) -set(SIMIX_SRC - ${SIMIX_SRC} - src/simix/smx_new_api.c -) -#* ****************************************************************************************** *# - set(SIMDAG_SRC src/simdag/instr_sd_task.c src/simdag/sd_daxloader.c @@ -596,11 +584,27 @@ set(JEDULE_SRC src/instr/jedule/jedule_sd_binding.c ) +set(MC_SRC_BASE + src/mc/mc_base.c + src/mc/mc_base.h + src/mc/mc_record.h + src/mc/mc_record.c + src/mc/mc_config.c + src/mc/mc_global.c + ) + set(MC_SRC + src/mc/mc_forward.h + src/mc/mc_mmalloc.h + src/mc/mc_model_checker.h + src/mc/mc_object_info.h src/mc/mc_checkpoint.c + src/mc/mc_snapshot.h src/mc/mc_snapshot.c + src/mc/mc_page_store.h src/mc/mc_page_store.cpp src/mc/mc_page_snapshot.cpp + src/mc/mc_comm_pattern.h src/mc/mc_comm_determinism.c src/mc/mc_compare.cpp src/mc/mc_diff.c @@ -608,19 +612,26 @@ set(MC_SRC src/mc/mc_dwarf_attrnames.h src/mc/mc_dwarf_expression.c src/mc/mc_dwarf_tagnames.h - src/mc/mc_global.c src/mc/mc_hash.c src/mc/mc_ignore.c + src/mc/mc_interface.h + src/mc/mc_liveness.h + src/mc/mc_location.h src/mc/mc_liveness.c + src/mc/mc_record.c src/mc/mc_member.c src/mc/mc_memory.c src/mc/mc_pair.c src/mc/mc_private.h + src/mc/mc_request.h src/mc/mc_request.c + src/mc/mc_safety.h src/mc/mc_safety.c src/mc/mc_set.cpp + src/mc/mc_state.h src/mc/mc_state.c src/mc/mc_visited.c + src/mc/mc_memory_map.h src/mc/memory_map.c ) @@ -771,6 +782,11 @@ else() ) endif() +set(simgrid_sources + ${simgrid_sources} + ${MC_SRC_BASE} + ) + if(HAVE_MC) set(simgrid_sources ${simgrid_sources} @@ -1033,6 +1049,7 @@ set(TESHSUITE_CMAKEFILES_TXT teshsuite/mc/CMakeLists.txt teshsuite/mc/dwarf/CMakeLists.txt teshsuite/mc/dwarf_expression/CMakeLists.txt + teshsuite/mc/replay/CMakeLists.txt teshsuite/msg/CMakeLists.txt teshsuite/msg/get_sender/CMakeLists.txt teshsuite/msg/host_on_off/CMakeLists.txt @@ -1079,6 +1096,7 @@ set(TESHSUITE_CMAKEFILES_TXT teshsuite/smpi/mpich3-test/datatype/CMakeLists.txt # teshsuite/smpi/mpich3-test/f77/attr/CMakeLists.txt teshsuite/smpi/mpich3-test/f77/coll/CMakeLists.txt + teshsuite/smpi/mpich3-test/f77/info/CMakeLists.txt teshsuite/smpi/mpich3-test/f77/comm/CMakeLists.txt teshsuite/smpi/mpich3-test/f77/datatype/CMakeLists.txt teshsuite/smpi/mpich3-test/f77/ext/CMakeLists.txt @@ -1089,11 +1107,13 @@ set(TESHSUITE_CMAKEFILES_TXT teshsuite/smpi/mpich3-test/f77/rma/CMakeLists.txt teshsuite/smpi/mpich3-test/f90/coll/CMakeLists.txt teshsuite/smpi/mpich3-test/f90/datatype/CMakeLists.txt + teshsuite/smpi/mpich3-test/f90/info/CMakeLists.txt teshsuite/smpi/mpich3-test/f90/init/CMakeLists.txt teshsuite/smpi/mpich3-test/f90/pt2pt/CMakeLists.txt teshsuite/smpi/mpich3-test/f90/util/CMakeLists.txt teshsuite/smpi/mpich3-test/f90/rma/CMakeLists.txt teshsuite/smpi/mpich3-test/group/CMakeLists.txt + teshsuite/smpi/mpich3-test/info/CMakeLists.txt teshsuite/smpi/mpich3-test/init/CMakeLists.txt teshsuite/smpi/mpich3-test/pt2pt/CMakeLists.txt teshsuite/smpi/mpich3-test/topo/CMakeLists.txt @@ -1179,6 +1199,13 @@ set(CMAKE_SOURCE_FILES buildtools/Cmake/test_prog/prog_stacksetup.c buildtools/Cmake/test_prog/prog_thread_storage.c buildtools/Cmake/test_prog/prog_vsnprintf.c + tools/stack-cleaner/as + tools/stack-cleaner/cc + tools/stack-cleaner/c++ + tools/stack-cleaner/fortran + tools/stack-cleaner/clean-stack-filter + tools/stack-cleaner/compiler-wrapper + tools/stack-cleaner/README ) set(PLATFORMS_EXAMPLES @@ -1246,6 +1273,23 @@ set(generated_src_files src/xbt/automaton/parserPromela.tab.hacc ) +if(enable_ust) + set(simgrid_sources ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_ust.c ${simgrid_sources}) + ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_ust.c + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_ust.h + COMMAND lttng-gen-tp -o simgrid_ust.c -o simgrid_ust.h ${CMAKE_CURRENT_SOURCE_DIR}/src/probes.tp + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src/ + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/probes.tp + ) + ADD_CUSTOM_TARGET(simgrid_ust + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_ust.c + ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_ust.h + ) + set(generated_src_files ${CMAKE_CURRENT_BINARY_DIR}/src/simgrid_ust.c ${generated_src_files}) +endif() + foreach(file ${generated_src_files}) set_source_files_properties(${file} PROPERTIES GENERATED true) endforeach(file ${generated_src_files}) diff --git a/buildtools/Cmake/Distrib.cmake b/buildtools/Cmake/Distrib.cmake index 1fcd9e2eab..428db7c6ea 100644 --- a/buildtools/Cmake/Distrib.cmake +++ b/buildtools/Cmake/Distrib.cmake @@ -203,6 +203,7 @@ set(source_to_pack ${JSURF_SWIG_SRC_EXTRA} ${JSURF_C_SRC} ${LUA_SRC} + ${MC_SRC_BASE} ${MC_SRC} ${MSG_SRC} ${NS3_SRC} diff --git a/buildtools/Cmake/Flags.cmake b/buildtools/Cmake/Flags.cmake index 6e5011034e..d45e7f9305 100644 --- a/buildtools/Cmake/Flags.cmake +++ b/buildtools/Cmake/Flags.cmake @@ -50,6 +50,14 @@ else() set(optCFLAGS "-O0 ") endif() +if(enable_sdt) + add_definitions(-DUSE_SDT) +endif() + +if(enable_ust) + add_definitions(-DUSE_UST) +endif() + if(enable_model-checking AND enable_compile_optimizations) # Forget it, do not optimize the code (because it confuses the MC): set(optCFLAGS "-O0 ") diff --git a/buildtools/Cmake/GenerateDoc.cmake b/buildtools/Cmake/GenerateDoc.cmake index 3d01654d0f..bcae064765 100644 --- a/buildtools/Cmake/GenerateDoc.cmake +++ b/buildtools/Cmake/GenerateDoc.cmake @@ -23,9 +23,17 @@ if(DOXYGEN_FOUND) message(STATUS "Doxygen version: ${DOXYGEN_VERSION}") + # This is a workaround for older cmake versions + # (such as 2.8.7 on Ubuntu 12.04). These cmake versions do not provide the + # DOXYGEN_VERSION variable and hence, building the documentation will always + # fail. This code is the same as used in the cmake library, version 3. + if(DOXYGEN_EXECUTABLE) + execute_process(COMMAND ${DOXYGEN_EXECUTABLE} "--version" OUTPUT_VARIABLE DOXYGEN_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() + if(DOXYGEN_VERSION VERSION_LESS "1.8") ADD_CUSTOM_TARGET(error_doxygen - COMMAND ${CMAKE_COMMAND} -E echo "Doxygen must be at least version 1.8 to generate documentation" + COMMAND ${CMAKE_COMMAND} -E echo "Doxygen must be at least version 1.8 to generate documentation. Version found: ${DOXYGEN_VERSION}" COMMAND false ) @@ -106,6 +114,6 @@ add_custom_target(sync-gforge-dtd COMMAND ${RSYNC_CMD} src/surf/simgrid.dtd scm.gforge.inria.fr:/home/groups/simgrid/htdocs/simgrid.dtd WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}" ) - + endif() diff --git a/buildtools/Cmake/MaintainerMode.cmake b/buildtools/Cmake/MaintainerMode.cmake index ebc8ef797a..fba030f36f 100644 --- a/buildtools/Cmake/MaintainerMode.cmake +++ b/buildtools/Cmake/MaintainerMode.cmake @@ -10,12 +10,10 @@ if(enable_maintainer_mode AND NOT WIN32) if (PYTHON_EXE) add_custom_command( OUTPUT - ${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_enum.h - ${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_string.c - ${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_res_getter_setter.h - ${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_args_getter_setter.h - ${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_case.c - ${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_body.c + ${CMAKE_HOME_DIRECTORY}/src/simix/popping_generated.c + ${CMAKE_HOME_DIRECTORY}/src/simix/popping_bodies.c + ${CMAKE_HOME_DIRECTORY}/src/simix/popping_enum.h + ${CMAKE_HOME_DIRECTORY}/src/simix/popping_accessors.h DEPENDS ${CMAKE_HOME_DIRECTORY}/src/simix/simcalls.py @@ -28,16 +26,14 @@ if(enable_maintainer_mode AND NOT WIN32) add_custom_target(simcalls_generated_src DEPENDS - ${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_enum.h - ${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_string.c - ${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_res_getter_setter.h - ${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_args_getter_setter.h - ${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_case.c - ${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_body.c + ${CMAKE_HOME_DIRECTORY}/src/simix/popping_generated.c + ${CMAKE_HOME_DIRECTORY}/src/simix/popping_bodies.c + ${CMAKE_HOME_DIRECTORY}/src/simix/popping_enum.h + ${CMAKE_HOME_DIRECTORY}/src/simix/popping_accessors.h ) SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES - "${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_enum.h;${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_string.c;${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_res_getter_setter.h;${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_args_getter_setter.h;${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_case.c;${CMAKE_HOME_DIRECTORY}/src/simix/simcalls_generated_body.c" + "${CMAKE_HOME_DIRECTORY}/src/simix/popping_enum.h;${CMAKE_HOME_DIRECTORY}/src/simix/popping_generated.c;${CMAKE_HOME_DIRECTORY}/src/simix/popping_bodies.c;${CMAKE_HOME_DIRECTORY}/src/simix/popping_accessors.h" ) endif() endif() diff --git a/buildtools/Cmake/MakeExe.cmake b/buildtools/Cmake/MakeExe.cmake index 2328e391f0..5cd1d9859e 100644 --- a/buildtools/Cmake/MakeExe.cmake +++ b/buildtools/Cmake/MakeExe.cmake @@ -88,6 +88,7 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/java/sleep_host_off) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/mc) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/mc/dwarf) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/mc/dwarf_expression) +add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/mc/replay) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/msg) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/msg/get_sender) @@ -146,6 +147,7 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/init) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/pt2pt) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/rma) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/perf) +add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/info) #add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/attr) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/util) @@ -154,6 +156,7 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/comm) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/datatype) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/ext) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/init) +add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/info) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/pt2pt) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/topo) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f77/rma) @@ -161,6 +164,7 @@ add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/util) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/rma) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/coll) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/datatype) +add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/info) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/init) add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/f90/pt2pt) diff --git a/buildtools/Cmake/MakeJava.cmake b/buildtools/Cmake/MakeJava.cmake index 8a34726ab2..c4bb53964e 100644 --- a/buildtools/Cmake/MakeJava.cmake +++ b/buildtools/Cmake/MakeJava.cmake @@ -110,8 +110,8 @@ add_custom_command( COMMAND ${JAVA_ARCHIVE} -uvf ${SIMGRID_FULL_JAR} "NATIVE" COMMAND ${CMAKE_COMMAND} -E remove ${SIMGRID_JAR}_finalized COMMAND ${CMAKE_COMMAND} -E touch ${SIMGRID_JAR}_finalized - COMMAND ${Java_JAVADOC_EXECUTABLE} -quiet -d doc ${CMAKE_HOME_DIRECTORY}/src/bindings/java/org/simgrid/*.java ${CMAKE_HOME_DIRECTORY}/src/bindings/java/org/simgrid/*/*.java - COMMAND ${JAVA_ARCHIVE} -uvf ${SIMGRID_FULL_JAR} doc + COMMAND ${Java_JAVADOC_EXECUTABLE} -quiet -d doc/javadoc ${CMAKE_HOME_DIRECTORY}/src/bindings/java/org/simgrid/*.java ${CMAKE_HOME_DIRECTORY}/src/bindings/java/org/simgrid/*/*.java + COMMAND ${JAVA_ARCHIVE} -uvf ${SIMGRID_FULL_JAR} doc/javadoc ) add_custom_target(simgrid-java_jar ALL DEPENDS ${SIMGRID_JAR}_finalized) diff --git a/buildtools/Cmake/MakeLib.cmake b/buildtools/Cmake/MakeLib.cmake index f73882a51d..9f15a915bd 100644 --- a/buildtools/Cmake/MakeLib.cmake +++ b/buildtools/Cmake/MakeLib.cmake @@ -12,6 +12,10 @@ if(enable_lib_static) add_library(simgrid_static STATIC ${simgrid_sources}) endif() +if(enable_ust) + ADD_DEPENDENCIES(simgrid simgrid_ust) +endif() + if(enable_java) include(${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/MakeJava.cmake) endif() @@ -124,6 +128,12 @@ if(HAVE_BACKTRACE_IN_LIBEXECINFO) SET(SIMGRID_DEP "${SIMGRID_DEP} -lexecinfo") endif(HAVE_BACKTRACE_IN_LIBEXECINFO) +# Dependencies from USR +################################### +if(enable_ust) + set(SIMGRID_DEP "${SIMGRID_DEP} -llttng-ust") +endif() + # Compute the dependencies of SMPI ################################## if(enable_smpi AND APPLE) diff --git a/buildtools/Cmake/Option.cmake b/buildtools/Cmake/Option.cmake index eb1aae11ff..27463ba975 100644 --- a/buildtools/Cmake/Option.cmake +++ b/buildtools/Cmake/Option.cmake @@ -27,6 +27,8 @@ option(enable_maintainer_mode "Whether flex and flexml files should be rebuilt." option(enable_tracing "Tracing simulations for visualization." on) option(enable_latency_bound_tracking "" off) option(enable_coverage "Enable coverage." off) +option(enable_ust "Enable userspace statuic tracepoint (lttng-ust)." off) +option(enable_sdt "Enable statically defined tracepoint (strace/systemtap)." off) mark_as_advanced(enable_coverage) option(enable_memcheck "Enable memcheck." off) option(enable_memcheck_xml "Enable memcheck with xml output." off) diff --git a/buildtools/Cmake/Scripts/java_bundle.sh b/buildtools/Cmake/Scripts/java_bundle.sh index c0d51ce6be..38f663fa03 100755 --- a/buildtools/Cmake/Scripts/java_bundle.sh +++ b/buildtools/Cmake/Scripts/java_bundle.sh @@ -9,8 +9,8 @@ Usage: $0 simgrid.jar java_command strip_command [-so file.so...] [-txt file.txt simgrid.jar SimGrid jar file java_command path to the Java runtime strip_command path to the command used to strip libraries - file.so library file to stript and bundle into the archive - file.txt other file to bundle into the archive + file.so library file to strip and bundle into the archive + file.txt other file to bundle into the archive EOF exit 1 fi @@ -20,7 +20,7 @@ JAVA=$2 STRIP=$3 shift 3 -JSG_BUNDLE=$("$JAVA" -classpath "$SIMGRID_JAR" org.simgrid.NativeLib) +JSG_BUNDLE=$("$JAVA" -classpath "$SIMGRID_JAR" org.simgrid.NativeLib --quiet) # sanity check case "$JSG_BUNDLE" in diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 0ec8546a23..920688eb78 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -751,7 +751,7 @@ RECURSIVE = NO # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = @top_srcdir@/src/simix/simcalls_generated_case.c +EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded @@ -1284,7 +1284,7 @@ SERVER_BASED_SEARCH = NO # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. -GENERATE_LATEX = YES +GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be diff --git a/doc/doxygen/inside_extending.doc b/doc/doxygen/inside_extending.doc index ea7cc55ce3..bb37b1d7e1 100644 --- a/doc/doxygen/inside_extending.doc +++ b/doc/doxygen/inside_extending.doc @@ -1,29 +1,7 @@ /*! \page inside_extending Extending SimGrid -We start to put TAGS in simgrid source code for having tutorials to see where is the important parts ans steps to create: -\li \ref simgrid_dev_guide_api -\li \ref simgrid_dev_guide_model -\li \ref simgrid_dev_guide_tag - -\section simgrid_dev_guide_api How to add a new MSG function? -Search for expression \"TUTORIAL: New API\". -\verbatim -user@caraja:~/workspace/simgrid/src$ cg "TUTORIAL: New API" - 0 msg/msg_new_api.c 15 /* TUTORIAL: New API*/ - 1 simix/smx_smurf.c 582 /* TUTORIAL: New API*/ - 2 simix/smx_smurf.c 616 /* TUTORIAL: New API*/ - 3 simix/smx_smurf_private.h 102 /* TUTORIAL: New API*/ - 4 simix/smx_smurf_private.h 629 /* TUTORIAL: New API*/ - 5 simix/smx_private.h 28 /* TUTORIAL: New API*/ - 6 simix/smx_private.h 101 /* TUTORIAL: New API*/ - 7 simix/smx_private.h 182 /* TUTORIAL: New API*/ - 8 simix/smx_global.c 454 /* TUTORIAL: New API*/ - 9 simix/smx_new_api.c 8 /* TUTORIAL: New API*/ -10 simix/smx_user.c 1684 /* TUTORIAL: New API*/ -11 simix/smx_new_api_private.h 8 /* TUTORIAL: New API*/ -12 simix/smx_process.c 338 /* TUTORIAL: New API*/ -\endverbatim +\tableofcontents \section simgrid_dev_guide_model How to add a new model in surf? The figure below show the architecture of the SURF layer. This layer is composed @@ -139,39 +117,48 @@ s_surf_model_description_t surf_plugin_description[] = { ~~~~ \section simgrid_dev_guide_simcall How to add a new simcall? -A simcall is used to go from user mode to kernel mode. The workflow of -a simcall is the following: + +A simcall is used to go from user mode to kernel mode. There is some +sort of popping dance involved, as we want to isolate the user +contextes from their environment (so that they can run in parallel). + +The workflow of a simcall is the following: - ` simcall_()` - `simcall_BODY_()` - - create the simcall - - `SIMIX_process_yield` if not maestro + - Initializes the simcall (store the arguments in position) + - If maestro, executes the simcall directly (and return) + - If not, call `SIMIX_process_yield` to give back the control to maestro - ========== KERNEL MODE ========== - - `SIMIX_simcall_pre` - - `SIMIX_pre_(simcall, )` - - `SIMIX_simcall_answer(simcall)` - -To simplify the simcall creation, we have made a python script that -generate most of the code and give helpers for the remaining stuff. -The script generating the simcalls (src/simix/simcalls.in) take in input -the src/simix/simcalls.in file where the simcalls are defined and generate -the following files: - -- simcall_generated_args_getter_setter.h: - functions to get and set simcall arguments -- simcall_generated_res_getter_setter.h: - functions to get and set simcall result -- simcall_generated_body.c: - the BODY function of the simcall -- simcall_generated_case.c: - the case of the SIMIX_simcall_pre function -- simcall_generated_enum.h: - the enum of simcalls -- simcall_generated_string.c: - string corresponding to the enum to debug - -Furthermode if the simcall_ or the SIMIX_pre_ function are missing, -a warning will show up with a prototype of the corresponding fonction to fill. + - `SIMIX_simcall_handle` large switch (on simcall) doing for each: + - `simcall_HANDLER_(simcall, )` (the manual code handling the simcall) + - If the simcall is not marked as "blocking" in its definition, + call `SIMIX_simcall_answer(simcall)` that adds back the issuer + process to the list of processes to run in the next scheduling round. + It is thus the responsability of the blocking simcalls to call + `SIMIX_simcall_answer(simcall)` themselves in their handler. + +Note that empty HANDLERs can be omitted. These functions usually do +some parameter checking, or retrieve some information about the +simcall issuer, but when there no need for such things, the handler +can be omited. In that case, we directly call the function +`simcall_()`. + +To simplify the simcall creation, a python script generates most of +the code and give helpers for the remaining stuff. That script reads +the simcall definitions from src/simix/simcalls.in, checks that both +`simcall_()` and `simcall_HANDLER()` are defined somewhere, and +generates the following files: + +- smx_popping_accessors.h: + Helper functions to get and set simcall arguments and results +- smx_popping_bodies.c: + The BODY function of each simcall +- smx_popping_enum.c: + Definition of type `enum e_smx_simcall_t` (one value per existing simcall) +- smx_popping_generated.c: + Definitions of `simcall_names[]` (debug name of each simcall), and + SIMIX_simcall_enter() that deals with the simcall from within the kernel The simcall.in file list all the simcalls in sections. A line starting by "##" define a new section which will be replace by a "ifdef" in the generated code. diff --git a/doc/doxygen/module-smpi.doc b/doc/doxygen/module-smpi.doc index f747121319..0474d172c1 100644 --- a/doc/doxygen/module-smpi.doc +++ b/doc/doxygen/module-smpi.doc @@ -48,7 +48,7 @@ feature, please get in touch with us: we can guide you though the SimGrid code to help you implementing it, and we'd glad to integrate it in the main project afterward if you contribute them back. -\subsection SMPI_what_globals Issues with the globals +\subsection SMPI_what_globals Global variables Concerning the globals, the problem comes from the fact that usually, MPI processes run as real UNIX processes while they are all folded @@ -67,13 +67,20 @@ available at http://charm.cs.illinois.edu/newPapers/11-23/paper.pdf (note that this article does not deal with SMPI but with a concurrent solution called AMPI that suffers of the same issue). -Currently, we have no solution to offer you, because all proposed solutions will -modify the performance of your application (in the computational -sections). Sacrificing realism for usability is not very satisfying, so we did -not implement them yet. You will thus have to modify your application if it uses -global variables. We are working on another solution, leveraging distributed -simulation to keep each MPI process within a separate system process, but this -is far from being ready at the moment. +A method using dynamic switching of the .data and .bss segments of an +ELF executable has been introduced in SimGrid 3.11. By using the smpi/ +privatize_global_variableles option to yes, SMPI will duplicate +the segments containing the global variables and when needed, will map +the right one in memory. This needs ELF executables and mmap on the system +(Linux and recent BSDs should be compatible). %As no copy is involved, +performance should not be altered (but memory occupation will be higher). + +This solution actually works really good for a good number of MPI +applications. Its main limitation is that if the application loads dynamic +libraries, their global variables won't be privatized. This can be avoided +by linking statically with these libraries (but NOT with libsimgrid, as we +need SimGrid's own global varibles). + \section SMPI_compiling Compiling your code diff --git a/doc/doxygen/options.doc b/doc/doxygen/options.doc index 82776a5768..f8a018ed3f 100644 --- a/doc/doxygen/options.doc +++ b/doc/doxygen/options.doc @@ -95,6 +95,11 @@ described in settings (accurate modeling of slow start with correction factors on three intervals: < 1KiB, < 64 KiB, >= 64 KiB). See also \ref options_model_network_coefs "this section" for more info. + - \b IB: Realistic network model specifically tailored for HPC + settings with InfiniBand networks (accurate modeling contention + behavior, based on the model explained in + http://mescal.imag.fr/membres/jean-marc.vincent/index.html/PhD/Vienne.pdf). + See also \ref options_model_network_coefs "this section" for more info. - \b CM02: Legacy network analytic model (Very similar to LV08, but without corrective factors. The timings of small messages are thus poorly modeled) @@ -208,6 +213,12 @@ If you are using the SMPI model, these correction coeficients are themselves corrected by constant values depending on the size of the exchange. Again, only hardcore experts should bother about this fact. +InfiniBand network behavior can be modeled through 3 parameters, as explained in +http://mescal.imag.fr/membres/jean-marc.vincent/index.html/PhD/Vienne.pdf . These +factors can be changed through option smpi/IB_penalty_factors:"βe;βs;γs". By +default SMPI uses factors computed one Stampede cluster from TACC, with optimal +deployment of processes on nodes. + \subsubsection options_model_network_crosstraffic Simulating cross-traffic As of SimGrid v3.7, cross-traffic effects can be taken into account in @@ -295,7 +306,7 @@ void MC_assert(int prop); If you want to specify liveness properties (beware, that's experimental), you have to pass them on the command line, specifying -the name of the file containing the property, as formated by the +the name of the file containing the property, as formatted by the ltl2ba program. \verbatim diff --git a/doc/simix.fig b/doc/simix.fig index c4df1aaaeb..90b8e3f19c 100644 --- a/doc/simix.fig +++ b/doc/simix.fig @@ -108,7 +108,7 @@ Single 3375 2700 3375 3375 5130 3375 5130 2835 4949 2700 3375 2700 2 3 0 1 0 31 101 0 17 0.000 0 0 7 0 0 4 4950 2700 4950 2835 5130 2835 4950 2700 -4 0 0 100 0 16 10 0.0000 4 150 945 3404 2890 smx_action_t\001 +4 0 0 100 0 16 10 0.0000 4 150 945 3404 2890 smx_synchro_t\001 4 0 0 100 0 16 10 0.0000 4 120 360 3420 3105 Dsc1\001 4 0 0 100 0 16 10 0.0000 4 120 360 3420 3285 Dsc2\001 -6 diff --git a/examples/java/cloud/cloud.tesh b/examples/java/cloud/cloud.tesh index faf82a5d7f..b6964d4d84 100644 --- a/examples/java/cloud/cloud.tesh +++ b/examples/java/cloud/cloud.tesh @@ -29,21 +29,15 @@ $ java -classpath ${classpath:=.} cloud/Cloud ${srcdir:=.}/../platforms/platform > [ 4.798398] (3:WRK01@VM01) WRK01 executed task (Task01) > [1000.000000] (1:Master@Jacquelin) Migrate everyone to Fernand > [1000.000000] (1:Master@Jacquelin) Migrate VM00fromIntelto Fernand -> [1000.000000] (5:__pr_mig_tx:VM00(Intel-Fernand)@Intel) mig-stage1: remaining_size 1073741824.000000 -> [3463.797594] (5:__pr_mig_tx:VM00(Intel-Fernand)@Intel) actual bandwidth 0.415619 (MB/s), threshold 13074.229313 -> [3463.797594] (5:__pr_mig_tx:VM00(Intel-Fernand)@Intel) mig-stage 2:0 updated_size 0.000000 computed_during_stage1 0.000000 dp_rate 0.000000 dp_cap 966367641.600000 -> [3463.797594] (5:__pr_mig_tx:VM00(Intel-Fernand)@Intel) mig-stage2.0: remaining_size 0.000000 (< threshold 13074.229313) -> [3463.797594] (5:__pr_mig_tx:VM00(Intel-Fernand)@Intel) mig-stage3: remaining_size 0.000000 +> [1000.000000] (5:__pr_mig_tx:VM00(Intel-Fernand)@Intel) Stage 1: Gonna send 1073741824 +> [3463.797594] (5:__pr_mig_tx:VM00(Intel-Fernand)@Intel) Stage 3: Gonna send 0.000000 > [3465.751712] (0:@) migrate VM(VM00): set bound (137333000.000000) at Fernand -> [3465.751712] (4:__pr_mig_rx:VM00(Intel-Fernand)@Fernand) set affinity(0x0000@Fernand) for VM00 +> [3465.751712] (5:__pr_mig_tx:VM00(Intel-Fernand)@Intel) mig: tx_done > [3467.577368] (1:Master@Jacquelin) Migrate VM01fromProvostto Fernand -> [3467.577368] (9:__pr_mig_tx:VM01(Provost-Fernand)@Provost) mig-stage1: remaining_size 1073741824.000000 -> [5929.514531] (9:__pr_mig_tx:VM01(Provost-Fernand)@Provost) actual bandwidth 0.415933 (MB/s), threshold 13084.109212 -> [5929.514531] (9:__pr_mig_tx:VM01(Provost-Fernand)@Provost) mig-stage 2:0 updated_size 0.000000 computed_during_stage1 0.000000 dp_rate 0.000000 dp_cap 966367641.600000 -> [5929.514531] (9:__pr_mig_tx:VM01(Provost-Fernand)@Provost) mig-stage2.0: remaining_size 0.000000 (< threshold 13084.109212) -> [5929.514531] (9:__pr_mig_tx:VM01(Provost-Fernand)@Provost) mig-stage3: remaining_size 0.000000 +> [3467.577368] (7:__pr_mig_tx:VM01(Provost-Fernand)@Provost) Stage 1: Gonna send 1073741824 +> [5929.514531] (7:__pr_mig_tx:VM01(Provost-Fernand)@Provost) Stage 3: Gonna send 0.000000 > [5929.608220] (0:@) migrate VM(VM01): set bound (137333000.000000) at Fernand -> [5929.608220] (8:__pr_mig_rx:VM01(Provost-Fernand)@Fernand) set affinity(0x0000@Fernand) for VM01 +> [5929.608220] (7:__pr_mig_tx:VM01(Provost-Fernand)@Provost) mig: tx_done > [5931.433875] (0:@) MSG_main finished; Cleaning up the simulation... > [5931.433875] (1:Master@Jacquelin) Let's shut down the simulation and kill everyone. > [5931.433875] (1:Master@Jacquelin) Master done. diff --git a/examples/java/cloud/migration/CMakeLists.txt b/examples/java/cloud/migration/CMakeLists.txt index b1620c4363..4967240b2b 100644 --- a/examples/java/cloud/migration/CMakeLists.txt +++ b/examples/java/cloud/migration/CMakeLists.txt @@ -5,6 +5,7 @@ set(sources ${CMAKE_CURRENT_SOURCE_DIR}/Daemon.java ${CMAKE_CURRENT_SOURCE_DIR}/Main.java ${CMAKE_CURRENT_SOURCE_DIR}/Test.java + ${CMAKE_CURRENT_SOURCE_DIR}/TestHostOnOff.java ${CMAKE_CURRENT_SOURCE_DIR}/XVM.java ) @@ -41,6 +42,7 @@ set(bin_files PARENT_SCOPE ) set(txt_files + ${CMAKE_CURRENT_SOURCE_DIR}/README ${txt_files} PARENT_SCOPE ) diff --git a/examples/java/cloud/migration/README b/examples/java/cloud/migration/README new file mode 100644 index 0000000000..382141c502 --- /dev/null +++ b/examples/java/cloud/migration/README @@ -0,0 +1,6 @@ +There are two tests: +- The first one aims at validating the migration in presence of consolidated VMs +- The second one aims at validating the robustness of the migration process (the SRC node or the DST node are turned off during the migration process) + +To switch between the first and the second tests, you should instrument Main.java (sorry for that :( ) +Adsein - Thu Oct 9 18:25:39 CEST 2014 diff --git a/examples/java/cloud/migration/TestHostOnOff.java b/examples/java/cloud/migration/TestHostOnOff.java new file mode 100644 index 0000000000..1f4278fcb7 --- /dev/null +++ b/examples/java/cloud/migration/TestHostOnOff.java @@ -0,0 +1,190 @@ +/* Copyright (c) 2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +package cloud.migration; + +import org.simgrid.msg.*; +import org.simgrid.msg.Process; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +// This test aims at validating that the migration process is robust in face of host turning off either on the SRC node or on the DST node. + +public class TestHostOnOff extends Process{ + + public static Host host0 = null; + public static Host host1 = null; + public static Host host2 = null; + + + TestHostOnOff(Host host, String name, String[] args) throws HostNotFoundException, NativeException { + super(host, name, args); + } + + public void main(String[] strings) throws MsgException { + + double startTime = 0; + double endTime = 0; + + /* get hosts 1 and 2*/ + try { + host0 = Host.getByName("host0"); + host1 = Host.getByName("host1"); + host1 = Host.getByName("host2"); + }catch (HostNotFoundException e) { + e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. + } + + // Robustness on the SRC node + //for (int i =0 ; i < 55000 ; i++) + // test_vm_migrate(host1, i); + + // Robustness on the DST node + //for (int i =0 ; i < 55000 ; i++) + // test_vm_migrate(host2, i); + + /* End of Tests */ + Msg.info("Nor more tests, Bye Bye !"); + Main.setEndOfTest(); + } + + public static void test_vm_migrate (Host hostToKill, long killAt) throws MsgException { + Msg.info("**** **** **** ***** ***** Test Migrate with host shutdown ***** ***** **** **** ****"); + Msg.info("Turn on one host, assign a VM on this host, launch a process inside the VM, migrate the VM and turn off either the SRC or DST"); + + host1.off(); + host2.off(); + host1.on(); + host2.on(); + + // Create VM0 + int dpRate = 70; + XVM vm0 = null; + vm0 = new XVM( + host1, + "vm0", + 1, // Nb of vcpu + 2048, // Ramsize, + 125, // Net Bandwidth + null, //VM disk image + -1, //size of disk image, + 125, // Net bandwidth, + dpRate // Memory intensity + ); + vm0.start(); + vm0.setLoad(90); + + String[] args = new String[3]; + + args[0] = "vm0"; + args[1] = "host1"; + args[2] = "host2"; + new Process(host1, "Migrate-" + new Random().nextDouble(), args) { + public void main(String[] args) { + Host destHost = null; + Host sourceHost = null; + + try { + sourceHost = Host.getByName(args[1]); + destHost = Host.getByName(args[2]); + } catch (Exception e) { + e.printStackTrace(); + System.err.println("You are trying to migrate from/to a non existing node"); + } + if (destHost != null) { + if (sourceHost.isOn() && destHost.isOn()) { + + try { + Msg.info("Migrate vm "+args[0]+" to node "+destHost.getName()); + VM.getVMByName(args[0]).migrate(destHost); + } catch (HostFailureException e) { + e.printStackTrace(); + Msg.info("Something occurs during the migration that cannot validate the operation"); + } + } + } + + } + }.start(); + + // Wait killAt ms before killing thehost + Process.sleep(killAt); + hostToKill.off(); + Process.sleep(5); + Msg.info("The migration process should be stopped and we should catch an exception\n"); + Process.sleep(5); + + Process.sleep(50000); + Msg.info("Destroy VMs"); + vm0.shutdown(); + vm0.destroy(); + Process.sleep(20000); + } + + + public static void test_vm_shutdown_destroy () throws HostFailureException { + + Msg.info("**** **** **** ***** ***** Test shutdown /destroy a VM ***** ***** **** **** ****"); + Msg.info("Turn on host1, assign a VM on host1, launch a process inside the VM, and turn off the vm, " + + "destroy it and check whether you can reallocate the same VM"); + + + // Create VM0 + int dpRate = 70; + XVM vm0 = null; + vm0 = new XVM( + host1, + "vm0", + 1, // Nb of vcpu + 2048, // Ramsize, + 125, // Net Bandwidth + null, //VM disk image + -1, //size of disk image, + 125, // Net bandwidth, + dpRate // Memory intensity + ); + Msg.info("Start VM0"); + vm0.start(); + vm0.setLoad(90); + + Process.sleep(5000); + + Msg.info("Shutdown VM0"); + vm0.shutdown(); + Process.sleep(5000); + Msg.info("Destroy VM0"); + vm0.destroy(); + + Process.sleep(5000); + Msg.info("Restart VM0"); + vm0 = new XVM( + host1, + "vm0", + 1, // Nb of vcpu + 2048, // Ramsize, + 125, // Net Bandwidth + null, //VM disk image + -1, //size of disk image, + 125, // Net bandwidth, + dpRate // Memory intensity + ); + vm0.start(); + vm0.setLoad(90); + + Msg.info("You suceed to recreate and restart a VM without generating any exception ! Great the Test is ok"); + + Process.sleep(5000); + vm0.shutdown(); + Process.sleep(5000); + vm0.destroy(); + } + +} + + + + diff --git a/examples/java/cloud/migration/XVM.java b/examples/java/cloud/migration/XVM.java index 97467cb76e..6e3671e866 100644 --- a/examples/java/cloud/migration/XVM.java +++ b/examples/java/cloud/migration/XVM.java @@ -8,6 +8,7 @@ package cloud.migration; import org.simgrid.msg.Host; import org.simgrid.msg.HostNotFoundException; +import org.simgrid.msg.HostFailureException; import org.simgrid.msg.Msg; import org.simgrid.msg.VM; @@ -65,10 +66,16 @@ public class XVM extends VM { return this.currentLoad; } - public void migrate(Host host){ + public void migrate(Host host) throws HostFailureException { Msg.info("Start migration of VM " + this.getName() + " to " + host.getName()); - Msg.info(" currentLoad:" + this.currentLoad + "/ramSize:" + this.ramsize + "/dpIntensity:" + this.dpIntensity + "/remaining:" + this.daemon.getRemaining()); - super.migrate(host); + Msg.info(" currentLoad:" + this.currentLoad + "/ramSize:" + this.ramsize + "/dpIntensity:" + this.dpIntensity + + "/remaining:" + String.format(java.util.Locale.US, "%.2E",this.daemon.getRemaining())); + try{ + super.migrate(host); + } catch (Exception e){ + Msg.info("Something wrong during the live migration of VM "+this.getName()); + throw new HostFailureException(); + } this.setLoad(this.currentLoad); //Fixed the fact that setBound is not propagated to the new node. Msg.info("End of migration of VM " + this.getName() + " to node " + host.getName()); } diff --git a/examples/java/cloud/migration/migration.tesh b/examples/java/cloud/migration/migration.tesh index fc93f692ea..e17cd4ab42 100644 --- a/examples/java/cloud/migration/migration.tesh +++ b/examples/java/cloud/migration/migration.tesh @@ -21,71 +21,35 @@ $ java -classpath ${classpath:=.} cloud/migration/Main ${srcdir:=.}/../platforms > [host0:cloud/migration/Test:(1) 0.000000] [jmsg/INFO] Round trip of VM1 (load 90%) > [host0:cloud/migration/Test:(1) 0.000000] [jmsg/INFO] - Launch migration from host 0 to host 1 > [host0:cloud/migration/Test:(1) 0.000000] [jmsg/INFO] Start migration of VM vm0 to host1 -> [host0:cloud/migration/Test:(1) 0.000000] [jmsg/INFO] currentLoad:90/ramSize:2048/dpIntensity:70/remaining:8.095E11 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 0.000000] [msg_vm/INFO] mig-stage1: remaining_size 2147483648.000000 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 18.598067] [msg_vm/INFO] actual bandwidth 110.118973 (MB/s), threshold 3464043.375348 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 18.598067] [msg_vm/INFO] mig-stage 2:0 updated_size 1009084906.862392 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 18.598067] [msg_vm/INFO] mig-stage2.0: remaining_size 1009084906.862392 (> threshold 3464043.375348) -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 27.337835] [msg_vm/INFO] actual bandwidth 110.110284, threshold 3463770.024427 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 27.337835] [msg_vm/INFO] mig-stage 2:1 updated_size 474198119.178924 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 27.337835] [msg_vm/INFO] mig-stage2.1: remaining_size 474198119.178924 (> threshold 3463770.024427) -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 31.445594] [msg_vm/INFO] actual bandwidth 110.091798, threshold 3463188.514958 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 31.445594] [msg_vm/INFO] mig-stage 2:2 updated_size 222876798.522755 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 31.445594] [msg_vm/INFO] mig-stage2.2: remaining_size 222876798.522755 (> threshold 3463188.514958) -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 33.376962] [msg_vm/INFO] actual bandwidth 110.052494, threshold 3461952.124955 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 33.376962] [msg_vm/INFO] mig-stage 2:3 updated_size 104791237.544459 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 33.376962] [msg_vm/INFO] mig-stage2.3: remaining_size 104791237.544459 (> threshold 3461952.124955) -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 34.285733] [msg_vm/INFO] actual bandwidth 109.969020, threshold 3459326.250492 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 34.285733] [msg_vm/INFO] mig-stage 2:4 updated_size 49307685.020391 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 34.285733] [msg_vm/INFO] mig-stage2.4: remaining_size 49307685.020391 (> threshold 3459326.250492) -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 34.714029] [msg_vm/INFO] actual bandwidth 109.792154, threshold 3453762.521054 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 34.714029] [msg_vm/INFO] mig-stage 2:5 updated_size 23238243.968121 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 34.714029] [msg_vm/INFO] mig-stage2.5: remaining_size 23238243.968121 (> threshold 3453762.521054) -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 34.916568] [msg_vm/INFO] actual bandwidth 109.419289, threshold 3442033.220071 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 34.916568] [msg_vm/INFO] mig-stage 2:6 updated_size 10989284.465950 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 34.916568] [msg_vm/INFO] mig-stage2.6: remaining_size 10989284.465950 (> threshold 3442033.220071) -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 35.013034] [msg_vm/INFO] actual bandwidth 108.641444, threshold 3417564.332268 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 35.013034] [msg_vm/INFO] mig-stage 2:7 updated_size 5234001.988682 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 35.013034] [msg_vm/INFO] mig-stage2.7: remaining_size 5234001.988682 (> threshold 3417564.332268) -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 35.059660] [msg_vm/INFO] actual bandwidth 107.053869, threshold 3367623.544281 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 35.059660] [msg_vm/INFO] mig-stage 2:8 updated_size 2529831.013694 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 35.059660] [msg_vm/INFO] mig-stage2.8: remaining_size 2529831.013694 (< threshold 3367623.544281) -> [host0:__pr_mig_tx:vm0(host0-host1):(16) 35.059660] [msg_vm/INFO] mig-stage3: remaining_size 2529831.013694 +> [host0:cloud/migration/Test:(1) 0.000000] [jmsg/INFO] currentLoad:90/ramSize:2048/dpIntensity:70/remaining:8.10E+11 +> [host0:__pr_mig_tx:vm0(host0-host1):(16) 0.000000] [msg_vm/INFO] Stage 1: Gonna send 2147483648 +> [host0:__pr_mig_tx:vm0(host0-host1):(16) 18.598067] [msg_vm/INFO] Stage 2, gonna send 1009084906 +> [host0:__pr_mig_tx:vm0(host0-host1):(16) 27.337835] [msg_vm/INFO] Stage 2, gonna send 474198119 +> [host0:__pr_mig_tx:vm0(host0-host1):(16) 31.445594] [msg_vm/INFO] Stage 2, gonna send 222876798 +> [host0:__pr_mig_tx:vm0(host0-host1):(16) 33.376962] [msg_vm/INFO] Stage 2, gonna send 104791237 +> [host0:__pr_mig_tx:vm0(host0-host1):(16) 34.285733] [msg_vm/INFO] Stage 2, gonna send 49307685 +> [host0:__pr_mig_tx:vm0(host0-host1):(16) 34.714029] [msg_vm/INFO] Stage 2, gonna send 23238243 +> [host0:__pr_mig_tx:vm0(host0-host1):(16) 34.916568] [msg_vm/INFO] Stage 2, gonna send 10989284 +> [host0:__pr_mig_tx:vm0(host0-host1):(16) 35.013034] [msg_vm/INFO] Stage 2, gonna send 5234001 +> [host0:__pr_mig_tx:vm0(host0-host1):(16) 35.059660] [msg_vm/INFO] Stage 3: Gonna send 2529831.000000 +> [host0:__pr_mig_tx:vm0(host0-host1):(16) 35.082869] [msg_vm/INFO] mig: tx_done > [35.082869] [surf_vm_workstation/INFO] migrate VM(vm0): set bound (7285500000.000000) at host1 -> [host1:__pr_mig_rx:vm0(host0-host1):(15) 35.082869] [msg_vm/INFO] set affinity(0x0000@host1) for vm0 > [host0:cloud/migration/Test:(1) 35.084170] [jmsg/INFO] End of migration of VM vm0 to node host1 > [host0:cloud/migration/Test:(1) 35.084170] [jmsg/INFO] - End of Migration from host 0 to host 1 (duration:35.0841702956701) > [host0:cloud/migration/Test:(1) 35.084170] [jmsg/INFO] - Launch migration from host 1 to host 0 > [host0:cloud/migration/Test:(1) 35.084170] [jmsg/INFO] Start migration of VM vm0 to host0 -> [host0:cloud/migration/Test:(1) 35.084170] [jmsg/INFO] currentLoad:90/ramSize:2048/dpIntensity:70/remaining:6.220564352570236E11 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 35.084170] [msg_vm/INFO] mig-stage1: remaining_size 2147483648.000000 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 53.682237] [msg_vm/INFO] actual bandwidth 110.118973 (MB/s), threshold 3464043.375348 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 53.682237] [msg_vm/INFO] mig-stage 2:0 updated_size 917349915.329448 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 53.682237] [msg_vm/INFO] mig-stage2.0: remaining_size 917349915.329448 (> threshold 3464043.375348) -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 61.627599] [msg_vm/INFO] actual bandwidth 110.108645, threshold 3463718.461873 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 61.627599] [msg_vm/INFO] mig-stage 2:1 updated_size 391905106.046906 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 61.627599] [msg_vm/INFO] mig-stage2.1: remaining_size 391905106.046906 (> threshold 3463718.461873) -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 65.022717] [msg_vm/INFO] actual bandwidth 110.084477, threshold 3462958.209981 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 65.022717] [msg_vm/INFO] mig-stage 2:2 updated_size 167464266.773127 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 65.022717] [msg_vm/INFO] mig-stage2.2: remaining_size 167464266.773127 (> threshold 3462958.209981) -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 66.474224] [msg_vm/INFO] actual bandwidth 110.027970, threshold 3461180.656939 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 66.474224] [msg_vm/INFO] mig-stage 2:3 updated_size 71595605.337913 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 66.474224] [msg_vm/INFO] mig-stage2.3: remaining_size 71595605.337913 (> threshold 3461180.656939) -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 67.095529] [msg_vm/INFO] actual bandwidth 109.896074, threshold 3457031.577357 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 67.095529] [msg_vm/INFO] mig-stage 2:4 updated_size 30645837.890704 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 67.095529] [msg_vm/INFO] mig-stage2.4: remaining_size 30645837.890704 (> threshold 3457031.577357) -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 67.362216] [msg_vm/INFO] actual bandwidth 109.589442, threshold 3447385.759089 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 67.362216] [msg_vm/INFO] mig-stage 2:5 updated_size 13154371.345477 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 67.362216] [msg_vm/INFO] mig-stage2.5: remaining_size 13154371.345477 (> threshold 3447385.759089) -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 67.477431] [msg_vm/INFO] actual bandwidth 108.883138, threshold 3425167.371629 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 67.477431] [msg_vm/INFO] mig-stage 2:6 updated_size 5682988.543846 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 67.477431] [msg_vm/INFO] mig-stage2.6: remaining_size 5682988.543846 (> threshold 3425167.371629) -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 67.527946] [msg_vm/INFO] actual bandwidth 107.290377, threshold 3375063.431326 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 67.527946] [msg_vm/INFO] mig-stage 2:7 updated_size 2491628.685811 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 67.527946] [msg_vm/INFO] mig-stage2.7: remaining_size 2491628.685811 (< threshold 3375063.431326) -> [host1:__pr_mig_tx:vm0(host1-host0):(28) 67.527946] [msg_vm/INFO] mig-stage3: remaining_size 2491628.685811 +> [host0:cloud/migration/Test:(1) 35.084170] [jmsg/INFO] currentLoad:90/ramSize:2048/dpIntensity:70/remaining:6.22E+11 +> [host1:__pr_mig_tx:vm0(host1-host0):(18) 35.084170] [msg_vm/INFO] Stage 1: Gonna send 2147483648 +> [host1:__pr_mig_tx:vm0(host1-host0):(18) 53.682237] [msg_vm/INFO] Stage 2, gonna send 917349915 +> [host1:__pr_mig_tx:vm0(host1-host0):(18) 61.627599] [msg_vm/INFO] Stage 2, gonna send 391905106 +> [host1:__pr_mig_tx:vm0(host1-host0):(18) 65.022717] [msg_vm/INFO] Stage 2, gonna send 167464266 +> [host1:__pr_mig_tx:vm0(host1-host0):(18) 66.474224] [msg_vm/INFO] Stage 2, gonna send 71595605 +> [host1:__pr_mig_tx:vm0(host1-host0):(18) 67.095529] [msg_vm/INFO] Stage 2, gonna send 30645837 +> [host1:__pr_mig_tx:vm0(host1-host0):(18) 67.362216] [msg_vm/INFO] Stage 2, gonna send 13154371 +> [host1:__pr_mig_tx:vm0(host1-host0):(18) 67.477431] [msg_vm/INFO] Stage 2, gonna send 5682988 +> [host1:__pr_mig_tx:vm0(host1-host0):(18) 67.527946] [msg_vm/INFO] Stage 3: Gonna send 2491628.000000 +> [host1:__pr_mig_tx:vm0(host1-host0):(18) 67.550824] [msg_vm/INFO] mig: tx_done > [67.550824] [surf_vm_workstation/INFO] migrate VM(vm0): set bound (7285500000.000000) at host0 -> [host0:__pr_mig_rx:vm0(host1-host0):(27) 67.550824] [msg_vm/INFO] set affinity(0x0000@host0) for vm0 > [host0:cloud/migration/Test:(1) 67.551019] [jmsg/INFO] End of migration of VM vm0 to node host0 > [host0:cloud/migration/Test:(1) 67.551019] [jmsg/INFO] - End of Migration from host 1 to host 0 (duration:32.46684874546391) > [host0:cloud/migration/Test:(1) 67.551019] [jmsg/INFO] @@ -94,71 +58,35 @@ $ java -classpath ${classpath:=.} cloud/migration/Main ${srcdir:=.}/../platforms > Round trip of VM1 (load 80%) > [host0:cloud/migration/Test:(1) 67.551019] [jmsg/INFO] - Launch migration from host 0 to host 1 > [host0:cloud/migration/Test:(1) 67.551019] [jmsg/INFO] Start migration of VM vm0 to host1 -> [host0:cloud/migration/Test:(1) 67.551019] [jmsg/INFO] currentLoad:80/ramSize:2048/dpIntensity:70/remaining:4.6436485611595026E11 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 67.551019] [msg_vm/INFO] mig-stage1: remaining_size 2147483648.000000 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 86.149086] [msg_vm/INFO] actual bandwidth 110.118973 (MB/s), threshold 3464043.375348 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 86.149086] [msg_vm/INFO] mig-stage 2:0 updated_size 1009084906.862392 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 86.149086] [msg_vm/INFO] mig-stage2.0: remaining_size 1009084906.862392 (> threshold 3464043.375348) -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 94.888854] [msg_vm/INFO] actual bandwidth 110.110284, threshold 3463770.024427 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 94.888854] [msg_vm/INFO] mig-stage 2:1 updated_size 474198119.178924 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 94.888854] [msg_vm/INFO] mig-stage2.1: remaining_size 474198119.178924 (> threshold 3463770.024427) -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 98.996613] [msg_vm/INFO] actual bandwidth 110.091798, threshold 3463188.514958 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 98.996613] [msg_vm/INFO] mig-stage 2:2 updated_size 222876798.522756 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 98.996613] [msg_vm/INFO] mig-stage2.2: remaining_size 222876798.522756 (> threshold 3463188.514958) -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 100.927981] [msg_vm/INFO] actual bandwidth 110.052494, threshold 3461952.124955 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 100.927981] [msg_vm/INFO] mig-stage 2:3 updated_size 104791237.544460 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 100.927981] [msg_vm/INFO] mig-stage2.3: remaining_size 104791237.544460 (> threshold 3461952.124955) -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 101.836752] [msg_vm/INFO] actual bandwidth 109.969020, threshold 3459326.250492 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 101.836752] [msg_vm/INFO] mig-stage 2:4 updated_size 49307685.020392 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 101.836752] [msg_vm/INFO] mig-stage2.4: remaining_size 49307685.020392 (> threshold 3459326.250492) -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 102.265048] [msg_vm/INFO] actual bandwidth 109.792154, threshold 3453762.521054 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 102.265048] [msg_vm/INFO] mig-stage 2:5 updated_size 23238243.968121 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 102.265048] [msg_vm/INFO] mig-stage2.5: remaining_size 23238243.968121 (> threshold 3453762.521054) -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 102.467587] [msg_vm/INFO] actual bandwidth 109.419289, threshold 3442033.220071 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 102.467587] [msg_vm/INFO] mig-stage 2:6 updated_size 10989284.465950 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 102.467587] [msg_vm/INFO] mig-stage2.6: remaining_size 10989284.465950 (> threshold 3442033.220071) -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 102.564053] [msg_vm/INFO] actual bandwidth 108.641444, threshold 3417564.332268 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 102.564053] [msg_vm/INFO] mig-stage 2:7 updated_size 5234001.988682 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 102.564053] [msg_vm/INFO] mig-stage2.7: remaining_size 5234001.988682 (> threshold 3417564.332268) -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 102.610680] [msg_vm/INFO] actual bandwidth 107.053869, threshold 3367623.544281 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 102.610680] [msg_vm/INFO] mig-stage 2:8 updated_size 2529831.013694 computed_during_stage1 99363890485.508911 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 102.610680] [msg_vm/INFO] mig-stage2.8: remaining_size 2529831.013694 (< threshold 3367623.544281) -> [host0:__pr_mig_tx:vm0(host0-host1):(39) 102.610680] [msg_vm/INFO] mig-stage3: remaining_size 2529831.013694 +> [host0:cloud/migration/Test:(1) 67.551019] [jmsg/INFO] currentLoad:80/ramSize:2048/dpIntensity:70/remaining:4.64E+11 +> [host0:__pr_mig_tx:vm0(host0-host1):(20) 67.551019] [msg_vm/INFO] Stage 1: Gonna send 2147483648 +> [host0:__pr_mig_tx:vm0(host0-host1):(20) 86.149086] [msg_vm/INFO] Stage 2, gonna send 1009084906 +> [host0:__pr_mig_tx:vm0(host0-host1):(20) 94.888854] [msg_vm/INFO] Stage 2, gonna send 474198119 +> [host0:__pr_mig_tx:vm0(host0-host1):(20) 98.996613] [msg_vm/INFO] Stage 2, gonna send 222876798 +> [host0:__pr_mig_tx:vm0(host0-host1):(20) 100.927981] [msg_vm/INFO] Stage 2, gonna send 104791237 +> [host0:__pr_mig_tx:vm0(host0-host1):(20) 101.836752] [msg_vm/INFO] Stage 2, gonna send 49307685 +> [host0:__pr_mig_tx:vm0(host0-host1):(20) 102.265048] [msg_vm/INFO] Stage 2, gonna send 23238243 +> [host0:__pr_mig_tx:vm0(host0-host1):(20) 102.467587] [msg_vm/INFO] Stage 2, gonna send 10989284 +> [host0:__pr_mig_tx:vm0(host0-host1):(20) 102.564053] [msg_vm/INFO] Stage 2, gonna send 5234001 +> [host0:__pr_mig_tx:vm0(host0-host1):(20) 102.610680] [msg_vm/INFO] Stage 3: Gonna send 2529831.000000 +> [host0:__pr_mig_tx:vm0(host0-host1):(20) 102.633888] [msg_vm/INFO] mig: tx_done > [102.633888] [surf_vm_workstation/INFO] migrate VM(vm0): set bound (6476000000.000000) at host1 -> [host1:__pr_mig_rx:vm0(host0-host1):(38) 102.633888] [msg_vm/INFO] set affinity(0x0000@host1) for vm0 > [host0:cloud/migration/Test:(1) 102.635189] [jmsg/INFO] End of migration of VM vm0 to node host1 > [host0:cloud/migration/Test:(1) 102.635189] [jmsg/INFO] - End of Migration from host 0 to host 1 (duration:35.08417029567006) > [host0:cloud/migration/Test:(1) 102.635189] [jmsg/INFO] - Launch migration from host 1 to host 0 > [host0:cloud/migration/Test:(1) 102.635189] [jmsg/INFO] Start migration of VM vm0 to host0 -> [host0:cloud/migration/Test:(1) 102.635189] [jmsg/INFO] currentLoad:80/ramSize:2048/dpIntensity:70/remaining:2.7692129137297363E11 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 102.635189] [msg_vm/INFO] mig-stage1: remaining_size 2147483648.000000 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 121.233256] [msg_vm/INFO] actual bandwidth 110.118973 (MB/s), threshold 3464043.375348 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 121.233256] [msg_vm/INFO] mig-stage 2:0 updated_size 917349915.329448 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 121.233256] [msg_vm/INFO] mig-stage2.0: remaining_size 917349915.329448 (> threshold 3464043.375348) -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 129.178618] [msg_vm/INFO] actual bandwidth 110.108645, threshold 3463718.461873 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 129.178618] [msg_vm/INFO] mig-stage 2:1 updated_size 391905106.046906 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 129.178618] [msg_vm/INFO] mig-stage2.1: remaining_size 391905106.046906 (> threshold 3463718.461873) -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 132.573736] [msg_vm/INFO] actual bandwidth 110.084477, threshold 3462958.209981 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 132.573736] [msg_vm/INFO] mig-stage 2:2 updated_size 167464266.773128 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 132.573736] [msg_vm/INFO] mig-stage2.2: remaining_size 167464266.773128 (> threshold 3462958.209981) -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 134.025243] [msg_vm/INFO] actual bandwidth 110.027970, threshold 3461180.656939 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 134.025243] [msg_vm/INFO] mig-stage 2:3 updated_size 71595605.337913 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 134.025243] [msg_vm/INFO] mig-stage2.3: remaining_size 71595605.337913 (> threshold 3461180.656939) -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 134.646548] [msg_vm/INFO] actual bandwidth 109.896074, threshold 3457031.577357 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 134.646548] [msg_vm/INFO] mig-stage 2:4 updated_size 30645837.890704 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 134.646548] [msg_vm/INFO] mig-stage2.4: remaining_size 30645837.890704 (> threshold 3457031.577357) -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 134.913235] [msg_vm/INFO] actual bandwidth 109.589442, threshold 3447385.759089 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 134.913235] [msg_vm/INFO] mig-stage 2:5 updated_size 13154371.345477 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 134.913235] [msg_vm/INFO] mig-stage2.5: remaining_size 13154371.345477 (> threshold 3447385.759089) -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 135.028450] [msg_vm/INFO] actual bandwidth 108.883138, threshold 3425167.371628 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 135.028450] [msg_vm/INFO] mig-stage 2:6 updated_size 5682988.543847 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 135.028450] [msg_vm/INFO] mig-stage2.6: remaining_size 5682988.543847 (> threshold 3425167.371628) -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 135.078965] [msg_vm/INFO] actual bandwidth 107.290377, threshold 3375063.431326 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 135.078965] [msg_vm/INFO] mig-stage 2:7 updated_size 2491628.685810 computed_during_stage1 90330809532.280823 dp_rate 0.010155 dp_cap 1932735283.200000 -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 135.078965] [msg_vm/INFO] mig-stage2.7: remaining_size 2491628.685810 (< threshold 3375063.431326) -> [host1:__pr_mig_tx:vm0(host1-host0):(51) 135.078965] [msg_vm/INFO] mig-stage3: remaining_size 2491628.685810 +> [host0:cloud/migration/Test:(1) 102.635189] [jmsg/INFO] currentLoad:80/ramSize:2048/dpIntensity:70/remaining:2.77E+11 +> [host1:__pr_mig_tx:vm0(host1-host0):(22) 102.635189] [msg_vm/INFO] Stage 1: Gonna send 2147483648 +> [host1:__pr_mig_tx:vm0(host1-host0):(22) 121.233256] [msg_vm/INFO] Stage 2, gonna send 917349915 +> [host1:__pr_mig_tx:vm0(host1-host0):(22) 129.178618] [msg_vm/INFO] Stage 2, gonna send 391905106 +> [host1:__pr_mig_tx:vm0(host1-host0):(22) 132.573736] [msg_vm/INFO] Stage 2, gonna send 167464266 +> [host1:__pr_mig_tx:vm0(host1-host0):(22) 134.025243] [msg_vm/INFO] Stage 2, gonna send 71595605 +> [host1:__pr_mig_tx:vm0(host1-host0):(22) 134.646548] [msg_vm/INFO] Stage 2, gonna send 30645837 +> [host1:__pr_mig_tx:vm0(host1-host0):(22) 134.913235] [msg_vm/INFO] Stage 2, gonna send 13154371 +> [host1:__pr_mig_tx:vm0(host1-host0):(22) 135.028450] [msg_vm/INFO] Stage 2, gonna send 5682988 +> [host1:__pr_mig_tx:vm0(host1-host0):(22) 135.078965] [msg_vm/INFO] Stage 3: Gonna send 2491628.000000 +> [host1:__pr_mig_tx:vm0(host1-host0):(22) 135.101843] [msg_vm/INFO] mig: tx_done > [135.101843] [surf_vm_workstation/INFO] migrate VM(vm0): set bound (6476000000.000000) at host0 -> [host0:__pr_mig_rx:vm0(host1-host0):(50) 135.101843] [msg_vm/INFO] set affinity(0x0000@host0) for vm0 > [host0:cloud/migration/Test:(1) 135.102038] [jmsg/INFO] End of migration of VM vm0 to node host0 > [host0:cloud/migration/Test:(1) 135.102038] [jmsg/INFO] - End of Migration from host 1 to host 0 (duration:32.46684874546395) > [host0:cloud/migration/Test:(1) 135.102038] [jmsg/INFO] Destroy VMs diff --git a/examples/java/surfCpuModel/TestCpuModel.java b/examples/java/surfCpuModel/TestCpuModel.java index 5dc900f945..068cb8fa57 100644 --- a/examples/java/surfCpuModel/TestCpuModel.java +++ b/examples/java/surfCpuModel/TestCpuModel.java @@ -21,11 +21,11 @@ public class TestCpuModel { public static void main(String[] args) throws NativeException { /* initialize the MSG simulation. Must be done before anything else (even logging). */ + Msg.init(args); + CpuConstantModel cm = new CpuConstantModel(); Surf.setCpuModel(cm); - Msg.init(args); - if(args.length < 2) { Msg.info("Usage : TestPlugin platform_file deployment_file"); Msg.info("example : TestPlugin ping_pong_platform.xml ping_pong_deployment.xml"); diff --git a/examples/java/surfCpuModel/surf_cpu_model.tesh b/examples/java/surfCpuModel/surf_cpu_model.tesh index ce1c446e35..596d2bcf85 100644 --- a/examples/java/surfCpuModel/surf_cpu_model.tesh +++ b/examples/java/surfCpuModel/surf_cpu_model.tesh @@ -1,9 +1,9 @@ #! tesh $ java -classpath ${classpath:=.} surfCpuModel/TestCpuModel ${srcdir:=.}/../platforms/small_platform.xml ${srcdir:=.}/surfCpuModel/surfCpuModelDeployment.xml --cfg=workstation/model:compound -> [0.000000] [jmsg/INFO] Initialize Cpu Constant Model > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'workstation/model' to 'compound' > [0.000000] [jmsg/INFO] Using regular java threads. Coroutines could speed your simulation up. +> [0.000000] [jmsg/INFO] Initialize Cpu Constant Model > [0.000000] [jmsg/INFO] New Cpu(Tremblay, 9.8095E7, 1.0) > [0.000000] [jmsg/INFO] New Cpu(Jupiter, 7.6296E7, 1.0) > [0.000000] [jmsg/INFO] New Cpu(Fafard, 7.6296E7, 1.0) diff --git a/examples/lua/README b/examples/lua/README index 890b886c03..0c01f469e4 100644 --- a/examples/lua/README +++ b/examples/lua/README @@ -1,7 +1,8 @@ Examples contained in this directory -To execute any SimGrid Lua example, the SimGrid dynamic library must be in +To execute any SimGrid Lua example, SimGrid must have been compiled with lua +support enabled (-Denable_lua) and the SimGrid dynamic library must be in your LUA_CPATH. For example: export LUA_CPATH="${LUA_CPATH};/path/to/simgrid/examples/lua/?.so" @@ -17,13 +18,13 @@ export LUA_CPATH="${LUA_CPATH};/path/to/simgrid/examples/lua/?.so" examples/lua/masterslave - Platform Files: - ../../msg/small_platform.xml - + ../../platforms/small_platform.xml + - Deployment Files: ../deploy.xml - - Execute: - lua master_slave.lua + - Execute: + lua master_slave.lua ../../platforms/small_platform.xml ../deploy.xml =============================================================================== * multi_matrix @@ -37,16 +38,16 @@ export LUA_CPATH="${LUA_CPATH};/path/to/simgrid/examples/lua/?.so" - Directory: examples/lua/multi_matrix - + - Platform Files: - quicksort_platform.xml - + quicksort_platform.xml + - Deployment Files: quicksort_deployment.xml - - Execute: + - Execute: lua mult_matrix.lua - + ================================================================================ ================================================================================ diff --git a/examples/msg/actions/actions_split_p0.txt b/examples/msg/actions/actions_split_p0.txt index 35ab7a0835..b873353e26 100644 --- a/examples/msg/actions/actions_split_p0.txt +++ b/examples/msg/actions/actions_split_p0.txt @@ -1,4 +1,4 @@ -# sample action file (with only the actions for p1, +# sample action file (with only the actions for p0, # to be launched by deployment file) p0 init p0 recv p1 diff --git a/examples/msg/chord/chord.c b/examples/msg/chord/chord.c index a64b03a158..96105a851e 100644 --- a/examples/msg/chord/chord.c +++ b/examples/msg/chord/chord.c @@ -297,7 +297,7 @@ int node(int argc, char *argv[]) { /* Reduce the run size for the MC */ - if(MC_is_active()){ + if(MC_is_active() || MC_record_replay_is_active()){ periodic_stabilize_delay = 8; periodic_fix_fingers_delay = 8; periodic_check_predecessor_delay = 8; @@ -371,8 +371,8 @@ int node(int argc, char *argv[]) // no task was received: make some periodic calls - if(MC_is_active()){ - if(!MC_visited_reduction() && no_op){ + if(MC_is_active() || MC_record_replay_is_active()){ + if(MC_is_active() && !MC_visited_reduction() && no_op){ MC_cut(); } if(listen == 0 && (sub_protocol = MC_random(0, 4)) > 0){ diff --git a/examples/msg/cloud/master_worker_vm.tesh b/examples/msg/cloud/master_worker_vm.tesh index 7e7422de80..eda4522be5 100644 --- a/examples/msg/cloud/master_worker_vm.tesh +++ b/examples/msg/cloud/master_worker_vm.tesh @@ -44,39 +44,27 @@ $ $SG_TEST_EXENV ${bindir:=.}/master_worker_vm$EXEEXT --log=no_loc ${srcdir:=.}/ > [VM01:WRK03:(5) 1097.307521] [msg_test/INFO] WRK03 received task(Task03) from mailbox(MBOX:WRK03) > [Jacquelin:master:(1) 1097.307521] [msg_test/INFO] # Migrate all VMs to PM(Intel) > [Intel:__pr_mig_tx:VM00(Intel-Intel):(7) 1097.307521] [msg_vm/WARNING] use the default max_downtime value 30ms -> [Intel:__pr_mig_tx:VM00(Intel-Intel):(7) 1097.307521] [msg_vm/INFO] mig-stage1: remaining_size 1073741824.000000 +> [Intel:__pr_mig_tx:VM00(Intel-Intel):(7) 1097.307521] [msg_vm/INFO] Stage 1: Gonna send 1073741824 > [VM01:WRK03:(5) 1097.380336] [msg_test/INFO] WRK03 executed task(Task03) -> [Intel:__pr_mig_tx:VM00(Intel-Intel):(7) 1099.463824] [msg_vm/INFO] actual bandwidth 474.886827 (MB/s), threshold 14938647.898422 -> [Intel:__pr_mig_tx:VM00(Intel-Intel):(7) 1099.463824] [msg_vm/INFO] mig-stage 2:0 updated_size 0.000000 computed_during_stage1 0.000000 dp_rate 0.000000 dp_cap 0.000000 -> [Intel:__pr_mig_tx:VM00(Intel-Intel):(7) 1099.463824] [msg_vm/INFO] mig-stage2.0: remaining_size 0.000000 (< threshold 14938647.898422) -> [Intel:__pr_mig_tx:VM00(Intel-Intel):(7) 1099.463824] [msg_vm/INFO] mig-stage3: remaining_size 0.000000 +> [Intel:__pr_mig_tx:VM00(Intel-Intel):(7) 1099.463824] [msg_vm/INFO] Stage 3: Gonna send 0.000000 +> [Intel:__pr_mig_tx:VM00(Intel-Intel):(7) 1099.464019] [msg_vm/INFO] mig: tx_done > [1099.464019] [surf_vm_workstation/INFO] migrate VM(VM00): set bound (137333000.000000) at Intel -> [Intel:__pr_mig_rx:VM00(Intel-Intel):(6) 1099.464019] [msg_vm/INFO] set affinity(0x0000@Intel) for VM00 -> [Provost:__pr_mig_tx:VM01(Provost-Intel):(11) 1100.382717] [msg_vm/WARNING] use the default max_downtime value 30ms -> [Provost:__pr_mig_tx:VM01(Provost-Intel):(11) 1100.382717] [msg_vm/INFO] mig-stage1: remaining_size 1073741824.000000 -> [Provost:__pr_mig_tx:VM01(Provost-Intel):(11) 3564.234309] [msg_vm/INFO] actual bandwidth 0.415609 (MB/s), threshold 13073.942775 -> [Provost:__pr_mig_tx:VM01(Provost-Intel):(11) 3564.234309] [msg_vm/INFO] mig-stage 2:0 updated_size 0.000000 computed_during_stage1 0.000000 dp_rate 0.000000 dp_cap 0.000000 -> [Provost:__pr_mig_tx:VM01(Provost-Intel):(11) 3564.234309] [msg_vm/INFO] mig-stage2.0: remaining_size 0.000000 (< threshold 13073.942775) -> [Provost:__pr_mig_tx:VM01(Provost-Intel):(11) 3564.234309] [msg_vm/INFO] mig-stage3: remaining_size 0.000000 +> [Provost:__pr_mig_tx:VM01(Provost-Intel):(9) 1100.382717] [msg_vm/WARNING] use the default max_downtime value 30ms +> [Provost:__pr_mig_tx:VM01(Provost-Intel):(9) 1100.382717] [msg_vm/INFO] Stage 1: Gonna send 1073741824 +> [Provost:__pr_mig_tx:VM01(Provost-Intel):(9) 3564.234309] [msg_vm/INFO] Stage 3: Gonna send 0.000000 +> [Provost:__pr_mig_tx:VM01(Provost-Intel):(9) 3566.242426] [msg_vm/INFO] mig: tx_done > [3566.242426] [surf_vm_workstation/INFO] migrate VM(VM01): set bound (137333000.000000) at Intel -> [Intel:__pr_mig_rx:VM01(Provost-Intel):(10) 3566.242426] [msg_vm/INFO] set affinity(0x0000@Intel) for VM01 > [Jacquelin:master:(1) 3567.161124] [msg_test/INFO] # Migrate all VMs to PM(Provost) -> [Intel:__pr_mig_tx:VM00(Intel-Provost):(15) 3567.161124] [msg_vm/WARNING] use the default max_downtime value 30ms -> [Intel:__pr_mig_tx:VM00(Intel-Provost):(15) 3567.161124] [msg_vm/INFO] mig-stage1: remaining_size 1073741824.000000 -> [Intel:__pr_mig_tx:VM00(Intel-Provost):(15) 6031.012716] [msg_vm/INFO] actual bandwidth 0.415609 (MB/s), threshold 13073.942775 -> [Intel:__pr_mig_tx:VM00(Intel-Provost):(15) 6031.012716] [msg_vm/INFO] mig-stage 2:0 updated_size 0.000000 computed_during_stage1 0.000000 dp_rate 0.000000 dp_cap 0.000000 -> [Intel:__pr_mig_tx:VM00(Intel-Provost):(15) 6031.012716] [msg_vm/INFO] mig-stage2.0: remaining_size 0.000000 (< threshold 13073.942775) -> [Intel:__pr_mig_tx:VM00(Intel-Provost):(15) 6031.012716] [msg_vm/INFO] mig-stage3: remaining_size 0.000000 +> [Intel:__pr_mig_tx:VM00(Intel-Provost):(11) 3567.161124] [msg_vm/WARNING] use the default max_downtime value 30ms +> [Intel:__pr_mig_tx:VM00(Intel-Provost):(11) 3567.161124] [msg_vm/INFO] Stage 1: Gonna send 1073741824 +> [Intel:__pr_mig_tx:VM00(Intel-Provost):(11) 6031.012716] [msg_vm/INFO] Stage 3: Gonna send 0.000000 +> [Intel:__pr_mig_tx:VM00(Intel-Provost):(11) 6033.020833] [msg_vm/INFO] mig: tx_done > [6033.020833] [surf_vm_workstation/INFO] migrate VM(VM00): set bound (137333000.000000) at Provost -> [Provost:__pr_mig_rx:VM00(Intel-Provost):(14) 6033.020833] [msg_vm/INFO] set affinity(0x0000@Provost) for VM00 -> [Intel:__pr_mig_tx:VM01(Intel-Provost):(19) 6034.900487] [msg_vm/WARNING] use the default max_downtime value 30ms -> [Intel:__pr_mig_tx:VM01(Intel-Provost):(19) 6034.900487] [msg_vm/INFO] mig-stage1: remaining_size 1073741824.000000 -> [Intel:__pr_mig_tx:VM01(Intel-Provost):(19) 8498.752079] [msg_vm/INFO] actual bandwidth 0.415609 (MB/s), threshold 13073.942775 -> [Intel:__pr_mig_tx:VM01(Intel-Provost):(19) 8498.752079] [msg_vm/INFO] mig-stage 2:0 updated_size 0.000000 computed_during_stage1 0.000000 dp_rate 0.000000 dp_cap 0.000000 -> [Intel:__pr_mig_tx:VM01(Intel-Provost):(19) 8498.752079] [msg_vm/INFO] mig-stage2.0: remaining_size 0.000000 (< threshold 13073.942775) -> [Intel:__pr_mig_tx:VM01(Intel-Provost):(19) 8498.752079] [msg_vm/INFO] mig-stage3: remaining_size 0.000000 +> [Intel:__pr_mig_tx:VM01(Intel-Provost):(13) 6034.900487] [msg_vm/WARNING] use the default max_downtime value 30ms +> [Intel:__pr_mig_tx:VM01(Intel-Provost):(13) 6034.900487] [msg_vm/INFO] Stage 1: Gonna send 1073741824 +> [Intel:__pr_mig_tx:VM01(Intel-Provost):(13) 8498.752079] [msg_vm/INFO] Stage 3: Gonna send 0.000000 +> [Intel:__pr_mig_tx:VM01(Intel-Provost):(13) 8500.760196] [msg_vm/INFO] mig: tx_done > [8500.760196] [surf_vm_workstation/INFO] migrate VM(VM01): set bound (137333000.000000) at Provost -> [Provost:__pr_mig_rx:VM01(Intel-Provost):(18) 8500.760196] [msg_vm/INFO] set affinity(0x0000@Provost) for VM01 > [Jacquelin:master:(1) 8502.639850] [msg_test/INFO] # Shutdown the half of worker processes gracefuly. The remaining half will be forcibly killed. > [VM00:WRK00:(2) 8504.519504] [msg_test/INFO] WRK00 received task(finalize) from mailbox(MBOX:WRK00) > [VM01:WRK01:(3) 8506.399157] [msg_test/INFO] WRK01 received task(finalize) from mailbox(MBOX:WRK01) diff --git a/examples/msg/cloud/simple_vm.tesh b/examples/msg/cloud/simple_vm.tesh index 6adcb34f14..67f6155c6e 100644 --- a/examples/msg/cloud/simple_vm.tesh +++ b/examples/msg/cloud/simple_vm.tesh @@ -65,22 +65,16 @@ $ $SG_TEST_EXENV ${bindir:=.}/simple_vm$EXEEXT --log=no_loc ${srcdir:=.}/../../p > [Fafard:master_:(1) 49.000000] [msg_test/INFO] ### Relocate VM0 between PM0 and PM1 > [49.000000] [surf_vm_workstation/INFO] Create VM(VM0)@PM(Fafard) with 0 mounted disks > [Fafard:__pr_mig_tx:VM0(Fafard-Tremblay):(38) 49.010000] [msg_vm/WARNING] use the default max_downtime value 30ms -> [Fafard:__pr_mig_tx:VM0(Fafard-Tremblay):(38) 49.010000] [msg_vm/INFO] mig-stage1: remaining_size 1073741824.000000 +> [Fafard:__pr_mig_tx:VM0(Fafard-Tremblay):(38) 49.010000] [msg_vm/INFO] Stage 1: Gonna send 1073741824 > [Bourassa:comm_rx:(36) 49.204993] [msg_test/INFO] VM0:comm_tx to Bourassa:comm_rx => 0.204993 sec -> [Fafard:__pr_mig_tx:VM0(Fafard-Tremblay):(38) 191.612841] [msg_vm/INFO] actual bandwidth 7.180783 (MB/s), threshold 225887.888231 -> [Fafard:__pr_mig_tx:VM0(Fafard-Tremblay):(38) 191.612841] [msg_vm/INFO] mig-stage 2:0 updated_size 0.000000 computed_during_stage1 0.000000 dp_rate 0.000000 dp_cap 0.000000 -> [Fafard:__pr_mig_tx:VM0(Fafard-Tremblay):(38) 191.612841] [msg_vm/INFO] mig-stage2.0: remaining_size 0.000000 (< threshold 225887.888231) -> [Fafard:__pr_mig_tx:VM0(Fafard-Tremblay):(38) 191.612841] [msg_vm/INFO] mig-stage3: remaining_size 0.000000 +> [Fafard:__pr_mig_tx:VM0(Fafard-Tremblay):(38) 191.612841] [msg_vm/INFO] Stage 3: Gonna send 0.000000 +> [Fafard:__pr_mig_tx:VM0(Fafard-Tremblay):(38) 191.638550] [msg_vm/INFO] mig: tx_done > [191.638550] [surf_vm_workstation/INFO] migrate VM(VM0): set bound (76296000.000000) at Tremblay -> [Tremblay:__pr_mig_rx:VM0(Fafard-Tremblay):(37) 191.638550] [msg_vm/INFO] set affinity(0x0000@Tremblay) for VM0 -> [Tremblay:__pr_mig_tx:VM0(Tremblay-Fafard):(42) 191.674258] [msg_vm/WARNING] use the default max_downtime value 30ms -> [Tremblay:__pr_mig_tx:VM0(Tremblay-Fafard):(42) 191.674258] [msg_vm/INFO] mig-stage1: remaining_size 1073741824.000000 -> [Tremblay:__pr_mig_tx:VM0(Tremblay-Fafard):(42) 334.173348] [msg_vm/INFO] actual bandwidth 7.186011 (MB/s), threshold 226052.353672 -> [Tremblay:__pr_mig_tx:VM0(Tremblay-Fafard):(42) 334.173348] [msg_vm/INFO] mig-stage 2:0 updated_size 0.000000 computed_during_stage1 0.000000 dp_rate 0.000000 dp_cap 0.000000 -> [Tremblay:__pr_mig_tx:VM0(Tremblay-Fafard):(42) 334.173348] [msg_vm/INFO] mig-stage2.0: remaining_size 0.000000 (< threshold 226052.353672) -> [Tremblay:__pr_mig_tx:VM0(Tremblay-Fafard):(42) 334.173348] [msg_vm/INFO] mig-stage3: remaining_size 0.000000 +> [Tremblay:__pr_mig_tx:VM0(Tremblay-Fafard):(40) 191.674258] [msg_vm/WARNING] use the default max_downtime value 30ms +> [Tremblay:__pr_mig_tx:VM0(Tremblay-Fafard):(40) 191.674258] [msg_vm/INFO] Stage 1: Gonna send 1073741824 +> [Tremblay:__pr_mig_tx:VM0(Tremblay-Fafard):(40) 334.173348] [msg_vm/INFO] Stage 3: Gonna send 0.000000 +> [Tremblay:__pr_mig_tx:VM0(Tremblay-Fafard):(40) 334.199056] [msg_vm/INFO] mig: tx_done > [334.199056] [surf_vm_workstation/CRITICAL] FIXME: may need a proper handling, 1 > [334.199056] [surf_vm_workstation/INFO] migrate VM(VM0): set bound (76296000.000000) at Fafard -> [Fafard:__pr_mig_rx:VM0(Tremblay-Fafard):(41) 334.199056] [msg_vm/INFO] set affinity(0x0000@Fafard) for VM0 > [Fafard:master_:(1) 339.199251] [msg_test/INFO] ## Test 6 (ended) > [339.199251] [msg_test/INFO] Bye (simulation time 339.199) diff --git a/examples/msg/energy/e1/e1.c b/examples/msg/energy/e1/e1.c index 6a3085d3df..bfbb0c0ae8 100644 --- a/examples/msg/energy/e1/e1.c +++ b/examples/msg/energy/e1/e1.c @@ -38,10 +38,10 @@ int dvfs(int argc, char *argv[]) int new_peak_index=2; host = MSG_host_self();; //MSG_get_host_by_name("MyHost1"); - int nb = MSG_get_host_nb_pstates(host); + int nb = MSG_host_get_pstate_number(host); XBT_INFO("Number of Processor states=%d", nb); - double current_peak = MSG_get_host_current_power_peak(host); + double current_peak = MSG_host_get_current_power_peak(host); XBT_INFO("Current power peak=%f", current_peak); // Run a task @@ -59,12 +59,12 @@ int dvfs(int argc, char *argv[]) return 0; } - double peak_at = MSG_get_host_power_peak_at(host, new_peak_index); + double peak_at = MSG_host_get_power_peak_at(host, new_peak_index); XBT_INFO("Changing power peak value to %f (at index %d)", peak_at, new_peak_index); - MSG_set_host_power_peak_at(host, new_peak_index); + MSG_host_set_pstate(host, new_peak_index); - current_peak = MSG_get_host_current_power_peak(host); + current_peak = MSG_host_get_current_power_peak(host); XBT_INFO("Current power peak=%f", current_peak); // Run a second task @@ -78,10 +78,10 @@ int dvfs(int argc, char *argv[]) // Verify the default pstate is set to 0 host = MSG_get_host_by_name("MyHost2"); - int nb2 = MSG_get_host_nb_pstates(host); + int nb2 = MSG_host_get_pstate_number(host); XBT_INFO("Number of Processor states=%d", nb2); - double current_peak2 = MSG_get_host_current_power_peak(host); + double current_peak2 = MSG_host_get_current_power_peak(host); XBT_INFO("Current power peak=%f", current_peak2); return 0; } diff --git a/examples/msg/energy/e2/e2.c b/examples/msg/energy/e2/e2.c index 1be86ff8fe..2d46b2b587 100644 --- a/examples/msg/energy/e2/e2.c +++ b/examples/msg/energy/e2/e2.c @@ -24,52 +24,65 @@ int dvfs(int argc, char *argv[]) { msg_host_t host = NULL; msg_task_t task1 = NULL; - double task_time = 0; host = MSG_get_host_by_name("MyHost1"); - double current_peak = MSG_get_host_current_power_peak(host); - XBT_INFO("Current power peak=%f", current_peak); + XBT_INFO("Energetic profile: %s", + MSG_host_get_property_value(host,"watt_per_state")); + XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); - double consumed_energy = MSG_get_host_consumed_energy(host); - XBT_INFO("Total energy (Joules): %f", consumed_energy); + double start = MSG_get_clock(); + XBT_INFO("Sleep for 10 seconds"); + MSG_process_sleep(10); + XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E; Energy dissipated=%.2f J", + MSG_get_clock()-start, + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); // Run a task + start = MSG_get_clock(); + XBT_INFO("Run a task for 100E6 flops"); task1 = MSG_task_create ("t1", 100E6, 0, NULL); MSG_task_execute (task1); MSG_task_destroy(task1); - - task_time = MSG_get_clock(); - XBT_INFO("Task1 simulation time: %e", task_time); - consumed_energy = MSG_get_host_consumed_energy(host); - XBT_INFO("Total energy (Joules): %f", consumed_energy); + XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", + MSG_get_clock()-start, + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); // ========= Change power peak ========= - int peak_index=2; - double peak_at = MSG_get_host_power_peak_at(host, peak_index); - XBT_INFO("=========Changing power peak value to %f (at index %d)", peak_at, peak_index); - - MSG_set_host_power_peak_at(host, peak_index); + int pstate=2; + MSG_host_set_pstate(host, pstate); + XBT_INFO("========= Requesting pstate %d (speed should be of %.2f flop/s and is of %.2f flop/s)", + pstate, + MSG_host_get_power_peak_at(host, pstate), + MSG_host_get_current_power_peak(host)); // Run a second task + start = MSG_get_clock(); + XBT_INFO("Run a task for 100E6 flops"); task1 = MSG_task_create ("t2", 100E6, 0, NULL); MSG_task_execute (task1); MSG_task_destroy(task1); - - task_time = MSG_get_clock() - task_time; - XBT_INFO("Task2 simulation time: %e", task_time); - - consumed_energy = MSG_get_host_consumed_energy(host); - XBT_INFO("Total energy (Joules): %f", consumed_energy); - - - MSG_process_sleep(3); - - task_time = MSG_get_clock() - task_time; - XBT_INFO("Task3 (sleep) simulation time: %e", task_time); - consumed_energy = MSG_get_host_consumed_energy(host); - XBT_INFO("Total energy (Joules): %f", consumed_energy); - + XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", + MSG_get_clock()-start, + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); + + start = MSG_get_clock(); + XBT_INFO("Sleep for 4 seconds"); + MSG_process_sleep(4); + XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", + MSG_get_clock()-start, + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); + + // =========== Turn the other host off ========== + XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 disipated %.0f J so far.", + MSG_host_get_consumed_energy(MSG_get_host_by_name("MyHost2")) ); + MSG_host_off(MSG_get_host_by_name("MyHost2")); + start = MSG_get_clock(); + MSG_process_sleep(10); + XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", + MSG_get_clock()-start, + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); return 0; } @@ -97,7 +110,7 @@ int main(int argc, char *argv[]) res = MSG_main(); - XBT_INFO("Total simulation time: %e", MSG_get_clock()); + XBT_INFO("Total simulation time: %.2f", MSG_get_clock()); if (res == MSG_OK) return 0; diff --git a/examples/msg/energy/e2/energy_consumption.tesh b/examples/msg/energy/e2/energy_consumption.tesh index 67dedf72ae..574fde4a20 100644 --- a/examples/msg/energy/e2/energy_consumption.tesh +++ b/examples/msg/energy/e2/energy_consumption.tesh @@ -4,15 +4,19 @@ p Testing the mechanism for computing host energy consumption ! output sort $ $SG_TEST_EXENV energy/e2/e2$EXEEXT ${srcdir:=.}/../platforms/energy_platform.xml ${srcdir:=.}/energy/e2/deployment_e2.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" -> [ 0.000000] (1:dvfs_test@MyHost1) Current power peak=100000000.000000 -> [ 0.000000] (1:dvfs_test@MyHost1) Total energy (Joules): 0.000000 -> [ 1.000000] (1:dvfs_test@MyHost1) Task1 simulation time: 1.000000e+00 -> [ 1.000000] (1:dvfs_test@MyHost1) Total energy (Joules): 200.000000 -> [ 1.000000] (1:dvfs_test@MyHost1) =========Changing power peak value to 20000000.000000 (at index 2) -> [ 6.000000] (1:dvfs_test@MyHost1) Task2 simulation time: 5.000000e+00 -> [ 6.000000] (1:dvfs_test@MyHost1) Total energy (Joules): 950.000000 -> [ 9.000000] (1:dvfs_test@MyHost1) Task3 (sleep) simulation time: 4.000000e+00 -> [ 9.000000] (1:dvfs_test@MyHost1) Total energy (Joules): 1220.000000 -> [ 9.000000] (0:@) Total simulation time: 9.000000e+00 -> [ 9.000000] (0:@) Total energy (Joules) of host MyHost1: 1220.000000 -> [ 9.000000] (0:@) Total energy (Joules) of host MyHost2: 0.000000 +> [ 0.000000] (1:dvfs_test@MyHost1) Energetic profile: 95.0:200.0, 93.0:170.0, 90.0:150.0 +> [ 0.000000] (1:dvfs_test@MyHost1) Initial peak speed=1E+08 flop/s; Energy dissipated =0E+00 J +> [ 0.000000] (1:dvfs_test@MyHost1) Sleep for 10 seconds +> [ 10.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=1E+08; Energy dissipated=950.00 J +> [ 10.000000] (1:dvfs_test@MyHost1) Run a task for 100E6 flops +> [ 11.000000] (1:dvfs_test@MyHost1) Task done (duration: 1.00 s). Current peak speed=1E+08 flop/s; Energy dissipated=1150 J +> [ 11.000000] (1:dvfs_test@MyHost1) ========= Requesting pstate 2 (speed should be of 20000000.00 flop/s and is of 20000000.00 flop/s) +> [ 11.000000] (1:dvfs_test@MyHost1) Run a task for 100E6 flops +> [ 16.000000] (1:dvfs_test@MyHost1) Task done (duration: 5.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=1900 J +> [ 16.000000] (1:dvfs_test@MyHost1) Sleep for 4 seconds +> [ 20.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 4.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2260 J +> [ 20.000000] (1:dvfs_test@MyHost1) Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 disipated 2000 J so far. +> [ 30.000000] (0:@) Total simulation time: 30.00 +> [ 30.000000] (0:@) Total energy of host MyHost1: 3160.000000 Joules +> [ 30.000000] (0:@) Total energy of host MyHost2: 2100.000000 Joules +> [ 30.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=3160 J diff --git a/examples/msg/energy/e3/concurrent_tasks.tesh b/examples/msg/energy/e3/concurrent_tasks.tesh index 88b7f3be2c..3dcfbf55a7 100644 --- a/examples/msg/energy/e3/concurrent_tasks.tesh +++ b/examples/msg/energy/e3/concurrent_tasks.tesh @@ -19,5 +19,5 @@ $ $SG_TEST_EXENV energy/e3/e3$EXEEXT ${srcdir:=.}/../platforms/energy_platform.x > [ 8.000000] (1:dvfs_test@MyHost1) Task simulation time: 8.000000e+00 > [ 8.000000] (1:dvfs_test@MyHost1) Total energy (Joules): 1390.000000 > [ 8.000000] (0:@) Total simulation time: 8.000000e+00 -> [ 8.000000] (0:@) Total energy (Joules) of host MyHost1: 1390.000000 -> [ 8.000000] (0:@) Total energy (Joules) of host MyHost2: 0.000000 +> [ 8.000000] (0:@) Total energy of host MyHost1: 1390.000000 Joules +> [ 8.000000] (0:@) Total energy of host MyHost2: 800.000000 Joules diff --git a/examples/msg/energy/e3/e3.c b/examples/msg/energy/e3/e3.c index 1eab1b8cf8..57d3c99e62 100644 --- a/examples/msg/energy/e3/e3.c +++ b/examples/msg/energy/e3/e3.c @@ -59,10 +59,10 @@ static int dvfs(int argc, char *argv[]) double task_time = 0; host = MSG_host_self(); - double current_peak = MSG_get_host_current_power_peak(host); + double current_peak = MSG_host_get_current_power_peak(host); XBT_INFO("Current power peak=%f", current_peak); - double consumed_energy = MSG_get_host_consumed_energy(host); + double consumed_energy = MSG_host_get_consumed_energy(host); XBT_INFO("Total energy (Joules): %f", consumed_energy); // Process 1 - long CPU task @@ -91,7 +91,7 @@ static int dvfs(int argc, char *argv[]) task_time = MSG_get_clock() - task_time; XBT_INFO("Task simulation time: %e", task_time); - consumed_energy = MSG_get_host_consumed_energy(host); + consumed_energy = MSG_host_get_consumed_energy(host); XBT_INFO("Total energy (Joules): %f", consumed_energy); return 0; diff --git a/examples/msg/mc/CMakeLists.txt b/examples/msg/mc/CMakeLists.txt index 483500c018..fb51f84e29 100644 --- a/examples/msg/mc/CMakeLists.txt +++ b/examples/msg/mc/CMakeLists.txt @@ -17,7 +17,20 @@ if(HAVE_MC) target_link_libraries(bugged3 simgrid ) target_link_libraries(electric_fence simgrid ) target_link_libraries(bugged1_liveness simgrid ) - target_link_libraries(bugged2_liveness simgrid ) + target_link_libraries(bugged2_liveness simgrid ) + + if(HAVE_C_STACK_CLEANER) + add_executable(bugged1_liveness_cleaner_on bugged1_liveness.c ) + add_executable(bugged1_liveness_cleaner_off bugged1_liveness.c ) + + target_link_libraries(bugged1_liveness_cleaner_on simgrid ) + target_link_libraries(bugged1_liveness_cleaner_off simgrid ) + + set_target_properties(bugged1_liveness_cleaner_on + PROPERTIES COMPILE_FLAGS "-DGARBAGE_STACK -fstack-cleaner") + set_target_properties(bugged1_liveness_cleaner_off + PROPERTIES COMPILE_FLAGS "-DGARBAGE_STACK -fno-stack-cleaner") + endif() endif() @@ -62,6 +75,7 @@ set(bin_files ${bin_files} ${CMAKE_CURRENT_SOURCE_DIR}/promela_bugged1_liveness ${CMAKE_CURRENT_SOURCE_DIR}/promela_bugged2_liveness + ${CMAKE_CURRENT_SOURCE_DIR}/bugged1_liveness_stack_cleaner PARENT_SCOPE ) set(txt_files diff --git a/examples/msg/mc/bugged1_liveness.c b/examples/msg/mc/bugged1_liveness.c index 09d374613f..5143623f2e 100644 --- a/examples/msg/mc/bugged1_liveness.c +++ b/examples/msg/mc/bugged1_liveness.c @@ -10,6 +10,12 @@ /* LTL property checked : G(r->F(cs)); (r=request of CS, cs=CS ok) */ /******************************************************************************/ +#ifdef GARBAGE_STACK +#include +#include +#include +#endif + #include "msg/msg.h" #include "mc/mc.h" #include "xbt/automaton.h" @@ -28,6 +34,16 @@ int predCS(){ return cs; } +#ifdef GARBAGE_STACK +/** Do not use a clean stack */ +static void garbage_stack(void) { + const size_t size = 256; + int fd = open("/dev/urandom", O_RDONLY); + char foo[size]; + read(fd, foo, size); + close(fd); +} +#endif int coordinator(int argc, char *argv[]) { @@ -84,7 +100,7 @@ int client(int argc, char *argv[]) char *my_mailbox = xbt_strdup(argv[1]); msg_task_t grant = NULL, release = NULL; - + while(1){ XBT_INFO("Ask the request"); MSG_task_send(MSG_task_create("request", 0, 1000, my_mailbox), "coordinator"); @@ -130,6 +146,17 @@ int client(int argc, char *argv[]) return 0; } +static int raw_client(int argc, char *argv[]) +{ +#ifdef GARBAGE_STACK + // At this point the stack of the callee (client) is probably filled with + // zeros and unitialized variables will contain 0. This call will place + // random byes in the stack of the callee: + garbage_stack(); +#endif + return client(argc, argv); +} + int main(int argc, char *argv[]) { @@ -146,7 +173,7 @@ int main(int argc, char *argv[]) MSG_create_environment(platform_file); MSG_function_register("coordinator", coordinator); - MSG_function_register("client", client); + MSG_function_register("client", raw_client); MSG_launch_application(application_file); MSG_main(); diff --git a/examples/msg/mc/bugged1_liveness.tesh b/examples/msg/mc/bugged1_liveness.tesh index 94b5a1de33..5f72c22e51 100644 --- a/examples/msg/mc/bugged1_liveness.tesh +++ b/examples/msg/mc/bugged1_liveness.tesh @@ -15,7 +15,7 @@ $ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/platform.xml ${srcd > [ 0.000000] (1:coordinator@Tremblay) CS release. resource now idle > [ 0.000000] (3:client@Fafard) Ask the request > [ 0.000000] (1:coordinator@Tremblay) CS idle. Grant immediatly -> [ 0.000000] (0:@) Pair 21 already reached (equal to pair 9) ! +> [ 0.000000] (0:@) Pair 22 already reached (equal to pair 10) ! > [ 0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* > [ 0.000000] (0:@) | ACCEPTANCE CYCLE | > [ 0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* @@ -40,7 +40,8 @@ $ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/platform.xml ${srcd > [ 0.000000] (0:@) [(3)Fafard (client)] Wait(comm=(verbose only) [(3)Fafard (client)-> (1)Tremblay (coordinator)]) > [ 0.000000] (0:@) [(3)Fafard (client)] iSend(src=(3)Fafard (client), buff=(verbose only), size=(verbose only)) > [ 0.000000] (0:@) [(1)Tremblay (coordinator)] Wait(comm=(verbose only) [(3)Fafard (client)-> (1)Tremblay (coordinator)]) -> [ 0.000000] (0:@) Expanded pairs = 21 -> [ 0.000000] (0:@) Visited pairs = 21 +> [ 0.000000] (0:@) Expanded pairs = 22 +> [ 0.000000] (0:@) Visited pairs = 20 > [ 0.000000] (0:@) Executed transitions = 20 -> [ 0.000000] (0:@) Counter-example depth : 20 +> [ 0.000000] (0:@) Counter-example depth : 21 + diff --git a/examples/msg/mc/bugged1_liveness_sparse.tesh b/examples/msg/mc/bugged1_liveness_sparse.tesh index 37ac72cf97..bc934d924e 100644 --- a/examples/msg/mc/bugged1_liveness_sparse.tesh +++ b/examples/msg/mc/bugged1_liveness_sparse.tesh @@ -2,7 +2,7 @@ ! expect signal SIGABRT ! timeout 60 -$ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/platform.xml ${srcdir:=.}/deploy_bugged1_liveness.xml --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=contexts/stack_size:256 +$ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/platform.xml ${srcdir:=.}/deploy_bugged1_liveness.xml --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=contexts/stack_size:256 --cfg=model-check/sparse-checkpoint:yes > [ 0.000000] (0:@) Configuration change: Set 'model-check' to '1' > [ 0.000000] (0:@) Configuration change: Set 'model-check/sparse-checkpoint' to 'yes' > [ 0.000000] (0:@) Check the liveness property promela_bugged1_liveness @@ -16,7 +16,7 @@ $ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/platform.xml ${srcd > [ 0.000000] (1:coordinator@Tremblay) CS release. resource now idle > [ 0.000000] (3:client@Fafard) Ask the request > [ 0.000000] (1:coordinator@Tremblay) CS idle. Grant immediatly -> [ 0.000000] (0:@) Pair 21 already reached (equal to pair 9) ! +> [ 0.000000] (0:@) Pair 22 already reached (equal to pair 10) ! > [ 0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* > [ 0.000000] (0:@) | ACCEPTANCE CYCLE | > [ 0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* @@ -41,7 +41,7 @@ $ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/platform.xml ${srcd > [ 0.000000] (0:@) [(3)Fafard (client)] Wait(comm=(verbose only) [(3)Fafard (client)-> (1)Tremblay (coordinator)]) > [ 0.000000] (0:@) [(3)Fafard (client)] iSend(src=(3)Fafard (client), buff=(verbose only), size=(verbose only)) > [ 0.000000] (0:@) [(1)Tremblay (coordinator)] Wait(comm=(verbose only) [(3)Fafard (client)-> (1)Tremblay (coordinator)]) -> [ 0.000000] (0:@) Expanded pairs = 21 -> [ 0.000000] (0:@) Visited pairs = 21 +> [ 0.000000] (0:@) Expanded pairs = 22 +> [ 0.000000] (0:@) Visited pairs = 20 > [ 0.000000] (0:@) Executed transitions = 20 -> [ 0.000000] (0:@) Counter-example depth : 20 +> [ 0.000000] (0:@) Counter-example depth : 21 diff --git a/examples/msg/mc/bugged1_liveness_stack_cleaner b/examples/msg/mc/bugged1_liveness_stack_cleaner new file mode 100755 index 0000000000..2f372b629b --- /dev/null +++ b/examples/msg/mc/bugged1_liveness_stack_cleaner @@ -0,0 +1,59 @@ +#!/bin/sh +# Run the same test compiled with -fstack-cleaner / f-no-stack-cleaner +# and compare the output. + +srcdir="$1" +bindir="$2" + +cd "$srcdir" + +die() { + echo "$@" >&2 + exit 1 +} + +assert() { + if ! eval "$1"; then + die "Assertion failed: $@" + fi +} + +# If we don't have timeout, fake it: +if ! which timeout > /dev/null; then + timeout() { + shift + "$@" + } +fi + +run() { + state=$1 + shift + timeout 30s ${bindir:=.}/bugged1_liveness_cleaner_$state \ + ${srcdir:=.}/../../platforms/platform.xml \ + ${srcdir:=.}/deploy_bugged1_liveness.xml \ + --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" \ + --cfg=contexts/factory:ucontext \ + --cfg=contexts/stack_size:256 + assert 'test $? = 134' +} + +get_states() { + echo "$1" | grep "Expanded pairs = " | sed "s/^.*Expanded pairs = //" | head -n1 +} + +RES_ON="$(run on 2>&1 1>/dev/null)" +RES_OFF="$(run off 2>&1 1>/dev/null)" + +STATES_ON=$(get_states "$RES_ON") +STATES_OFF=$(get_states "$RES_OFF") + +# Both runs finished: +assert 'test -n "$STATES_ON"' +assert 'test -n "$STATES_OFF"' + +# We expect 21 visited pairs with the stack cleaner: +assert 'test "$STATES_ON" = 21' + +# We expect more states without the stack cleaner: +assert 'test "$STATES_ON" -lt "$STATES_OFF"' diff --git a/examples/msg/mc/bugged1_liveness_visited.tesh b/examples/msg/mc/bugged1_liveness_visited.tesh index 30ed49fd9f..d05858a39f 100644 --- a/examples/msg/mc/bugged1_liveness_visited.tesh +++ b/examples/msg/mc/bugged1_liveness_visited.tesh @@ -73,7 +73,7 @@ $ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/platform.xml ${srcd > [ 0.000000] (2:client@Boivin) Ask the request > [ 0.000000] (1:coordinator@Tremblay) CS idle. Grant immediatly > [ 0.000000] (2:client@Boivin) 2 got the answer. Sleep a bit and release it -> [ 0.000000] (0:@) Pair 57 already reached (equal to pair 45) ! +> [ 0.000000] (0:@) Pair 58 already reached (equal to pair 46) ! > [ 0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* > [ 0.000000] (0:@) | ACCEPTANCE CYCLE | > [ 0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* @@ -128,7 +128,8 @@ $ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/platform.xml ${srcd > [ 0.000000] (0:@) [(1)Tremblay (coordinator)] iRecv(dst=(1)Tremblay (coordinator), buff=(verbose only), size=(verbose only)) > [ 0.000000] (0:@) [(2)Boivin (client)] Wait(comm=(verbose only) [(1)Tremblay (coordinator)-> (2)Boivin (client)]) > [ 0.000000] (0:@) [(2)Boivin (client)] iSend(src=(2)Boivin (client), buff=(verbose only), size=(verbose only)) -> [ 0.000000] (0:@) Expanded pairs = 57 -> [ 0.000000] (0:@) Visited pairs = 208 +> [ 0.000000] (0:@) Expanded pairs = 58 +> [ 0.000000] (0:@) Visited pairs = 201 > [ 0.000000] (0:@) Executed transitions = 207 -> [ 0.000000] (0:@) Counter-example depth : 50 +> [ 0.000000] (0:@) Counter-example depth : 51 + diff --git a/examples/msg/mc/bugged1_liveness_visited_sparse.tesh b/examples/msg/mc/bugged1_liveness_visited_sparse.tesh index 0c34a4fd84..9e987ea3cd 100644 --- a/examples/msg/mc/bugged1_liveness_visited_sparse.tesh +++ b/examples/msg/mc/bugged1_liveness_visited_sparse.tesh @@ -2,7 +2,7 @@ ! expect signal SIGABRT ! timeout 90 -$ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/platform.xml ${srcdir:=.}/deploy_bugged1_liveness_visited.xml --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=model-check/visited:100 --cfg=contexts/stack_size:256 +$ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/platform.xml ${srcdir:=.}/deploy_bugged1_liveness_visited.xml --cfg=model-check:1 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=contexts/factory:ucontext --cfg=model-check/visited:100 --cfg=contexts/stack_size:256 --cfg=model-check/sparse-checkpoint:yes > [ 0.000000] (0:@) Configuration change: Set 'model-check' to '1' > [ 0.000000] (0:@) Configuration change: Set 'model-check/visited' to '100' > [ 0.000000] (0:@) Configuration change: Set 'model-check/sparse-checkpoint' to 'yes' @@ -74,7 +74,7 @@ $ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/platform.xml ${srcd > [ 0.000000] (2:client@Boivin) Ask the request > [ 0.000000] (1:coordinator@Tremblay) CS idle. Grant immediatly > [ 0.000000] (2:client@Boivin) 2 got the answer. Sleep a bit and release it -> [ 0.000000] (0:@) Pair 57 already reached (equal to pair 45) ! +> [ 0.000000] (0:@) Pair 58 already reached (equal to pair 46) ! > [ 0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* > [ 0.000000] (0:@) | ACCEPTANCE CYCLE | > [ 0.000000] (0:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* @@ -129,7 +129,7 @@ $ ${bindir:=.}/bugged1_liveness ${srcdir:=.}/../../platforms/platform.xml ${srcd > [ 0.000000] (0:@) [(1)Tremblay (coordinator)] iRecv(dst=(1)Tremblay (coordinator), buff=(verbose only), size=(verbose only)) > [ 0.000000] (0:@) [(2)Boivin (client)] Wait(comm=(verbose only) [(1)Tremblay (coordinator)-> (2)Boivin (client)]) > [ 0.000000] (0:@) [(2)Boivin (client)] iSend(src=(2)Boivin (client), buff=(verbose only), size=(verbose only)) -> [ 0.000000] (0:@) Expanded pairs = 57 -> [ 0.000000] (0:@) Visited pairs = 208 +> [ 0.000000] (0:@) Expanded pairs = 58 +> [ 0.000000] (0:@) Visited pairs = 201 > [ 0.000000] (0:@) Executed transitions = 207 -> [ 0.000000] (0:@) Counter-example depth : 50 +> [ 0.000000] (0:@) Counter-example depth : 51 diff --git a/examples/msg/properties/deployment_properties.xml b/examples/msg/properties/deployment_properties.xml index 54e735b5f3..e601c08139 100644 --- a/examples/msg/properties/deployment_properties.xml +++ b/examples/msg/properties/deployment_properties.xml @@ -9,4 +9,6 @@ + + diff --git a/examples/msg/properties/msg_prop.c b/examples/msg/properties/msg_prop.c index 6ea54d82d1..c9e881f9f7 100644 --- a/examples/msg/properties/msg_prop.c +++ b/examples/msg/properties/msg_prop.c @@ -31,6 +31,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Property test"); int alice(int argc, char *argv[]); int bob(int argc, char *argv[]); int carole(int argc, char *argv[]); +int david(int argc, char *argv[]); msg_error_t test_all(const char *platform_file, const char *application_file); @@ -44,7 +45,7 @@ static void test_host(const char*hostname) const char *value; char exist[] = "Hdd"; - XBT_INFO("== Print the properties of the host"); + XBT_INFO("== Print the properties of the host '%s'", hostname); xbt_dict_foreach(props, cursor, key, data) XBT_INFO(" Host property: '%s' -> '%s'", key, data); @@ -85,6 +86,11 @@ int carole(int argc, char *argv[]) {/* Dump what we have on a remote host */ test_host("host1"); return 0; } +int david(int argc, char *argv[]) {/* Dump what we have on a remote host */ + MSG_process_sleep(2); // Wait for alice and carole to be done with its experiment + test_host("node-0.acme.org"); + return 0; +} int bob(int argc, char *argv[]) { @@ -120,6 +126,7 @@ msg_error_t test_all(const char *platform_file, MSG_function_register("alice", alice); MSG_function_register("bob", bob); MSG_function_register("carole", carole); + MSG_function_register("david", david); MSG_create_environment(platform_file); diff --git a/examples/msg/properties/msg_prop.tesh b/examples/msg/properties/msg_prop.tesh index d6bb37038b..a3d97db863 100644 --- a/examples/msg/properties/msg_prop.tesh +++ b/examples/msg/properties/msg_prop.tesh @@ -4,10 +4,15 @@ p Testing a MSG application with properties in the XML for Hosts, Links and Proc ! output sort $ $SG_TEST_EXENV properties/msg_prop$EXEEXT ${srcdir:=.}/../platforms/prop.xml ${srcdir:=.}/properties/deployment_properties.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" -> [ 0.000000] (0:@) There are 2 hosts in the environment +> [ 0.000000] (0:@) There are 7 hosts in the environment +> [ 0.000000] (0:@) Host 'node-3.acme.org' runs at 1000000000 flops/s +> [ 0.000000] (0:@) Host 'node-0.acme.org' runs at 1000000000 flops/s +> [ 0.000000] (0:@) Host 'node-4.acme.org' runs at 1000000000 flops/s +> [ 0.000000] (0:@) Host 'node-1.acme.org' runs at 1000000000 flops/s +> [ 0.000000] (0:@) Host 'node-2.acme.org' runs at 1000000000 flops/s > [ 0.000000] (0:@) Host 'host1' runs at 1000000000 flops/s > [ 0.000000] (0:@) Host 'host2' runs at 1000000000 flops/s -> [ 0.000000] (1:alice@host1) == Print the properties of the host +> [ 0.000000] (1:alice@host1) == Print the properties of the host 'host1' > [ 0.000000] (1:alice@host1) Host property: 'mem' -> '4' > [ 0.000000] (1:alice@host1) Host property: 'Hdd' -> '180' > [ 0.000000] (1:alice@host1) == Try to get a host property that does not exist @@ -18,7 +23,7 @@ $ $SG_TEST_EXENV properties/msg_prop$EXEEXT ${srcdir:=.}/../platforms/prop.xml $ > [ 0.000000] (2:bob@host1) == Print the properties of the process > [ 0.000000] (2:bob@host1) Process property: SomeProp -> SomeValue > [ 0.000000] (2:bob@host1) == Try to get a process property that does not exist -> [ 1.000000] (3:carole@host2) == Print the properties of the host +> [ 1.000000] (3:carole@host2) == Print the properties of the host 'host1' > [ 1.000000] (3:carole@host2) Host property: 'mem' -> '4' > [ 1.000000] (3:carole@host2) Host property: 'Hdd' -> '180' > [ 1.000000] (3:carole@host2) == Try to get a host property that does not exist @@ -26,3 +31,13 @@ $ $SG_TEST_EXENV properties/msg_prop$EXEEXT ${srcdir:=.}/../platforms/prop.xml $ > [ 1.000000] (3:carole@host2) Property: Hdd old value: 180 > [ 1.000000] (3:carole@host2) == Trying to modify a host property > [ 1.000000] (3:carole@host2) Property: Hdd old value: 250 +> [ 2.000000] (4:david@host2) == Print the properties of the host 'node-0.acme.org' +> [ 2.000000] (4:david@host2) Host property: 'mem' -> '42' +> [ 2.000000] (4:david@host2) Host property: 'bla' -> 'acme cluster' +> [ 2.000000] (4:david@host2) Host property: 'name' -> 'AS2' +> [ 2.000000] (4:david@host2) Host property: 'Hdd' -> '180' +> [ 2.000000] (4:david@host2) == Try to get a host property that does not exist +> [ 2.000000] (4:david@host2) == Try to get a host property that does exist +> [ 2.000000] (4:david@host2) Property: Hdd old value: 180 +> [ 2.000000] (4:david@host2) == Trying to modify a host property +> [ 2.000000] (4:david@host2) Property: Hdd old value: 250 diff --git a/examples/platforms/energy_platform.xml b/examples/platforms/energy_platform.xml index cb6d3325fc..7799229b09 100644 --- a/examples/platforms/energy_platform.xml +++ b/examples/platforms/energy_platform.xml @@ -7,10 +7,12 @@ - + + - + + diff --git a/examples/platforms/prop.xml b/examples/platforms/prop.xml index 17246bbc15..33a34e112a 100644 --- a/examples/platforms/prop.xml +++ b/examples/platforms/prop.xml @@ -20,7 +20,18 @@ - + + + + + + + + diff --git a/examples/simdag/properties/sd_prop.c b/examples/simdag/properties/sd_prop.c index 0ffef3d412..c996fad4c6 100644 --- a/examples/simdag/properties/sd_prop.c +++ b/examples/simdag/properties/sd_prop.c @@ -16,7 +16,6 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Property test"); int main(int argc, char **argv) { - const SD_workstation_t *workstations; SD_workstation_t w1; SD_workstation_t w2; const char *name1; @@ -38,9 +37,8 @@ int main(int argc, char **argv) SD_create_environment(argv[1]); /* init of platform elements */ - workstations = SD_workstation_get_list(); - w1 = workstations[0]; - w2 = workstations[1]; + w1 = SD_workstation_get_by_name("host1"); + w2 = SD_workstation_get_by_name("host2"); SD_workstation_set_access_mode(w2, SD_WORKSTATION_SEQUENTIAL_ACCESS); name1 = SD_workstation_get_name(w1); name2 = SD_workstation_get_name(w2); diff --git a/examples/smpi/CMakeLists.txt b/examples/smpi/CMakeLists.txt index c067e74d61..8effff1913 100644 --- a/examples/smpi/CMakeLists.txt +++ b/examples/smpi/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mc/") diff --git a/examples/smpi/MM/CMakeLists.txt b/examples/smpi/MM/CMakeLists.txt index 366f39c754..bac394d3b6 100644 --- a/examples/smpi/MM/CMakeLists.txt +++ b/examples/smpi/MM/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.6) if(enable_smpi) set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc") set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") if(NOT WIN32) add_executable(MM_mpi MM_mpi.c 2.5D_MM.c Summa.c Matrix_init.c) diff --git a/examples/smpi/NAS/BT/Makefile b/examples/smpi/NAS/BT/Makefile deleted file mode 100644 index dd27503221..0000000000 --- a/examples/smpi/NAS/BT/Makefile +++ /dev/null @@ -1,106 +0,0 @@ -SHELL=/bin/sh -BENCHMARK=bt -BENCHMARKU=BT -VEC= - -include ../config/make.def - - -OBJS = bt.o make_set.o initialize.o exact_solution.o exact_rhs.o \ - set_constants.o adi.o define.o copy_faces.o rhs.o solve_subs.o \ - x_solve$(VEC).o y_solve$(VEC).o z_solve$(VEC).o add.o error.o \ - verify.o setup_mpi.o \ - ${COMMON}/print_results.o ${COMMON}/timers.o - -include ../sys/make.common - -# npbparams.h is included by header.h -# The following rule should do the trick but many make programs (not gmake) -# will do the wrong thing and rebuild the world every time (because the -# mod time on header.h is not changed. One solution would be to -# touch header.h but this might cause confusion if someone has -# accidentally deleted it. Instead, make the dependency on npbparams.h -# explicit in all the lines below (even though dependence is indirect). - -# header.h: npbparams.h - -${PROGRAM}: config - @if [ x$(VERSION) = xvec ] ; then \ - ${MAKE} VEC=_vec exec; \ - elif [ x$(VERSION) = xVEC ] ; then \ - ${MAKE} VEC=_vec exec; \ - else \ - ${MAKE} exec; \ - fi - -exec: $(OBJS) - @if [ x$(SUBTYPE) = xfull ] ; then \ - ${MAKE} bt-full; \ - elif [ x$(SUBTYPE) = xFULL ] ; then \ - ${MAKE} bt-full; \ - elif [ x$(SUBTYPE) = xsimple ] ; then \ - ${MAKE} bt-simple; \ - elif [ x$(SUBTYPE) = xSIMPLE ] ; then \ - ${MAKE} bt-simple; \ - elif [ x$(SUBTYPE) = xfortran ] ; then \ - ${MAKE} bt-fortran; \ - elif [ x$(SUBTYPE) = xFORTRAN ] ; then \ - ${MAKE} bt-fortran; \ - elif [ x$(SUBTYPE) = xepio ] ; then \ - ${MAKE} bt-epio; \ - elif [ x$(SUBTYPE) = xEPIO ] ; then \ - ${MAKE} bt-epio; \ - else \ - ${MAKE} bt-bt; \ - fi - -bt-bt: ${OBJS} btio.o - ${FLINK} ${FLINKFLAGS} -o ${PROGRAM} ${OBJS} btio.o ${FMPI_LIB} - -bt-full: ${OBJS} full_mpiio.o btio_common.o - ${FLINK} ${FLINKFLAGS} -o ${PROGRAM}.mpi_io_full ${OBJS} btio_common.o full_mpiio.o ${FMPI_LIB} - -bt-simple: ${OBJS} simple_mpiio.o btio_common.o - ${FLINK} ${FLINKFLAGS} -o ${PROGRAM}.mpi_io_simple ${OBJS} btio_common.o simple_mpiio.o ${FMPI_LIB} - -bt-fortran: ${OBJS} fortran_io.o btio_common.o - ${FLINK} ${FLINKFLAGS} -o ${PROGRAM}.fortran_io ${OBJS} btio_common.o fortran_io.o ${FMPI_LIB} - -bt-epio: ${OBJS} epio.o btio_common.o - ${FLINK} ${FLINKFLAGS} -o ${PROGRAM}.ep_io ${OBJS} btio_common.o epio.o ${FMPI_LIB} - -.f.o: - ${FCOMPILE} $< - -.c.o: - ${CCOMPILE} $< - - -bt.o: bt.f header.h npbparams.h mpinpb.h -make_set.o: make_set.f header.h npbparams.h mpinpb.h -initialize.o: initialize.f header.h npbparams.h -exact_solution.o: exact_solution.f header.h npbparams.h -exact_rhs.o: exact_rhs.f header.h npbparams.h -set_constants.o: set_constants.f header.h npbparams.h -adi.o: adi.f header.h npbparams.h -define.o: define.f header.h npbparams.h -copy_faces.o: copy_faces.f header.h npbparams.h mpinpb.h -rhs.o: rhs.f header.h npbparams.h -x_solve$(VEC).o: x_solve$(VEC).f header.h work_lhs$(VEC).h npbparams.h mpinpb.h -y_solve$(VEC).o: y_solve$(VEC).f header.h work_lhs$(VEC).h npbparams.h mpinpb.h -z_solve$(VEC).o: z_solve$(VEC).f header.h work_lhs$(VEC).h npbparams.h mpinpb.h -solve_subs.o: solve_subs.f npbparams.h -add.o: add.f header.h npbparams.h -error.o: error.f header.h npbparams.h mpinpb.h -verify.o: verify.f header.h npbparams.h mpinpb.h -setup_mpi.o: setup_mpi.f mpinpb.h npbparams.h -btio.o: btio.f header.h npbparams.h -btio_common.o: btio_common.f mpinpb.h npbparams.h -fortran_io.o: fortran_io.f mpinpb.h npbparams.h -simple_mpiio.o: simple_mpiio.f mpinpb.h npbparams.h -full_mpiio.o: full_mpiio.f mpinpb.h npbparams.h -epio.o: epio.f mpinpb.h npbparams.h - -clean: - - rm -f *.o *~ mputil* - - rm -f npbparams.h core diff --git a/examples/smpi/NAS/BT/add.f b/examples/smpi/NAS/BT/add.f deleted file mode 100644 index e14cde46ef..0000000000 --- a/examples/smpi/NAS/BT/add.f +++ /dev/null @@ -1,30 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine add - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c addition of update to the vector u -c--------------------------------------------------------------------- - - include 'header.h' - - integer c, i, j, k, m - - do c = 1, ncells - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - u(m,i,j,k,c) = u(m,i,j,k,c) + rhs(m,i,j,k,c) - enddo - enddo - enddo - enddo - enddo - - return - end diff --git a/examples/smpi/NAS/BT/adi.f b/examples/smpi/NAS/BT/adi.f deleted file mode 100644 index 58450c028e..0000000000 --- a/examples/smpi/NAS/BT/adi.f +++ /dev/null @@ -1,21 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine adi - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - call copy_faces - - call x_solve - - call y_solve - - call z_solve - - call add - - return - end - diff --git a/examples/smpi/NAS/BT/bt.f b/examples/smpi/NAS/BT/bt.f deleted file mode 100644 index 36e50781b3..0000000000 --- a/examples/smpi/NAS/BT/bt.f +++ /dev/null @@ -1,275 +0,0 @@ -!-------------------------------------------------------------------------! -! ! -! N A S P A R A L L E L B E N C H M A R K S 3.3 ! -! ! -! B T ! -! ! -!-------------------------------------------------------------------------! -! ! -! This benchmark is part of the NAS Parallel Benchmark 3.3 suite. ! -! It is described in NAS Technical Reports 95-020 and 02-007. ! -! ! -! Permission to use, copy, distribute and modify this software ! -! for any purpose with or without fee is hereby granted. We ! -! request, however, that all derived work reference the NAS ! -! Parallel Benchmarks 3.3. This software is provided "as is" ! -! without express or implied warranty. ! -! ! -! Information on NPB 3.3, including the technical report, the ! -! original specifications, source code, results and information ! -! on how to submit new results, is available at: ! -! ! -! http://www.nas.nasa.gov/Software/NPB/ ! -! ! -! Send comments or suggestions to npb@nas.nasa.gov ! -! ! -! NAS Parallel Benchmarks Group ! -! NASA Ames Research Center ! -! Mail Stop: T27A-1 ! -! Moffett Field, CA 94035-1000 ! -! ! -! E-mail: npb@nas.nasa.gov ! -! Fax: (650) 604-3957 ! -! ! -!-------------------------------------------------------------------------! - -c--------------------------------------------------------------------- -c -c Authors: R. F. Van der Wijngaart -c T. Harris -c M. Yarrow -c -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- - program MPBT -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer i, niter, step, c, error, fstatus - double precision navg, mflops, mbytes, n3 - - external timer_read - double precision t, tmax, tiominv, tpc, timer_read - logical verified - character class, cbuff*40 - - integer wr_interval - - call setup_mpi - if (.not. active) goto 999 - -c--------------------------------------------------------------------- -c Root node reads input file (if it exists) else takes -c defaults from parameters -c--------------------------------------------------------------------- - if (node .eq. root) then - - write(*, 1000) - open (unit=2,file='inputbt.data',status='old', iostat=fstatus) -c - rd_interval = 0 - if (fstatus .eq. 0) then - write(*,233) - 233 format(' Reading from input file inputbt.data') - read (2,*) niter - read (2,*) dt - read (2,*) grid_points(1), grid_points(2), grid_points(3) - if (iotype .ne. 0) then - read (2,'(A)') cbuff - read (cbuff,*,iostat=i) wr_interval, rd_interval - if (i .ne. 0) rd_interval = 0 - if (wr_interval .le. 0) wr_interval = wr_default - endif - if (iotype .eq. 1) then - read (2,*) collbuf_nodes, collbuf_size - write(*,*) 'collbuf_nodes ', collbuf_nodes - write(*,*) 'collbuf_size ', collbuf_size - endif - close(2) - else - write(*,234) - niter = niter_default - dt = dt_default - grid_points(1) = problem_size - grid_points(2) = problem_size - grid_points(3) = problem_size - wr_interval = wr_default - if (iotype .eq. 1) then -c set number of nodes involved in collective buffering to 4, -c unless total number of nodes is smaller than that. -c set buffer size for collective buffering to 1MB per node -c collbuf_nodes = min(4,no_nodes) -c set default to No-File-Hints with a value of 0 - collbuf_nodes = 0 - collbuf_size = 1000000 - endif - endif - 234 format(' No input file inputbt.data. Using compiled defaults') - - write(*, 1001) grid_points(1), grid_points(2), grid_points(3) - write(*, 1002) niter, dt - if (no_nodes .ne. total_nodes) write(*, 1004) total_nodes - if (no_nodes .ne. maxcells*maxcells) - > write(*, 1005) maxcells*maxcells - write(*, 1003) no_nodes - - if (iotype .eq. 1) write(*, 1006) 'FULL MPI-IO', wr_interval - if (iotype .eq. 2) write(*, 1006) 'SIMPLE MPI-IO', wr_interval - if (iotype .eq. 3) write(*, 1006) 'EPIO', wr_interval - if (iotype .eq. 4) write(*, 1006) 'FORTRAN IO', wr_interval - - 1000 format(//, ' NAS Parallel Benchmarks 3.3 -- BT Benchmark ',/) - 1001 format(' Size: ', i4, 'x', i4, 'x', i4) - 1002 format(' Iterations: ', i4, ' dt: ', F11.7) - 1004 format(' Total number of processes: ', i5) - 1005 format(' WARNING: compiled for ', i5, ' processes ') - 1003 format(' Number of active processes: ', i5, /) - 1006 format(' BTIO -- ', A, ' write interval: ', i3 /) - - endif - - call mpi_bcast(niter, 1, MPI_INTEGER, - > root, comm_setup, error) - - call mpi_bcast(dt, 1, dp_type, - > root, comm_setup, error) - - call mpi_bcast(grid_points(1), 3, MPI_INTEGER, - > root, comm_setup, error) - - call mpi_bcast(wr_interval, 1, MPI_INTEGER, - > root, comm_setup, error) - - call mpi_bcast(rd_interval, 1, MPI_INTEGER, - > root, comm_setup, error) - - call make_set - - do c = 1, maxcells - if ( (cell_size(1,c) .gt. IMAX) .or. - > (cell_size(2,c) .gt. JMAX) .or. - > (cell_size(3,c) .gt. KMAX) ) then - print *,node, c, (cell_size(i,c),i=1,3) - print *,' Problem size too big for compiled array sizes' - goto 999 - endif - end do - - call set_constants - - call initialize - - call setup_btio - idump = 0 - - call lhsinit - - call exact_rhs - - call compute_buffer_size(5) - -c--------------------------------------------------------------------- -c do one time step to touch all code, and reinitialize -c--------------------------------------------------------------------- - call adi - call initialize - - call timer_clear(2) - -c--------------------------------------------------------------------- -c Synchronize before placing time stamp -c--------------------------------------------------------------------- - call mpi_barrier(comm_setup, error) - - call timer_clear(1) - call timer_start(1) - - do step = 1, niter - - if (node .eq. root) then - if (mod(step, 20) .eq. 0 .or. step .eq. niter .or. - > step .eq. 1) then - write(*, 200) step - 200 format(' Time step ', i4) - endif - endif - - call adi - - if (iotype .ne. 0) then - call timer_start(2) - if (mod(step, wr_interval).eq.0 .or. step .eq. niter) then - if (node .eq. root) then - print *, 'Writing data set, time step', step - endif - if (step .eq. niter .and. rd_interval .gt. 1) then - rd_interval = 1 - endif - call output_timestep - idump = idump + 1 - endif - call timer_stop(2) - endif - end do - - call btio_cleanup - - call timer_stop(1) - t = timer_read(1) - - call verify(niter, class, verified) - - call mpi_reduce(t, tmax, 1, - > dp_type, MPI_MAX, - > root, comm_setup, error) - - if (iotype .ne. 0) then - t = timer_read(2) - if (t .ne. 0.d0) t = 1.0d0 / t - call mpi_reduce(t, tiominv, 1, - > dp_type, MPI_SUM, - > root, comm_setup, error) - endif - - if( node .eq. root ) then - n3 = 1.0d0*grid_points(1)*grid_points(2)*grid_points(3) - navg = (grid_points(1)+grid_points(2)+grid_points(3))/3.0 - if( tmax .ne. 0. ) then - mflops = 1.0e-6*float(niter)* - > (3478.8*n3-17655.7*navg**2+28023.7*navg) - > / tmax - else - mflops = 0.0 - endif - - if (iotype .ne. 0) then - mbytes = n3 * 40.0 * idump * 1.0d-6 - tiominv = tiominv / no_nodes - t = 0.0 - if (tiominv .ne. 0.) t = 1.d0 / tiominv - tpc = 0.0 - if (tmax .ne. 0.) tpc = t * 100.0 / tmax - write(*,1100) t, tpc, mbytes, mbytes*tiominv - 1100 format(/' BTIO -- statistics:'/ - > ' I/O timing in seconds : ', f14.2/ - > ' I/O timing percentage : ', f14.2/ - > ' Total data written (MB) : ', f14.2/ - > ' I/O data rate (MB/sec) : ', f14.2) - endif - - call print_results('BT', class, grid_points(1), - > grid_points(2), grid_points(3), niter, maxcells*maxcells, - > total_nodes, tmax, mflops, ' floating point', - > verified, npbversion,compiletime, cs1, cs2, cs3, cs4, cs5, - > cs6, '(none)') - endif - - 999 continue - call mpi_barrier(MPI_COMM_WORLD, error) - call mpi_finalize(error) - - end - diff --git a/examples/smpi/NAS/BT/btio.f b/examples/smpi/NAS/BT/btio.f deleted file mode 100644 index 1fb730b1f6..0000000000 --- a/examples/smpi/NAS/BT/btio.f +++ /dev/null @@ -1,72 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine setup_btio - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine output_timestep - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine btio_cleanup - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine btio_verify(verified) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - logical verified - - verified = .true. - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine accumulate_norms(xce_acc) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - double precision xce_acc(5) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine checksum_timestep - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - return - end diff --git a/examples/smpi/NAS/BT/btio_common.f b/examples/smpi/NAS/BT/btio_common.f deleted file mode 100644 index 9227a12b70..0000000000 --- a/examples/smpi/NAS/BT/btio_common.f +++ /dev/null @@ -1,30 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine clear_timestep - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer cio, kio, jio, ix - - do cio=1,ncells - do kio=0, cell_size(3,cio)-1 - do jio=0, cell_size(2,cio)-1 - do ix=0,cell_size(1,cio)-1 - u(1,ix, jio,kio,cio) = 0 - u(2,ix, jio,kio,cio) = 0 - u(3,ix, jio,kio,cio) = 0 - u(4,ix, jio,kio,cio) = 0 - u(5,ix, jio,kio,cio) = 0 - enddo - enddo - enddo - enddo - - return - end - diff --git a/examples/smpi/NAS/BT/copy_faces.f b/examples/smpi/NAS/BT/copy_faces.f deleted file mode 100644 index 14b82caf83..0000000000 --- a/examples/smpi/NAS/BT/copy_faces.f +++ /dev/null @@ -1,316 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine copy_faces - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c This function copies the face values of a variable defined on a set -c of cells to the overlap locations of the adjacent sets of cells. -c Because a set of cells interfaces in each direction with exactly one -c other set, we only need to fill six different buffers. We could try to -c overlap communication with computation, by computing -c some internal values while communicating boundary values, but this -c adds so much overhead that it's not clearly useful. -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer i, j, k, c, m, requests(0:11), p0, p1, - > p2, p3, p4, p5, b_size(0:5), ss(0:5), - > sr(0:5), error, statuses(MPI_STATUS_SIZE, 0:11) - -c--------------------------------------------------------------------- -c exit immediately if there are no faces to be copied -c--------------------------------------------------------------------- - if (no_nodes .eq. 1) then - call compute_rhs - return - endif - - ss(0) = start_send_east - ss(1) = start_send_west - ss(2) = start_send_north - ss(3) = start_send_south - ss(4) = start_send_top - ss(5) = start_send_bottom - - sr(0) = start_recv_east - sr(1) = start_recv_west - sr(2) = start_recv_north - sr(3) = start_recv_south - sr(4) = start_recv_top - sr(5) = start_recv_bottom - - b_size(0) = east_size - b_size(1) = west_size - b_size(2) = north_size - b_size(3) = south_size - b_size(4) = top_size - b_size(5) = bottom_size - -c--------------------------------------------------------------------- -c because the difference stencil for the diagonalized scheme is -c orthogonal, we do not have to perform the staged copying of faces, -c but can send all face information simultaneously to the neighboring -c cells in all directions -c--------------------------------------------------------------------- - p0 = 0 - p1 = 0 - p2 = 0 - p3 = 0 - p4 = 0 - p5 = 0 - - do c = 1, ncells - -c--------------------------------------------------------------------- -c fill the buffer to be sent to eastern neighbors (i-dir) -c--------------------------------------------------------------------- - if (cell_coord(1,c) .ne. ncells) then - do k = 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = cell_size(1,c)-2, cell_size(1,c)-1 - do m = 1, 5 - out_buffer(ss(0)+p0) = u(m,i,j,k,c) - p0 = p0 + 1 - end do - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c fill the buffer to be sent to western neighbors -c--------------------------------------------------------------------- - if (cell_coord(1,c) .ne. 1) then - do k = 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = 0, 1 - do m = 1, 5 - out_buffer(ss(1)+p1) = u(m,i,j,k,c) - p1 = p1 + 1 - end do - end do - end do - end do - - endif - -c--------------------------------------------------------------------- -c fill the buffer to be sent to northern neighbors (j_dir) -c--------------------------------------------------------------------- - if (cell_coord(2,c) .ne. ncells) then - do k = 0, cell_size(3,c)-1 - do j = cell_size(2,c)-2, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - do m = 1, 5 - out_buffer(ss(2)+p2) = u(m,i,j,k,c) - p2 = p2 + 1 - end do - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c fill the buffer to be sent to southern neighbors -c--------------------------------------------------------------------- - if (cell_coord(2,c).ne. 1) then - do k = 0, cell_size(3,c)-1 - do j = 0, 1 - do i = 0, cell_size(1,c)-1 - do m = 1, 5 - out_buffer(ss(3)+p3) = u(m,i,j,k,c) - p3 = p3 + 1 - end do - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c fill the buffer to be sent to top neighbors (k-dir) -c--------------------------------------------------------------------- - if (cell_coord(3,c) .ne. ncells) then - do k = cell_size(3,c)-2, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - do m = 1, 5 - out_buffer(ss(4)+p4) = u(m,i,j,k,c) - p4 = p4 + 1 - end do - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c fill the buffer to be sent to bottom neighbors -c--------------------------------------------------------------------- - if (cell_coord(3,c).ne. 1) then - do k=0, 1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - do m = 1, 5 - out_buffer(ss(5)+p5) = u(m,i,j,k,c) - p5 = p5 + 1 - end do - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c cell loop -c--------------------------------------------------------------------- - end do - - call mpi_irecv(in_buffer(sr(0)), b_size(0), - > dp_type, successor(1), WEST, - > comm_rhs, requests(0), error) - call mpi_irecv(in_buffer(sr(1)), b_size(1), - > dp_type, predecessor(1), EAST, - > comm_rhs, requests(1), error) - call mpi_irecv(in_buffer(sr(2)), b_size(2), - > dp_type, successor(2), SOUTH, - > comm_rhs, requests(2), error) - call mpi_irecv(in_buffer(sr(3)), b_size(3), - > dp_type, predecessor(2), NORTH, - > comm_rhs, requests(3), error) - call mpi_irecv(in_buffer(sr(4)), b_size(4), - > dp_type, successor(3), BOTTOM, - > comm_rhs, requests(4), error) - call mpi_irecv(in_buffer(sr(5)), b_size(5), - > dp_type, predecessor(3), TOP, - > comm_rhs, requests(5), error) - - call mpi_isend(out_buffer(ss(0)), b_size(0), - > dp_type, successor(1), EAST, - > comm_rhs, requests(6), error) - call mpi_isend(out_buffer(ss(1)), b_size(1), - > dp_type, predecessor(1), WEST, - > comm_rhs, requests(7), error) - call mpi_isend(out_buffer(ss(2)), b_size(2), - > dp_type,successor(2), NORTH, - > comm_rhs, requests(8), error) - call mpi_isend(out_buffer(ss(3)), b_size(3), - > dp_type,predecessor(2), SOUTH, - > comm_rhs, requests(9), error) - call mpi_isend(out_buffer(ss(4)), b_size(4), - > dp_type,successor(3), TOP, - > comm_rhs, requests(10), error) - call mpi_isend(out_buffer(ss(5)), b_size(5), - > dp_type,predecessor(3), BOTTOM, - > comm_rhs,requests(11), error) - - - call mpi_waitall(12, requests, statuses, error) - -c--------------------------------------------------------------------- -c unpack the data that has just been received; -c--------------------------------------------------------------------- - p0 = 0 - p1 = 0 - p2 = 0 - p3 = 0 - p4 = 0 - p5 = 0 - - do c = 1, ncells - - if (cell_coord(1,c) .ne. 1) then - do k = 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = -2, -1 - do m = 1, 5 - u(m,i,j,k,c) = in_buffer(sr(1)+p0) - p0 = p0 + 1 - end do - end do - end do - end do - endif - - if (cell_coord(1,c) .ne. ncells) then - do k = 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = cell_size(1,c), cell_size(1,c)+1 - do m = 1, 5 - u(m,i,j,k,c) = in_buffer(sr(0)+p1) - p1 = p1 + 1 - end do - end do - end do - end do - end if - - if (cell_coord(2,c) .ne. 1) then - do k = 0, cell_size(3,c)-1 - do j = -2, -1 - do i = 0, cell_size(1,c)-1 - do m = 1, 5 - u(m,i,j,k,c) = in_buffer(sr(3)+p2) - p2 = p2 + 1 - end do - end do - end do - end do - - endif - - if (cell_coord(2,c) .ne. ncells) then - do k = 0, cell_size(3,c)-1 - do j = cell_size(2,c), cell_size(2,c)+1 - do i = 0, cell_size(1,c)-1 - do m = 1, 5 - u(m,i,j,k,c) = in_buffer(sr(2)+p3) - p3 = p3 + 1 - end do - end do - end do - end do - endif - - if (cell_coord(3,c) .ne. 1) then - do k = -2, -1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - do m = 1, 5 - u(m,i,j,k,c) = in_buffer(sr(5)+p4) - p4 = p4 + 1 - end do - end do - end do - end do - endif - - if (cell_coord(3,c) .ne. ncells) then - do k = cell_size(3,c), cell_size(3,c)+1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - do m = 1, 5 - u(m,i,j,k,c) = in_buffer(sr(4)+p5) - p5 = p5 + 1 - end do - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c cells loop -c--------------------------------------------------------------------- - end do - -c--------------------------------------------------------------------- -c do the rest of the rhs that uses the copied face values -c--------------------------------------------------------------------- - call compute_rhs - - return - end diff --git a/examples/smpi/NAS/BT/define.f b/examples/smpi/NAS/BT/define.f deleted file mode 100644 index 03c4c6edd7..0000000000 --- a/examples/smpi/NAS/BT/define.f +++ /dev/null @@ -1,64 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine compute_buffer_size(dim) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - - integer c, dim, face_size - - if (ncells .eq. 1) return - -c--------------------------------------------------------------------- -c compute the actual sizes of the buffers; note that there is -c always one cell face that doesn't need buffer space, because it -c is at the boundary of the grid -c--------------------------------------------------------------------- - west_size = 0 - east_size = 0 - - do c = 1, ncells - face_size = cell_size(2,c) * cell_size(3,c) * dim * 2 - if (cell_coord(1,c).ne.1) west_size = west_size + face_size - if (cell_coord(1,c).ne.ncells) east_size = east_size + - > face_size - end do - - north_size = 0 - south_size = 0 - do c = 1, ncells - face_size = cell_size(1,c)*cell_size(3,c) * dim * 2 - if (cell_coord(2,c).ne.1) south_size = south_size + face_size - if (cell_coord(2,c).ne.ncells) north_size = north_size + - > face_size - end do - - top_size = 0 - bottom_size = 0 - do c = 1, ncells - face_size = cell_size(1,c) * cell_size(2,c) * dim * 2 - if (cell_coord(3,c).ne.1) bottom_size = bottom_size + - > face_size - if (cell_coord(3,c).ne.ncells) top_size = top_size + - > face_size - end do - - start_send_west = 1 - start_send_east = start_send_west + west_size - start_send_south = start_send_east + east_size - start_send_north = start_send_south + south_size - start_send_bottom = start_send_north + north_size - start_send_top = start_send_bottom + bottom_size - start_recv_west = 1 - start_recv_east = start_recv_west + west_size - start_recv_south = start_recv_east + east_size - start_recv_north = start_recv_south + south_size - start_recv_bottom = start_recv_north + north_size - start_recv_top = start_recv_bottom + bottom_size - - return - end - diff --git a/examples/smpi/NAS/BT/epio.f b/examples/smpi/NAS/BT/epio.f deleted file mode 100644 index 52b630999d..0000000000 --- a/examples/smpi/NAS/BT/epio.f +++ /dev/null @@ -1,165 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine setup_btio - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - character*(128) newfilenm - integer m - - if (node .lt. 10000) then - write (newfilenm, 996) filenm,node - else - print *, 'error generating file names (> 10000 nodes)' - stop - endif - -996 format (a,'.',i4.4) - - open (unit=99, file=newfilenm, form='unformatted', - $ status='unknown') - - do m = 1, 5 - xce_sub(m) = 0.d0 - end do - - idump_sub = 0 - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine output_timestep - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - include 'header.h' - include 'mpinpb.h' - - integer ix, iio, jio, kio, cio, aio - - do cio=1,ncells - write(99) - $ ((((u(aio,ix, jio,kio,cio),aio=1,5), - $ ix=0, cell_size(1,cio)-1), - $ jio=0, cell_size(2,cio)-1), - $ kio=0, cell_size(3,cio)-1) - enddo - - idump_sub = idump_sub + 1 - if (rd_interval .gt. 0) then - if (idump_sub .ge. rd_interval) then - - rewind(99) - call acc_sub_norms(idump+1) - - rewind(99) - idump_sub = 0 - endif - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine acc_sub_norms(idump_cur) - - include 'header.h' - include 'mpinpb.h' - - integer idump_cur - - integer ix, jio, kio, cio, ii, m, ichunk - double precision xce_single(5) - - ichunk = idump_cur - idump_sub + 1 - do ii=0, idump_sub-1 - do cio=1,ncells - read(99) - $ ((((u(m,ix, jio,kio,cio),m=1,5), - $ ix=0, cell_size(1,cio)-1), - $ jio=0, cell_size(2,cio)-1), - $ kio=0, cell_size(3,cio)-1) - enddo - - if (node .eq. root) print *, 'Reading data set ', ii+ichunk - - call error_norm(xce_single) - do m = 1, 5 - xce_sub(m) = xce_sub(m) + xce_single(m) - end do - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine btio_cleanup - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - close(unit=99) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine accumulate_norms(xce_acc) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - double precision xce_acc(5) - - character*(128) newfilenm - integer m - - if (rd_interval .gt. 0) goto 20 - - if (node .lt. 10000) then - write (newfilenm, 996) filenm,node - else - print *, 'error generating file names (> 10000 nodes)' - stop - endif - -996 format (a,'.',i4.4) - - open (unit=99, file=newfilenm, - $ form='unformatted') - -c clear the last time step - - call clear_timestep - -c read back the time steps and accumulate norms - - call acc_sub_norms(idump) - - close(unit=99) - - 20 continue - do m = 1, 5 - xce_acc(m) = xce_sub(m) / dble(idump) - end do - - return - end diff --git a/examples/smpi/NAS/BT/error.f b/examples/smpi/NAS/BT/error.f deleted file mode 100644 index 147a582b58..0000000000 --- a/examples/smpi/NAS/BT/error.f +++ /dev/null @@ -1,106 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine error_norm(rms) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c this function computes the norm of the difference between the -c computed solution and the exact solution -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer c, i, j, k, m, ii, jj, kk, d, error - double precision xi, eta, zeta, u_exact(5), rms(5), rms_work(5), - > add - - do m = 1, 5 - rms_work(m) = 0.0d0 - enddo - - do c = 1, ncells - kk = 0 - do k = cell_low(3,c), cell_high(3,c) - zeta = dble(k) * dnzm1 - jj = 0 - do j = cell_low(2,c), cell_high(2,c) - eta = dble(j) * dnym1 - ii = 0 - do i = cell_low(1,c), cell_high(1,c) - xi = dble(i) * dnxm1 - call exact_solution(xi, eta, zeta, u_exact) - - do m = 1, 5 - add = u(m,ii,jj,kk,c)-u_exact(m) - rms_work(m) = rms_work(m) + add*add - enddo - ii = ii + 1 - enddo - jj = jj + 1 - enddo - kk = kk + 1 - enddo - enddo - - call mpi_allreduce(rms_work, rms, 5, dp_type, - > MPI_SUM, comm_setup, error) - - do m = 1, 5 - do d = 1, 3 - rms(m) = rms(m) / dble(grid_points(d)-2) - enddo - rms(m) = dsqrt(rms(m)) - enddo - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine rhs_norm(rms) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer c, i, j, k, d, m, error - double precision rms(5), rms_work(5), add - - do m = 1, 5 - rms_work(m) = 0.0d0 - enddo - - do c = 1, ncells - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - add = rhs(m,i,j,k,c) - rms_work(m) = rms_work(m) + add*add - enddo - enddo - enddo - enddo - enddo - - call mpi_allreduce(rms_work, rms, 5, dp_type, - > MPI_SUM, comm_setup, error) - - do m = 1, 5 - do d = 1, 3 - rms(m) = rms(m) / dble(grid_points(d)-2) - enddo - rms(m) = dsqrt(rms(m)) - enddo - - return - end - diff --git a/examples/smpi/NAS/BT/exact_rhs.f b/examples/smpi/NAS/BT/exact_rhs.f deleted file mode 100644 index 26a2871d20..0000000000 --- a/examples/smpi/NAS/BT/exact_rhs.f +++ /dev/null @@ -1,360 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine exact_rhs - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c compute the right hand side based on exact solution -c--------------------------------------------------------------------- - - include 'header.h' - - double precision dtemp(5), xi, eta, zeta, dtpp - integer c, m, i, j, k, ip1, im1, jp1, - > jm1, km1, kp1 - - -c--------------------------------------------------------------------- -c loop over all cells owned by this node -c--------------------------------------------------------------------- - do c = 1, ncells - -c--------------------------------------------------------------------- -c initialize -c--------------------------------------------------------------------- - do k= 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - do m = 1, 5 - forcing(m,i,j,k,c) = 0.0d0 - enddo - enddo - enddo - enddo - -c--------------------------------------------------------------------- -c xi-direction flux differences -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - zeta = dble(k+cell_low(3,c)) * dnzm1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - eta = dble(j+cell_low(2,c)) * dnym1 - - do i=-2*(1-start(1,c)), cell_size(1,c)+1-2*end(1,c) - xi = dble(i+cell_low(1,c)) * dnxm1 - - call exact_solution(xi, eta, zeta, dtemp) - do m = 1, 5 - ue(i,m) = dtemp(m) - enddo - - dtpp = 1.0d0 / dtemp(1) - - do m = 2, 5 - buf(i,m) = dtpp * dtemp(m) - enddo - - cuf(i) = buf(i,2) * buf(i,2) - buf(i,1) = cuf(i) + buf(i,3) * buf(i,3) + - > buf(i,4) * buf(i,4) - q(i) = 0.5d0*(buf(i,2)*ue(i,2) + buf(i,3)*ue(i,3) + - > buf(i,4)*ue(i,4)) - - enddo - - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - im1 = i-1 - ip1 = i+1 - - forcing(1,i,j,k,c) = forcing(1,i,j,k,c) - - > tx2*( ue(ip1,2)-ue(im1,2) )+ - > dx1tx1*(ue(ip1,1)-2.0d0*ue(i,1)+ue(im1,1)) - - forcing(2,i,j,k,c) = forcing(2,i,j,k,c) - tx2 * ( - > (ue(ip1,2)*buf(ip1,2)+c2*(ue(ip1,5)-q(ip1)))- - > (ue(im1,2)*buf(im1,2)+c2*(ue(im1,5)-q(im1))))+ - > xxcon1*(buf(ip1,2)-2.0d0*buf(i,2)+buf(im1,2))+ - > dx2tx1*( ue(ip1,2)-2.0d0* ue(i,2)+ue(im1,2)) - - forcing(3,i,j,k,c) = forcing(3,i,j,k,c) - tx2 * ( - > ue(ip1,3)*buf(ip1,2)-ue(im1,3)*buf(im1,2))+ - > xxcon2*(buf(ip1,3)-2.0d0*buf(i,3)+buf(im1,3))+ - > dx3tx1*( ue(ip1,3)-2.0d0*ue(i,3) +ue(im1,3)) - - forcing(4,i,j,k,c) = forcing(4,i,j,k,c) - tx2*( - > ue(ip1,4)*buf(ip1,2)-ue(im1,4)*buf(im1,2))+ - > xxcon2*(buf(ip1,4)-2.0d0*buf(i,4)+buf(im1,4))+ - > dx4tx1*( ue(ip1,4)-2.0d0* ue(i,4)+ ue(im1,4)) - - forcing(5,i,j,k,c) = forcing(5,i,j,k,c) - tx2*( - > buf(ip1,2)*(c1*ue(ip1,5)-c2*q(ip1))- - > buf(im1,2)*(c1*ue(im1,5)-c2*q(im1)))+ - > 0.5d0*xxcon3*(buf(ip1,1)-2.0d0*buf(i,1)+ - > buf(im1,1))+ - > xxcon4*(cuf(ip1)-2.0d0*cuf(i)+cuf(im1))+ - > xxcon5*(buf(ip1,5)-2.0d0*buf(i,5)+buf(im1,5))+ - > dx5tx1*( ue(ip1,5)-2.0d0* ue(i,5)+ ue(im1,5)) - enddo - -c--------------------------------------------------------------------- -c Fourth-order dissipation -c--------------------------------------------------------------------- - if (start(1,c) .gt. 0) then - do m = 1, 5 - i = 1 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp * - > (5.0d0*ue(i,m) - 4.0d0*ue(i+1,m) +ue(i+2,m)) - i = 2 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp * - > (-4.0d0*ue(i-1,m) + 6.0d0*ue(i,m) - - > 4.0d0*ue(i+1,m) + ue(i+2,m)) - enddo - endif - - do i = start(1,c)*3, cell_size(1,c)-3*end(1,c)-1 - do m = 1, 5 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp* - > (ue(i-2,m) - 4.0d0*ue(i-1,m) + - > 6.0d0*ue(i,m) - 4.0d0*ue(i+1,m) + ue(i+2,m)) - enddo - enddo - - if (end(1,c) .gt. 0) then - do m = 1, 5 - i = cell_size(1,c)-3 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp * - > (ue(i-2,m) - 4.0d0*ue(i-1,m) + - > 6.0d0*ue(i,m) - 4.0d0*ue(i+1,m)) - i = cell_size(1,c)-2 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp * - > (ue(i-2,m) - 4.0d0*ue(i-1,m) + 5.0d0*ue(i,m)) - enddo - endif - - enddo - enddo - -c--------------------------------------------------------------------- -c eta-direction flux differences -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - zeta = dble(k+cell_low(3,c)) * dnzm1 - do i=start(1,c), cell_size(1,c)-end(1,c)-1 - xi = dble(i+cell_low(1,c)) * dnxm1 - - do j=-2*(1-start(2,c)), cell_size(2,c)+1-2*end(2,c) - eta = dble(j+cell_low(2,c)) * dnym1 - - call exact_solution(xi, eta, zeta, dtemp) - do m = 1, 5 - ue(j,m) = dtemp(m) - enddo - - dtpp = 1.0d0/dtemp(1) - - do m = 2, 5 - buf(j,m) = dtpp * dtemp(m) - enddo - - cuf(j) = buf(j,3) * buf(j,3) - buf(j,1) = cuf(j) + buf(j,2) * buf(j,2) + - > buf(j,4) * buf(j,4) - q(j) = 0.5d0*(buf(j,2)*ue(j,2) + buf(j,3)*ue(j,3) + - > buf(j,4)*ue(j,4)) - enddo - - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - jm1 = j-1 - jp1 = j+1 - - forcing(1,i,j,k,c) = forcing(1,i,j,k,c) - - > ty2*( ue(jp1,3)-ue(jm1,3) )+ - > dy1ty1*(ue(jp1,1)-2.0d0*ue(j,1)+ue(jm1,1)) - - forcing(2,i,j,k,c) = forcing(2,i,j,k,c) - ty2*( - > ue(jp1,2)*buf(jp1,3)-ue(jm1,2)*buf(jm1,3))+ - > yycon2*(buf(jp1,2)-2.0d0*buf(j,2)+buf(jm1,2))+ - > dy2ty1*( ue(jp1,2)-2.0* ue(j,2)+ ue(jm1,2)) - - forcing(3,i,j,k,c) = forcing(3,i,j,k,c) - ty2*( - > (ue(jp1,3)*buf(jp1,3)+c2*(ue(jp1,5)-q(jp1)))- - > (ue(jm1,3)*buf(jm1,3)+c2*(ue(jm1,5)-q(jm1))))+ - > yycon1*(buf(jp1,3)-2.0d0*buf(j,3)+buf(jm1,3))+ - > dy3ty1*( ue(jp1,3)-2.0d0*ue(j,3) +ue(jm1,3)) - - forcing(4,i,j,k,c) = forcing(4,i,j,k,c) - ty2*( - > ue(jp1,4)*buf(jp1,3)-ue(jm1,4)*buf(jm1,3))+ - > yycon2*(buf(jp1,4)-2.0d0*buf(j,4)+buf(jm1,4))+ - > dy4ty1*( ue(jp1,4)-2.0d0*ue(j,4)+ ue(jm1,4)) - - forcing(5,i,j,k,c) = forcing(5,i,j,k,c) - ty2*( - > buf(jp1,3)*(c1*ue(jp1,5)-c2*q(jp1))- - > buf(jm1,3)*(c1*ue(jm1,5)-c2*q(jm1)))+ - > 0.5d0*yycon3*(buf(jp1,1)-2.0d0*buf(j,1)+ - > buf(jm1,1))+ - > yycon4*(cuf(jp1)-2.0d0*cuf(j)+cuf(jm1))+ - > yycon5*(buf(jp1,5)-2.0d0*buf(j,5)+buf(jm1,5))+ - > dy5ty1*(ue(jp1,5)-2.0d0*ue(j,5)+ue(jm1,5)) - enddo - -c--------------------------------------------------------------------- -c Fourth-order dissipation -c--------------------------------------------------------------------- - if (start(2,c) .gt. 0) then - do m = 1, 5 - j = 1 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp * - > (5.0d0*ue(j,m) - 4.0d0*ue(j+1,m) +ue(j+2,m)) - j = 2 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp * - > (-4.0d0*ue(j-1,m) + 6.0d0*ue(j,m) - - > 4.0d0*ue(j+1,m) + ue(j+2,m)) - enddo - endif - - do j = start(2,c)*3, cell_size(2,c)-3*end(2,c)-1 - do m = 1, 5 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp* - > (ue(j-2,m) - 4.0d0*ue(j-1,m) + - > 6.0d0*ue(j,m) - 4.0d0*ue(j+1,m) + ue(j+2,m)) - enddo - enddo - - if (end(2,c) .gt. 0) then - do m = 1, 5 - j = cell_size(2,c)-3 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp * - > (ue(j-2,m) - 4.0d0*ue(j-1,m) + - > 6.0d0*ue(j,m) - 4.0d0*ue(j+1,m)) - j = cell_size(2,c)-2 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp * - > (ue(j-2,m) - 4.0d0*ue(j-1,m) + 5.0d0*ue(j,m)) - - enddo - endif - - enddo - enddo - -c--------------------------------------------------------------------- -c zeta-direction flux differences -c--------------------------------------------------------------------- - do j=start(2,c), cell_size(2,c)-end(2,c)-1 - eta = dble(j+cell_low(2,c)) * dnym1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - xi = dble(i+cell_low(1,c)) * dnxm1 - - do k=-2*(1-start(3,c)), cell_size(3,c)+1-2*end(3,c) - zeta = dble(k+cell_low(3,c)) * dnzm1 - - call exact_solution(xi, eta, zeta, dtemp) - do m = 1, 5 - ue(k,m) = dtemp(m) - enddo - - dtpp = 1.0d0/dtemp(1) - - do m = 2, 5 - buf(k,m) = dtpp * dtemp(m) - enddo - - cuf(k) = buf(k,4) * buf(k,4) - buf(k,1) = cuf(k) + buf(k,2) * buf(k,2) + - > buf(k,3) * buf(k,3) - q(k) = 0.5d0*(buf(k,2)*ue(k,2) + buf(k,3)*ue(k,3) + - > buf(k,4)*ue(k,4)) - enddo - - do k=start(3,c), cell_size(3,c)-end(3,c)-1 - km1 = k-1 - kp1 = k+1 - - forcing(1,i,j,k,c) = forcing(1,i,j,k,c) - - > tz2*( ue(kp1,4)-ue(km1,4) )+ - > dz1tz1*(ue(kp1,1)-2.0d0*ue(k,1)+ue(km1,1)) - - forcing(2,i,j,k,c) = forcing(2,i,j,k,c) - tz2 * ( - > ue(kp1,2)*buf(kp1,4)-ue(km1,2)*buf(km1,4))+ - > zzcon2*(buf(kp1,2)-2.0d0*buf(k,2)+buf(km1,2))+ - > dz2tz1*( ue(kp1,2)-2.0d0* ue(k,2)+ ue(km1,2)) - - forcing(3,i,j,k,c) = forcing(3,i,j,k,c) - tz2 * ( - > ue(kp1,3)*buf(kp1,4)-ue(km1,3)*buf(km1,4))+ - > zzcon2*(buf(kp1,3)-2.0d0*buf(k,3)+buf(km1,3))+ - > dz3tz1*(ue(kp1,3)-2.0d0*ue(k,3)+ue(km1,3)) - - forcing(4,i,j,k,c) = forcing(4,i,j,k,c) - tz2 * ( - > (ue(kp1,4)*buf(kp1,4)+c2*(ue(kp1,5)-q(kp1)))- - > (ue(km1,4)*buf(km1,4)+c2*(ue(km1,5)-q(km1))))+ - > zzcon1*(buf(kp1,4)-2.0d0*buf(k,4)+buf(km1,4))+ - > dz4tz1*( ue(kp1,4)-2.0d0*ue(k,4) +ue(km1,4)) - - forcing(5,i,j,k,c) = forcing(5,i,j,k,c) - tz2 * ( - > buf(kp1,4)*(c1*ue(kp1,5)-c2*q(kp1))- - > buf(km1,4)*(c1*ue(km1,5)-c2*q(km1)))+ - > 0.5d0*zzcon3*(buf(kp1,1)-2.0d0*buf(k,1) - > +buf(km1,1))+ - > zzcon4*(cuf(kp1)-2.0d0*cuf(k)+cuf(km1))+ - > zzcon5*(buf(kp1,5)-2.0d0*buf(k,5)+buf(km1,5))+ - > dz5tz1*( ue(kp1,5)-2.0d0*ue(k,5)+ ue(km1,5)) - enddo - -c--------------------------------------------------------------------- -c Fourth-order dissipation -c--------------------------------------------------------------------- - if (start(3,c) .gt. 0) then - do m = 1, 5 - k = 1 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp * - > (5.0d0*ue(k,m) - 4.0d0*ue(k+1,m) +ue(k+2,m)) - k = 2 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp * - > (-4.0d0*ue(k-1,m) + 6.0d0*ue(k,m) - - > 4.0d0*ue(k+1,m) + ue(k+2,m)) - enddo - endif - - do k = start(3,c)*3, cell_size(3,c)-3*end(3,c)-1 - do m = 1, 5 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp* - > (ue(k-2,m) - 4.0d0*ue(k-1,m) + - > 6.0d0*ue(k,m) - 4.0d0*ue(k+1,m) + ue(k+2,m)) - enddo - enddo - - if (end(3,c) .gt. 0) then - do m = 1, 5 - k = cell_size(3,c)-3 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp * - > (ue(k-2,m) - 4.0d0*ue(k-1,m) + - > 6.0d0*ue(k,m) - 4.0d0*ue(k+1,m)) - k = cell_size(3,c)-2 - forcing(m,i,j,k,c) = forcing(m,i,j,k,c) - dssp * - > (ue(k-2,m) - 4.0d0*ue(k-1,m) + 5.0d0*ue(k,m)) - enddo - endif - - enddo - enddo - -c--------------------------------------------------------------------- -c now change the sign of the forcing function, -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - forcing(m,i,j,k,c) = -1.d0 * forcing(m,i,j,k,c) - enddo - enddo - enddo - enddo - - enddo - - return - end diff --git a/examples/smpi/NAS/BT/exact_solution.f b/examples/smpi/NAS/BT/exact_solution.f deleted file mode 100644 index b093b46d16..0000000000 --- a/examples/smpi/NAS/BT/exact_solution.f +++ /dev/null @@ -1,29 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine exact_solution(xi,eta,zeta,dtemp) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c this function returns the exact solution at point xi, eta, zeta -c--------------------------------------------------------------------- - - include 'header.h' - - double precision xi, eta, zeta, dtemp(5) - integer m - - do m = 1, 5 - dtemp(m) = ce(m,1) + - > xi*(ce(m,2) + xi*(ce(m,5) + xi*(ce(m,8) + xi*ce(m,11)))) + - > eta*(ce(m,3) + eta*(ce(m,6) + eta*(ce(m,9) + eta*ce(m,12))))+ - > zeta*(ce(m,4) + zeta*(ce(m,7) + zeta*(ce(m,10) + - > zeta*ce(m,13)))) - enddo - - return - end - - diff --git a/examples/smpi/NAS/BT/fortran_io.f b/examples/smpi/NAS/BT/fortran_io.f deleted file mode 100644 index d3085a030a..0000000000 --- a/examples/smpi/NAS/BT/fortran_io.f +++ /dev/null @@ -1,174 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine setup_btio - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - character*(128) newfilenm - integer m, ierr - - if (node.eq.root) record_length = 40/fortran_rec_sz - call mpi_bcast(record_length, 1, MPI_INTEGER, - > root, comm_setup, ierr) - - open (unit=99, file=filenm, - $ form='unformatted', access='direct', - $ recl=record_length) - - do m = 1, 5 - xce_sub(m) = 0.d0 - end do - - idump_sub = 0 - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine output_timestep - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - include 'header.h' - include 'mpinpb.h' - - integer ix, jio, kio, cio - - do cio=1,ncells - do kio=0, cell_size(3,cio)-1 - do jio=0, cell_size(2,cio)-1 - iseek=(cell_low(1,cio) + - $ PROBLEM_SIZE*((cell_low(2,cio)+jio) + - $ PROBLEM_SIZE*((cell_low(3,cio)+kio) + - $ PROBLEM_SIZE*idump_sub))) - - do ix=0,cell_size(1,cio)-1 - write(99, rec=iseek+ix+1) - $ u(1,ix, jio,kio,cio), - $ u(2,ix, jio,kio,cio), - $ u(3,ix, jio,kio,cio), - $ u(4,ix, jio,kio,cio), - $ u(5,ix, jio,kio,cio) - enddo - enddo - enddo - enddo - - idump_sub = idump_sub + 1 - if (rd_interval .gt. 0) then - if (idump_sub .ge. rd_interval) then - - call acc_sub_norms(idump+1) - - idump_sub = 0 - endif - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine acc_sub_norms(idump_cur) - - include 'header.h' - include 'mpinpb.h' - - integer idump_cur - - integer ix, jio, kio, cio, ii, m, ichunk - double precision xce_single(5) - - ichunk = idump_cur - idump_sub + 1 - do ii=0, idump_sub-1 - do cio=1,ncells - do kio=0, cell_size(3,cio)-1 - do jio=0, cell_size(2,cio)-1 - iseek=(cell_low(1,cio) + - $ PROBLEM_SIZE*((cell_low(2,cio)+jio) + - $ PROBLEM_SIZE*((cell_low(3,cio)+kio) + - $ PROBLEM_SIZE*ii))) - - - do ix=0,cell_size(1,cio)-1 - read(99, rec=iseek+ix+1) - $ u(1,ix, jio,kio,cio), - $ u(2,ix, jio,kio,cio), - $ u(3,ix, jio,kio,cio), - $ u(4,ix, jio,kio,cio), - $ u(5,ix, jio,kio,cio) - enddo - enddo - enddo - enddo - - if (node .eq. root) print *, 'Reading data set ', ii+ichunk - - call error_norm(xce_single) - do m = 1, 5 - xce_sub(m) = xce_sub(m) + xce_single(m) - end do - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine btio_cleanup - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - close(unit=99) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine accumulate_norms(xce_acc) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - include 'header.h' - include 'mpinpb.h' - - double precision xce_acc(5) - integer m - - if (rd_interval .gt. 0) goto 20 - - open (unit=99, file=filenm, - $ form='unformatted', access='direct', - $ recl=record_length) - -c clear the last time step - - call clear_timestep - -c read back the time steps and accumulate norms - - call acc_sub_norms(idump) - - close(unit=99) - - 20 continue - do m = 1, 5 - xce_acc(m) = xce_sub(m) / dble(idump) - end do - - return - end diff --git a/examples/smpi/NAS/BT/full_mpiio.f b/examples/smpi/NAS/BT/full_mpiio.f deleted file mode 100644 index ecfd41ca73..0000000000 --- a/examples/smpi/NAS/BT/full_mpiio.f +++ /dev/null @@ -1,307 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine setup_btio - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer ierr - integer mstatus(MPI_STATUS_SIZE) - integer sizes(4), starts(4), subsizes(4) - integer cell_btype(maxcells), cell_ftype(maxcells) - integer cell_blength(maxcells) - integer info - character*20 cb_nodes, cb_size - integer c, m - integer cell_disp(maxcells) - - call mpi_bcast(collbuf_nodes, 1, MPI_INTEGER, - > root, comm_setup, ierr) - - call mpi_bcast(collbuf_size, 1, MPI_INTEGER, - > root, comm_setup, ierr) - - if (collbuf_nodes .eq. 0) then - info = MPI_INFO_NULL - else - write (cb_nodes,*) collbuf_nodes - write (cb_size,*) collbuf_size - call MPI_Info_create(info, ierr) - call MPI_Info_set(info, 'cb_nodes', cb_nodes, ierr) - call MPI_Info_set(info, 'cb_buffer_size', cb_size, ierr) - call MPI_Info_set(info, 'collective_buffering', 'true', ierr) - endif - - call MPI_Type_contiguous(5, MPI_DOUBLE_PRECISION, - $ element, ierr) - call MPI_Type_commit(element, ierr) - call MPI_Type_extent(element, eltext, ierr) - - do c = 1, ncells -c -c Outer array dimensions ar same for every cell -c - sizes(1) = IMAX+4 - sizes(2) = JMAX+4 - sizes(3) = KMAX+4 -c -c 4th dimension is cell number, total of maxcells cells -c - sizes(4) = maxcells -c -c Internal dimensions of cells can differ slightly between cells -c - subsizes(1) = cell_size(1, c) - subsizes(2) = cell_size(2, c) - subsizes(3) = cell_size(3, c) -c -c Cell is 4th dimension, 1 cell per cell type to handle varying -c cell sub-array sizes -c - subsizes(4) = 1 - -c -c type constructors use 0-based start addresses -c - starts(1) = 2 - starts(2) = 2 - starts(3) = 2 - starts(4) = c-1 - -c -c Create buftype for a cell -c - call MPI_Type_create_subarray(4, sizes, subsizes, - $ starts, MPI_ORDER_FORTRAN, element, - $ cell_btype(c), ierr) -c -c block length and displacement for joining cells - -c 1 cell buftype per block, cell buftypes have own displacment -c generated from cell number (4th array dimension) -c - cell_blength(c) = 1 - cell_disp(c) = 0 - - enddo -c -c Create combined buftype for all cells -c - call MPI_Type_struct(ncells, cell_blength, cell_disp, - $ cell_btype, combined_btype, ierr) - call MPI_Type_commit(combined_btype, ierr) - - do c = 1, ncells -c -c Entire array size -c - sizes(1) = PROBLEM_SIZE - sizes(2) = PROBLEM_SIZE - sizes(3) = PROBLEM_SIZE - -c -c Size of c'th cell -c - subsizes(1) = cell_size(1, c) - subsizes(2) = cell_size(2, c) - subsizes(3) = cell_size(3, c) - -c -c Starting point in full array of c'th cell -c - starts(1) = cell_low(1,c) - starts(2) = cell_low(2,c) - starts(3) = cell_low(3,c) - - call MPI_Type_create_subarray(3, sizes, subsizes, - $ starts, MPI_ORDER_FORTRAN, - $ element, cell_ftype(c), ierr) - cell_blength(c) = 1 - cell_disp(c) = 0 - enddo - - call MPI_Type_struct(ncells, cell_blength, cell_disp, - $ cell_ftype, combined_ftype, ierr) - call MPI_Type_commit(combined_ftype, ierr) - - iseek=0 - if (node .eq. root) then - call MPI_File_delete(filenm, MPI_INFO_NULL, ierr) - endif - - - call MPI_Barrier(comm_solve, ierr) - - call MPI_File_open(comm_solve, - $ filenm, - $ MPI_MODE_RDWR+MPI_MODE_CREATE, - $ MPI_INFO_NULL, fp, ierr) - - if (ierr .ne. MPI_SUCCESS) then - print *, 'Error opening file' - stop - endif - - call MPI_File_set_view(fp, iseek, element, - $ combined_ftype, 'native', info, ierr) - - if (ierr .ne. MPI_SUCCESS) then - print *, 'Error setting file view' - stop - endif - - do m = 1, 5 - xce_sub(m) = 0.d0 - end do - - idump_sub = 0 - - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine output_timestep - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - include 'header.h' - include 'mpinpb.h' - - integer mstatus(MPI_STATUS_SIZE) - integer ierr - - call MPI_File_write_at_all(fp, iseek, u, - $ 1, combined_btype, mstatus, ierr) - if (ierr .ne. MPI_SUCCESS) then - print *, 'Error writing to file' - stop - endif - - call MPI_Type_size(combined_btype, iosize, ierr) - iseek = iseek + iosize/eltext - - idump_sub = idump_sub + 1 - if (rd_interval .gt. 0) then - if (idump_sub .ge. rd_interval) then - - iseek = 0 - call acc_sub_norms(idump+1) - - iseek = 0 - idump_sub = 0 - endif - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine acc_sub_norms(idump_cur) - - include 'header.h' - include 'mpinpb.h' - - integer idump_cur - - integer ii, m, ichunk - integer ierr - integer mstatus(MPI_STATUS_SIZE) - double precision xce_single(5) - - ichunk = idump_cur - idump_sub + 1 - do ii=0, idump_sub-1 - - call MPI_File_read_at_all(fp, iseek, u, - $ 1, combined_btype, mstatus, ierr) - if (ierr .ne. MPI_SUCCESS) then - print *, 'Error reading back file' - call MPI_File_close(fp, ierr) - stop - endif - - call MPI_Type_size(combined_btype, iosize, ierr) - iseek = iseek + iosize/eltext - - if (node .eq. root) print *, 'Reading data set ', ii+ichunk - - call error_norm(xce_single) - do m = 1, 5 - xce_sub(m) = xce_sub(m) + xce_single(m) - end do - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine btio_cleanup - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - include 'header.h' - include 'mpinpb.h' - - integer ierr - - call MPI_File_close(fp, ierr) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - - subroutine accumulate_norms(xce_acc) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - double precision xce_acc(5) - integer m, ierr - - if (rd_interval .gt. 0) goto 20 - - call MPI_File_open(comm_solve, - $ filenm, - $ MPI_MODE_RDONLY, - $ MPI_INFO_NULL, - $ fp, - $ ierr) - - iseek = 0 - call MPI_File_set_view(fp, iseek, element, combined_ftype, - $ 'native', MPI_INFO_NULL, ierr) - -c clear the last time step - - call clear_timestep - -c read back the time steps and accumulate norms - - call acc_sub_norms(idump) - - call MPI_File_close(fp, ierr) - - 20 continue - do m = 1, 5 - xce_acc(m) = xce_sub(m) / dble(idump) - end do - - return - end - diff --git a/examples/smpi/NAS/BT/header.h b/examples/smpi/NAS/BT/header.h deleted file mode 100644 index 47719da674..0000000000 --- a/examples/smpi/NAS/BT/header.h +++ /dev/null @@ -1,137 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- -c -c header.h -c -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - -c--------------------------------------------------------------------- -c The following include file is generated automatically by the -c "setparams" utility. It defines -c maxcells: the square root of the maximum number of processors -c problem_size: 12, 64, 102, 162 (for class T, A, B, C) -c dt_default: default time step for this problem size if no -c config file -c niter_default: default number of iterations for this problem size -c--------------------------------------------------------------------- - - include 'npbparams.h' - - integer aa, bb, cc, BLOCK_SIZE - parameter (aa=1, bb=2, cc=3, BLOCK_SIZE=5) - - integer ncells, grid_points(3) - double precision elapsed_time - common /global/ elapsed_time, ncells, grid_points - - double precision tx1, tx2, tx3, ty1, ty2, ty3, tz1, tz2, tz3, - > dx1, dx2, dx3, dx4, dx5, dy1, dy2, dy3, dy4, - > dy5, dz1, dz2, dz3, dz4, dz5, dssp, dt, - > ce(5,13), dxmax, dymax, dzmax, xxcon1, xxcon2, - > xxcon3, xxcon4, xxcon5, dx1tx1, dx2tx1, dx3tx1, - > dx4tx1, dx5tx1, yycon1, yycon2, yycon3, yycon4, - > yycon5, dy1ty1, dy2ty1, dy3ty1, dy4ty1, dy5ty1, - > zzcon1, zzcon2, zzcon3, zzcon4, zzcon5, dz1tz1, - > dz2tz1, dz3tz1, dz4tz1, dz5tz1, dnxm1, dnym1, - > dnzm1, c1c2, c1c5, c3c4, c1345, conz1, c1, c2, - > c3, c4, c5, c4dssp, c5dssp, dtdssp, dttx1, bt, - > dttx2, dtty1, dtty2, dttz1, dttz2, c2dttx1, - > c2dtty1, c2dttz1, comz1, comz4, comz5, comz6, - > c3c4tx3, c3c4ty3, c3c4tz3, c2iv, con43, con16 - - common /constants/ tx1, tx2, tx3, ty1, ty2, ty3, tz1, tz2, tz3, - > dx1, dx2, dx3, dx4, dx5, dy1, dy2, dy3, dy4, - > dy5, dz1, dz2, dz3, dz4, dz5, dssp, dt, - > ce, dxmax, dymax, dzmax, xxcon1, xxcon2, - > xxcon3, xxcon4, xxcon5, dx1tx1, dx2tx1, dx3tx1, - > dx4tx1, dx5tx1, yycon1, yycon2, yycon3, yycon4, - > yycon5, dy1ty1, dy2ty1, dy3ty1, dy4ty1, dy5ty1, - > zzcon1, zzcon2, zzcon3, zzcon4, zzcon5, dz1tz1, - > dz2tz1, dz3tz1, dz4tz1, dz5tz1, dnxm1, dnym1, - > dnzm1, c1c2, c1c5, c3c4, c1345, conz1, c1, c2, - > c3, c4, c5, c4dssp, c5dssp, dtdssp, dttx1, bt, - > dttx2, dtty1, dtty2, dttz1, dttz2, c2dttx1, - > c2dtty1, c2dttz1, comz1, comz4, comz5, comz6, - > c3c4tx3, c3c4ty3, c3c4tz3, c2iv, con43, con16 - - integer EAST, WEST, NORTH, SOUTH, - > BOTTOM, TOP - - parameter (EAST=2000, WEST=3000, NORTH=4000, SOUTH=5000, - > BOTTOM=6000, TOP=7000) - - integer cell_coord (3,maxcells), cell_low (3,maxcells), - > cell_high (3,maxcells), cell_size(3,maxcells), - > predecessor(3), slice (3,maxcells), - > grid_size (3), successor(3) , - > start (3,maxcells), end (3,maxcells) - common /partition/ cell_coord, cell_low, cell_high, cell_size, - > grid_size, successor, predecessor, slice, - > start, end - - integer IMAX, JMAX, KMAX, MAX_CELL_DIM, BUF_SIZE - - parameter (MAX_CELL_DIM = (problem_size/maxcells)+1) - - parameter (IMAX=MAX_CELL_DIM,JMAX=MAX_CELL_DIM,KMAX=MAX_CELL_DIM) - - parameter (BUF_SIZE=MAX_CELL_DIM*MAX_CELL_DIM*(maxcells-1)*60+1) - - double precision - > us ( -1:IMAX, -1:JMAX, -1:KMAX, maxcells), - > vs ( -1:IMAX, -1:JMAX, -1:KMAX, maxcells), - > ws ( -1:IMAX, -1:JMAX, -1:KMAX, maxcells), - > qs ( -1:IMAX, -1:JMAX, -1:KMAX, maxcells), - > rho_i ( -1:IMAX, -1:JMAX, -1:KMAX, maxcells), - > square ( -1:IMAX, -1:JMAX, -1:KMAX, maxcells), - > forcing (5, 0:IMAX-1, 0:JMAX-1, 0:KMAX-1, maxcells), - > u (5, -2:IMAX+1,-2:JMAX+1,-2:KMAX+1, maxcells), - > rhs (5, -1:IMAX-1,-1:JMAX-1,-1:KMAX-1, maxcells), - > lhsc (5,5,-1:IMAX-1,-1:JMAX-1,-1:KMAX-1, maxcells), - > backsub_info (5, 0:MAX_CELL_DIM, 0:MAX_CELL_DIM, maxcells), - > in_buffer(BUF_SIZE), out_buffer(BUF_SIZE) - common /fields/ u, us, vs, ws, qs, rho_i, square, - > rhs, forcing, lhsc, in_buffer, out_buffer, - > backsub_info - - double precision cv(-2:MAX_CELL_DIM+1), rhon(-2:MAX_CELL_DIM+1), - > rhos(-2:MAX_CELL_DIM+1), rhoq(-2:MAX_CELL_DIM+1), - > cuf(-2:MAX_CELL_DIM+1), q(-2:MAX_CELL_DIM+1), - > ue(-2:MAX_CELL_DIM+1,5), buf(-2:MAX_CELL_DIM+1,5) - common /work_1d/ cv, rhon, rhos, rhoq, cuf, q, ue, buf - - integer west_size, east_size, bottom_size, top_size, - > north_size, south_size, start_send_west, - > start_send_east, start_send_south, start_send_north, - > start_send_bottom, start_send_top, start_recv_west, - > start_recv_east, start_recv_south, start_recv_north, - > start_recv_bottom, start_recv_top - common /box/ west_size, east_size, bottom_size, - > top_size, north_size, south_size, - > start_send_west, start_send_east, start_send_south, - > start_send_north, start_send_bottom, start_send_top, - > start_recv_west, start_recv_east, start_recv_south, - > start_recv_north, start_recv_bottom, start_recv_top - - double precision tmp_block(5,5), b_inverse(5,5), tmp_vec(5) - common /work_solve/ tmp_block, b_inverse, tmp_vec - -c -c These are used by btio -c - integer collbuf_nodes, collbuf_size, iosize, eltext, - $ combined_btype, fp, idump, record_length, element, - $ combined_ftype, idump_sub, rd_interval - common /btio/ collbuf_nodes, collbuf_size, iosize, eltext, - $ combined_btype, fp, idump, record_length, - $ idump_sub, rd_interval - double precision sum(niter_default), xce_sub(5) - common /btio/ sum, xce_sub - integer*8 iseek - common /btio/ iseek, element, combined_ftype - - - diff --git a/examples/smpi/NAS/BT/initialize.f b/examples/smpi/NAS/BT/initialize.f deleted file mode 100644 index 274cdb1899..0000000000 --- a/examples/smpi/NAS/BT/initialize.f +++ /dev/null @@ -1,308 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine initialize - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c This subroutine initializes the field variable u using -c tri-linear transfinite interpolation of the boundary values -c--------------------------------------------------------------------- - - include 'header.h' - - integer c, i, j, k, m, ii, jj, kk, ix, iy, iz - double precision xi, eta, zeta, Pface(5,3,2), Pxi, Peta, - > Pzeta, temp(5) - -c--------------------------------------------------------------------- -c Later (in compute_rhs) we compute 1/u for every element. A few of -c the corner elements are not used, but it convenient (and faster) -c to compute the whole thing with a simple loop. Make sure those -c values are nonzero by initializing the whole thing here. -c--------------------------------------------------------------------- - do c = 1, ncells - do kk = -1, KMAX - do jj = -1, JMAX - do ii = -1, IMAX - do m = 1, 5 - u(m, ii, jj, kk, c) = 1.0 - end do - end do - end do - end do - end do -c--------------------------------------------------------------------- - - - -c--------------------------------------------------------------------- -c first store the "interpolated" values everywhere on the grid -c--------------------------------------------------------------------- - do c=1, ncells - kk = 0 - do k = cell_low(3,c), cell_high(3,c) - zeta = dble(k) * dnzm1 - jj = 0 - do j = cell_low(2,c), cell_high(2,c) - eta = dble(j) * dnym1 - ii = 0 - do i = cell_low(1,c), cell_high(1,c) - xi = dble(i) * dnxm1 - - do ix = 1, 2 - call exact_solution(dble(ix-1), eta, zeta, - > Pface(1,1,ix)) - enddo - - do iy = 1, 2 - call exact_solution(xi, dble(iy-1) , zeta, - > Pface(1,2,iy)) - enddo - - do iz = 1, 2 - call exact_solution(xi, eta, dble(iz-1), - > Pface(1,3,iz)) - enddo - - do m = 1, 5 - Pxi = xi * Pface(m,1,2) + - > (1.0d0-xi) * Pface(m,1,1) - Peta = eta * Pface(m,2,2) + - > (1.0d0-eta) * Pface(m,2,1) - Pzeta = zeta * Pface(m,3,2) + - > (1.0d0-zeta) * Pface(m,3,1) - - u(m,ii,jj,kk,c) = Pxi + Peta + Pzeta - - > Pxi*Peta - Pxi*Pzeta - Peta*Pzeta + - > Pxi*Peta*Pzeta - - enddo - ii = ii + 1 - enddo - jj = jj + 1 - enddo - kk = kk+1 - enddo - enddo - -c--------------------------------------------------------------------- -c now store the exact values on the boundaries -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c west face -c--------------------------------------------------------------------- - c = slice(1,1) - ii = 0 - xi = 0.0d0 - kk = 0 - do k = cell_low(3,c), cell_high(3,c) - zeta = dble(k) * dnzm1 - jj = 0 - do j = cell_low(2,c), cell_high(2,c) - eta = dble(j) * dnym1 - call exact_solution(xi, eta, zeta, temp) - do m = 1, 5 - u(m,ii,jj,kk,c) = temp(m) - enddo - jj = jj + 1 - enddo - kk = kk + 1 - enddo - -c--------------------------------------------------------------------- -c east face -c--------------------------------------------------------------------- - c = slice(1,ncells) - ii = cell_size(1,c)-1 - xi = 1.0d0 - kk = 0 - do k = cell_low(3,c), cell_high(3,c) - zeta = dble(k) * dnzm1 - jj = 0 - do j = cell_low(2,c), cell_high(2,c) - eta = dble(j) * dnym1 - call exact_solution(xi, eta, zeta, temp) - do m = 1, 5 - u(m,ii,jj,kk,c) = temp(m) - enddo - jj = jj + 1 - enddo - kk = kk + 1 - enddo - -c--------------------------------------------------------------------- -c south face -c--------------------------------------------------------------------- - c = slice(2,1) - jj = 0 - eta = 0.0d0 - kk = 0 - do k = cell_low(3,c), cell_high(3,c) - zeta = dble(k) * dnzm1 - ii = 0 - do i = cell_low(1,c), cell_high(1,c) - xi = dble(i) * dnxm1 - call exact_solution(xi, eta, zeta, temp) - do m = 1, 5 - u(m,ii,jj,kk,c) = temp(m) - enddo - ii = ii + 1 - enddo - kk = kk + 1 - enddo - - -c--------------------------------------------------------------------- -c north face -c--------------------------------------------------------------------- - c = slice(2,ncells) - jj = cell_size(2,c)-1 - eta = 1.0d0 - kk = 0 - do k = cell_low(3,c), cell_high(3,c) - zeta = dble(k) * dnzm1 - ii = 0 - do i = cell_low(1,c), cell_high(1,c) - xi = dble(i) * dnxm1 - call exact_solution(xi, eta, zeta, temp) - do m = 1, 5 - u(m,ii,jj,kk,c) = temp(m) - enddo - ii = ii + 1 - enddo - kk = kk + 1 - enddo - -c--------------------------------------------------------------------- -c bottom face -c--------------------------------------------------------------------- - c = slice(3,1) - kk = 0 - zeta = 0.0d0 - jj = 0 - do j = cell_low(2,c), cell_high(2,c) - eta = dble(j) * dnym1 - ii = 0 - do i =cell_low(1,c), cell_high(1,c) - xi = dble(i) *dnxm1 - call exact_solution(xi, eta, zeta, temp) - do m = 1, 5 - u(m,ii,jj,kk,c) = temp(m) - enddo - ii = ii + 1 - enddo - jj = jj + 1 - enddo - -c--------------------------------------------------------------------- -c top face -c--------------------------------------------------------------------- - c = slice(3,ncells) - kk = cell_size(3,c)-1 - zeta = 1.0d0 - jj = 0 - do j = cell_low(2,c), cell_high(2,c) - eta = dble(j) * dnym1 - ii = 0 - do i =cell_low(1,c), cell_high(1,c) - xi = dble(i) * dnxm1 - call exact_solution(xi, eta, zeta, temp) - do m = 1, 5 - u(m,ii,jj,kk,c) = temp(m) - enddo - ii = ii + 1 - enddo - jj = jj + 1 - enddo - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine lhsinit - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - - integer i, j, k, d, c, m, n - -c--------------------------------------------------------------------- -c loop over all cells -c--------------------------------------------------------------------- - do c = 1, ncells - -c--------------------------------------------------------------------- -c first, initialize the start and end arrays -c--------------------------------------------------------------------- - do d = 1, 3 - if (cell_coord(d,c) .eq. 1) then - start(d,c) = 1 - else - start(d,c) = 0 - endif - if (cell_coord(d,c) .eq. ncells) then - end(d,c) = 1 - else - end(d,c) = 0 - endif - enddo - -c--------------------------------------------------------------------- -c zero the whole left hand side for starters -c--------------------------------------------------------------------- - do k = 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - do m = 1,5 - do n = 1, 5 - lhsc(m,n,i,j,k,c) = 0.0d0 - enddo - enddo - enddo - enddo - enddo - - enddo - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine lhsabinit(lhsa, lhsb, size) - implicit none - - integer size - double precision lhsa(5, 5, -1:size), lhsb(5, 5, -1:size) - - integer i, m, n - -c--------------------------------------------------------------------- -c next, set all diagonal values to 1. This is overkill, but convenient -c--------------------------------------------------------------------- - do i = 0, size - do m = 1, 5 - do n = 1, 5 - lhsa(m,n,i) = 0.0d0 - lhsb(m,n,i) = 0.0d0 - enddo - lhsb(m,m,i) = 1.0d0 - enddo - enddo - - return - end - - - diff --git a/examples/smpi/NAS/BT/inputbt.data.sample b/examples/smpi/NAS/BT/inputbt.data.sample deleted file mode 100644 index 776654e8d0..0000000000 --- a/examples/smpi/NAS/BT/inputbt.data.sample +++ /dev/null @@ -1,5 +0,0 @@ -200 number of time steps -0.0008d0 dt for class A = 0.0008d0. class B = 0.0003d0 class C = 0.0001d0 -64 64 64 -5 0 write interval (optional read interval) for BTIO -0 1000000 number of nodes in collective buffering and buffer size for BTIO diff --git a/examples/smpi/NAS/BT/make_set.f b/examples/smpi/NAS/BT/make_set.f deleted file mode 100644 index b8d90c65a4..0000000000 --- a/examples/smpi/NAS/BT/make_set.f +++ /dev/null @@ -1,124 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine make_set - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c This function allocates space for a set of cells and fills the set -c such that communication between cells on different nodes is only -c nearest neighbor -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - - integer p, i, j, c, dir, size, excess, ierr,ierrcode - -c--------------------------------------------------------------------- -c compute square root; add small number to allow for roundoff -c (note: this is computed in setup_mpi.f also, but prefer to do -c it twice because of some include file problems). -c--------------------------------------------------------------------- - ncells = dint(dsqrt(dble(no_nodes) + 0.00001d0)) - -c--------------------------------------------------------------------- -c this makes coding easier -c--------------------------------------------------------------------- - p = ncells - -c--------------------------------------------------------------------- -c determine the location of the cell at the bottom of the 3D -c array of cells -c--------------------------------------------------------------------- - cell_coord(1,1) = mod(node,p) - cell_coord(2,1) = node/p - cell_coord(3,1) = 0 - -c--------------------------------------------------------------------- -c set the cell_coords for cells in the rest of the z-layers; -c this comes down to a simple linear numbering in the z-direct- -c ion, and to the doubly-cyclic numbering in the other dirs -c--------------------------------------------------------------------- - do c=2, p - cell_coord(1,c) = mod(cell_coord(1,c-1)+1,p) - cell_coord(2,c) = mod(cell_coord(2,c-1)-1+p,p) - cell_coord(3,c) = c-1 - end do - -c--------------------------------------------------------------------- -c offset all the coordinates by 1 to adjust for Fortran arrays -c--------------------------------------------------------------------- - do dir = 1, 3 - do c = 1, p - cell_coord(dir,c) = cell_coord(dir,c) + 1 - end do - end do - -c--------------------------------------------------------------------- -c slice(dir,n) contains the sequence number of the cell that is in -c coordinate plane n in the dir direction -c--------------------------------------------------------------------- - do dir = 1, 3 - do c = 1, p - slice(dir,cell_coord(dir,c)) = c - end do - end do - - -c--------------------------------------------------------------------- -c fill the predecessor and successor entries, using the indices -c of the bottom cells (they are the same at each level of k -c anyway) acting as if full periodicity pertains; note that p is -c added to those arguments to the mod functions that might -c otherwise return wrong values when using the modulo function -c--------------------------------------------------------------------- - i = cell_coord(1,1)-1 - j = cell_coord(2,1)-1 - - predecessor(1) = mod(i-1+p,p) + p*j - predecessor(2) = i + p*mod(j-1+p,p) - predecessor(3) = mod(i+1,p) + p*mod(j-1+p,p) - successor(1) = mod(i+1,p) + p*j - successor(2) = i + p*mod(j+1,p) - successor(3) = mod(i-1+p,p) + p*mod(j+1,p) - -c--------------------------------------------------------------------- -c now compute the sizes of the cells -c--------------------------------------------------------------------- - do dir= 1, 3 -c--------------------------------------------------------------------- -c set cell_coord range for each direction -c--------------------------------------------------------------------- - size = grid_points(dir)/p - excess = mod(grid_points(dir),p) - do c=1, ncells - if (cell_coord(dir,c) .le. excess) then - cell_size(dir,c) = size+1 - cell_low(dir,c) = (cell_coord(dir,c)-1)*(size+1) - cell_high(dir,c) = cell_low(dir,c)+size - else - cell_size(dir,c) = size - cell_low(dir,c) = excess*(size+1)+ - > (cell_coord(dir,c)-excess-1)*size - cell_high(dir,c) = cell_low(dir,c)+size-1 - endif - if (cell_size(dir, c) .le. 2) then - write(*,50) - 50 format(' Error: Cell size too small. Min size is 3') - call MPI_Abort(mpi_comm_world,ierrcode,ierr) - stop - endif - end do - end do - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - diff --git a/examples/smpi/NAS/BT/mpinpb.h b/examples/smpi/NAS/BT/mpinpb.h deleted file mode 100644 index f621f08b64..0000000000 --- a/examples/smpi/NAS/BT/mpinpb.h +++ /dev/null @@ -1,12 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'mpif.h' - - integer node, no_nodes, total_nodes, root, comm_setup, - > comm_solve, comm_rhs, dp_type - logical active - common /mpistuff/ node, no_nodes, total_nodes, root, comm_setup, - > comm_solve, comm_rhs, dp_type, active - diff --git a/examples/smpi/NAS/BT/rhs.f b/examples/smpi/NAS/BT/rhs.f deleted file mode 100644 index 89171a6741..0000000000 --- a/examples/smpi/NAS/BT/rhs.f +++ /dev/null @@ -1,425 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine compute_rhs - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - - integer c, i, j, k, m - double precision rho_inv, uijk, up1, um1, vijk, vp1, vm1, - > wijk, wp1, wm1 - - -c--------------------------------------------------------------------- -c loop over all cells owned by this node -c--------------------------------------------------------------------- - do c = 1, ncells - -c--------------------------------------------------------------------- -c compute the reciprocal of density, and the kinetic energy, -c and the speed of sound. -c--------------------------------------------------------------------- - do k = -1, cell_size(3,c) - do j = -1, cell_size(2,c) - do i = -1, cell_size(1,c) - rho_inv = 1.0d0/u(1,i,j,k,c) - rho_i(i,j,k,c) = rho_inv - us(i,j,k,c) = u(2,i,j,k,c) * rho_inv - vs(i,j,k,c) = u(3,i,j,k,c) * rho_inv - ws(i,j,k,c) = u(4,i,j,k,c) * rho_inv - square(i,j,k,c) = 0.5d0* ( - > u(2,i,j,k,c)*u(2,i,j,k,c) + - > u(3,i,j,k,c)*u(3,i,j,k,c) + - > u(4,i,j,k,c)*u(4,i,j,k,c) ) * rho_inv - qs(i,j,k,c) = square(i,j,k,c) * rho_inv - enddo - enddo - enddo - -c--------------------------------------------------------------------- -c copy the exact forcing term to the right hand side; because -c this forcing term is known, we can store it on the whole of every -c cell, including the boundary -c--------------------------------------------------------------------- - - do k = 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - do m = 1, 5 - rhs(m,i,j,k,c) = forcing(m,i,j,k,c) - enddo - enddo - enddo - enddo - - -c--------------------------------------------------------------------- -c compute xi-direction fluxes -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - uijk = us(i,j,k,c) - up1 = us(i+1,j,k,c) - um1 = us(i-1,j,k,c) - - rhs(1,i,j,k,c) = rhs(1,i,j,k,c) + dx1tx1 * - > (u(1,i+1,j,k,c) - 2.0d0*u(1,i,j,k,c) + - > u(1,i-1,j,k,c)) - - > tx2 * (u(2,i+1,j,k,c) - u(2,i-1,j,k,c)) - - rhs(2,i,j,k,c) = rhs(2,i,j,k,c) + dx2tx1 * - > (u(2,i+1,j,k,c) - 2.0d0*u(2,i,j,k,c) + - > u(2,i-1,j,k,c)) + - > xxcon2*con43 * (up1 - 2.0d0*uijk + um1) - - > tx2 * (u(2,i+1,j,k,c)*up1 - - > u(2,i-1,j,k,c)*um1 + - > (u(5,i+1,j,k,c)- square(i+1,j,k,c)- - > u(5,i-1,j,k,c)+ square(i-1,j,k,c))* - > c2) - - rhs(3,i,j,k,c) = rhs(3,i,j,k,c) + dx3tx1 * - > (u(3,i+1,j,k,c) - 2.0d0*u(3,i,j,k,c) + - > u(3,i-1,j,k,c)) + - > xxcon2 * (vs(i+1,j,k,c) - 2.0d0*vs(i,j,k,c) + - > vs(i-1,j,k,c)) - - > tx2 * (u(3,i+1,j,k,c)*up1 - - > u(3,i-1,j,k,c)*um1) - - rhs(4,i,j,k,c) = rhs(4,i,j,k,c) + dx4tx1 * - > (u(4,i+1,j,k,c) - 2.0d0*u(4,i,j,k,c) + - > u(4,i-1,j,k,c)) + - > xxcon2 * (ws(i+1,j,k,c) - 2.0d0*ws(i,j,k,c) + - > ws(i-1,j,k,c)) - - > tx2 * (u(4,i+1,j,k,c)*up1 - - > u(4,i-1,j,k,c)*um1) - - rhs(5,i,j,k,c) = rhs(5,i,j,k,c) + dx5tx1 * - > (u(5,i+1,j,k,c) - 2.0d0*u(5,i,j,k,c) + - > u(5,i-1,j,k,c)) + - > xxcon3 * (qs(i+1,j,k,c) - 2.0d0*qs(i,j,k,c) + - > qs(i-1,j,k,c)) + - > xxcon4 * (up1*up1 - 2.0d0*uijk*uijk + - > um1*um1) + - > xxcon5 * (u(5,i+1,j,k,c)*rho_i(i+1,j,k,c) - - > 2.0d0*u(5,i,j,k,c)*rho_i(i,j,k,c) + - > u(5,i-1,j,k,c)*rho_i(i-1,j,k,c)) - - > tx2 * ( (c1*u(5,i+1,j,k,c) - - > c2*square(i+1,j,k,c))*up1 - - > (c1*u(5,i-1,j,k,c) - - > c2*square(i-1,j,k,c))*um1 ) - enddo - enddo - enddo - -c--------------------------------------------------------------------- -c add fourth order xi-direction dissipation -c--------------------------------------------------------------------- - if (start(1,c) .gt. 0) then - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - i = 1 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c)- dssp * - > ( 5.0d0*u(m,i,j,k,c) - 4.0d0*u(m,i+1,j,k,c) + - > u(m,i+2,j,k,c)) - enddo - - i = 2 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - dssp * - > (-4.0d0*u(m,i-1,j,k,c) + 6.0d0*u(m,i,j,k,c) - - > 4.0d0*u(m,i+1,j,k,c) + u(m,i+2,j,k,c)) - enddo - enddo - enddo - endif - - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = 3*start(1,c),cell_size(1,c)-3*end(1,c)-1 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - dssp * - > ( u(m,i-2,j,k,c) - 4.0d0*u(m,i-1,j,k,c) + - > 6.0*u(m,i,j,k,c) - 4.0d0*u(m,i+1,j,k,c) + - > u(m,i+2,j,k,c) ) - enddo - enddo - enddo - enddo - - - if (end(1,c) .gt. 0) then - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - i = cell_size(1,c)-3 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - dssp * - > ( u(m,i-2,j,k,c) - 4.0d0*u(m,i-1,j,k,c) + - > 6.0d0*u(m,i,j,k,c) - 4.0d0*u(m,i+1,j,k,c) ) - enddo - - i = cell_size(1,c)-2 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - dssp * - > ( u(m,i-2,j,k,c) - 4.d0*u(m,i-1,j,k,c) + - > 5.d0*u(m,i,j,k,c) ) - enddo - enddo - enddo - endif - -c--------------------------------------------------------------------- -c compute eta-direction fluxes -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - vijk = vs(i,j,k,c) - vp1 = vs(i,j+1,k,c) - vm1 = vs(i,j-1,k,c) - rhs(1,i,j,k,c) = rhs(1,i,j,k,c) + dy1ty1 * - > (u(1,i,j+1,k,c) - 2.0d0*u(1,i,j,k,c) + - > u(1,i,j-1,k,c)) - - > ty2 * (u(3,i,j+1,k,c) - u(3,i,j-1,k,c)) - rhs(2,i,j,k,c) = rhs(2,i,j,k,c) + dy2ty1 * - > (u(2,i,j+1,k,c) - 2.0d0*u(2,i,j,k,c) + - > u(2,i,j-1,k,c)) + - > yycon2 * (us(i,j+1,k,c) - 2.0d0*us(i,j,k,c) + - > us(i,j-1,k,c)) - - > ty2 * (u(2,i,j+1,k,c)*vp1 - - > u(2,i,j-1,k,c)*vm1) - rhs(3,i,j,k,c) = rhs(3,i,j,k,c) + dy3ty1 * - > (u(3,i,j+1,k,c) - 2.0d0*u(3,i,j,k,c) + - > u(3,i,j-1,k,c)) + - > yycon2*con43 * (vp1 - 2.0d0*vijk + vm1) - - > ty2 * (u(3,i,j+1,k,c)*vp1 - - > u(3,i,j-1,k,c)*vm1 + - > (u(5,i,j+1,k,c) - square(i,j+1,k,c) - - > u(5,i,j-1,k,c) + square(i,j-1,k,c)) - > *c2) - rhs(4,i,j,k,c) = rhs(4,i,j,k,c) + dy4ty1 * - > (u(4,i,j+1,k,c) - 2.0d0*u(4,i,j,k,c) + - > u(4,i,j-1,k,c)) + - > yycon2 * (ws(i,j+1,k,c) - 2.0d0*ws(i,j,k,c) + - > ws(i,j-1,k,c)) - - > ty2 * (u(4,i,j+1,k,c)*vp1 - - > u(4,i,j-1,k,c)*vm1) - rhs(5,i,j,k,c) = rhs(5,i,j,k,c) + dy5ty1 * - > (u(5,i,j+1,k,c) - 2.0d0*u(5,i,j,k,c) + - > u(5,i,j-1,k,c)) + - > yycon3 * (qs(i,j+1,k,c) - 2.0d0*qs(i,j,k,c) + - > qs(i,j-1,k,c)) + - > yycon4 * (vp1*vp1 - 2.0d0*vijk*vijk + - > vm1*vm1) + - > yycon5 * (u(5,i,j+1,k,c)*rho_i(i,j+1,k,c) - - > 2.0d0*u(5,i,j,k,c)*rho_i(i,j,k,c) + - > u(5,i,j-1,k,c)*rho_i(i,j-1,k,c)) - - > ty2 * ((c1*u(5,i,j+1,k,c) - - > c2*square(i,j+1,k,c)) * vp1 - - > (c1*u(5,i,j-1,k,c) - - > c2*square(i,j-1,k,c)) * vm1) - enddo - enddo - enddo - -c--------------------------------------------------------------------- -c add fourth order eta-direction dissipation -c--------------------------------------------------------------------- - if (start(2,c) .gt. 0) then - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - j = 1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c)- dssp * - > ( 5.0d0*u(m,i,j,k,c) - 4.0d0*u(m,i,j+1,k,c) + - > u(m,i,j+2,k,c)) - enddo - enddo - - j = 2 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - dssp * - > (-4.0d0*u(m,i,j-1,k,c) + 6.0d0*u(m,i,j,k,c) - - > 4.0d0*u(m,i,j+1,k,c) + u(m,i,j+2,k,c)) - enddo - enddo - enddo - endif - - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = 3*start(2,c), cell_size(2,c)-3*end(2,c)-1 - do i = start(1,c),cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - dssp * - > ( u(m,i,j-2,k,c) - 4.0d0*u(m,i,j-1,k,c) + - > 6.0*u(m,i,j,k,c) - 4.0d0*u(m,i,j+1,k,c) + - > u(m,i,j+2,k,c) ) - enddo - enddo - enddo - enddo - - if (end(2,c) .gt. 0) then - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - j = cell_size(2,c)-3 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - dssp * - > ( u(m,i,j-2,k,c) - 4.0d0*u(m,i,j-1,k,c) + - > 6.0d0*u(m,i,j,k,c) - 4.0d0*u(m,i,j+1,k,c) ) - enddo - enddo - - j = cell_size(2,c)-2 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - dssp * - > ( u(m,i,j-2,k,c) - 4.d0*u(m,i,j-1,k,c) + - > 5.d0*u(m,i,j,k,c) ) - enddo - enddo - enddo - endif - -c--------------------------------------------------------------------- -c compute zeta-direction fluxes -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - wijk = ws(i,j,k,c) - wp1 = ws(i,j,k+1,c) - wm1 = ws(i,j,k-1,c) - - rhs(1,i,j,k,c) = rhs(1,i,j,k,c) + dz1tz1 * - > (u(1,i,j,k+1,c) - 2.0d0*u(1,i,j,k,c) + - > u(1,i,j,k-1,c)) - - > tz2 * (u(4,i,j,k+1,c) - u(4,i,j,k-1,c)) - rhs(2,i,j,k,c) = rhs(2,i,j,k,c) + dz2tz1 * - > (u(2,i,j,k+1,c) - 2.0d0*u(2,i,j,k,c) + - > u(2,i,j,k-1,c)) + - > zzcon2 * (us(i,j,k+1,c) - 2.0d0*us(i,j,k,c) + - > us(i,j,k-1,c)) - - > tz2 * (u(2,i,j,k+1,c)*wp1 - - > u(2,i,j,k-1,c)*wm1) - rhs(3,i,j,k,c) = rhs(3,i,j,k,c) + dz3tz1 * - > (u(3,i,j,k+1,c) - 2.0d0*u(3,i,j,k,c) + - > u(3,i,j,k-1,c)) + - > zzcon2 * (vs(i,j,k+1,c) - 2.0d0*vs(i,j,k,c) + - > vs(i,j,k-1,c)) - - > tz2 * (u(3,i,j,k+1,c)*wp1 - - > u(3,i,j,k-1,c)*wm1) - rhs(4,i,j,k,c) = rhs(4,i,j,k,c) + dz4tz1 * - > (u(4,i,j,k+1,c) - 2.0d0*u(4,i,j,k,c) + - > u(4,i,j,k-1,c)) + - > zzcon2*con43 * (wp1 - 2.0d0*wijk + wm1) - - > tz2 * (u(4,i,j,k+1,c)*wp1 - - > u(4,i,j,k-1,c)*wm1 + - > (u(5,i,j,k+1,c) - square(i,j,k+1,c) - - > u(5,i,j,k-1,c) + square(i,j,k-1,c)) - > *c2) - rhs(5,i,j,k,c) = rhs(5,i,j,k,c) + dz5tz1 * - > (u(5,i,j,k+1,c) - 2.0d0*u(5,i,j,k,c) + - > u(5,i,j,k-1,c)) + - > zzcon3 * (qs(i,j,k+1,c) - 2.0d0*qs(i,j,k,c) + - > qs(i,j,k-1,c)) + - > zzcon4 * (wp1*wp1 - 2.0d0*wijk*wijk + - > wm1*wm1) + - > zzcon5 * (u(5,i,j,k+1,c)*rho_i(i,j,k+1,c) - - > 2.0d0*u(5,i,j,k,c)*rho_i(i,j,k,c) + - > u(5,i,j,k-1,c)*rho_i(i,j,k-1,c)) - - > tz2 * ( (c1*u(5,i,j,k+1,c) - - > c2*square(i,j,k+1,c))*wp1 - - > (c1*u(5,i,j,k-1,c) - - > c2*square(i,j,k-1,c))*wm1) - enddo - enddo - enddo - -c--------------------------------------------------------------------- -c add fourth order zeta-direction dissipation -c--------------------------------------------------------------------- - if (start(3,c) .gt. 0) then - k = 1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c)- dssp * - > ( 5.0d0*u(m,i,j,k,c) - 4.0d0*u(m,i,j,k+1,c) + - > u(m,i,j,k+2,c)) - enddo - enddo - enddo - - k = 2 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - dssp * - > (-4.0d0*u(m,i,j,k-1,c) + 6.0d0*u(m,i,j,k,c) - - > 4.0d0*u(m,i,j,k+1,c) + u(m,i,j,k+2,c)) - enddo - enddo - enddo - endif - - do k = 3*start(3,c), cell_size(3,c)-3*end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c),cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - dssp * - > ( u(m,i,j,k-2,c) - 4.0d0*u(m,i,j,k-1,c) + - > 6.0*u(m,i,j,k,c) - 4.0d0*u(m,i,j,k+1,c) + - > u(m,i,j,k+2,c) ) - enddo - enddo - enddo - enddo - - if (end(3,c) .gt. 0) then - k = cell_size(3,c)-3 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - dssp * - > ( u(m,i,j,k-2,c) - 4.0d0*u(m,i,j,k-1,c) + - > 6.0d0*u(m,i,j,k,c) - 4.0d0*u(m,i,j,k+1,c) ) - enddo - enddo - enddo - - k = cell_size(3,c)-2 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - dssp * - > ( u(m,i,j,k-2,c) - 4.d0*u(m,i,j,k-1,c) + - > 5.d0*u(m,i,j,k,c) ) - enddo - enddo - enddo - endif - - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) * dt - enddo - enddo - enddo - enddo - - enddo - - return - end - - - - diff --git a/examples/smpi/NAS/BT/set_constants.f b/examples/smpi/NAS/BT/set_constants.f deleted file mode 100644 index 81397d4bcf..0000000000 --- a/examples/smpi/NAS/BT/set_constants.f +++ /dev/null @@ -1,202 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine set_constants - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - - ce(1,1) = 2.0d0 - ce(1,2) = 0.0d0 - ce(1,3) = 0.0d0 - ce(1,4) = 4.0d0 - ce(1,5) = 5.0d0 - ce(1,6) = 3.0d0 - ce(1,7) = 0.5d0 - ce(1,8) = 0.02d0 - ce(1,9) = 0.01d0 - ce(1,10) = 0.03d0 - ce(1,11) = 0.5d0 - ce(1,12) = 0.4d0 - ce(1,13) = 0.3d0 - - ce(2,1) = 1.0d0 - ce(2,2) = 0.0d0 - ce(2,3) = 0.0d0 - ce(2,4) = 0.0d0 - ce(2,5) = 1.0d0 - ce(2,6) = 2.0d0 - ce(2,7) = 3.0d0 - ce(2,8) = 0.01d0 - ce(2,9) = 0.03d0 - ce(2,10) = 0.02d0 - ce(2,11) = 0.4d0 - ce(2,12) = 0.3d0 - ce(2,13) = 0.5d0 - - ce(3,1) = 2.0d0 - ce(3,2) = 2.0d0 - ce(3,3) = 0.0d0 - ce(3,4) = 0.0d0 - ce(3,5) = 0.0d0 - ce(3,6) = 2.0d0 - ce(3,7) = 3.0d0 - ce(3,8) = 0.04d0 - ce(3,9) = 0.03d0 - ce(3,10) = 0.05d0 - ce(3,11) = 0.3d0 - ce(3,12) = 0.5d0 - ce(3,13) = 0.4d0 - - ce(4,1) = 2.0d0 - ce(4,2) = 2.0d0 - ce(4,3) = 0.0d0 - ce(4,4) = 0.0d0 - ce(4,5) = 0.0d0 - ce(4,6) = 2.0d0 - ce(4,7) = 3.0d0 - ce(4,8) = 0.03d0 - ce(4,9) = 0.05d0 - ce(4,10) = 0.04d0 - ce(4,11) = 0.2d0 - ce(4,12) = 0.1d0 - ce(4,13) = 0.3d0 - - ce(5,1) = 5.0d0 - ce(5,2) = 4.0d0 - ce(5,3) = 3.0d0 - ce(5,4) = 2.0d0 - ce(5,5) = 0.1d0 - ce(5,6) = 0.4d0 - ce(5,7) = 0.3d0 - ce(5,8) = 0.05d0 - ce(5,9) = 0.04d0 - ce(5,10) = 0.03d0 - ce(5,11) = 0.1d0 - ce(5,12) = 0.3d0 - ce(5,13) = 0.2d0 - - c1 = 1.4d0 - c2 = 0.4d0 - c3 = 0.1d0 - c4 = 1.0d0 - c5 = 1.4d0 - - bt = dsqrt(0.5d0) - - dnxm1 = 1.0d0 / dble(grid_points(1)-1) - dnym1 = 1.0d0 / dble(grid_points(2)-1) - dnzm1 = 1.0d0 / dble(grid_points(3)-1) - - c1c2 = c1 * c2 - c1c5 = c1 * c5 - c3c4 = c3 * c4 - c1345 = c1c5 * c3c4 - - conz1 = (1.0d0-c1c5) - - tx1 = 1.0d0 / (dnxm1 * dnxm1) - tx2 = 1.0d0 / (2.0d0 * dnxm1) - tx3 = 1.0d0 / dnxm1 - - ty1 = 1.0d0 / (dnym1 * dnym1) - ty2 = 1.0d0 / (2.0d0 * dnym1) - ty3 = 1.0d0 / dnym1 - - tz1 = 1.0d0 / (dnzm1 * dnzm1) - tz2 = 1.0d0 / (2.0d0 * dnzm1) - tz3 = 1.0d0 / dnzm1 - - dx1 = 0.75d0 - dx2 = 0.75d0 - dx3 = 0.75d0 - dx4 = 0.75d0 - dx5 = 0.75d0 - - dy1 = 0.75d0 - dy2 = 0.75d0 - dy3 = 0.75d0 - dy4 = 0.75d0 - dy5 = 0.75d0 - - dz1 = 1.0d0 - dz2 = 1.0d0 - dz3 = 1.0d0 - dz4 = 1.0d0 - dz5 = 1.0d0 - - dxmax = dmax1(dx3, dx4) - dymax = dmax1(dy2, dy4) - dzmax = dmax1(dz2, dz3) - - dssp = 0.25d0 * dmax1(dx1, dmax1(dy1, dz1) ) - - c4dssp = 4.0d0 * dssp - c5dssp = 5.0d0 * dssp - - dttx1 = dt*tx1 - dttx2 = dt*tx2 - dtty1 = dt*ty1 - dtty2 = dt*ty2 - dttz1 = dt*tz1 - dttz2 = dt*tz2 - - c2dttx1 = 2.0d0*dttx1 - c2dtty1 = 2.0d0*dtty1 - c2dttz1 = 2.0d0*dttz1 - - dtdssp = dt*dssp - - comz1 = dtdssp - comz4 = 4.0d0*dtdssp - comz5 = 5.0d0*dtdssp - comz6 = 6.0d0*dtdssp - - c3c4tx3 = c3c4*tx3 - c3c4ty3 = c3c4*ty3 - c3c4tz3 = c3c4*tz3 - - dx1tx1 = dx1*tx1 - dx2tx1 = dx2*tx1 - dx3tx1 = dx3*tx1 - dx4tx1 = dx4*tx1 - dx5tx1 = dx5*tx1 - - dy1ty1 = dy1*ty1 - dy2ty1 = dy2*ty1 - dy3ty1 = dy3*ty1 - dy4ty1 = dy4*ty1 - dy5ty1 = dy5*ty1 - - dz1tz1 = dz1*tz1 - dz2tz1 = dz2*tz1 - dz3tz1 = dz3*tz1 - dz4tz1 = dz4*tz1 - dz5tz1 = dz5*tz1 - - c2iv = 2.5d0 - con43 = 4.0d0/3.0d0 - con16 = 1.0d0/6.0d0 - - xxcon1 = c3c4tx3*con43*tx3 - xxcon2 = c3c4tx3*tx3 - xxcon3 = c3c4tx3*conz1*tx3 - xxcon4 = c3c4tx3*con16*tx3 - xxcon5 = c3c4tx3*c1c5*tx3 - - yycon1 = c3c4ty3*con43*ty3 - yycon2 = c3c4ty3*ty3 - yycon3 = c3c4ty3*conz1*ty3 - yycon4 = c3c4ty3*con16*ty3 - yycon5 = c3c4ty3*c1c5*ty3 - - zzcon1 = c3c4tz3*con43*tz3 - zzcon2 = c3c4tz3*tz3 - zzcon3 = c3c4tz3*conz1*tz3 - zzcon4 = c3c4tz3*con16*tz3 - zzcon5 = c3c4tz3*c1c5*tz3 - - return - end diff --git a/examples/smpi/NAS/BT/setup_mpi.f b/examples/smpi/NAS/BT/setup_mpi.f deleted file mode 100644 index 987c6bfba4..0000000000 --- a/examples/smpi/NAS/BT/setup_mpi.f +++ /dev/null @@ -1,64 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine setup_mpi - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c set up MPI stuff -c--------------------------------------------------------------------- - - implicit none - include 'mpinpb.h' - include 'npbparams.h' - integer error, color, nc - - call mpi_init(error) - - call mpi_comm_size(MPI_COMM_WORLD, total_nodes, error) - call mpi_comm_rank(MPI_COMM_WORLD, node, error) - - if (.not. convertdouble) then - dp_type = MPI_DOUBLE_PRECISION - else - dp_type = MPI_REAL - endif - -c--------------------------------------------------------------------- -c compute square root; add small number to allow for roundoff -c--------------------------------------------------------------------- - nc = dint(dsqrt(dble(total_nodes) + 0.00001d0)) - -c--------------------------------------------------------------------- -c We handle a non-square number of nodes by making the excess nodes -c inactive. However, we can never handle more cells than were compiled -c in. -c--------------------------------------------------------------------- - - if (nc .gt. maxcells) nc = maxcells - if (node .ge. nc*nc) then - active = .false. - color = 1 - else - active = .true. - color = 0 - end if - - call mpi_comm_split(MPI_COMM_WORLD,color,node,comm_setup,error) - if (.not. active) return - - call mpi_comm_size(comm_setup, no_nodes, error) - call mpi_comm_dup(comm_setup, comm_solve, error) - call mpi_comm_dup(comm_setup, comm_rhs, error) - -c--------------------------------------------------------------------- -c let node 0 be the root for the group (there is only one) -c--------------------------------------------------------------------- - root = 0 - - return - end - diff --git a/examples/smpi/NAS/BT/simple_mpiio.f b/examples/smpi/NAS/BT/simple_mpiio.f deleted file mode 100644 index 02e2700177..0000000000 --- a/examples/smpi/NAS/BT/simple_mpiio.f +++ /dev/null @@ -1,213 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine setup_btio - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer m, ierr - - iseek=0 - - if (node .eq. root) then - call MPI_File_delete(filenm, MPI_INFO_NULL, ierr) - endif - - call MPI_Barrier(comm_solve, ierr) - - call MPI_File_open(comm_solve, - $ filenm, - $ MPI_MODE_RDWR + MPI_MODE_CREATE, - $ MPI_INFO_NULL, - $ fp, - $ ierr) - - call MPI_File_set_view(fp, - $ iseek, MPI_DOUBLE_PRECISION, MPI_DOUBLE_PRECISION, - $ 'native', MPI_INFO_NULL, ierr) - - if (ierr .ne. MPI_SUCCESS) then - print *, 'Error opening file' - stop - endif - - do m = 1, 5 - xce_sub(m) = 0.d0 - end do - - idump_sub = 0 - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine output_timestep - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - include 'header.h' - include 'mpinpb.h' - - integer count, jio, kio, cio, aio - integer ierr - integer mstatus(MPI_STATUS_SIZE) - - do cio=1,ncells - do kio=0, cell_size(3,cio)-1 - do jio=0, cell_size(2,cio)-1 - iseek=5*(cell_low(1,cio) + - $ PROBLEM_SIZE*((cell_low(2,cio)+jio) + - $ PROBLEM_SIZE*((cell_low(3,cio)+kio) + - $ PROBLEM_SIZE*idump_sub))) - - count=5*cell_size(1,cio) - - call MPI_File_write_at(fp, iseek, - $ u(1,0,jio,kio,cio), - $ count, MPI_DOUBLE_PRECISION, - $ mstatus, ierr) - - if (ierr .ne. MPI_SUCCESS) then - print *, 'Error writing to file' - stop - endif - enddo - enddo - enddo - - idump_sub = idump_sub + 1 - if (rd_interval .gt. 0) then - if (idump_sub .ge. rd_interval) then - - call acc_sub_norms(idump+1) - - idump_sub = 0 - endif - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine acc_sub_norms(idump_cur) - - include 'header.h' - include 'mpinpb.h' - - integer idump_cur - - integer count, jio, kio, cio, ii, m, ichunk - integer ierr - integer mstatus(MPI_STATUS_SIZE) - double precision xce_single(5) - - ichunk = idump_cur - idump_sub + 1 - do ii=0, idump_sub-1 - do cio=1,ncells - do kio=0, cell_size(3,cio)-1 - do jio=0, cell_size(2,cio)-1 - iseek=5*(cell_low(1,cio) + - $ PROBLEM_SIZE*((cell_low(2,cio)+jio) + - $ PROBLEM_SIZE*((cell_low(3,cio)+kio) + - $ PROBLEM_SIZE*ii))) - - count=5*cell_size(1,cio) - - call MPI_File_read_at(fp, iseek, - $ u(1,0,jio,kio,cio), - $ count, MPI_DOUBLE_PRECISION, - $ mstatus, ierr) - - if (ierr .ne. MPI_SUCCESS) then - print *, 'Error reading back file' - call MPI_File_close(fp, ierr) - stop - endif - enddo - enddo - enddo - - if (node .eq. root) print *, 'Reading data set ', ii+ichunk - - call error_norm(xce_single) - do m = 1, 5 - xce_sub(m) = xce_sub(m) + xce_single(m) - end do - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine btio_cleanup - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer ierr - - call MPI_File_close(fp, ierr) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine accumulate_norms(xce_acc) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - double precision xce_acc(5) - integer m, ierr - - if (rd_interval .gt. 0) goto 20 - - call MPI_File_open(comm_solve, - $ filenm, - $ MPI_MODE_RDONLY, - $ MPI_INFO_NULL, - $ fp, - $ ierr) - - iseek = 0 - call MPI_File_set_view(fp, - $ iseek, MPI_DOUBLE_PRECISION, MPI_DOUBLE_PRECISION, - $ 'native', MPI_INFO_NULL, ierr) - -c clear the last time step - - call clear_timestep - -c read back the time steps and accumulate norms - - call acc_sub_norms(idump) - - call MPI_File_close(fp, ierr) - - 20 continue - do m = 1, 5 - xce_acc(m) = xce_sub(m) / dble(idump) - end do - - return - end - diff --git a/examples/smpi/NAS/BT/solve_subs.f b/examples/smpi/NAS/BT/solve_subs.f deleted file mode 100644 index 351489a313..0000000000 --- a/examples/smpi/NAS/BT/solve_subs.f +++ /dev/null @@ -1,642 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine matvec_sub(ablock,avec,bvec) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c subtracts bvec=bvec - ablock*avec -c--------------------------------------------------------------------- - - implicit none - - double precision ablock,avec,bvec - dimension ablock(5,5),avec(5),bvec(5) - -c--------------------------------------------------------------------- -c rhs(i,ic,jc,kc,ccell) = rhs(i,ic,jc,kc,ccell) -c $ - lhs(i,1,ablock,ia,ja,ka,acell)* -c--------------------------------------------------------------------- - bvec(1) = bvec(1) - ablock(1,1)*avec(1) - > - ablock(1,2)*avec(2) - > - ablock(1,3)*avec(3) - > - ablock(1,4)*avec(4) - > - ablock(1,5)*avec(5) - bvec(2) = bvec(2) - ablock(2,1)*avec(1) - > - ablock(2,2)*avec(2) - > - ablock(2,3)*avec(3) - > - ablock(2,4)*avec(4) - > - ablock(2,5)*avec(5) - bvec(3) = bvec(3) - ablock(3,1)*avec(1) - > - ablock(3,2)*avec(2) - > - ablock(3,3)*avec(3) - > - ablock(3,4)*avec(4) - > - ablock(3,5)*avec(5) - bvec(4) = bvec(4) - ablock(4,1)*avec(1) - > - ablock(4,2)*avec(2) - > - ablock(4,3)*avec(3) - > - ablock(4,4)*avec(4) - > - ablock(4,5)*avec(5) - bvec(5) = bvec(5) - ablock(5,1)*avec(1) - > - ablock(5,2)*avec(2) - > - ablock(5,3)*avec(3) - > - ablock(5,4)*avec(4) - > - ablock(5,5)*avec(5) - - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine matmul_sub(ablock, bblock, cblock) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c subtracts a(i,j,k) X b(i,j,k) from c(i,j,k) -c--------------------------------------------------------------------- - - implicit none - - double precision ablock, bblock, cblock - dimension ablock(5,5), bblock(5,5), cblock(5,5) - - - cblock(1,1) = cblock(1,1) - ablock(1,1)*bblock(1,1) - > - ablock(1,2)*bblock(2,1) - > - ablock(1,3)*bblock(3,1) - > - ablock(1,4)*bblock(4,1) - > - ablock(1,5)*bblock(5,1) - cblock(2,1) = cblock(2,1) - ablock(2,1)*bblock(1,1) - > - ablock(2,2)*bblock(2,1) - > - ablock(2,3)*bblock(3,1) - > - ablock(2,4)*bblock(4,1) - > - ablock(2,5)*bblock(5,1) - cblock(3,1) = cblock(3,1) - ablock(3,1)*bblock(1,1) - > - ablock(3,2)*bblock(2,1) - > - ablock(3,3)*bblock(3,1) - > - ablock(3,4)*bblock(4,1) - > - ablock(3,5)*bblock(5,1) - cblock(4,1) = cblock(4,1) - ablock(4,1)*bblock(1,1) - > - ablock(4,2)*bblock(2,1) - > - ablock(4,3)*bblock(3,1) - > - ablock(4,4)*bblock(4,1) - > - ablock(4,5)*bblock(5,1) - cblock(5,1) = cblock(5,1) - ablock(5,1)*bblock(1,1) - > - ablock(5,2)*bblock(2,1) - > - ablock(5,3)*bblock(3,1) - > - ablock(5,4)*bblock(4,1) - > - ablock(5,5)*bblock(5,1) - cblock(1,2) = cblock(1,2) - ablock(1,1)*bblock(1,2) - > - ablock(1,2)*bblock(2,2) - > - ablock(1,3)*bblock(3,2) - > - ablock(1,4)*bblock(4,2) - > - ablock(1,5)*bblock(5,2) - cblock(2,2) = cblock(2,2) - ablock(2,1)*bblock(1,2) - > - ablock(2,2)*bblock(2,2) - > - ablock(2,3)*bblock(3,2) - > - ablock(2,4)*bblock(4,2) - > - ablock(2,5)*bblock(5,2) - cblock(3,2) = cblock(3,2) - ablock(3,1)*bblock(1,2) - > - ablock(3,2)*bblock(2,2) - > - ablock(3,3)*bblock(3,2) - > - ablock(3,4)*bblock(4,2) - > - ablock(3,5)*bblock(5,2) - cblock(4,2) = cblock(4,2) - ablock(4,1)*bblock(1,2) - > - ablock(4,2)*bblock(2,2) - > - ablock(4,3)*bblock(3,2) - > - ablock(4,4)*bblock(4,2) - > - ablock(4,5)*bblock(5,2) - cblock(5,2) = cblock(5,2) - ablock(5,1)*bblock(1,2) - > - ablock(5,2)*bblock(2,2) - > - ablock(5,3)*bblock(3,2) - > - ablock(5,4)*bblock(4,2) - > - ablock(5,5)*bblock(5,2) - cblock(1,3) = cblock(1,3) - ablock(1,1)*bblock(1,3) - > - ablock(1,2)*bblock(2,3) - > - ablock(1,3)*bblock(3,3) - > - ablock(1,4)*bblock(4,3) - > - ablock(1,5)*bblock(5,3) - cblock(2,3) = cblock(2,3) - ablock(2,1)*bblock(1,3) - > - ablock(2,2)*bblock(2,3) - > - ablock(2,3)*bblock(3,3) - > - ablock(2,4)*bblock(4,3) - > - ablock(2,5)*bblock(5,3) - cblock(3,3) = cblock(3,3) - ablock(3,1)*bblock(1,3) - > - ablock(3,2)*bblock(2,3) - > - ablock(3,3)*bblock(3,3) - > - ablock(3,4)*bblock(4,3) - > - ablock(3,5)*bblock(5,3) - cblock(4,3) = cblock(4,3) - ablock(4,1)*bblock(1,3) - > - ablock(4,2)*bblock(2,3) - > - ablock(4,3)*bblock(3,3) - > - ablock(4,4)*bblock(4,3) - > - ablock(4,5)*bblock(5,3) - cblock(5,3) = cblock(5,3) - ablock(5,1)*bblock(1,3) - > - ablock(5,2)*bblock(2,3) - > - ablock(5,3)*bblock(3,3) - > - ablock(5,4)*bblock(4,3) - > - ablock(5,5)*bblock(5,3) - cblock(1,4) = cblock(1,4) - ablock(1,1)*bblock(1,4) - > - ablock(1,2)*bblock(2,4) - > - ablock(1,3)*bblock(3,4) - > - ablock(1,4)*bblock(4,4) - > - ablock(1,5)*bblock(5,4) - cblock(2,4) = cblock(2,4) - ablock(2,1)*bblock(1,4) - > - ablock(2,2)*bblock(2,4) - > - ablock(2,3)*bblock(3,4) - > - ablock(2,4)*bblock(4,4) - > - ablock(2,5)*bblock(5,4) - cblock(3,4) = cblock(3,4) - ablock(3,1)*bblock(1,4) - > - ablock(3,2)*bblock(2,4) - > - ablock(3,3)*bblock(3,4) - > - ablock(3,4)*bblock(4,4) - > - ablock(3,5)*bblock(5,4) - cblock(4,4) = cblock(4,4) - ablock(4,1)*bblock(1,4) - > - ablock(4,2)*bblock(2,4) - > - ablock(4,3)*bblock(3,4) - > - ablock(4,4)*bblock(4,4) - > - ablock(4,5)*bblock(5,4) - cblock(5,4) = cblock(5,4) - ablock(5,1)*bblock(1,4) - > - ablock(5,2)*bblock(2,4) - > - ablock(5,3)*bblock(3,4) - > - ablock(5,4)*bblock(4,4) - > - ablock(5,5)*bblock(5,4) - cblock(1,5) = cblock(1,5) - ablock(1,1)*bblock(1,5) - > - ablock(1,2)*bblock(2,5) - > - ablock(1,3)*bblock(3,5) - > - ablock(1,4)*bblock(4,5) - > - ablock(1,5)*bblock(5,5) - cblock(2,5) = cblock(2,5) - ablock(2,1)*bblock(1,5) - > - ablock(2,2)*bblock(2,5) - > - ablock(2,3)*bblock(3,5) - > - ablock(2,4)*bblock(4,5) - > - ablock(2,5)*bblock(5,5) - cblock(3,5) = cblock(3,5) - ablock(3,1)*bblock(1,5) - > - ablock(3,2)*bblock(2,5) - > - ablock(3,3)*bblock(3,5) - > - ablock(3,4)*bblock(4,5) - > - ablock(3,5)*bblock(5,5) - cblock(4,5) = cblock(4,5) - ablock(4,1)*bblock(1,5) - > - ablock(4,2)*bblock(2,5) - > - ablock(4,3)*bblock(3,5) - > - ablock(4,4)*bblock(4,5) - > - ablock(4,5)*bblock(5,5) - cblock(5,5) = cblock(5,5) - ablock(5,1)*bblock(1,5) - > - ablock(5,2)*bblock(2,5) - > - ablock(5,3)*bblock(3,5) - > - ablock(5,4)*bblock(4,5) - > - ablock(5,5)*bblock(5,5) - - - return - end - - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine binvcrhs( lhs,c,r ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c--------------------------------------------------------------------- - - implicit none - - double precision pivot, coeff, lhs - dimension lhs(5,5) - double precision c(5,5), r(5) - -c--------------------------------------------------------------------- -c -c--------------------------------------------------------------------- - - pivot = 1.00d0/lhs(1,1) - lhs(1,2) = lhs(1,2)*pivot - lhs(1,3) = lhs(1,3)*pivot - lhs(1,4) = lhs(1,4)*pivot - lhs(1,5) = lhs(1,5)*pivot - c(1,1) = c(1,1)*pivot - c(1,2) = c(1,2)*pivot - c(1,3) = c(1,3)*pivot - c(1,4) = c(1,4)*pivot - c(1,5) = c(1,5)*pivot - r(1) = r(1) *pivot - - coeff = lhs(2,1) - lhs(2,2)= lhs(2,2) - coeff*lhs(1,2) - lhs(2,3)= lhs(2,3) - coeff*lhs(1,3) - lhs(2,4)= lhs(2,4) - coeff*lhs(1,4) - lhs(2,5)= lhs(2,5) - coeff*lhs(1,5) - c(2,1) = c(2,1) - coeff*c(1,1) - c(2,2) = c(2,2) - coeff*c(1,2) - c(2,3) = c(2,3) - coeff*c(1,3) - c(2,4) = c(2,4) - coeff*c(1,4) - c(2,5) = c(2,5) - coeff*c(1,5) - r(2) = r(2) - coeff*r(1) - - coeff = lhs(3,1) - lhs(3,2)= lhs(3,2) - coeff*lhs(1,2) - lhs(3,3)= lhs(3,3) - coeff*lhs(1,3) - lhs(3,4)= lhs(3,4) - coeff*lhs(1,4) - lhs(3,5)= lhs(3,5) - coeff*lhs(1,5) - c(3,1) = c(3,1) - coeff*c(1,1) - c(3,2) = c(3,2) - coeff*c(1,2) - c(3,3) = c(3,3) - coeff*c(1,3) - c(3,4) = c(3,4) - coeff*c(1,4) - c(3,5) = c(3,5) - coeff*c(1,5) - r(3) = r(3) - coeff*r(1) - - coeff = lhs(4,1) - lhs(4,2)= lhs(4,2) - coeff*lhs(1,2) - lhs(4,3)= lhs(4,3) - coeff*lhs(1,3) - lhs(4,4)= lhs(4,4) - coeff*lhs(1,4) - lhs(4,5)= lhs(4,5) - coeff*lhs(1,5) - c(4,1) = c(4,1) - coeff*c(1,1) - c(4,2) = c(4,2) - coeff*c(1,2) - c(4,3) = c(4,3) - coeff*c(1,3) - c(4,4) = c(4,4) - coeff*c(1,4) - c(4,5) = c(4,5) - coeff*c(1,5) - r(4) = r(4) - coeff*r(1) - - coeff = lhs(5,1) - lhs(5,2)= lhs(5,2) - coeff*lhs(1,2) - lhs(5,3)= lhs(5,3) - coeff*lhs(1,3) - lhs(5,4)= lhs(5,4) - coeff*lhs(1,4) - lhs(5,5)= lhs(5,5) - coeff*lhs(1,5) - c(5,1) = c(5,1) - coeff*c(1,1) - c(5,2) = c(5,2) - coeff*c(1,2) - c(5,3) = c(5,3) - coeff*c(1,3) - c(5,4) = c(5,4) - coeff*c(1,4) - c(5,5) = c(5,5) - coeff*c(1,5) - r(5) = r(5) - coeff*r(1) - - - pivot = 1.00d0/lhs(2,2) - lhs(2,3) = lhs(2,3)*pivot - lhs(2,4) = lhs(2,4)*pivot - lhs(2,5) = lhs(2,5)*pivot - c(2,1) = c(2,1)*pivot - c(2,2) = c(2,2)*pivot - c(2,3) = c(2,3)*pivot - c(2,4) = c(2,4)*pivot - c(2,5) = c(2,5)*pivot - r(2) = r(2) *pivot - - coeff = lhs(1,2) - lhs(1,3)= lhs(1,3) - coeff*lhs(2,3) - lhs(1,4)= lhs(1,4) - coeff*lhs(2,4) - lhs(1,5)= lhs(1,5) - coeff*lhs(2,5) - c(1,1) = c(1,1) - coeff*c(2,1) - c(1,2) = c(1,2) - coeff*c(2,2) - c(1,3) = c(1,3) - coeff*c(2,3) - c(1,4) = c(1,4) - coeff*c(2,4) - c(1,5) = c(1,5) - coeff*c(2,5) - r(1) = r(1) - coeff*r(2) - - coeff = lhs(3,2) - lhs(3,3)= lhs(3,3) - coeff*lhs(2,3) - lhs(3,4)= lhs(3,4) - coeff*lhs(2,4) - lhs(3,5)= lhs(3,5) - coeff*lhs(2,5) - c(3,1) = c(3,1) - coeff*c(2,1) - c(3,2) = c(3,2) - coeff*c(2,2) - c(3,3) = c(3,3) - coeff*c(2,3) - c(3,4) = c(3,4) - coeff*c(2,4) - c(3,5) = c(3,5) - coeff*c(2,5) - r(3) = r(3) - coeff*r(2) - - coeff = lhs(4,2) - lhs(4,3)= lhs(4,3) - coeff*lhs(2,3) - lhs(4,4)= lhs(4,4) - coeff*lhs(2,4) - lhs(4,5)= lhs(4,5) - coeff*lhs(2,5) - c(4,1) = c(4,1) - coeff*c(2,1) - c(4,2) = c(4,2) - coeff*c(2,2) - c(4,3) = c(4,3) - coeff*c(2,3) - c(4,4) = c(4,4) - coeff*c(2,4) - c(4,5) = c(4,5) - coeff*c(2,5) - r(4) = r(4) - coeff*r(2) - - coeff = lhs(5,2) - lhs(5,3)= lhs(5,3) - coeff*lhs(2,3) - lhs(5,4)= lhs(5,4) - coeff*lhs(2,4) - lhs(5,5)= lhs(5,5) - coeff*lhs(2,5) - c(5,1) = c(5,1) - coeff*c(2,1) - c(5,2) = c(5,2) - coeff*c(2,2) - c(5,3) = c(5,3) - coeff*c(2,3) - c(5,4) = c(5,4) - coeff*c(2,4) - c(5,5) = c(5,5) - coeff*c(2,5) - r(5) = r(5) - coeff*r(2) - - - pivot = 1.00d0/lhs(3,3) - lhs(3,4) = lhs(3,4)*pivot - lhs(3,5) = lhs(3,5)*pivot - c(3,1) = c(3,1)*pivot - c(3,2) = c(3,2)*pivot - c(3,3) = c(3,3)*pivot - c(3,4) = c(3,4)*pivot - c(3,5) = c(3,5)*pivot - r(3) = r(3) *pivot - - coeff = lhs(1,3) - lhs(1,4)= lhs(1,4) - coeff*lhs(3,4) - lhs(1,5)= lhs(1,5) - coeff*lhs(3,5) - c(1,1) = c(1,1) - coeff*c(3,1) - c(1,2) = c(1,2) - coeff*c(3,2) - c(1,3) = c(1,3) - coeff*c(3,3) - c(1,4) = c(1,4) - coeff*c(3,4) - c(1,5) = c(1,5) - coeff*c(3,5) - r(1) = r(1) - coeff*r(3) - - coeff = lhs(2,3) - lhs(2,4)= lhs(2,4) - coeff*lhs(3,4) - lhs(2,5)= lhs(2,5) - coeff*lhs(3,5) - c(2,1) = c(2,1) - coeff*c(3,1) - c(2,2) = c(2,2) - coeff*c(3,2) - c(2,3) = c(2,3) - coeff*c(3,3) - c(2,4) = c(2,4) - coeff*c(3,4) - c(2,5) = c(2,5) - coeff*c(3,5) - r(2) = r(2) - coeff*r(3) - - coeff = lhs(4,3) - lhs(4,4)= lhs(4,4) - coeff*lhs(3,4) - lhs(4,5)= lhs(4,5) - coeff*lhs(3,5) - c(4,1) = c(4,1) - coeff*c(3,1) - c(4,2) = c(4,2) - coeff*c(3,2) - c(4,3) = c(4,3) - coeff*c(3,3) - c(4,4) = c(4,4) - coeff*c(3,4) - c(4,5) = c(4,5) - coeff*c(3,5) - r(4) = r(4) - coeff*r(3) - - coeff = lhs(5,3) - lhs(5,4)= lhs(5,4) - coeff*lhs(3,4) - lhs(5,5)= lhs(5,5) - coeff*lhs(3,5) - c(5,1) = c(5,1) - coeff*c(3,1) - c(5,2) = c(5,2) - coeff*c(3,2) - c(5,3) = c(5,3) - coeff*c(3,3) - c(5,4) = c(5,4) - coeff*c(3,4) - c(5,5) = c(5,5) - coeff*c(3,5) - r(5) = r(5) - coeff*r(3) - - - pivot = 1.00d0/lhs(4,4) - lhs(4,5) = lhs(4,5)*pivot - c(4,1) = c(4,1)*pivot - c(4,2) = c(4,2)*pivot - c(4,3) = c(4,3)*pivot - c(4,4) = c(4,4)*pivot - c(4,5) = c(4,5)*pivot - r(4) = r(4) *pivot - - coeff = lhs(1,4) - lhs(1,5)= lhs(1,5) - coeff*lhs(4,5) - c(1,1) = c(1,1) - coeff*c(4,1) - c(1,2) = c(1,2) - coeff*c(4,2) - c(1,3) = c(1,3) - coeff*c(4,3) - c(1,4) = c(1,4) - coeff*c(4,4) - c(1,5) = c(1,5) - coeff*c(4,5) - r(1) = r(1) - coeff*r(4) - - coeff = lhs(2,4) - lhs(2,5)= lhs(2,5) - coeff*lhs(4,5) - c(2,1) = c(2,1) - coeff*c(4,1) - c(2,2) = c(2,2) - coeff*c(4,2) - c(2,3) = c(2,3) - coeff*c(4,3) - c(2,4) = c(2,4) - coeff*c(4,4) - c(2,5) = c(2,5) - coeff*c(4,5) - r(2) = r(2) - coeff*r(4) - - coeff = lhs(3,4) - lhs(3,5)= lhs(3,5) - coeff*lhs(4,5) - c(3,1) = c(3,1) - coeff*c(4,1) - c(3,2) = c(3,2) - coeff*c(4,2) - c(3,3) = c(3,3) - coeff*c(4,3) - c(3,4) = c(3,4) - coeff*c(4,4) - c(3,5) = c(3,5) - coeff*c(4,5) - r(3) = r(3) - coeff*r(4) - - coeff = lhs(5,4) - lhs(5,5)= lhs(5,5) - coeff*lhs(4,5) - c(5,1) = c(5,1) - coeff*c(4,1) - c(5,2) = c(5,2) - coeff*c(4,2) - c(5,3) = c(5,3) - coeff*c(4,3) - c(5,4) = c(5,4) - coeff*c(4,4) - c(5,5) = c(5,5) - coeff*c(4,5) - r(5) = r(5) - coeff*r(4) - - - pivot = 1.00d0/lhs(5,5) - c(5,1) = c(5,1)*pivot - c(5,2) = c(5,2)*pivot - c(5,3) = c(5,3)*pivot - c(5,4) = c(5,4)*pivot - c(5,5) = c(5,5)*pivot - r(5) = r(5) *pivot - - coeff = lhs(1,5) - c(1,1) = c(1,1) - coeff*c(5,1) - c(1,2) = c(1,2) - coeff*c(5,2) - c(1,3) = c(1,3) - coeff*c(5,3) - c(1,4) = c(1,4) - coeff*c(5,4) - c(1,5) = c(1,5) - coeff*c(5,5) - r(1) = r(1) - coeff*r(5) - - coeff = lhs(2,5) - c(2,1) = c(2,1) - coeff*c(5,1) - c(2,2) = c(2,2) - coeff*c(5,2) - c(2,3) = c(2,3) - coeff*c(5,3) - c(2,4) = c(2,4) - coeff*c(5,4) - c(2,5) = c(2,5) - coeff*c(5,5) - r(2) = r(2) - coeff*r(5) - - coeff = lhs(3,5) - c(3,1) = c(3,1) - coeff*c(5,1) - c(3,2) = c(3,2) - coeff*c(5,2) - c(3,3) = c(3,3) - coeff*c(5,3) - c(3,4) = c(3,4) - coeff*c(5,4) - c(3,5) = c(3,5) - coeff*c(5,5) - r(3) = r(3) - coeff*r(5) - - coeff = lhs(4,5) - c(4,1) = c(4,1) - coeff*c(5,1) - c(4,2) = c(4,2) - coeff*c(5,2) - c(4,3) = c(4,3) - coeff*c(5,3) - c(4,4) = c(4,4) - coeff*c(5,4) - c(4,5) = c(4,5) - coeff*c(5,5) - r(4) = r(4) - coeff*r(5) - - - return - end - - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine binvrhs( lhs,r ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c--------------------------------------------------------------------- - - implicit none - - double precision pivot, coeff, lhs - dimension lhs(5,5) - double precision r(5) - -c--------------------------------------------------------------------- -c -c--------------------------------------------------------------------- - - - pivot = 1.00d0/lhs(1,1) - lhs(1,2) = lhs(1,2)*pivot - lhs(1,3) = lhs(1,3)*pivot - lhs(1,4) = lhs(1,4)*pivot - lhs(1,5) = lhs(1,5)*pivot - r(1) = r(1) *pivot - - coeff = lhs(2,1) - lhs(2,2)= lhs(2,2) - coeff*lhs(1,2) - lhs(2,3)= lhs(2,3) - coeff*lhs(1,3) - lhs(2,4)= lhs(2,4) - coeff*lhs(1,4) - lhs(2,5)= lhs(2,5) - coeff*lhs(1,5) - r(2) = r(2) - coeff*r(1) - - coeff = lhs(3,1) - lhs(3,2)= lhs(3,2) - coeff*lhs(1,2) - lhs(3,3)= lhs(3,3) - coeff*lhs(1,3) - lhs(3,4)= lhs(3,4) - coeff*lhs(1,4) - lhs(3,5)= lhs(3,5) - coeff*lhs(1,5) - r(3) = r(3) - coeff*r(1) - - coeff = lhs(4,1) - lhs(4,2)= lhs(4,2) - coeff*lhs(1,2) - lhs(4,3)= lhs(4,3) - coeff*lhs(1,3) - lhs(4,4)= lhs(4,4) - coeff*lhs(1,4) - lhs(4,5)= lhs(4,5) - coeff*lhs(1,5) - r(4) = r(4) - coeff*r(1) - - coeff = lhs(5,1) - lhs(5,2)= lhs(5,2) - coeff*lhs(1,2) - lhs(5,3)= lhs(5,3) - coeff*lhs(1,3) - lhs(5,4)= lhs(5,4) - coeff*lhs(1,4) - lhs(5,5)= lhs(5,5) - coeff*lhs(1,5) - r(5) = r(5) - coeff*r(1) - - - pivot = 1.00d0/lhs(2,2) - lhs(2,3) = lhs(2,3)*pivot - lhs(2,4) = lhs(2,4)*pivot - lhs(2,5) = lhs(2,5)*pivot - r(2) = r(2) *pivot - - coeff = lhs(1,2) - lhs(1,3)= lhs(1,3) - coeff*lhs(2,3) - lhs(1,4)= lhs(1,4) - coeff*lhs(2,4) - lhs(1,5)= lhs(1,5) - coeff*lhs(2,5) - r(1) = r(1) - coeff*r(2) - - coeff = lhs(3,2) - lhs(3,3)= lhs(3,3) - coeff*lhs(2,3) - lhs(3,4)= lhs(3,4) - coeff*lhs(2,4) - lhs(3,5)= lhs(3,5) - coeff*lhs(2,5) - r(3) = r(3) - coeff*r(2) - - coeff = lhs(4,2) - lhs(4,3)= lhs(4,3) - coeff*lhs(2,3) - lhs(4,4)= lhs(4,4) - coeff*lhs(2,4) - lhs(4,5)= lhs(4,5) - coeff*lhs(2,5) - r(4) = r(4) - coeff*r(2) - - coeff = lhs(5,2) - lhs(5,3)= lhs(5,3) - coeff*lhs(2,3) - lhs(5,4)= lhs(5,4) - coeff*lhs(2,4) - lhs(5,5)= lhs(5,5) - coeff*lhs(2,5) - r(5) = r(5) - coeff*r(2) - - - pivot = 1.00d0/lhs(3,3) - lhs(3,4) = lhs(3,4)*pivot - lhs(3,5) = lhs(3,5)*pivot - r(3) = r(3) *pivot - - coeff = lhs(1,3) - lhs(1,4)= lhs(1,4) - coeff*lhs(3,4) - lhs(1,5)= lhs(1,5) - coeff*lhs(3,5) - r(1) = r(1) - coeff*r(3) - - coeff = lhs(2,3) - lhs(2,4)= lhs(2,4) - coeff*lhs(3,4) - lhs(2,5)= lhs(2,5) - coeff*lhs(3,5) - r(2) = r(2) - coeff*r(3) - - coeff = lhs(4,3) - lhs(4,4)= lhs(4,4) - coeff*lhs(3,4) - lhs(4,5)= lhs(4,5) - coeff*lhs(3,5) - r(4) = r(4) - coeff*r(3) - - coeff = lhs(5,3) - lhs(5,4)= lhs(5,4) - coeff*lhs(3,4) - lhs(5,5)= lhs(5,5) - coeff*lhs(3,5) - r(5) = r(5) - coeff*r(3) - - - pivot = 1.00d0/lhs(4,4) - lhs(4,5) = lhs(4,5)*pivot - r(4) = r(4) *pivot - - coeff = lhs(1,4) - lhs(1,5)= lhs(1,5) - coeff*lhs(4,5) - r(1) = r(1) - coeff*r(4) - - coeff = lhs(2,4) - lhs(2,5)= lhs(2,5) - coeff*lhs(4,5) - r(2) = r(2) - coeff*r(4) - - coeff = lhs(3,4) - lhs(3,5)= lhs(3,5) - coeff*lhs(4,5) - r(3) = r(3) - coeff*r(4) - - coeff = lhs(5,4) - lhs(5,5)= lhs(5,5) - coeff*lhs(4,5) - r(5) = r(5) - coeff*r(4) - - - pivot = 1.00d0/lhs(5,5) - r(5) = r(5) *pivot - - coeff = lhs(1,5) - r(1) = r(1) - coeff*r(5) - - coeff = lhs(2,5) - r(2) = r(2) - coeff*r(5) - - coeff = lhs(3,5) - r(3) = r(3) - coeff*r(5) - - coeff = lhs(4,5) - r(4) = r(4) - coeff*r(5) - - - return - end - - - diff --git a/examples/smpi/NAS/BT/verify.f b/examples/smpi/NAS/BT/verify.f deleted file mode 100644 index 7dbc8a96a2..0000000000 --- a/examples/smpi/NAS/BT/verify.f +++ /dev/null @@ -1,435 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine verify(no_time_steps, class, verified) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c verification routine -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - double precision xcrref(5),xceref(5),xcrdif(5),xcedif(5), - > epsilon, xce(5), xcr(5), dtref - integer m, no_time_steps - character class - logical verified - -c--------------------------------------------------------------------- -c tolerance level -c--------------------------------------------------------------------- - epsilon = 1.0d-08 - verified = .true. - -c--------------------------------------------------------------------- -c compute the error norm and the residual norm, and exit if not printing -c--------------------------------------------------------------------- - - if (iotype .ne. 0) then - call accumulate_norms(xce) - else - call error_norm(xce) - endif - - call copy_faces - - call rhs_norm(xcr) - - do m = 1, 5 - xcr(m) = xcr(m) / dt - enddo - - if (node .ne. 0) return - - class = 'U' - - do m = 1,5 - xcrref(m) = 1.0 - xceref(m) = 1.0 - end do - -c--------------------------------------------------------------------- -c reference data for 12X12X12 grids after 60 time steps, with DT = 1.0d-02 -c--------------------------------------------------------------------- - if ( (grid_points(1) .eq. 12 ) .and. - > (grid_points(2) .eq. 12 ) .and. - > (grid_points(3) .eq. 12 ) .and. - > (no_time_steps .eq. 60 )) then - - class = 'S' - dtref = 1.0d-2 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual. -c--------------------------------------------------------------------- - xcrref(1) = 1.7034283709541311d-01 - xcrref(2) = 1.2975252070034097d-02 - xcrref(3) = 3.2527926989486055d-02 - xcrref(4) = 2.6436421275166801d-02 - xcrref(5) = 1.9211784131744430d-01 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error. -c--------------------------------------------------------------------- - - if (iotype .eq. 0) then - xceref(1) = 4.9976913345811579d-04 - xceref(2) = 4.5195666782961927d-05 - xceref(3) = 7.3973765172921357d-05 - xceref(4) = 7.3821238632439731d-05 - xceref(5) = 8.9269630987491446d-04 - else - xceref(1) = 0.1149036328945d+02 - xceref(2) = 0.9156788904727d+00 - xceref(3) = 0.2857899428614d+01 - xceref(4) = 0.2598273346734d+01 - xceref(5) = 0.2652795397547d+02 - endif - -c--------------------------------------------------------------------- -c reference data for 24X24X24 grids after 200 time steps, with DT = 0.8d-3 -c--------------------------------------------------------------------- - elseif ( (grid_points(1) .eq. 24) .and. - > (grid_points(2) .eq. 24) .and. - > (grid_points(3) .eq. 24) .and. - > (no_time_steps . eq. 200) ) then - - class = 'W' - dtref = 0.8d-3 -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual. -c--------------------------------------------------------------------- - xcrref(1) = 0.1125590409344d+03 - xcrref(2) = 0.1180007595731d+02 - xcrref(3) = 0.2710329767846d+02 - xcrref(4) = 0.2469174937669d+02 - xcrref(5) = 0.2638427874317d+03 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error. -c--------------------------------------------------------------------- - - if (iotype .eq. 0) then - xceref(1) = 0.4419655736008d+01 - xceref(2) = 0.4638531260002d+00 - xceref(3) = 0.1011551749967d+01 - xceref(4) = 0.9235878729944d+00 - xceref(5) = 0.1018045837718d+02 - else - xceref(1) = 0.6729594398612d+02 - xceref(2) = 0.5264523081690d+01 - xceref(3) = 0.1677107142637d+02 - xceref(4) = 0.1508721463436d+02 - xceref(5) = 0.1477018363393d+03 - endif - - -c--------------------------------------------------------------------- -c reference data for 64X64X64 grids after 200 time steps, with DT = 0.8d-3 -c--------------------------------------------------------------------- - elseif ( (grid_points(1) .eq. 64) .and. - > (grid_points(2) .eq. 64) .and. - > (grid_points(3) .eq. 64) .and. - > (no_time_steps . eq. 200) ) then - - class = 'A' - dtref = 0.8d-3 -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual. -c--------------------------------------------------------------------- - xcrref(1) = 1.0806346714637264d+02 - xcrref(2) = 1.1319730901220813d+01 - xcrref(3) = 2.5974354511582465d+01 - xcrref(4) = 2.3665622544678910d+01 - xcrref(5) = 2.5278963211748344d+02 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error. -c--------------------------------------------------------------------- - - if (iotype .eq. 0) then - xceref(1) = 4.2348416040525025d+00 - xceref(2) = 4.4390282496995698d-01 - xceref(3) = 9.6692480136345650d-01 - xceref(4) = 8.8302063039765474d-01 - xceref(5) = 9.7379901770829278d+00 - else - xceref(1) = 0.6482218724961d+02 - xceref(2) = 0.5066461714527d+01 - xceref(3) = 0.1613931961359d+02 - xceref(4) = 0.1452010201481d+02 - xceref(5) = 0.1420099377681d+03 - endif - -c--------------------------------------------------------------------- -c reference data for 102X102X102 grids after 200 time steps, -c with DT = 3.0d-04 -c--------------------------------------------------------------------- - elseif ( (grid_points(1) .eq. 102) .and. - > (grid_points(2) .eq. 102) .and. - > (grid_points(3) .eq. 102) .and. - > (no_time_steps . eq. 200) ) then - - class = 'B' - dtref = 3.0d-4 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual. -c--------------------------------------------------------------------- - xcrref(1) = 1.4233597229287254d+03 - xcrref(2) = 9.9330522590150238d+01 - xcrref(3) = 3.5646025644535285d+02 - xcrref(4) = 3.2485447959084092d+02 - xcrref(5) = 3.2707541254659363d+03 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error. -c--------------------------------------------------------------------- - - if (iotype .eq. 0) then - xceref(1) = 5.2969847140936856d+01 - xceref(2) = 4.4632896115670668d+00 - xceref(3) = 1.3122573342210174d+01 - xceref(4) = 1.2006925323559144d+01 - xceref(5) = 1.2459576151035986d+02 - else - xceref(1) = 0.1477545106464d+03 - xceref(2) = 0.1108895555053d+02 - xceref(3) = 0.3698065590331d+02 - xceref(4) = 0.3310505581440d+02 - xceref(5) = 0.3157928282563d+03 - endif - -c--------------------------------------------------------------------- -c reference data for 162X162X162 grids after 200 time steps, -c with DT = 1.0d-04 -c--------------------------------------------------------------------- - elseif ( (grid_points(1) .eq. 162) .and. - > (grid_points(2) .eq. 162) .and. - > (grid_points(3) .eq. 162) .and. - > (no_time_steps . eq. 200) ) then - - class = 'C' - dtref = 1.0d-4 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual. -c--------------------------------------------------------------------- - xcrref(1) = 0.62398116551764615d+04 - xcrref(2) = 0.50793239190423964d+03 - xcrref(3) = 0.15423530093013596d+04 - xcrref(4) = 0.13302387929291190d+04 - xcrref(5) = 0.11604087428436455d+05 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error. -c--------------------------------------------------------------------- - - if (iotype .eq. 0) then - xceref(1) = 0.16462008369091265d+03 - xceref(2) = 0.11497107903824313d+02 - xceref(3) = 0.41207446207461508d+02 - xceref(4) = 0.37087651059694167d+02 - xceref(5) = 0.36211053051841265d+03 - else - xceref(1) = 0.2597156483475d+03 - xceref(2) = 0.1985384289495d+02 - xceref(3) = 0.6517950485788d+02 - xceref(4) = 0.5757235541520d+02 - xceref(5) = 0.5215668188726d+03 - endif - - -c--------------------------------------------------------------------- -c reference data for 408x408x408 grids after 250 time steps, -c with DT = 0.2d-04 -c--------------------------------------------------------------------- - elseif ( (grid_points(1) .eq. 408) .and. - > (grid_points(2) .eq. 408) .and. - > (grid_points(3) .eq. 408) .and. - > (no_time_steps . eq. 250) ) then - - class = 'D' - dtref = 0.2d-4 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual. -c--------------------------------------------------------------------- - xcrref(1) = 0.2533188551738d+05 - xcrref(2) = 0.2346393716980d+04 - xcrref(3) = 0.6294554366904d+04 - xcrref(4) = 0.5352565376030d+04 - xcrref(5) = 0.3905864038618d+05 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error. -c--------------------------------------------------------------------- - - if (iotype .eq. 0) then - xceref(1) = 0.3100009377557d+03 - xceref(2) = 0.2424086324913d+02 - xceref(3) = 0.7782212022645d+02 - xceref(4) = 0.6835623860116d+02 - xceref(5) = 0.6065737200368d+03 - else - xceref(1) = 0.3813781566713d+03 - xceref(2) = 0.3160872966198d+02 - xceref(3) = 0.9593576357290d+02 - xceref(4) = 0.8363391989815d+02 - xceref(5) = 0.7063466087423d+03 - endif - - -c--------------------------------------------------------------------- -c reference data for 1020x1020x1020 grids after 250 time steps, -c with DT = 0.4d-05 -c--------------------------------------------------------------------- - elseif ( (grid_points(1) .eq. 1020) .and. - > (grid_points(2) .eq. 1020) .and. - > (grid_points(3) .eq. 1020) .and. - > (no_time_steps . eq. 250) ) then - - class = 'E' - dtref = 0.4d-5 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual. -c--------------------------------------------------------------------- - xcrref(1) = 0.9795372484517d+05 - xcrref(2) = 0.9739814511521d+04 - xcrref(3) = 0.2467606342965d+05 - xcrref(4) = 0.2092419572860d+05 - xcrref(5) = 0.1392138856939d+06 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error. -c--------------------------------------------------------------------- - - if (iotype .eq. 0) then - xceref(1) = 0.4327562208414d+03 - xceref(2) = 0.3699051964887d+02 - xceref(3) = 0.1089845040954d+03 - xceref(4) = 0.9462517622043d+02 - xceref(5) = 0.7765512765309d+03 - else -c wr_interval = 5 - xceref(1) = 0.4729898413058d+03 - xceref(2) = 0.4145899331704d+02 - xceref(3) = 0.1192850917138d+03 - xceref(4) = 0.1032746026932d+03 - xceref(5) = 0.8270322177634d+03 -c wr_interval = 10 -c xceref(1) = 0.4718135916251d+03 -c xceref(2) = 0.4132620259096d+02 -c xceref(3) = 0.1189831133503d+03 -c xceref(4) = 0.1030212798803d+03 -c xceref(5) = 0.8255924078458d+03 - endif - - else - verified = .false. - endif - -c--------------------------------------------------------------------- -c verification test for residuals if gridsize is one of -c the defined grid sizes above (class .ne. 'U') -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Compute the difference of solution values and the known reference -c values. -c--------------------------------------------------------------------- - do m = 1, 5 - - xcrdif(m) = dabs((xcr(m)-xcrref(m))/xcrref(m)) - xcedif(m) = dabs((xce(m)-xceref(m))/xceref(m)) - - enddo - -c--------------------------------------------------------------------- -c Output the comparison of computed results to known cases. -c--------------------------------------------------------------------- - - if (class .ne. 'U') then - write(*, 1990) class - 1990 format(' Verification being performed for class ', a) - write (*,2000) epsilon - 2000 format(' accuracy setting for epsilon = ', E20.13) - verified = (dabs(dt-dtref) .le. epsilon) - if (.not.verified) then - verified = .false. - class = 'U' - write (*,1000) dtref - 1000 format(' DT does not match the reference value of ', - > E15.8) - endif - else - write(*, 1995) - 1995 format(' Unknown class') - endif - - - if (class .ne. 'U') then - write (*,2001) - else - write (*, 2005) - endif - - 2001 format(' Comparison of RMS-norms of residual') - 2005 format(' RMS-norms of residual') - do m = 1, 5 - if (class .eq. 'U') then - write(*, 2015) m, xcr(m) - else if (xcrdif(m) .le. epsilon) then - write (*,2011) m,xcr(m),xcrref(m),xcrdif(m) - else - verified = .false. - write (*,2010) m,xcr(m),xcrref(m),xcrdif(m) - endif - enddo - - if (class .ne. 'U') then - write (*,2002) - else - write (*,2006) - endif - 2002 format(' Comparison of RMS-norms of solution error') - 2006 format(' RMS-norms of solution error') - - do m = 1, 5 - if (class .eq. 'U') then - write(*, 2015) m, xce(m) - else if (xcedif(m) .le. epsilon) then - write (*,2011) m,xce(m),xceref(m),xcedif(m) - else - verified = .false. - write (*,2010) m,xce(m),xceref(m),xcedif(m) - endif - enddo - - 2010 format(' FAILURE: ', i2, E20.13, E20.13, E20.13) - 2011 format(' ', i2, E20.13, E20.13, E20.13) - 2015 format(' ', i2, E20.13) - - if (class .eq. 'U') then - write(*, 2022) - write(*, 2023) - 2022 format(' No reference values provided') - 2023 format(' No verification performed') - else if (verified) then - write(*, 2020) - 2020 format(' Verification Successful') - else - write(*, 2021) - 2021 format(' Verification failed') - endif - - return - - - end diff --git a/examples/smpi/NAS/BT/work_lhs.h b/examples/smpi/NAS/BT/work_lhs.h deleted file mode 100644 index d9bc9e4d66..0000000000 --- a/examples/smpi/NAS/BT/work_lhs.h +++ /dev/null @@ -1,14 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- -c -c work_lhs.h -c -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - double precision fjac(5, 5, -2:MAX_CELL_DIM+1), - > njac(5, 5, -2:MAX_CELL_DIM+1), - > lhsa(5, 5, -1:MAX_CELL_DIM), - > lhsb(5, 5, -1:MAX_CELL_DIM), - > tmp1, tmp2, tmp3 - common /work_lhs/ fjac, njac, lhsa, lhsb, tmp1, tmp2, tmp3 diff --git a/examples/smpi/NAS/BT/work_lhs_vec.h b/examples/smpi/NAS/BT/work_lhs_vec.h deleted file mode 100644 index a97054f419..0000000000 --- a/examples/smpi/NAS/BT/work_lhs_vec.h +++ /dev/null @@ -1,14 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- -c -c work_lhs_vec.h -c -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - double precision fjac(5, 5, -2:MAX_CELL_DIM+1, -2:MAX_CELL_DIM+1), - > njac(5, 5, -2:MAX_CELL_DIM+1, -2:MAX_CELL_DIM+1), - > lhsa(5, 5, -1:MAX_CELL_DIM, -1:MAX_CELL_DIM), - > lhsb(5, 5, -1:MAX_CELL_DIM, -1:MAX_CELL_DIM), - > tmp1, tmp2, tmp3 - common /work_lhs/ fjac, njac, lhsa, lhsb, tmp1, tmp2, tmp3 diff --git a/examples/smpi/NAS/BT/x_solve.f b/examples/smpi/NAS/BT/x_solve.f deleted file mode 100644 index 5386732616..0000000000 --- a/examples/smpi/NAS/BT/x_solve.f +++ /dev/null @@ -1,761 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_solve - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c Performs line solves in X direction by first factoring -c the block-tridiagonal matrix into an upper triangular matrix, -c and then performing back substitution to solve for the unknow -c vectors of each line. -c -c Make sure we treat elements zero to cell_size in the direction -c of the sweep. -c -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - integer c, istart, stage, - > first, last, recv_id, error, r_status(MPI_STATUS_SIZE), - > isize,jsize,ksize,send_id - - istart = 0 - -c--------------------------------------------------------------------- -c in our terminology stage is the number of the cell in the x-direction -c i.e. stage = 1 means the start of the line stage=ncells means end -c--------------------------------------------------------------------- - do stage = 1,ncells - c = slice(1,stage) - isize = cell_size(1,c) - 1 - jsize = cell_size(2,c) - 1 - ksize = cell_size(3,c) - 1 - -c--------------------------------------------------------------------- -c set last-cell flag -c--------------------------------------------------------------------- - if (stage .eq. ncells) then - last = 1 - else - last = 0 - endif - - if (stage .eq. 1) then -c--------------------------------------------------------------------- -c This is the first cell, so solve without receiving data -c--------------------------------------------------------------------- - first = 1 -c call lhsx(c) - call x_solve_cell(first,last,c) - else -c--------------------------------------------------------------------- -c Not the first cell of this line, so receive info from -c processor working on preceeding cell -c--------------------------------------------------------------------- - first = 0 - call x_receive_solve_info(recv_id,c) -c--------------------------------------------------------------------- -c overlap computations and communications -c--------------------------------------------------------------------- -c call lhsx(c) -c--------------------------------------------------------------------- -c wait for completion -c--------------------------------------------------------------------- - call mpi_wait(send_id,r_status,error) - call mpi_wait(recv_id,r_status,error) -c--------------------------------------------------------------------- -c install C'(istart) and rhs'(istart) to be used in this cell -c--------------------------------------------------------------------- - call x_unpack_solve_info(c) - call x_solve_cell(first,last,c) - endif - - if (last .eq. 0) call x_send_solve_info(send_id,c) - enddo - -c--------------------------------------------------------------------- -c now perform backsubstitution in reverse direction -c--------------------------------------------------------------------- - do stage = ncells, 1, -1 - c = slice(1,stage) - first = 0 - last = 0 - if (stage .eq. 1) first = 1 - if (stage .eq. ncells) then - last = 1 -c--------------------------------------------------------------------- -c last cell, so perform back substitute without waiting -c--------------------------------------------------------------------- - call x_backsubstitute(first, last,c) - else - call x_receive_backsub_info(recv_id,c) - call mpi_wait(send_id,r_status,error) - call mpi_wait(recv_id,r_status,error) - call x_unpack_backsub_info(c) - call x_backsubstitute(first,last,c) - endif - if (first .eq. 0) call x_send_backsub_info(send_id,c) - enddo - - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_unpack_solve_info(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c unpack C'(-1) and rhs'(-1) for -c all j and k -c--------------------------------------------------------------------- - - include 'header.h' - integer j,k,m,n,ptr,c,istart - - istart = 0 - ptr = 0 - do k=0,KMAX-1 - do j=0,JMAX-1 - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - lhsc(m,n,istart-1,j,k,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - do n=1,BLOCK_SIZE - rhs(n,istart-1,j,k,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_send_solve_info(send_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c pack up and send C'(iend) and rhs'(iend) for -c all j and k -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer j,k,m,n,isize,ptr,c,jp,kp - integer error,send_id,buffer_size - - isize = cell_size(1,c)-1 - jp = cell_coord(2,c) - 1 - kp = cell_coord(3,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM* - > (BLOCK_SIZE*BLOCK_SIZE + BLOCK_SIZE) - -c--------------------------------------------------------------------- -c pack up buffer -c--------------------------------------------------------------------- - ptr = 0 - do k=0,KMAX-1 - do j=0,JMAX-1 - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = lhsc(m,n,isize,j,k,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = rhs(n,isize,j,k,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - -c--------------------------------------------------------------------- -c send buffer -c--------------------------------------------------------------------- - call mpi_isend(in_buffer, buffer_size, - > dp_type, successor(1), - > WEST+jp+kp*NCELLS, comm_solve, - > send_id,error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_send_backsub_info(send_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c pack up and send U(istart) for all j and k -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer j,k,n,ptr,c,istart,jp,kp - integer error,send_id,buffer_size - -c--------------------------------------------------------------------- -c Send element 0 to previous processor -c--------------------------------------------------------------------- - istart = 0 - jp = cell_coord(2,c)-1 - kp = cell_coord(3,c)-1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM*BLOCK_SIZE - ptr = 0 - do k=0,KMAX-1 - do j=0,JMAX-1 - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = rhs(n,istart,j,k,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - call mpi_isend(in_buffer, buffer_size, - > dp_type, predecessor(1), - > EAST+jp+kp*NCELLS, comm_solve, - > send_id,error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_unpack_backsub_info(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c unpack U(isize) for all j and k -c--------------------------------------------------------------------- - - include 'header.h' - integer j,k,n,ptr,c - - ptr = 0 - do k=0,KMAX-1 - do j=0,JMAX-1 - do n=1,BLOCK_SIZE - backsub_info(n,j,k,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_receive_backsub_info(recv_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c post mpi receives -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer error,recv_id,jp,kp,c,buffer_size - jp = cell_coord(2,c) - 1 - kp = cell_coord(3,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM*BLOCK_SIZE - call mpi_irecv(out_buffer, buffer_size, - > dp_type, successor(1), - > EAST+jp+kp*NCELLS, comm_solve, - > recv_id, error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_receive_solve_info(recv_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c post mpi receives -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer jp,kp,recv_id,error,c,buffer_size - jp = cell_coord(2,c) - 1 - kp = cell_coord(3,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM* - > (BLOCK_SIZE*BLOCK_SIZE + BLOCK_SIZE) - call mpi_irecv(out_buffer, buffer_size, - > dp_type, predecessor(1), - > WEST+jp+kp*NCELLS, comm_solve, - > recv_id, error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_backsubstitute(first, last, c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c back solve: if last cell, then generate U(isize)=rhs(isize) -c else assume U(isize) is loaded in un pack backsub_info -c so just use it -c after call u(istart) will be sent to next cell -c--------------------------------------------------------------------- - - include 'header.h' - - integer first, last, c, i, j, k - integer m,n,isize,jsize,ksize,istart - - istart = 0 - isize = cell_size(1,c)-1 - jsize = cell_size(2,c)-end(2,c)-1 - ksize = cell_size(3,c)-end(3,c)-1 - if (last .eq. 0) then - do k=start(3,c),ksize - do j=start(2,c),jsize -c--------------------------------------------------------------------- -c U(isize) uses info from previous cell if not last cell -c--------------------------------------------------------------------- - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - rhs(m,isize,j,k,c) = rhs(m,isize,j,k,c) - > - lhsc(m,n,isize,j,k,c)* - > backsub_info(n,j,k,c) -c--------------------------------------------------------------------- -c rhs(m,isize,j,k,c) = rhs(m,isize,j,k,c) -c $ - lhsc(m,n,isize,j,k,c)*rhs(n,isize+1,j,k,c) -c--------------------------------------------------------------------- - enddo - enddo - enddo - enddo - endif - do k=start(3,c),ksize - do j=start(2,c),jsize - do i=isize-1,istart,-1 - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - > - lhsc(m,n,i,j,k,c)*rhs(n,i+1,j,k,c) - enddo - enddo - enddo - enddo - enddo - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_solve_cell(first,last,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c performs guaussian elimination on this cell. -c -c assumes that unpacking routines for non-first cells -c preload C' and rhs' from previous cell. -c -c assumed send happens outside this routine, but that -c c'(IMAX) and rhs'(IMAX) will be sent to next cell -c--------------------------------------------------------------------- - - include 'header.h' - include 'work_lhs.h' - - integer first,last,c - integer i,j,k,isize,ksize,jsize,istart - - istart = 0 - isize = cell_size(1,c)-1 - jsize = cell_size(2,c)-end(2,c)-1 - ksize = cell_size(3,c)-end(3,c)-1 - - call lhsabinit(lhsa, lhsb, isize) - - do k=start(3,c),ksize - do j=start(2,c),jsize - -c--------------------------------------------------------------------- -c This function computes the left hand side in the xi-direction -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c determine a (labeled f) and n jacobians for cell c -c--------------------------------------------------------------------- - do i = start(1,c)-1, cell_size(1,c) - end(1,c) - - tmp1 = rho_i(i,j,k,c) - tmp2 = tmp1 * tmp1 - tmp3 = tmp1 * tmp2 -c--------------------------------------------------------------------- -c -c--------------------------------------------------------------------- - fjac(1,1,i) = 0.0d+00 - fjac(1,2,i) = 1.0d+00 - fjac(1,3,i) = 0.0d+00 - fjac(1,4,i) = 0.0d+00 - fjac(1,5,i) = 0.0d+00 - - fjac(2,1,i) = -(u(2,i,j,k,c) * tmp2 * - > u(2,i,j,k,c)) - > + c2 * qs(i,j,k,c) - fjac(2,2,i) = ( 2.0d+00 - c2 ) - > * ( u(2,i,j,k,c) * tmp1 ) - fjac(2,3,i) = - c2 * ( u(3,i,j,k,c) * tmp1 ) - fjac(2,4,i) = - c2 * ( u(4,i,j,k,c) * tmp1 ) - fjac(2,5,i) = c2 - - fjac(3,1,i) = - ( u(2,i,j,k,c)*u(3,i,j,k,c) ) * tmp2 - fjac(3,2,i) = u(3,i,j,k,c) * tmp1 - fjac(3,3,i) = u(2,i,j,k,c) * tmp1 - fjac(3,4,i) = 0.0d+00 - fjac(3,5,i) = 0.0d+00 - - fjac(4,1,i) = - ( u(2,i,j,k,c)*u(4,i,j,k,c) ) * tmp2 - fjac(4,2,i) = u(4,i,j,k,c) * tmp1 - fjac(4,3,i) = 0.0d+00 - fjac(4,4,i) = u(2,i,j,k,c) * tmp1 - fjac(4,5,i) = 0.0d+00 - - fjac(5,1,i) = ( c2 * 2.0d0 * qs(i,j,k,c) - > - c1 * ( u(5,i,j,k,c) * tmp1 ) ) - > * ( u(2,i,j,k,c) * tmp1 ) - fjac(5,2,i) = c1 * u(5,i,j,k,c) * tmp1 - > - c2 - > * ( u(2,i,j,k,c)*u(2,i,j,k,c) * tmp2 - > + qs(i,j,k,c) ) - fjac(5,3,i) = - c2 * ( u(3,i,j,k,c)*u(2,i,j,k,c) ) - > * tmp2 - fjac(5,4,i) = - c2 * ( u(4,i,j,k,c)*u(2,i,j,k,c) ) - > * tmp2 - fjac(5,5,i) = c1 * ( u(2,i,j,k,c) * tmp1 ) - - njac(1,1,i) = 0.0d+00 - njac(1,2,i) = 0.0d+00 - njac(1,3,i) = 0.0d+00 - njac(1,4,i) = 0.0d+00 - njac(1,5,i) = 0.0d+00 - - njac(2,1,i) = - con43 * c3c4 * tmp2 * u(2,i,j,k,c) - njac(2,2,i) = con43 * c3c4 * tmp1 - njac(2,3,i) = 0.0d+00 - njac(2,4,i) = 0.0d+00 - njac(2,5,i) = 0.0d+00 - - njac(3,1,i) = - c3c4 * tmp2 * u(3,i,j,k,c) - njac(3,2,i) = 0.0d+00 - njac(3,3,i) = c3c4 * tmp1 - njac(3,4,i) = 0.0d+00 - njac(3,5,i) = 0.0d+00 - - njac(4,1,i) = - c3c4 * tmp2 * u(4,i,j,k,c) - njac(4,2,i) = 0.0d+00 - njac(4,3,i) = 0.0d+00 - njac(4,4,i) = c3c4 * tmp1 - njac(4,5,i) = 0.0d+00 - - njac(5,1,i) = - ( con43 * c3c4 - > - c1345 ) * tmp3 * (u(2,i,j,k,c)**2) - > - ( c3c4 - c1345 ) * tmp3 * (u(3,i,j,k,c)**2) - > - ( c3c4 - c1345 ) * tmp3 * (u(4,i,j,k,c)**2) - > - c1345 * tmp2 * u(5,i,j,k,c) - - njac(5,2,i) = ( con43 * c3c4 - > - c1345 ) * tmp2 * u(2,i,j,k,c) - njac(5,3,i) = ( c3c4 - c1345 ) * tmp2 * u(3,i,j,k,c) - njac(5,4,i) = ( c3c4 - c1345 ) * tmp2 * u(4,i,j,k,c) - njac(5,5,i) = ( c1345 ) * tmp1 - - enddo -c--------------------------------------------------------------------- -c now jacobians set, so form left hand side in x direction -c--------------------------------------------------------------------- - do i = start(1,c), isize - end(1,c) - - tmp1 = dt * tx1 - tmp2 = dt * tx2 - - lhsa(1,1,i) = - tmp2 * fjac(1,1,i-1) - > - tmp1 * njac(1,1,i-1) - > - tmp1 * dx1 - lhsa(1,2,i) = - tmp2 * fjac(1,2,i-1) - > - tmp1 * njac(1,2,i-1) - lhsa(1,3,i) = - tmp2 * fjac(1,3,i-1) - > - tmp1 * njac(1,3,i-1) - lhsa(1,4,i) = - tmp2 * fjac(1,4,i-1) - > - tmp1 * njac(1,4,i-1) - lhsa(1,5,i) = - tmp2 * fjac(1,5,i-1) - > - tmp1 * njac(1,5,i-1) - - lhsa(2,1,i) = - tmp2 * fjac(2,1,i-1) - > - tmp1 * njac(2,1,i-1) - lhsa(2,2,i) = - tmp2 * fjac(2,2,i-1) - > - tmp1 * njac(2,2,i-1) - > - tmp1 * dx2 - lhsa(2,3,i) = - tmp2 * fjac(2,3,i-1) - > - tmp1 * njac(2,3,i-1) - lhsa(2,4,i) = - tmp2 * fjac(2,4,i-1) - > - tmp1 * njac(2,4,i-1) - lhsa(2,5,i) = - tmp2 * fjac(2,5,i-1) - > - tmp1 * njac(2,5,i-1) - - lhsa(3,1,i) = - tmp2 * fjac(3,1,i-1) - > - tmp1 * njac(3,1,i-1) - lhsa(3,2,i) = - tmp2 * fjac(3,2,i-1) - > - tmp1 * njac(3,2,i-1) - lhsa(3,3,i) = - tmp2 * fjac(3,3,i-1) - > - tmp1 * njac(3,3,i-1) - > - tmp1 * dx3 - lhsa(3,4,i) = - tmp2 * fjac(3,4,i-1) - > - tmp1 * njac(3,4,i-1) - lhsa(3,5,i) = - tmp2 * fjac(3,5,i-1) - > - tmp1 * njac(3,5,i-1) - - lhsa(4,1,i) = - tmp2 * fjac(4,1,i-1) - > - tmp1 * njac(4,1,i-1) - lhsa(4,2,i) = - tmp2 * fjac(4,2,i-1) - > - tmp1 * njac(4,2,i-1) - lhsa(4,3,i) = - tmp2 * fjac(4,3,i-1) - > - tmp1 * njac(4,3,i-1) - lhsa(4,4,i) = - tmp2 * fjac(4,4,i-1) - > - tmp1 * njac(4,4,i-1) - > - tmp1 * dx4 - lhsa(4,5,i) = - tmp2 * fjac(4,5,i-1) - > - tmp1 * njac(4,5,i-1) - - lhsa(5,1,i) = - tmp2 * fjac(5,1,i-1) - > - tmp1 * njac(5,1,i-1) - lhsa(5,2,i) = - tmp2 * fjac(5,2,i-1) - > - tmp1 * njac(5,2,i-1) - lhsa(5,3,i) = - tmp2 * fjac(5,3,i-1) - > - tmp1 * njac(5,3,i-1) - lhsa(5,4,i) = - tmp2 * fjac(5,4,i-1) - > - tmp1 * njac(5,4,i-1) - lhsa(5,5,i) = - tmp2 * fjac(5,5,i-1) - > - tmp1 * njac(5,5,i-1) - > - tmp1 * dx5 - - lhsb(1,1,i) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(1,1,i) - > + tmp1 * 2.0d+00 * dx1 - lhsb(1,2,i) = tmp1 * 2.0d+00 * njac(1,2,i) - lhsb(1,3,i) = tmp1 * 2.0d+00 * njac(1,3,i) - lhsb(1,4,i) = tmp1 * 2.0d+00 * njac(1,4,i) - lhsb(1,5,i) = tmp1 * 2.0d+00 * njac(1,5,i) - - lhsb(2,1,i) = tmp1 * 2.0d+00 * njac(2,1,i) - lhsb(2,2,i) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(2,2,i) - > + tmp1 * 2.0d+00 * dx2 - lhsb(2,3,i) = tmp1 * 2.0d+00 * njac(2,3,i) - lhsb(2,4,i) = tmp1 * 2.0d+00 * njac(2,4,i) - lhsb(2,5,i) = tmp1 * 2.0d+00 * njac(2,5,i) - - lhsb(3,1,i) = tmp1 * 2.0d+00 * njac(3,1,i) - lhsb(3,2,i) = tmp1 * 2.0d+00 * njac(3,2,i) - lhsb(3,3,i) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(3,3,i) - > + tmp1 * 2.0d+00 * dx3 - lhsb(3,4,i) = tmp1 * 2.0d+00 * njac(3,4,i) - lhsb(3,5,i) = tmp1 * 2.0d+00 * njac(3,5,i) - - lhsb(4,1,i) = tmp1 * 2.0d+00 * njac(4,1,i) - lhsb(4,2,i) = tmp1 * 2.0d+00 * njac(4,2,i) - lhsb(4,3,i) = tmp1 * 2.0d+00 * njac(4,3,i) - lhsb(4,4,i) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(4,4,i) - > + tmp1 * 2.0d+00 * dx4 - lhsb(4,5,i) = tmp1 * 2.0d+00 * njac(4,5,i) - - lhsb(5,1,i) = tmp1 * 2.0d+00 * njac(5,1,i) - lhsb(5,2,i) = tmp1 * 2.0d+00 * njac(5,2,i) - lhsb(5,3,i) = tmp1 * 2.0d+00 * njac(5,3,i) - lhsb(5,4,i) = tmp1 * 2.0d+00 * njac(5,4,i) - lhsb(5,5,i) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(5,5,i) - > + tmp1 * 2.0d+00 * dx5 - - lhsc(1,1,i,j,k,c) = tmp2 * fjac(1,1,i+1) - > - tmp1 * njac(1,1,i+1) - > - tmp1 * dx1 - lhsc(1,2,i,j,k,c) = tmp2 * fjac(1,2,i+1) - > - tmp1 * njac(1,2,i+1) - lhsc(1,3,i,j,k,c) = tmp2 * fjac(1,3,i+1) - > - tmp1 * njac(1,3,i+1) - lhsc(1,4,i,j,k,c) = tmp2 * fjac(1,4,i+1) - > - tmp1 * njac(1,4,i+1) - lhsc(1,5,i,j,k,c) = tmp2 * fjac(1,5,i+1) - > - tmp1 * njac(1,5,i+1) - - lhsc(2,1,i,j,k,c) = tmp2 * fjac(2,1,i+1) - > - tmp1 * njac(2,1,i+1) - lhsc(2,2,i,j,k,c) = tmp2 * fjac(2,2,i+1) - > - tmp1 * njac(2,2,i+1) - > - tmp1 * dx2 - lhsc(2,3,i,j,k,c) = tmp2 * fjac(2,3,i+1) - > - tmp1 * njac(2,3,i+1) - lhsc(2,4,i,j,k,c) = tmp2 * fjac(2,4,i+1) - > - tmp1 * njac(2,4,i+1) - lhsc(2,5,i,j,k,c) = tmp2 * fjac(2,5,i+1) - > - tmp1 * njac(2,5,i+1) - - lhsc(3,1,i,j,k,c) = tmp2 * fjac(3,1,i+1) - > - tmp1 * njac(3,1,i+1) - lhsc(3,2,i,j,k,c) = tmp2 * fjac(3,2,i+1) - > - tmp1 * njac(3,2,i+1) - lhsc(3,3,i,j,k,c) = tmp2 * fjac(3,3,i+1) - > - tmp1 * njac(3,3,i+1) - > - tmp1 * dx3 - lhsc(3,4,i,j,k,c) = tmp2 * fjac(3,4,i+1) - > - tmp1 * njac(3,4,i+1) - lhsc(3,5,i,j,k,c) = tmp2 * fjac(3,5,i+1) - > - tmp1 * njac(3,5,i+1) - - lhsc(4,1,i,j,k,c) = tmp2 * fjac(4,1,i+1) - > - tmp1 * njac(4,1,i+1) - lhsc(4,2,i,j,k,c) = tmp2 * fjac(4,2,i+1) - > - tmp1 * njac(4,2,i+1) - lhsc(4,3,i,j,k,c) = tmp2 * fjac(4,3,i+1) - > - tmp1 * njac(4,3,i+1) - lhsc(4,4,i,j,k,c) = tmp2 * fjac(4,4,i+1) - > - tmp1 * njac(4,4,i+1) - > - tmp1 * dx4 - lhsc(4,5,i,j,k,c) = tmp2 * fjac(4,5,i+1) - > - tmp1 * njac(4,5,i+1) - - lhsc(5,1,i,j,k,c) = tmp2 * fjac(5,1,i+1) - > - tmp1 * njac(5,1,i+1) - lhsc(5,2,i,j,k,c) = tmp2 * fjac(5,2,i+1) - > - tmp1 * njac(5,2,i+1) - lhsc(5,3,i,j,k,c) = tmp2 * fjac(5,3,i+1) - > - tmp1 * njac(5,3,i+1) - lhsc(5,4,i,j,k,c) = tmp2 * fjac(5,4,i+1) - > - tmp1 * njac(5,4,i+1) - lhsc(5,5,i,j,k,c) = tmp2 * fjac(5,5,i+1) - > - tmp1 * njac(5,5,i+1) - > - tmp1 * dx5 - - enddo - - -c--------------------------------------------------------------------- -c outer most do loops - sweeping in i direction -c--------------------------------------------------------------------- - if (first .eq. 1) then - -c--------------------------------------------------------------------- -c multiply c(istart,j,k) by b_inverse and copy back to c -c multiply rhs(istart) by b_inverse(istart) and copy to rhs -c--------------------------------------------------------------------- - call binvcrhs( lhsb(1,1,istart), - > lhsc(1,1,istart,j,k,c), - > rhs(1,istart,j,k,c) ) - - endif - -c--------------------------------------------------------------------- -c begin inner most do loop -c do all the elements of the cell unless last -c--------------------------------------------------------------------- - do i=istart+first,isize-last - -c--------------------------------------------------------------------- -c rhs(i) = rhs(i) - A*rhs(i-1) -c--------------------------------------------------------------------- - call matvec_sub(lhsa(1,1,i), - > rhs(1,i-1,j,k,c),rhs(1,i,j,k,c)) - -c--------------------------------------------------------------------- -c B(i) = B(i) - C(i-1)*A(i) -c--------------------------------------------------------------------- - call matmul_sub(lhsa(1,1,i), - > lhsc(1,1,i-1,j,k,c), - > lhsb(1,1,i)) - - -c--------------------------------------------------------------------- -c multiply c(i,j,k) by b_inverse and copy back to c -c multiply rhs(1,j,k) by b_inverse(1,j,k) and copy to rhs -c--------------------------------------------------------------------- - call binvcrhs( lhsb(1,1,i), - > lhsc(1,1,i,j,k,c), - > rhs(1,i,j,k,c) ) - - enddo - -c--------------------------------------------------------------------- -c Now finish up special cases for last cell -c--------------------------------------------------------------------- - if (last .eq. 1) then - -c--------------------------------------------------------------------- -c rhs(isize) = rhs(isize) - A*rhs(isize-1) -c--------------------------------------------------------------------- - call matvec_sub(lhsa(1,1,isize), - > rhs(1,isize-1,j,k,c),rhs(1,isize,j,k,c)) - -c--------------------------------------------------------------------- -c B(isize) = B(isize) - C(isize-1)*A(isize) -c--------------------------------------------------------------------- - call matmul_sub(lhsa(1,1,isize), - > lhsc(1,1,isize-1,j,k,c), - > lhsb(1,1,isize)) - -c--------------------------------------------------------------------- -c multiply rhs() by b_inverse() and copy to rhs -c--------------------------------------------------------------------- - call binvrhs( lhsb(1,1,isize), - > rhs(1,isize,j,k,c) ) - - endif - enddo - enddo - - - return - end - diff --git a/examples/smpi/NAS/BT/x_solve_vec.f b/examples/smpi/NAS/BT/x_solve_vec.f deleted file mode 100644 index 8f1c1371db..0000000000 --- a/examples/smpi/NAS/BT/x_solve_vec.f +++ /dev/null @@ -1,789 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_solve - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c Performs line solves in X direction by first factoring -c the block-tridiagonal matrix into an upper triangular matrix, -c and then performing back substitution to solve for the unknow -c vectors of each line. -c -c Make sure we treat elements zero to cell_size in the direction -c of the sweep. -c -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - integer c, istart, stage, - > first, last, recv_id, error, r_status(MPI_STATUS_SIZE), - > isize,jsize,ksize,send_id - - istart = 0 - -c--------------------------------------------------------------------- -c in our terminology stage is the number of the cell in the x-direct -c i.e. stage = 1 means the start of the line stage=ncells means end -c--------------------------------------------------------------------- - do stage = 1,ncells - c = slice(1,stage) - isize = cell_size(1,c) - 1 - jsize = cell_size(2,c) - 1 - ksize = cell_size(3,c) - 1 - -c--------------------------------------------------------------------- -c set last-cell flag -c--------------------------------------------------------------------- - if (stage .eq. ncells) then - last = 1 - else - last = 0 - endif - - if (stage .eq. 1) then -c--------------------------------------------------------------------- -c This is the first cell, so solve without receiving data -c--------------------------------------------------------------------- - first = 1 -c call lhsx(c) - call x_solve_cell(first,last,c) - else -c--------------------------------------------------------------------- -c Not the first cell of this line, so receive info from -c processor working on preceeding cell -c--------------------------------------------------------------------- - first = 0 - call x_receive_solve_info(recv_id,c) -c--------------------------------------------------------------------- -c overlap computations and communications -c--------------------------------------------------------------------- -c call lhsx(c) -c--------------------------------------------------------------------- -c wait for completion -c--------------------------------------------------------------------- - call mpi_wait(send_id,r_status,error) - call mpi_wait(recv_id,r_status,error) -c--------------------------------------------------------------------- -c install C'(istart) and rhs'(istart) to be used in this cell -c--------------------------------------------------------------------- - call x_unpack_solve_info(c) - call x_solve_cell(first,last,c) - endif - - if (last .eq. 0) call x_send_solve_info(send_id,c) - enddo - -c--------------------------------------------------------------------- -c now perform backsubstitution in reverse direction -c--------------------------------------------------------------------- - do stage = ncells, 1, -1 - c = slice(1,stage) - first = 0 - last = 0 - if (stage .eq. 1) first = 1 - if (stage .eq. ncells) then - last = 1 -c--------------------------------------------------------------------- -c last cell, so perform back substitute without waiting -c--------------------------------------------------------------------- - call x_backsubstitute(first, last,c) - else - call x_receive_backsub_info(recv_id,c) - call mpi_wait(send_id,r_status,error) - call mpi_wait(recv_id,r_status,error) - call x_unpack_backsub_info(c) - call x_backsubstitute(first,last,c) - endif - if (first .eq. 0) call x_send_backsub_info(send_id,c) - enddo - - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_unpack_solve_info(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c unpack C'(-1) and rhs'(-1) for -c all j and k -c--------------------------------------------------------------------- - - include 'header.h' - integer j,k,m,n,ptr,c,istart - - istart = 0 - ptr = 0 - do k=0,KMAX-1 - do j=0,JMAX-1 - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - lhsc(m,n,istart-1,j,k,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - do n=1,BLOCK_SIZE - rhs(n,istart-1,j,k,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_send_solve_info(send_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c pack up and send C'(iend) and rhs'(iend) for -c all j and k -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer j,k,m,n,isize,ptr,c,jp,kp - integer error,send_id,buffer_size - - isize = cell_size(1,c)-1 - jp = cell_coord(2,c) - 1 - kp = cell_coord(3,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM* - > (BLOCK_SIZE*BLOCK_SIZE + BLOCK_SIZE) - -c--------------------------------------------------------------------- -c pack up buffer -c--------------------------------------------------------------------- - ptr = 0 - do k=0,KMAX-1 - do j=0,JMAX-1 - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = lhsc(m,n,isize,j,k,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = rhs(n,isize,j,k,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - -c--------------------------------------------------------------------- -c send buffer -c--------------------------------------------------------------------- - call mpi_isend(in_buffer, buffer_size, - > dp_type, successor(1), - > WEST+jp+kp*NCELLS, comm_solve, - > send_id,error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_send_backsub_info(send_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c pack up and send U(istart) for all j and k -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer j,k,n,ptr,c,istart,jp,kp - integer error,send_id,buffer_size - -c--------------------------------------------------------------------- -c Send element 0 to previous processor -c--------------------------------------------------------------------- - istart = 0 - jp = cell_coord(2,c)-1 - kp = cell_coord(3,c)-1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM*BLOCK_SIZE - ptr = 0 - do k=0,KMAX-1 - do j=0,JMAX-1 - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = rhs(n,istart,j,k,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - call mpi_isend(in_buffer, buffer_size, - > dp_type, predecessor(1), - > EAST+jp+kp*NCELLS, comm_solve, - > send_id,error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_unpack_backsub_info(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c unpack U(isize) for all j and k -c--------------------------------------------------------------------- - - include 'header.h' - integer j,k,n,ptr,c - - ptr = 0 - do k=0,KMAX-1 - do j=0,JMAX-1 - do n=1,BLOCK_SIZE - backsub_info(n,j,k,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_receive_backsub_info(recv_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c post mpi receives -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer error,recv_id,jp,kp,c,buffer_size - jp = cell_coord(2,c) - 1 - kp = cell_coord(3,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM*BLOCK_SIZE - call mpi_irecv(out_buffer, buffer_size, - > dp_type, successor(1), - > EAST+jp+kp*NCELLS, comm_solve, - > recv_id, error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_receive_solve_info(recv_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c post mpi receives -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer jp,kp,recv_id,error,c,buffer_size - jp = cell_coord(2,c) - 1 - kp = cell_coord(3,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM* - > (BLOCK_SIZE*BLOCK_SIZE + BLOCK_SIZE) - call mpi_irecv(out_buffer, buffer_size, - > dp_type, predecessor(1), - > WEST+jp+kp*NCELLS, comm_solve, - > recv_id, error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_backsubstitute(first, last, c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c back solve: if last cell, then generate U(isize)=rhs(isize) -c else assume U(isize) is loaded in un pack backsub_info -c so just use it -c after call u(istart) will be sent to next cell -c--------------------------------------------------------------------- - - include 'header.h' - - integer first, last, c, i, j, k - integer m,n,isize,jsize,ksize,istart - - istart = 0 - isize = cell_size(1,c)-1 - jsize = cell_size(2,c)-end(2,c)-1 - ksize = cell_size(3,c)-end(3,c)-1 - if (last .eq. 0) then - do k=start(3,c),ksize - do j=start(2,c),jsize -c--------------------------------------------------------------------- -c U(isize) uses info from previous cell if not last cell -c--------------------------------------------------------------------- - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - rhs(m,isize,j,k,c) = rhs(m,isize,j,k,c) - > - lhsc(m,n,isize,j,k,c)* - > backsub_info(n,j,k,c) -c--------------------------------------------------------------------- -c rhs(m,isize,j,k,c) = rhs(m,isize,j,k,c) -c $ - lhsc(m,n,isize,j,k,c)*rhs(n,isize+1,j,k,c) -c--------------------------------------------------------------------- - enddo - enddo - enddo - enddo - endif - do k=start(3,c),ksize - do j=start(2,c),jsize - do i=isize-1,istart,-1 - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - > - lhsc(m,n,i,j,k,c)*rhs(n,i+1,j,k,c) - enddo - enddo - enddo - enddo - enddo - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_solve_cell(first,last,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c performs guaussian elimination on this cell. -c -c assumes that unpacking routines for non-first cells -c preload C' and rhs' from previous cell. -c -c assumed send happens outside this routine, but that -c c'(IMAX) and rhs'(IMAX) will be sent to next cell -c--------------------------------------------------------------------- - - include 'header.h' - include 'work_lhs_vec.h' - - integer first,last,c - integer i,j,k,m,n,isize,ksize,jsize,istart - - istart = 0 - isize = cell_size(1,c)-1 - jsize = cell_size(2,c)-end(2,c)-1 - ksize = cell_size(3,c)-end(3,c)-1 - -c--------------------------------------------------------------------- -c zero the left hand side for starters -c set diagonal values to 1. This is overkill, but convenient -c--------------------------------------------------------------------- - do j = 0, jsize - do m = 1, 5 - do n = 1, 5 - lhsa(m,n,0,j) = 0.0d0 - lhsb(m,n,0,j) = 0.0d0 - lhsa(m,n,isize,j) = 0.0d0 - lhsb(m,n,isize,j) = 0.0d0 - enddo - lhsb(m,m,0,j) = 1.0d0 - lhsb(m,m,isize,j) = 1.0d0 - enddo - enddo - - do k=start(3,c),ksize - -c--------------------------------------------------------------------- -c This function computes the left hand side in the xi-direction -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c determine a (labeled f) and n jacobians for cell c -c--------------------------------------------------------------------- - do j=start(2,c),jsize - do i = start(1,c)-1, cell_size(1,c) - end(1,c) - - tmp1 = rho_i(i,j,k,c) - tmp2 = tmp1 * tmp1 - tmp3 = tmp1 * tmp2 -c--------------------------------------------------------------------- -c -c--------------------------------------------------------------------- - fjac(1,1,i,j) = 0.0d+00 - fjac(1,2,i,j) = 1.0d+00 - fjac(1,3,i,j) = 0.0d+00 - fjac(1,4,i,j) = 0.0d+00 - fjac(1,5,i,j) = 0.0d+00 - - fjac(2,1,i,j) = -(u(2,i,j,k,c) * tmp2 * - > u(2,i,j,k,c)) - > + c2 * qs(i,j,k,c) - fjac(2,2,i,j) = ( 2.0d+00 - c2 ) - > * ( u(2,i,j,k,c) * tmp1 ) - fjac(2,3,i,j) = - c2 * ( u(3,i,j,k,c) * tmp1 ) - fjac(2,4,i,j) = - c2 * ( u(4,i,j,k,c) * tmp1 ) - fjac(2,5,i,j) = c2 - - fjac(3,1,i,j) = - ( u(2,i,j,k,c)*u(3,i,j,k,c) ) * tmp2 - fjac(3,2,i,j) = u(3,i,j,k,c) * tmp1 - fjac(3,3,i,j) = u(2,i,j,k,c) * tmp1 - fjac(3,4,i,j) = 0.0d+00 - fjac(3,5,i,j) = 0.0d+00 - - fjac(4,1,i,j) = - ( u(2,i,j,k,c)*u(4,i,j,k,c) ) * tmp2 - fjac(4,2,i,j) = u(4,i,j,k,c) * tmp1 - fjac(4,3,i,j) = 0.0d+00 - fjac(4,4,i,j) = u(2,i,j,k,c) * tmp1 - fjac(4,5,i,j) = 0.0d+00 - - fjac(5,1,i,j) = ( c2 * 2.0d0 * qs(i,j,k,c) - > - c1 * ( u(5,i,j,k,c) * tmp1 ) ) - > * ( u(2,i,j,k,c) * tmp1 ) - fjac(5,2,i,j) = c1 * u(5,i,j,k,c) * tmp1 - > - c2 - > * ( u(2,i,j,k,c)*u(2,i,j,k,c) * tmp2 - > + qs(i,j,k,c) ) - fjac(5,3,i,j) = - c2 * ( u(3,i,j,k,c)*u(2,i,j,k,c) ) - > * tmp2 - fjac(5,4,i,j) = - c2 * ( u(4,i,j,k,c)*u(2,i,j,k,c) ) - > * tmp2 - fjac(5,5,i,j) = c1 * ( u(2,i,j,k,c) * tmp1 ) - - njac(1,1,i,j) = 0.0d+00 - njac(1,2,i,j) = 0.0d+00 - njac(1,3,i,j) = 0.0d+00 - njac(1,4,i,j) = 0.0d+00 - njac(1,5,i,j) = 0.0d+00 - - njac(2,1,i,j) = - con43 * c3c4 * tmp2 * u(2,i,j,k,c) - njac(2,2,i,j) = con43 * c3c4 * tmp1 - njac(2,3,i,j) = 0.0d+00 - njac(2,4,i,j) = 0.0d+00 - njac(2,5,i,j) = 0.0d+00 - - njac(3,1,i,j) = - c3c4 * tmp2 * u(3,i,j,k,c) - njac(3,2,i,j) = 0.0d+00 - njac(3,3,i,j) = c3c4 * tmp1 - njac(3,4,i,j) = 0.0d+00 - njac(3,5,i,j) = 0.0d+00 - - njac(4,1,i,j) = - c3c4 * tmp2 * u(4,i,j,k,c) - njac(4,2,i,j) = 0.0d+00 - njac(4,3,i,j) = 0.0d+00 - njac(4,4,i,j) = c3c4 * tmp1 - njac(4,5,i,j) = 0.0d+00 - - njac(5,1,i,j) = - ( con43 * c3c4 - > - c1345 ) * tmp3 * (u(2,i,j,k,c)**2) - > - ( c3c4 - c1345 ) * tmp3 * (u(3,i,j,k,c)**2) - > - ( c3c4 - c1345 ) * tmp3 * (u(4,i,j,k,c)**2) - > - c1345 * tmp2 * u(5,i,j,k,c) - - njac(5,2,i,j) = ( con43 * c3c4 - > - c1345 ) * tmp2 * u(2,i,j,k,c) - njac(5,3,i,j) = ( c3c4 - c1345 ) * tmp2 * u(3,i,j,k,c) - njac(5,4,i,j) = ( c3c4 - c1345 ) * tmp2 * u(4,i,j,k,c) - njac(5,5,i,j) = ( c1345 ) * tmp1 - - enddo - enddo - -c--------------------------------------------------------------------- -c now jacobians set, so form left hand side in x direction -c--------------------------------------------------------------------- - do j=start(2,c),jsize - do i = start(1,c), isize - end(1,c) - - tmp1 = dt * tx1 - tmp2 = dt * tx2 - - lhsa(1,1,i,j) = - tmp2 * fjac(1,1,i-1,j) - > - tmp1 * njac(1,1,i-1,j) - > - tmp1 * dx1 - lhsa(1,2,i,j) = - tmp2 * fjac(1,2,i-1,j) - > - tmp1 * njac(1,2,i-1,j) - lhsa(1,3,i,j) = - tmp2 * fjac(1,3,i-1,j) - > - tmp1 * njac(1,3,i-1,j) - lhsa(1,4,i,j) = - tmp2 * fjac(1,4,i-1,j) - > - tmp1 * njac(1,4,i-1,j) - lhsa(1,5,i,j) = - tmp2 * fjac(1,5,i-1,j) - > - tmp1 * njac(1,5,i-1,j) - - lhsa(2,1,i,j) = - tmp2 * fjac(2,1,i-1,j) - > - tmp1 * njac(2,1,i-1,j) - lhsa(2,2,i,j) = - tmp2 * fjac(2,2,i-1,j) - > - tmp1 * njac(2,2,i-1,j) - > - tmp1 * dx2 - lhsa(2,3,i,j) = - tmp2 * fjac(2,3,i-1,j) - > - tmp1 * njac(2,3,i-1,j) - lhsa(2,4,i,j) = - tmp2 * fjac(2,4,i-1,j) - > - tmp1 * njac(2,4,i-1,j) - lhsa(2,5,i,j) = - tmp2 * fjac(2,5,i-1,j) - > - tmp1 * njac(2,5,i-1,j) - - lhsa(3,1,i,j) = - tmp2 * fjac(3,1,i-1,j) - > - tmp1 * njac(3,1,i-1,j) - lhsa(3,2,i,j) = - tmp2 * fjac(3,2,i-1,j) - > - tmp1 * njac(3,2,i-1,j) - lhsa(3,3,i,j) = - tmp2 * fjac(3,3,i-1,j) - > - tmp1 * njac(3,3,i-1,j) - > - tmp1 * dx3 - lhsa(3,4,i,j) = - tmp2 * fjac(3,4,i-1,j) - > - tmp1 * njac(3,4,i-1,j) - lhsa(3,5,i,j) = - tmp2 * fjac(3,5,i-1,j) - > - tmp1 * njac(3,5,i-1,j) - - lhsa(4,1,i,j) = - tmp2 * fjac(4,1,i-1,j) - > - tmp1 * njac(4,1,i-1,j) - lhsa(4,2,i,j) = - tmp2 * fjac(4,2,i-1,j) - > - tmp1 * njac(4,2,i-1,j) - lhsa(4,3,i,j) = - tmp2 * fjac(4,3,i-1,j) - > - tmp1 * njac(4,3,i-1,j) - lhsa(4,4,i,j) = - tmp2 * fjac(4,4,i-1,j) - > - tmp1 * njac(4,4,i-1,j) - > - tmp1 * dx4 - lhsa(4,5,i,j) = - tmp2 * fjac(4,5,i-1,j) - > - tmp1 * njac(4,5,i-1,j) - - lhsa(5,1,i,j) = - tmp2 * fjac(5,1,i-1,j) - > - tmp1 * njac(5,1,i-1,j) - lhsa(5,2,i,j) = - tmp2 * fjac(5,2,i-1,j) - > - tmp1 * njac(5,2,i-1,j) - lhsa(5,3,i,j) = - tmp2 * fjac(5,3,i-1,j) - > - tmp1 * njac(5,3,i-1,j) - lhsa(5,4,i,j) = - tmp2 * fjac(5,4,i-1,j) - > - tmp1 * njac(5,4,i-1,j) - lhsa(5,5,i,j) = - tmp2 * fjac(5,5,i-1,j) - > - tmp1 * njac(5,5,i-1,j) - > - tmp1 * dx5 - - lhsb(1,1,i,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(1,1,i,j) - > + tmp1 * 2.0d+00 * dx1 - lhsb(1,2,i,j) = tmp1 * 2.0d+00 * njac(1,2,i,j) - lhsb(1,3,i,j) = tmp1 * 2.0d+00 * njac(1,3,i,j) - lhsb(1,4,i,j) = tmp1 * 2.0d+00 * njac(1,4,i,j) - lhsb(1,5,i,j) = tmp1 * 2.0d+00 * njac(1,5,i,j) - - lhsb(2,1,i,j) = tmp1 * 2.0d+00 * njac(2,1,i,j) - lhsb(2,2,i,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(2,2,i,j) - > + tmp1 * 2.0d+00 * dx2 - lhsb(2,3,i,j) = tmp1 * 2.0d+00 * njac(2,3,i,j) - lhsb(2,4,i,j) = tmp1 * 2.0d+00 * njac(2,4,i,j) - lhsb(2,5,i,j) = tmp1 * 2.0d+00 * njac(2,5,i,j) - - lhsb(3,1,i,j) = tmp1 * 2.0d+00 * njac(3,1,i,j) - lhsb(3,2,i,j) = tmp1 * 2.0d+00 * njac(3,2,i,j) - lhsb(3,3,i,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(3,3,i,j) - > + tmp1 * 2.0d+00 * dx3 - lhsb(3,4,i,j) = tmp1 * 2.0d+00 * njac(3,4,i,j) - lhsb(3,5,i,j) = tmp1 * 2.0d+00 * njac(3,5,i,j) - - lhsb(4,1,i,j) = tmp1 * 2.0d+00 * njac(4,1,i,j) - lhsb(4,2,i,j) = tmp1 * 2.0d+00 * njac(4,2,i,j) - lhsb(4,3,i,j) = tmp1 * 2.0d+00 * njac(4,3,i,j) - lhsb(4,4,i,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(4,4,i,j) - > + tmp1 * 2.0d+00 * dx4 - lhsb(4,5,i,j) = tmp1 * 2.0d+00 * njac(4,5,i,j) - - lhsb(5,1,i,j) = tmp1 * 2.0d+00 * njac(5,1,i,j) - lhsb(5,2,i,j) = tmp1 * 2.0d+00 * njac(5,2,i,j) - lhsb(5,3,i,j) = tmp1 * 2.0d+00 * njac(5,3,i,j) - lhsb(5,4,i,j) = tmp1 * 2.0d+00 * njac(5,4,i,j) - lhsb(5,5,i,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(5,5,i,j) - > + tmp1 * 2.0d+00 * dx5 - - lhsc(1,1,i,j,k,c) = tmp2 * fjac(1,1,i+1,j) - > - tmp1 * njac(1,1,i+1,j) - > - tmp1 * dx1 - lhsc(1,2,i,j,k,c) = tmp2 * fjac(1,2,i+1,j) - > - tmp1 * njac(1,2,i+1,j) - lhsc(1,3,i,j,k,c) = tmp2 * fjac(1,3,i+1,j) - > - tmp1 * njac(1,3,i+1,j) - lhsc(1,4,i,j,k,c) = tmp2 * fjac(1,4,i+1,j) - > - tmp1 * njac(1,4,i+1,j) - lhsc(1,5,i,j,k,c) = tmp2 * fjac(1,5,i+1,j) - > - tmp1 * njac(1,5,i+1,j) - - lhsc(2,1,i,j,k,c) = tmp2 * fjac(2,1,i+1,j) - > - tmp1 * njac(2,1,i+1,j) - lhsc(2,2,i,j,k,c) = tmp2 * fjac(2,2,i+1,j) - > - tmp1 * njac(2,2,i+1,j) - > - tmp1 * dx2 - lhsc(2,3,i,j,k,c) = tmp2 * fjac(2,3,i+1,j) - > - tmp1 * njac(2,3,i+1,j) - lhsc(2,4,i,j,k,c) = tmp2 * fjac(2,4,i+1,j) - > - tmp1 * njac(2,4,i+1,j) - lhsc(2,5,i,j,k,c) = tmp2 * fjac(2,5,i+1,j) - > - tmp1 * njac(2,5,i+1,j) - - lhsc(3,1,i,j,k,c) = tmp2 * fjac(3,1,i+1,j) - > - tmp1 * njac(3,1,i+1,j) - lhsc(3,2,i,j,k,c) = tmp2 * fjac(3,2,i+1,j) - > - tmp1 * njac(3,2,i+1,j) - lhsc(3,3,i,j,k,c) = tmp2 * fjac(3,3,i+1,j) - > - tmp1 * njac(3,3,i+1,j) - > - tmp1 * dx3 - lhsc(3,4,i,j,k,c) = tmp2 * fjac(3,4,i+1,j) - > - tmp1 * njac(3,4,i+1,j) - lhsc(3,5,i,j,k,c) = tmp2 * fjac(3,5,i+1,j) - > - tmp1 * njac(3,5,i+1,j) - - lhsc(4,1,i,j,k,c) = tmp2 * fjac(4,1,i+1,j) - > - tmp1 * njac(4,1,i+1,j) - lhsc(4,2,i,j,k,c) = tmp2 * fjac(4,2,i+1,j) - > - tmp1 * njac(4,2,i+1,j) - lhsc(4,3,i,j,k,c) = tmp2 * fjac(4,3,i+1,j) - > - tmp1 * njac(4,3,i+1,j) - lhsc(4,4,i,j,k,c) = tmp2 * fjac(4,4,i+1,j) - > - tmp1 * njac(4,4,i+1,j) - > - tmp1 * dx4 - lhsc(4,5,i,j,k,c) = tmp2 * fjac(4,5,i+1,j) - > - tmp1 * njac(4,5,i+1,j) - - lhsc(5,1,i,j,k,c) = tmp2 * fjac(5,1,i+1,j) - > - tmp1 * njac(5,1,i+1,j) - lhsc(5,2,i,j,k,c) = tmp2 * fjac(5,2,i+1,j) - > - tmp1 * njac(5,2,i+1,j) - lhsc(5,3,i,j,k,c) = tmp2 * fjac(5,3,i+1,j) - > - tmp1 * njac(5,3,i+1,j) - lhsc(5,4,i,j,k,c) = tmp2 * fjac(5,4,i+1,j) - > - tmp1 * njac(5,4,i+1,j) - lhsc(5,5,i,j,k,c) = tmp2 * fjac(5,5,i+1,j) - > - tmp1 * njac(5,5,i+1,j) - > - tmp1 * dx5 - - enddo - enddo - - -c--------------------------------------------------------------------- -c outer most do loops - sweeping in i direction -c--------------------------------------------------------------------- - if (first .eq. 1) then - -c--------------------------------------------------------------------- -c multiply c(istart,j,k) by b_inverse and copy back to c -c multiply rhs(istart) by b_inverse(istart) and copy to rhs -c--------------------------------------------------------------------- -!dir$ ivdep - do j=start(2,c),jsize - call binvcrhs( lhsb(1,1,istart,j), - > lhsc(1,1,istart,j,k,c), - > rhs(1,istart,j,k,c) ) - enddo - - endif - -c--------------------------------------------------------------------- -c begin inner most do loop -c do all the elements of the cell unless last -c--------------------------------------------------------------------- -!dir$ ivdep -!dir$ interchange(i,j) - do j=start(2,c),jsize - do i=istart+first,isize-last - -c--------------------------------------------------------------------- -c rhs(i) = rhs(i) - A*rhs(i-1) -c--------------------------------------------------------------------- - call matvec_sub(lhsa(1,1,i,j), - > rhs(1,i-1,j,k,c),rhs(1,i,j,k,c)) - -c--------------------------------------------------------------------- -c B(i) = B(i) - C(i-1)*A(i) -c--------------------------------------------------------------------- - call matmul_sub(lhsa(1,1,i,j), - > lhsc(1,1,i-1,j,k,c), - > lhsb(1,1,i,j)) - - -c--------------------------------------------------------------------- -c multiply c(i,j,k) by b_inverse and copy back to c -c multiply rhs(1,j,k) by b_inverse(1,j,k) and copy to rhs -c--------------------------------------------------------------------- - call binvcrhs( lhsb(1,1,i,j), - > lhsc(1,1,i,j,k,c), - > rhs(1,i,j,k,c) ) - - enddo - enddo - -c--------------------------------------------------------------------- -c Now finish up special cases for last cell -c--------------------------------------------------------------------- - if (last .eq. 1) then - -!dir$ ivdep - do j=start(2,c),jsize -c--------------------------------------------------------------------- -c rhs(isize) = rhs(isize) - A*rhs(isize-1) -c--------------------------------------------------------------------- - call matvec_sub(lhsa(1,1,isize,j), - > rhs(1,isize-1,j,k,c),rhs(1,isize,j,k,c)) - -c--------------------------------------------------------------------- -c B(isize) = B(isize) - C(isize-1)*A(isize) -c--------------------------------------------------------------------- - call matmul_sub(lhsa(1,1,isize,j), - > lhsc(1,1,isize-1,j,k,c), - > lhsb(1,1,isize,j)) - -c--------------------------------------------------------------------- -c multiply rhs() by b_inverse() and copy to rhs -c--------------------------------------------------------------------- - call binvrhs( lhsb(1,1,isize,j), - > rhs(1,isize,j,k,c) ) - enddo - - endif - enddo - - - return - end - diff --git a/examples/smpi/NAS/BT/y_solve.f b/examples/smpi/NAS/BT/y_solve.f deleted file mode 100644 index 33e2ebc018..0000000000 --- a/examples/smpi/NAS/BT/y_solve.f +++ /dev/null @@ -1,771 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_solve - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Performs line solves in Y direction by first factoring -c the block-tridiagonal matrix into an upper triangular matrix, -c and then performing back substitution to solve for the unknow -c vectors of each line. -c -c Make sure we treat elements zero to cell_size in the direction -c of the sweep. -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer - > c, jstart, stage, - > first, last, recv_id, error, r_status(MPI_STATUS_SIZE), - > isize,jsize,ksize,send_id - - jstart = 0 - -c--------------------------------------------------------------------- -c in our terminology stage is the number of the cell in the y-direction -c i.e. stage = 1 means the start of the line stage=ncells means end -c--------------------------------------------------------------------- - do stage = 1,ncells - c = slice(2,stage) - isize = cell_size(1,c) - 1 - jsize = cell_size(2,c) - 1 - ksize = cell_size(3,c) - 1 - -c--------------------------------------------------------------------- -c set last-cell flag -c--------------------------------------------------------------------- - if (stage .eq. ncells) then - last = 1 - else - last = 0 - endif - - if (stage .eq. 1) then -c--------------------------------------------------------------------- -c This is the first cell, so solve without receiving data -c--------------------------------------------------------------------- - first = 1 -c call lhsy(c) - call y_solve_cell(first,last,c) - else -c--------------------------------------------------------------------- -c Not the first cell of this line, so receive info from -c processor working on preceeding cell -c--------------------------------------------------------------------- - first = 0 - call y_receive_solve_info(recv_id,c) -c--------------------------------------------------------------------- -c overlap computations and communications -c--------------------------------------------------------------------- -c call lhsy(c) -c--------------------------------------------------------------------- -c wait for completion -c--------------------------------------------------------------------- - call mpi_wait(send_id,r_status,error) - call mpi_wait(recv_id,r_status,error) -c--------------------------------------------------------------------- -c install C'(jstart+1) and rhs'(jstart+1) to be used in this cell -c--------------------------------------------------------------------- - call y_unpack_solve_info(c) - call y_solve_cell(first,last,c) - endif - - if (last .eq. 0) call y_send_solve_info(send_id,c) - enddo - -c--------------------------------------------------------------------- -c now perform backsubstitution in reverse direction -c--------------------------------------------------------------------- - do stage = ncells, 1, -1 - c = slice(2,stage) - first = 0 - last = 0 - if (stage .eq. 1) first = 1 - if (stage .eq. ncells) then - last = 1 -c--------------------------------------------------------------------- -c last cell, so perform back substitute without waiting -c--------------------------------------------------------------------- - call y_backsubstitute(first, last,c) - else - call y_receive_backsub_info(recv_id,c) - call mpi_wait(send_id,r_status,error) - call mpi_wait(recv_id,r_status,error) - call y_unpack_backsub_info(c) - call y_backsubstitute(first,last,c) - endif - if (first .eq. 0) call y_send_backsub_info(send_id,c) - enddo - - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_unpack_solve_info(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c unpack C'(-1) and rhs'(-1) for -c all i and k -c--------------------------------------------------------------------- - - include 'header.h' - - integer i,k,m,n,ptr,c,jstart - - jstart = 0 - ptr = 0 - do k=0,KMAX-1 - do i=0,IMAX-1 - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - lhsc(m,n,i,jstart-1,k,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - do n=1,BLOCK_SIZE - rhs(n,i,jstart-1,k,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_send_solve_info(send_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c pack up and send C'(jend) and rhs'(jend) for -c all i and k -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer i,k,m,n,jsize,ptr,c,ip,kp - integer error,send_id,buffer_size - - jsize = cell_size(2,c)-1 - ip = cell_coord(1,c) - 1 - kp = cell_coord(3,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM* - > (BLOCK_SIZE*BLOCK_SIZE + BLOCK_SIZE) - -c--------------------------------------------------------------------- -c pack up buffer -c--------------------------------------------------------------------- - ptr = 0 - do k=0,KMAX-1 - do i=0,IMAX-1 - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = lhsc(m,n,i,jsize,k,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = rhs(n,i,jsize,k,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - -c--------------------------------------------------------------------- -c send buffer -c--------------------------------------------------------------------- - call mpi_isend(in_buffer, buffer_size, - > dp_type, successor(2), - > SOUTH+ip+kp*NCELLS, comm_solve, - > send_id,error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_send_backsub_info(send_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c pack up and send U(jstart) for all i and k -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer i,k,n,ptr,c,jstart,ip,kp - integer error,send_id,buffer_size - -c--------------------------------------------------------------------- -c Send element 0 to previous processor -c--------------------------------------------------------------------- - jstart = 0 - ip = cell_coord(1,c)-1 - kp = cell_coord(3,c)-1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM*BLOCK_SIZE - ptr = 0 - do k=0,KMAX-1 - do i=0,IMAX-1 - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = rhs(n,i,jstart,k,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - call mpi_isend(in_buffer, buffer_size, - > dp_type, predecessor(2), - > NORTH+ip+kp*NCELLS, comm_solve, - > send_id,error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_unpack_backsub_info(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c unpack U(jsize) for all i and k -c--------------------------------------------------------------------- - - include 'header.h' - - integer i,k,n,ptr,c - - ptr = 0 - do k=0,KMAX-1 - do i=0,IMAX-1 - do n=1,BLOCK_SIZE - backsub_info(n,i,k,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_receive_backsub_info(recv_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c post mpi receives -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer error,recv_id,ip,kp,c,buffer_size - ip = cell_coord(1,c) - 1 - kp = cell_coord(3,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM*BLOCK_SIZE - call mpi_irecv(out_buffer, buffer_size, - > dp_type, successor(2), - > NORTH+ip+kp*NCELLS, comm_solve, - > recv_id, error) - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_receive_solve_info(recv_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c post mpi receives -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer ip,kp,recv_id,error,c,buffer_size - ip = cell_coord(1,c) - 1 - kp = cell_coord(3,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM* - > (BLOCK_SIZE*BLOCK_SIZE + BLOCK_SIZE) - call mpi_irecv(out_buffer, buffer_size, - > dp_type, predecessor(2), - > SOUTH+ip+kp*NCELLS, comm_solve, - > recv_id, error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_backsubstitute(first, last, c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c back solve: if last cell, then generate U(jsize)=rhs(jsize) -c else assume U(jsize) is loaded in un pack backsub_info -c so just use it -c after call u(jstart) will be sent to next cell -c--------------------------------------------------------------------- - - include 'header.h' - - integer first, last, c, i, k - integer m,n,j,jsize,isize,ksize,jstart - - jstart = 0 - isize = cell_size(1,c)-end(1,c)-1 - jsize = cell_size(2,c)-1 - ksize = cell_size(3,c)-end(3,c)-1 - if (last .eq. 0) then - do k=start(3,c),ksize - do i=start(1,c),isize -c--------------------------------------------------------------------- -c U(jsize) uses info from previous cell if not last cell -c--------------------------------------------------------------------- - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - rhs(m,i,jsize,k,c) = rhs(m,i,jsize,k,c) - > - lhsc(m,n,i,jsize,k,c)* - > backsub_info(n,i,k,c) - enddo - enddo - enddo - enddo - endif - do k=start(3,c),ksize - do j=jsize-1,jstart,-1 - do i=start(1,c),isize - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - > - lhsc(m,n,i,j,k,c)*rhs(n,i,j+1,k,c) - enddo - enddo - enddo - enddo - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_solve_cell(first,last,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c performs guaussian elimination on this cell. -c -c assumes that unpacking routines for non-first cells -c preload C' and rhs' from previous cell. -c -c assumed send happens outside this routine, but that -c c'(JMAX) and rhs'(JMAX) will be sent to next cell -c--------------------------------------------------------------------- - - include 'header.h' - include 'work_lhs.h' - - integer first,last,c - integer i,j,k,isize,ksize,jsize,jstart - double precision utmp(6,-2:JMAX+1) - - jstart = 0 - isize = cell_size(1,c)-end(1,c)-1 - jsize = cell_size(2,c)-1 - ksize = cell_size(3,c)-end(3,c)-1 - - call lhsabinit(lhsa, lhsb, jsize) - - do k=start(3,c),ksize - do i=start(1,c),isize - -c--------------------------------------------------------------------- -c This function computes the left hand side for the three y-factors -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Compute the indices for storing the tri-diagonal matrix; -c determine a (labeled f) and n jacobians for cell c -c--------------------------------------------------------------------- - do j = start(2,c)-1, cell_size(2,c)-end(2,c) - utmp(1,j) = 1.0d0 / u(1,i,j,k,c) - utmp(2,j) = u(2,i,j,k,c) - utmp(3,j) = u(3,i,j,k,c) - utmp(4,j) = u(4,i,j,k,c) - utmp(5,j) = u(5,i,j,k,c) - utmp(6,j) = qs(i,j,k,c) - end do - - do j = start(2,c)-1, cell_size(2,c)-end(2,c) - - tmp1 = utmp(1,j) - tmp2 = tmp1 * tmp1 - tmp3 = tmp1 * tmp2 - - fjac(1,1,j) = 0.0d+00 - fjac(1,2,j) = 0.0d+00 - fjac(1,3,j) = 1.0d+00 - fjac(1,4,j) = 0.0d+00 - fjac(1,5,j) = 0.0d+00 - - fjac(2,1,j) = - ( utmp(2,j)*utmp(3,j) ) - > * tmp2 - fjac(2,2,j) = utmp(3,j) * tmp1 - fjac(2,3,j) = utmp(2,j) * tmp1 - fjac(2,4,j) = 0.0d+00 - fjac(2,5,j) = 0.0d+00 - - fjac(3,1,j) = - ( utmp(3,j)*utmp(3,j)*tmp2) - > + c2 * utmp(6,j) - fjac(3,2,j) = - c2 * utmp(2,j) * tmp1 - fjac(3,3,j) = ( 2.0d+00 - c2 ) - > * utmp(3,j) * tmp1 - fjac(3,4,j) = - c2 * utmp(4,j) * tmp1 - fjac(3,5,j) = c2 - - fjac(4,1,j) = - ( utmp(3,j)*utmp(4,j) ) - > * tmp2 - fjac(4,2,j) = 0.0d+00 - fjac(4,3,j) = utmp(4,j) * tmp1 - fjac(4,4,j) = utmp(3,j) * tmp1 - fjac(4,5,j) = 0.0d+00 - - fjac(5,1,j) = ( c2 * 2.0d0 * utmp(6,j) - > - c1 * utmp(5,j) * tmp1 ) - > * utmp(3,j) * tmp1 - fjac(5,2,j) = - c2 * utmp(2,j)*utmp(3,j) - > * tmp2 - fjac(5,3,j) = c1 * utmp(5,j) * tmp1 - > - c2 * ( utmp(6,j) - > + utmp(3,j)*utmp(3,j) * tmp2 ) - fjac(5,4,j) = - c2 * ( utmp(3,j)*utmp(4,j) ) - > * tmp2 - fjac(5,5,j) = c1 * utmp(3,j) * tmp1 - - njac(1,1,j) = 0.0d+00 - njac(1,2,j) = 0.0d+00 - njac(1,3,j) = 0.0d+00 - njac(1,4,j) = 0.0d+00 - njac(1,5,j) = 0.0d+00 - - njac(2,1,j) = - c3c4 * tmp2 * utmp(2,j) - njac(2,2,j) = c3c4 * tmp1 - njac(2,3,j) = 0.0d+00 - njac(2,4,j) = 0.0d+00 - njac(2,5,j) = 0.0d+00 - - njac(3,1,j) = - con43 * c3c4 * tmp2 * utmp(3,j) - njac(3,2,j) = 0.0d+00 - njac(3,3,j) = con43 * c3c4 * tmp1 - njac(3,4,j) = 0.0d+00 - njac(3,5,j) = 0.0d+00 - - njac(4,1,j) = - c3c4 * tmp2 * utmp(4,j) - njac(4,2,j) = 0.0d+00 - njac(4,3,j) = 0.0d+00 - njac(4,4,j) = c3c4 * tmp1 - njac(4,5,j) = 0.0d+00 - - njac(5,1,j) = - ( c3c4 - > - c1345 ) * tmp3 * (utmp(2,j)**2) - > - ( con43 * c3c4 - > - c1345 ) * tmp3 * (utmp(3,j)**2) - > - ( c3c4 - c1345 ) * tmp3 * (utmp(4,j)**2) - > - c1345 * tmp2 * utmp(5,j) - - njac(5,2,j) = ( c3c4 - c1345 ) * tmp2 * utmp(2,j) - njac(5,3,j) = ( con43 * c3c4 - > - c1345 ) * tmp2 * utmp(3,j) - njac(5,4,j) = ( c3c4 - c1345 ) * tmp2 * utmp(4,j) - njac(5,5,j) = ( c1345 ) * tmp1 - - enddo - -c--------------------------------------------------------------------- -c now joacobians set, so form left hand side in y direction -c--------------------------------------------------------------------- - do j = start(2,c), jsize-end(2,c) - - tmp1 = dt * ty1 - tmp2 = dt * ty2 - - lhsa(1,1,j) = - tmp2 * fjac(1,1,j-1) - > - tmp1 * njac(1,1,j-1) - > - tmp1 * dy1 - lhsa(1,2,j) = - tmp2 * fjac(1,2,j-1) - > - tmp1 * njac(1,2,j-1) - lhsa(1,3,j) = - tmp2 * fjac(1,3,j-1) - > - tmp1 * njac(1,3,j-1) - lhsa(1,4,j) = - tmp2 * fjac(1,4,j-1) - > - tmp1 * njac(1,4,j-1) - lhsa(1,5,j) = - tmp2 * fjac(1,5,j-1) - > - tmp1 * njac(1,5,j-1) - - lhsa(2,1,j) = - tmp2 * fjac(2,1,j-1) - > - tmp1 * njac(2,1,j-1) - lhsa(2,2,j) = - tmp2 * fjac(2,2,j-1) - > - tmp1 * njac(2,2,j-1) - > - tmp1 * dy2 - lhsa(2,3,j) = - tmp2 * fjac(2,3,j-1) - > - tmp1 * njac(2,3,j-1) - lhsa(2,4,j) = - tmp2 * fjac(2,4,j-1) - > - tmp1 * njac(2,4,j-1) - lhsa(2,5,j) = - tmp2 * fjac(2,5,j-1) - > - tmp1 * njac(2,5,j-1) - - lhsa(3,1,j) = - tmp2 * fjac(3,1,j-1) - > - tmp1 * njac(3,1,j-1) - lhsa(3,2,j) = - tmp2 * fjac(3,2,j-1) - > - tmp1 * njac(3,2,j-1) - lhsa(3,3,j) = - tmp2 * fjac(3,3,j-1) - > - tmp1 * njac(3,3,j-1) - > - tmp1 * dy3 - lhsa(3,4,j) = - tmp2 * fjac(3,4,j-1) - > - tmp1 * njac(3,4,j-1) - lhsa(3,5,j) = - tmp2 * fjac(3,5,j-1) - > - tmp1 * njac(3,5,j-1) - - lhsa(4,1,j) = - tmp2 * fjac(4,1,j-1) - > - tmp1 * njac(4,1,j-1) - lhsa(4,2,j) = - tmp2 * fjac(4,2,j-1) - > - tmp1 * njac(4,2,j-1) - lhsa(4,3,j) = - tmp2 * fjac(4,3,j-1) - > - tmp1 * njac(4,3,j-1) - lhsa(4,4,j) = - tmp2 * fjac(4,4,j-1) - > - tmp1 * njac(4,4,j-1) - > - tmp1 * dy4 - lhsa(4,5,j) = - tmp2 * fjac(4,5,j-1) - > - tmp1 * njac(4,5,j-1) - - lhsa(5,1,j) = - tmp2 * fjac(5,1,j-1) - > - tmp1 * njac(5,1,j-1) - lhsa(5,2,j) = - tmp2 * fjac(5,2,j-1) - > - tmp1 * njac(5,2,j-1) - lhsa(5,3,j) = - tmp2 * fjac(5,3,j-1) - > - tmp1 * njac(5,3,j-1) - lhsa(5,4,j) = - tmp2 * fjac(5,4,j-1) - > - tmp1 * njac(5,4,j-1) - lhsa(5,5,j) = - tmp2 * fjac(5,5,j-1) - > - tmp1 * njac(5,5,j-1) - > - tmp1 * dy5 - - lhsb(1,1,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(1,1,j) - > + tmp1 * 2.0d+00 * dy1 - lhsb(1,2,j) = tmp1 * 2.0d+00 * njac(1,2,j) - lhsb(1,3,j) = tmp1 * 2.0d+00 * njac(1,3,j) - lhsb(1,4,j) = tmp1 * 2.0d+00 * njac(1,4,j) - lhsb(1,5,j) = tmp1 * 2.0d+00 * njac(1,5,j) - - lhsb(2,1,j) = tmp1 * 2.0d+00 * njac(2,1,j) - lhsb(2,2,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(2,2,j) - > + tmp1 * 2.0d+00 * dy2 - lhsb(2,3,j) = tmp1 * 2.0d+00 * njac(2,3,j) - lhsb(2,4,j) = tmp1 * 2.0d+00 * njac(2,4,j) - lhsb(2,5,j) = tmp1 * 2.0d+00 * njac(2,5,j) - - lhsb(3,1,j) = tmp1 * 2.0d+00 * njac(3,1,j) - lhsb(3,2,j) = tmp1 * 2.0d+00 * njac(3,2,j) - lhsb(3,3,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(3,3,j) - > + tmp1 * 2.0d+00 * dy3 - lhsb(3,4,j) = tmp1 * 2.0d+00 * njac(3,4,j) - lhsb(3,5,j) = tmp1 * 2.0d+00 * njac(3,5,j) - - lhsb(4,1,j) = tmp1 * 2.0d+00 * njac(4,1,j) - lhsb(4,2,j) = tmp1 * 2.0d+00 * njac(4,2,j) - lhsb(4,3,j) = tmp1 * 2.0d+00 * njac(4,3,j) - lhsb(4,4,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(4,4,j) - > + tmp1 * 2.0d+00 * dy4 - lhsb(4,5,j) = tmp1 * 2.0d+00 * njac(4,5,j) - - lhsb(5,1,j) = tmp1 * 2.0d+00 * njac(5,1,j) - lhsb(5,2,j) = tmp1 * 2.0d+00 * njac(5,2,j) - lhsb(5,3,j) = tmp1 * 2.0d+00 * njac(5,3,j) - lhsb(5,4,j) = tmp1 * 2.0d+00 * njac(5,4,j) - lhsb(5,5,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(5,5,j) - > + tmp1 * 2.0d+00 * dy5 - - lhsc(1,1,i,j,k,c) = tmp2 * fjac(1,1,j+1) - > - tmp1 * njac(1,1,j+1) - > - tmp1 * dy1 - lhsc(1,2,i,j,k,c) = tmp2 * fjac(1,2,j+1) - > - tmp1 * njac(1,2,j+1) - lhsc(1,3,i,j,k,c) = tmp2 * fjac(1,3,j+1) - > - tmp1 * njac(1,3,j+1) - lhsc(1,4,i,j,k,c) = tmp2 * fjac(1,4,j+1) - > - tmp1 * njac(1,4,j+1) - lhsc(1,5,i,j,k,c) = tmp2 * fjac(1,5,j+1) - > - tmp1 * njac(1,5,j+1) - - lhsc(2,1,i,j,k,c) = tmp2 * fjac(2,1,j+1) - > - tmp1 * njac(2,1,j+1) - lhsc(2,2,i,j,k,c) = tmp2 * fjac(2,2,j+1) - > - tmp1 * njac(2,2,j+1) - > - tmp1 * dy2 - lhsc(2,3,i,j,k,c) = tmp2 * fjac(2,3,j+1) - > - tmp1 * njac(2,3,j+1) - lhsc(2,4,i,j,k,c) = tmp2 * fjac(2,4,j+1) - > - tmp1 * njac(2,4,j+1) - lhsc(2,5,i,j,k,c) = tmp2 * fjac(2,5,j+1) - > - tmp1 * njac(2,5,j+1) - - lhsc(3,1,i,j,k,c) = tmp2 * fjac(3,1,j+1) - > - tmp1 * njac(3,1,j+1) - lhsc(3,2,i,j,k,c) = tmp2 * fjac(3,2,j+1) - > - tmp1 * njac(3,2,j+1) - lhsc(3,3,i,j,k,c) = tmp2 * fjac(3,3,j+1) - > - tmp1 * njac(3,3,j+1) - > - tmp1 * dy3 - lhsc(3,4,i,j,k,c) = tmp2 * fjac(3,4,j+1) - > - tmp1 * njac(3,4,j+1) - lhsc(3,5,i,j,k,c) = tmp2 * fjac(3,5,j+1) - > - tmp1 * njac(3,5,j+1) - - lhsc(4,1,i,j,k,c) = tmp2 * fjac(4,1,j+1) - > - tmp1 * njac(4,1,j+1) - lhsc(4,2,i,j,k,c) = tmp2 * fjac(4,2,j+1) - > - tmp1 * njac(4,2,j+1) - lhsc(4,3,i,j,k,c) = tmp2 * fjac(4,3,j+1) - > - tmp1 * njac(4,3,j+1) - lhsc(4,4,i,j,k,c) = tmp2 * fjac(4,4,j+1) - > - tmp1 * njac(4,4,j+1) - > - tmp1 * dy4 - lhsc(4,5,i,j,k,c) = tmp2 * fjac(4,5,j+1) - > - tmp1 * njac(4,5,j+1) - - lhsc(5,1,i,j,k,c) = tmp2 * fjac(5,1,j+1) - > - tmp1 * njac(5,1,j+1) - lhsc(5,2,i,j,k,c) = tmp2 * fjac(5,2,j+1) - > - tmp1 * njac(5,2,j+1) - lhsc(5,3,i,j,k,c) = tmp2 * fjac(5,3,j+1) - > - tmp1 * njac(5,3,j+1) - lhsc(5,4,i,j,k,c) = tmp2 * fjac(5,4,j+1) - > - tmp1 * njac(5,4,j+1) - lhsc(5,5,i,j,k,c) = tmp2 * fjac(5,5,j+1) - > - tmp1 * njac(5,5,j+1) - > - tmp1 * dy5 - - enddo - - -c--------------------------------------------------------------------- -c outer most do loops - sweeping in i direction -c--------------------------------------------------------------------- - if (first .eq. 1) then - -c--------------------------------------------------------------------- -c multiply c(i,jstart,k) by b_inverse and copy back to c -c multiply rhs(jstart) by b_inverse(jstart) and copy to rhs -c--------------------------------------------------------------------- - call binvcrhs( lhsb(1,1,jstart), - > lhsc(1,1,i,jstart,k,c), - > rhs(1,i,jstart,k,c) ) - - endif - -c--------------------------------------------------------------------- -c begin inner most do loop -c do all the elements of the cell unless last -c--------------------------------------------------------------------- - do j=jstart+first,jsize-last - -c--------------------------------------------------------------------- -c subtract A*lhs_vector(j-1) from lhs_vector(j) -c -c rhs(j) = rhs(j) - A*rhs(j-1) -c--------------------------------------------------------------------- - call matvec_sub(lhsa(1,1,j), - > rhs(1,i,j-1,k,c),rhs(1,i,j,k,c)) - -c--------------------------------------------------------------------- -c B(j) = B(j) - C(j-1)*A(j) -c--------------------------------------------------------------------- - call matmul_sub(lhsa(1,1,j), - > lhsc(1,1,i,j-1,k,c), - > lhsb(1,1,j)) - -c--------------------------------------------------------------------- -c multiply c(i,j,k) by b_inverse and copy back to c -c multiply rhs(i,1,k) by b_inverse(i,1,k) and copy to rhs -c--------------------------------------------------------------------- - call binvcrhs( lhsb(1,1,j), - > lhsc(1,1,i,j,k,c), - > rhs(1,i,j,k,c) ) - - enddo - -c--------------------------------------------------------------------- -c Now finish up special cases for last cell -c--------------------------------------------------------------------- - if (last .eq. 1) then - -c--------------------------------------------------------------------- -c rhs(jsize) = rhs(jsize) - A*rhs(jsize-1) -c--------------------------------------------------------------------- - call matvec_sub(lhsa(1,1,jsize), - > rhs(1,i,jsize-1,k,c),rhs(1,i,jsize,k,c)) - -c--------------------------------------------------------------------- -c B(jsize) = B(jsize) - C(jsize-1)*A(jsize) -c call matmul_sub(aa,i,jsize,k,c, -c $ cc,i,jsize-1,k,c,bb,i,jsize,k,c) -c--------------------------------------------------------------------- - call matmul_sub(lhsa(1,1,jsize), - > lhsc(1,1,i,jsize-1,k,c), - > lhsb(1,1,jsize)) - -c--------------------------------------------------------------------- -c multiply rhs(jsize) by b_inverse(jsize) and copy to rhs -c--------------------------------------------------------------------- - call binvrhs( lhsb(1,1,jsize), - > rhs(1,i,jsize,k,c) ) - - endif - enddo - enddo - - - return - end - - - diff --git a/examples/smpi/NAS/BT/y_solve_vec.f b/examples/smpi/NAS/BT/y_solve_vec.f deleted file mode 100644 index e21cfa36ce..0000000000 --- a/examples/smpi/NAS/BT/y_solve_vec.f +++ /dev/null @@ -1,788 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_solve - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Performs line solves in Y direction by first factoring -c the block-tridiagonal matrix into an upper triangular matrix, -c and then performing back substitution to solve for the unknow -c vectors of each line. -c -c Make sure we treat elements zero to cell_size in the direction -c of the sweep. -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer - > c, jstart, stage, - > first, last, recv_id, error, r_status(MPI_STATUS_SIZE), - > isize,jsize,ksize,send_id - - jstart = 0 - -c--------------------------------------------------------------------- -c in our terminology stage is the number of the cell in the y-direct -c i.e. stage = 1 means the start of the line stage=ncells means end -c--------------------------------------------------------------------- - do stage = 1,ncells - c = slice(2,stage) - isize = cell_size(1,c) - 1 - jsize = cell_size(2,c) - 1 - ksize = cell_size(3,c) - 1 - -c--------------------------------------------------------------------- -c set last-cell flag -c--------------------------------------------------------------------- - if (stage .eq. ncells) then - last = 1 - else - last = 0 - endif - - if (stage .eq. 1) then -c--------------------------------------------------------------------- -c This is the first cell, so solve without receiving data -c--------------------------------------------------------------------- - first = 1 -c call lhsy(c) - call y_solve_cell(first,last,c) - else -c--------------------------------------------------------------------- -c Not the first cell of this line, so receive info from -c processor working on preceeding cell -c--------------------------------------------------------------------- - first = 0 - call y_receive_solve_info(recv_id,c) -c--------------------------------------------------------------------- -c overlap computations and communications -c--------------------------------------------------------------------- -c call lhsy(c) -c--------------------------------------------------------------------- -c wait for completion -c--------------------------------------------------------------------- - call mpi_wait(send_id,r_status,error) - call mpi_wait(recv_id,r_status,error) -c--------------------------------------------------------------------- -c install C'(jstart+1) and rhs'(jstart+1) to be used in this cell -c--------------------------------------------------------------------- - call y_unpack_solve_info(c) - call y_solve_cell(first,last,c) - endif - - if (last .eq. 0) call y_send_solve_info(send_id,c) - enddo - -c--------------------------------------------------------------------- -c now perform backsubstitution in reverse direction -c--------------------------------------------------------------------- - do stage = ncells, 1, -1 - c = slice(2,stage) - first = 0 - last = 0 - if (stage .eq. 1) first = 1 - if (stage .eq. ncells) then - last = 1 -c--------------------------------------------------------------------- -c last cell, so perform back substitute without waiting -c--------------------------------------------------------------------- - call y_backsubstitute(first, last,c) - else - call y_receive_backsub_info(recv_id,c) - call mpi_wait(send_id,r_status,error) - call mpi_wait(recv_id,r_status,error) - call y_unpack_backsub_info(c) - call y_backsubstitute(first,last,c) - endif - if (first .eq. 0) call y_send_backsub_info(send_id,c) - enddo - - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_unpack_solve_info(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c unpack C'(-1) and rhs'(-1) for -c all i and k -c--------------------------------------------------------------------- - - include 'header.h' - - integer i,k,m,n,ptr,c,jstart - - jstart = 0 - ptr = 0 - do k=0,KMAX-1 - do i=0,IMAX-1 - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - lhsc(m,n,i,jstart-1,k,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - do n=1,BLOCK_SIZE - rhs(n,i,jstart-1,k,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_send_solve_info(send_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c pack up and send C'(jend) and rhs'(jend) for -c all i and k -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer i,k,m,n,jsize,ptr,c,ip,kp - integer error,send_id,buffer_size - - jsize = cell_size(2,c)-1 - ip = cell_coord(1,c) - 1 - kp = cell_coord(3,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM* - > (BLOCK_SIZE*BLOCK_SIZE + BLOCK_SIZE) - -c--------------------------------------------------------------------- -c pack up buffer -c--------------------------------------------------------------------- - ptr = 0 - do k=0,KMAX-1 - do i=0,IMAX-1 - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = lhsc(m,n,i,jsize,k,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = rhs(n,i,jsize,k,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - -c--------------------------------------------------------------------- -c send buffer -c--------------------------------------------------------------------- - call mpi_isend(in_buffer, buffer_size, - > dp_type, successor(2), - > SOUTH+ip+kp*NCELLS, comm_solve, - > send_id,error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_send_backsub_info(send_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c pack up and send U(jstart) for all i and k -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer i,k,n,ptr,c,jstart,ip,kp - integer error,send_id,buffer_size - -c--------------------------------------------------------------------- -c Send element 0 to previous processor -c--------------------------------------------------------------------- - jstart = 0 - ip = cell_coord(1,c)-1 - kp = cell_coord(3,c)-1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM*BLOCK_SIZE - ptr = 0 - do k=0,KMAX-1 - do i=0,IMAX-1 - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = rhs(n,i,jstart,k,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - call mpi_isend(in_buffer, buffer_size, - > dp_type, predecessor(2), - > NORTH+ip+kp*NCELLS, comm_solve, - > send_id,error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_unpack_backsub_info(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c unpack U(jsize) for all i and k -c--------------------------------------------------------------------- - - include 'header.h' - - integer i,k,n,ptr,c - - ptr = 0 - do k=0,KMAX-1 - do i=0,IMAX-1 - do n=1,BLOCK_SIZE - backsub_info(n,i,k,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_receive_backsub_info(recv_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c post mpi receives -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer error,recv_id,ip,kp,c,buffer_size - ip = cell_coord(1,c) - 1 - kp = cell_coord(3,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM*BLOCK_SIZE - call mpi_irecv(out_buffer, buffer_size, - > dp_type, successor(2), - > NORTH+ip+kp*NCELLS, comm_solve, - > recv_id, error) - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_receive_solve_info(recv_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c post mpi receives -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer ip,kp,recv_id,error,c,buffer_size - ip = cell_coord(1,c) - 1 - kp = cell_coord(3,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM* - > (BLOCK_SIZE*BLOCK_SIZE + BLOCK_SIZE) - call mpi_irecv(out_buffer, buffer_size, - > dp_type, predecessor(2), - > SOUTH+ip+kp*NCELLS, comm_solve, - > recv_id, error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_backsubstitute(first, last, c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c back solve: if last cell, then generate U(jsize)=rhs(jsize) -c else assume U(jsize) is loaded in un pack backsub_info -c so just use it -c after call u(jstart) will be sent to next cell -c--------------------------------------------------------------------- - - include 'header.h' - - integer first, last, c, i, k - integer m,n,j,jsize,isize,ksize,jstart - - jstart = 0 - isize = cell_size(1,c)-end(1,c)-1 - jsize = cell_size(2,c)-1 - ksize = cell_size(3,c)-end(3,c)-1 - if (last .eq. 0) then - do k=start(3,c),ksize - do i=start(1,c),isize -c--------------------------------------------------------------------- -c U(jsize) uses info from previous cell if not last cell -c--------------------------------------------------------------------- - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - rhs(m,i,jsize,k,c) = rhs(m,i,jsize,k,c) - > - lhsc(m,n,i,jsize,k,c)* - > backsub_info(n,i,k,c) - enddo - enddo - enddo - enddo - endif - do k=start(3,c),ksize - do j=jsize-1,jstart,-1 - do i=start(1,c),isize - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - > - lhsc(m,n,i,j,k,c)*rhs(n,i,j+1,k,c) - enddo - enddo - enddo - enddo - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_solve_cell(first,last,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c performs guaussian elimination on this cell. -c -c assumes that unpacking routines for non-first cells -c preload C' and rhs' from previous cell. -c -c assumed send happens outside this routine, but that -c c'(JMAX) and rhs'(JMAX) will be sent to next cell -c--------------------------------------------------------------------- - - include 'header.h' - include 'work_lhs_vec.h' - - integer first,last,c - integer i,j,k,m,n,isize,ksize,jsize,jstart - - jstart = 0 - isize = cell_size(1,c)-end(1,c)-1 - jsize = cell_size(2,c)-1 - ksize = cell_size(3,c)-end(3,c)-1 - -c--------------------------------------------------------------------- -c zero the left hand side for starters -c set diagonal values to 1. This is overkill, but convenient -c--------------------------------------------------------------------- - do i = 0, isize - do m = 1, 5 - do n = 1, 5 - lhsa(m,n,i,0) = 0.0d0 - lhsb(m,n,i,0) = 0.0d0 - lhsa(m,n,i,jsize) = 0.0d0 - lhsb(m,n,i,jsize) = 0.0d0 - enddo - lhsb(m,m,i,0) = 1.0d0 - lhsb(m,m,i,jsize) = 1.0d0 - enddo - enddo - - do k=start(3,c),ksize - -c--------------------------------------------------------------------- -c This function computes the left hand side for the three y-factors -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Compute the indices for storing the tri-diagonal matrix; -c determine a (labeled f) and n jacobians for cell c -c--------------------------------------------------------------------- - - do j = start(2,c)-1, cell_size(2,c)-end(2,c) - do i=start(1,c),isize - - tmp1 = 1.0d0 / u(1,i,j,k,c) - tmp2 = tmp1 * tmp1 - tmp3 = tmp1 * tmp2 - - fjac(1,1,i,j) = 0.0d+00 - fjac(1,2,i,j) = 0.0d+00 - fjac(1,3,i,j) = 1.0d+00 - fjac(1,4,i,j) = 0.0d+00 - fjac(1,5,i,j) = 0.0d+00 - - fjac(2,1,i,j) = - ( u(2,i,j,k,c)*u(3,i,j,k,c) ) - > * tmp2 - fjac(2,2,i,j) = u(3,i,j,k,c) * tmp1 - fjac(2,3,i,j) = u(2,i,j,k,c) * tmp1 - fjac(2,4,i,j) = 0.0d+00 - fjac(2,5,i,j) = 0.0d+00 - - fjac(3,1,i,j) = - ( u(3,i,j,k,c)*u(3,i,j,k,c)*tmp2) - > + c2 * qs(i,j,k,c) - fjac(3,2,i,j) = - c2 * u(2,i,j,k,c) * tmp1 - fjac(3,3,i,j) = ( 2.0d+00 - c2 ) - > * u(3,i,j,k,c) * tmp1 - fjac(3,4,i,j) = - c2 * u(4,i,j,k,c) * tmp1 - fjac(3,5,i,j) = c2 - - fjac(4,1,i,j) = - ( u(3,i,j,k,c)*u(4,i,j,k,c) ) - > * tmp2 - fjac(4,2,i,j) = 0.0d+00 - fjac(4,3,i,j) = u(4,i,j,k,c) * tmp1 - fjac(4,4,i,j) = u(3,i,j,k,c) * tmp1 - fjac(4,5,i,j) = 0.0d+00 - - fjac(5,1,i,j) = ( c2 * 2.0d0 * qs(i,j,k,c) - > - c1 * u(5,i,j,k,c) * tmp1 ) - > * u(3,i,j,k,c) * tmp1 - fjac(5,2,i,j) = - c2 * u(2,i,j,k,c)*u(3,i,j,k,c) - > * tmp2 - fjac(5,3,i,j) = c1 * u(5,i,j,k,c) * tmp1 - > - c2 * ( qs(i,j,k,c) - > + u(3,i,j,k,c)*u(3,i,j,k,c) * tmp2 ) - fjac(5,4,i,j) = - c2 * ( u(3,i,j,k,c)*u(4,i,j,k,c) ) - > * tmp2 - fjac(5,5,i,j) = c1 * u(3,i,j,k,c) * tmp1 - - njac(1,1,i,j) = 0.0d+00 - njac(1,2,i,j) = 0.0d+00 - njac(1,3,i,j) = 0.0d+00 - njac(1,4,i,j) = 0.0d+00 - njac(1,5,i,j) = 0.0d+00 - - njac(2,1,i,j) = - c3c4 * tmp2 * u(2,i,j,k,c) - njac(2,2,i,j) = c3c4 * tmp1 - njac(2,3,i,j) = 0.0d+00 - njac(2,4,i,j) = 0.0d+00 - njac(2,5,i,j) = 0.0d+00 - - njac(3,1,i,j) = - con43 * c3c4 * tmp2 * u(3,i,j,k,c) - njac(3,2,i,j) = 0.0d+00 - njac(3,3,i,j) = con43 * c3c4 * tmp1 - njac(3,4,i,j) = 0.0d+00 - njac(3,5,i,j) = 0.0d+00 - - njac(4,1,i,j) = - c3c4 * tmp2 * u(4,i,j,k,c) - njac(4,2,i,j) = 0.0d+00 - njac(4,3,i,j) = 0.0d+00 - njac(4,4,i,j) = c3c4 * tmp1 - njac(4,5,i,j) = 0.0d+00 - - njac(5,1,i,j) = - ( c3c4 - > - c1345 ) * tmp3 * (u(2,i,j,k,c)**2) - > - ( con43 * c3c4 - > - c1345 ) * tmp3 * (u(3,i,j,k,c)**2) - > - ( c3c4 - c1345 ) * tmp3 * (u(4,i,j,k,c)**2) - > - c1345 * tmp2 * u(5,i,j,k,c) - - njac(5,2,i,j) = ( c3c4 - c1345 ) * tmp2 * u(2,i,j,k,c) - njac(5,3,i,j) = ( con43 * c3c4 - > - c1345 ) * tmp2 * u(3,i,j,k,c) - njac(5,4,i,j) = ( c3c4 - c1345 ) * tmp2 * u(4,i,j,k,c) - njac(5,5,i,j) = ( c1345 ) * tmp1 - - enddo - enddo - -c--------------------------------------------------------------------- -c now joacobians set, so form left hand side in y direction -c--------------------------------------------------------------------- - do j = start(2,c), jsize-end(2,c) - do i=start(1,c),isize - - tmp1 = dt * ty1 - tmp2 = dt * ty2 - - lhsa(1,1,i,j) = - tmp2 * fjac(1,1,i,j-1) - > - tmp1 * njac(1,1,i,j-1) - > - tmp1 * dy1 - lhsa(1,2,i,j) = - tmp2 * fjac(1,2,i,j-1) - > - tmp1 * njac(1,2,i,j-1) - lhsa(1,3,i,j) = - tmp2 * fjac(1,3,i,j-1) - > - tmp1 * njac(1,3,i,j-1) - lhsa(1,4,i,j) = - tmp2 * fjac(1,4,i,j-1) - > - tmp1 * njac(1,4,i,j-1) - lhsa(1,5,i,j) = - tmp2 * fjac(1,5,i,j-1) - > - tmp1 * njac(1,5,i,j-1) - - lhsa(2,1,i,j) = - tmp2 * fjac(2,1,i,j-1) - > - tmp1 * njac(2,1,i,j-1) - lhsa(2,2,i,j) = - tmp2 * fjac(2,2,i,j-1) - > - tmp1 * njac(2,2,i,j-1) - > - tmp1 * dy2 - lhsa(2,3,i,j) = - tmp2 * fjac(2,3,i,j-1) - > - tmp1 * njac(2,3,i,j-1) - lhsa(2,4,i,j) = - tmp2 * fjac(2,4,i,j-1) - > - tmp1 * njac(2,4,i,j-1) - lhsa(2,5,i,j) = - tmp2 * fjac(2,5,i,j-1) - > - tmp1 * njac(2,5,i,j-1) - - lhsa(3,1,i,j) = - tmp2 * fjac(3,1,i,j-1) - > - tmp1 * njac(3,1,i,j-1) - lhsa(3,2,i,j) = - tmp2 * fjac(3,2,i,j-1) - > - tmp1 * njac(3,2,i,j-1) - lhsa(3,3,i,j) = - tmp2 * fjac(3,3,i,j-1) - > - tmp1 * njac(3,3,i,j-1) - > - tmp1 * dy3 - lhsa(3,4,i,j) = - tmp2 * fjac(3,4,i,j-1) - > - tmp1 * njac(3,4,i,j-1) - lhsa(3,5,i,j) = - tmp2 * fjac(3,5,i,j-1) - > - tmp1 * njac(3,5,i,j-1) - - lhsa(4,1,i,j) = - tmp2 * fjac(4,1,i,j-1) - > - tmp1 * njac(4,1,i,j-1) - lhsa(4,2,i,j) = - tmp2 * fjac(4,2,i,j-1) - > - tmp1 * njac(4,2,i,j-1) - lhsa(4,3,i,j) = - tmp2 * fjac(4,3,i,j-1) - > - tmp1 * njac(4,3,i,j-1) - lhsa(4,4,i,j) = - tmp2 * fjac(4,4,i,j-1) - > - tmp1 * njac(4,4,i,j-1) - > - tmp1 * dy4 - lhsa(4,5,i,j) = - tmp2 * fjac(4,5,i,j-1) - > - tmp1 * njac(4,5,i,j-1) - - lhsa(5,1,i,j) = - tmp2 * fjac(5,1,i,j-1) - > - tmp1 * njac(5,1,i,j-1) - lhsa(5,2,i,j) = - tmp2 * fjac(5,2,i,j-1) - > - tmp1 * njac(5,2,i,j-1) - lhsa(5,3,i,j) = - tmp2 * fjac(5,3,i,j-1) - > - tmp1 * njac(5,3,i,j-1) - lhsa(5,4,i,j) = - tmp2 * fjac(5,4,i,j-1) - > - tmp1 * njac(5,4,i,j-1) - lhsa(5,5,i,j) = - tmp2 * fjac(5,5,i,j-1) - > - tmp1 * njac(5,5,i,j-1) - > - tmp1 * dy5 - - lhsb(1,1,i,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(1,1,i,j) - > + tmp1 * 2.0d+00 * dy1 - lhsb(1,2,i,j) = tmp1 * 2.0d+00 * njac(1,2,i,j) - lhsb(1,3,i,j) = tmp1 * 2.0d+00 * njac(1,3,i,j) - lhsb(1,4,i,j) = tmp1 * 2.0d+00 * njac(1,4,i,j) - lhsb(1,5,i,j) = tmp1 * 2.0d+00 * njac(1,5,i,j) - - lhsb(2,1,i,j) = tmp1 * 2.0d+00 * njac(2,1,i,j) - lhsb(2,2,i,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(2,2,i,j) - > + tmp1 * 2.0d+00 * dy2 - lhsb(2,3,i,j) = tmp1 * 2.0d+00 * njac(2,3,i,j) - lhsb(2,4,i,j) = tmp1 * 2.0d+00 * njac(2,4,i,j) - lhsb(2,5,i,j) = tmp1 * 2.0d+00 * njac(2,5,i,j) - - lhsb(3,1,i,j) = tmp1 * 2.0d+00 * njac(3,1,i,j) - lhsb(3,2,i,j) = tmp1 * 2.0d+00 * njac(3,2,i,j) - lhsb(3,3,i,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(3,3,i,j) - > + tmp1 * 2.0d+00 * dy3 - lhsb(3,4,i,j) = tmp1 * 2.0d+00 * njac(3,4,i,j) - lhsb(3,5,i,j) = tmp1 * 2.0d+00 * njac(3,5,i,j) - - lhsb(4,1,i,j) = tmp1 * 2.0d+00 * njac(4,1,i,j) - lhsb(4,2,i,j) = tmp1 * 2.0d+00 * njac(4,2,i,j) - lhsb(4,3,i,j) = tmp1 * 2.0d+00 * njac(4,3,i,j) - lhsb(4,4,i,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(4,4,i,j) - > + tmp1 * 2.0d+00 * dy4 - lhsb(4,5,i,j) = tmp1 * 2.0d+00 * njac(4,5,i,j) - - lhsb(5,1,i,j) = tmp1 * 2.0d+00 * njac(5,1,i,j) - lhsb(5,2,i,j) = tmp1 * 2.0d+00 * njac(5,2,i,j) - lhsb(5,3,i,j) = tmp1 * 2.0d+00 * njac(5,3,i,j) - lhsb(5,4,i,j) = tmp1 * 2.0d+00 * njac(5,4,i,j) - lhsb(5,5,i,j) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(5,5,i,j) - > + tmp1 * 2.0d+00 * dy5 - - lhsc(1,1,i,j,k,c) = tmp2 * fjac(1,1,i,j+1) - > - tmp1 * njac(1,1,i,j+1) - > - tmp1 * dy1 - lhsc(1,2,i,j,k,c) = tmp2 * fjac(1,2,i,j+1) - > - tmp1 * njac(1,2,i,j+1) - lhsc(1,3,i,j,k,c) = tmp2 * fjac(1,3,i,j+1) - > - tmp1 * njac(1,3,i,j+1) - lhsc(1,4,i,j,k,c) = tmp2 * fjac(1,4,i,j+1) - > - tmp1 * njac(1,4,i,j+1) - lhsc(1,5,i,j,k,c) = tmp2 * fjac(1,5,i,j+1) - > - tmp1 * njac(1,5,i,j+1) - - lhsc(2,1,i,j,k,c) = tmp2 * fjac(2,1,i,j+1) - > - tmp1 * njac(2,1,i,j+1) - lhsc(2,2,i,j,k,c) = tmp2 * fjac(2,2,i,j+1) - > - tmp1 * njac(2,2,i,j+1) - > - tmp1 * dy2 - lhsc(2,3,i,j,k,c) = tmp2 * fjac(2,3,i,j+1) - > - tmp1 * njac(2,3,i,j+1) - lhsc(2,4,i,j,k,c) = tmp2 * fjac(2,4,i,j+1) - > - tmp1 * njac(2,4,i,j+1) - lhsc(2,5,i,j,k,c) = tmp2 * fjac(2,5,i,j+1) - > - tmp1 * njac(2,5,i,j+1) - - lhsc(3,1,i,j,k,c) = tmp2 * fjac(3,1,i,j+1) - > - tmp1 * njac(3,1,i,j+1) - lhsc(3,2,i,j,k,c) = tmp2 * fjac(3,2,i,j+1) - > - tmp1 * njac(3,2,i,j+1) - lhsc(3,3,i,j,k,c) = tmp2 * fjac(3,3,i,j+1) - > - tmp1 * njac(3,3,i,j+1) - > - tmp1 * dy3 - lhsc(3,4,i,j,k,c) = tmp2 * fjac(3,4,i,j+1) - > - tmp1 * njac(3,4,i,j+1) - lhsc(3,5,i,j,k,c) = tmp2 * fjac(3,5,i,j+1) - > - tmp1 * njac(3,5,i,j+1) - - lhsc(4,1,i,j,k,c) = tmp2 * fjac(4,1,i,j+1) - > - tmp1 * njac(4,1,i,j+1) - lhsc(4,2,i,j,k,c) = tmp2 * fjac(4,2,i,j+1) - > - tmp1 * njac(4,2,i,j+1) - lhsc(4,3,i,j,k,c) = tmp2 * fjac(4,3,i,j+1) - > - tmp1 * njac(4,3,i,j+1) - lhsc(4,4,i,j,k,c) = tmp2 * fjac(4,4,i,j+1) - > - tmp1 * njac(4,4,i,j+1) - > - tmp1 * dy4 - lhsc(4,5,i,j,k,c) = tmp2 * fjac(4,5,i,j+1) - > - tmp1 * njac(4,5,i,j+1) - - lhsc(5,1,i,j,k,c) = tmp2 * fjac(5,1,i,j+1) - > - tmp1 * njac(5,1,i,j+1) - lhsc(5,2,i,j,k,c) = tmp2 * fjac(5,2,i,j+1) - > - tmp1 * njac(5,2,i,j+1) - lhsc(5,3,i,j,k,c) = tmp2 * fjac(5,3,i,j+1) - > - tmp1 * njac(5,3,i,j+1) - lhsc(5,4,i,j,k,c) = tmp2 * fjac(5,4,i,j+1) - > - tmp1 * njac(5,4,i,j+1) - lhsc(5,5,i,j,k,c) = tmp2 * fjac(5,5,i,j+1) - > - tmp1 * njac(5,5,i,j+1) - > - tmp1 * dy5 - - enddo - enddo - - -c--------------------------------------------------------------------- -c outer most do loops - sweeping in i direction -c--------------------------------------------------------------------- - if (first .eq. 1) then - -c--------------------------------------------------------------------- -c multiply c(i,jstart,k) by b_inverse and copy back to c -c multiply rhs(jstart) by b_inverse(jstart) and copy to rhs -c--------------------------------------------------------------------- -!dir$ ivdep - do i=start(1,c),isize - call binvcrhs( lhsb(1,1,i,jstart), - > lhsc(1,1,i,jstart,k,c), - > rhs(1,i,jstart,k,c) ) - enddo - - endif - -c--------------------------------------------------------------------- -c begin inner most do loop -c do all the elements of the cell unless last -c--------------------------------------------------------------------- - do j=jstart+first,jsize-last -!dir$ ivdep - do i=start(1,c),isize - -c--------------------------------------------------------------------- -c subtract A*lhs_vector(j-1) from lhs_vector(j) -c -c rhs(j) = rhs(j) - A*rhs(j-1) -c--------------------------------------------------------------------- - call matvec_sub(lhsa(1,1,i,j), - > rhs(1,i,j-1,k,c),rhs(1,i,j,k,c)) - -c--------------------------------------------------------------------- -c B(j) = B(j) - C(j-1)*A(j) -c--------------------------------------------------------------------- - call matmul_sub(lhsa(1,1,i,j), - > lhsc(1,1,i,j-1,k,c), - > lhsb(1,1,i,j)) - -c--------------------------------------------------------------------- -c multiply c(i,j,k) by b_inverse and copy back to c -c multiply rhs(i,1,k) by b_inverse(i,1,k) and copy to rhs -c--------------------------------------------------------------------- - call binvcrhs( lhsb(1,1,i,j), - > lhsc(1,1,i,j,k,c), - > rhs(1,i,j,k,c) ) - - enddo - enddo - -c--------------------------------------------------------------------- -c Now finish up special cases for last cell -c--------------------------------------------------------------------- - if (last .eq. 1) then - -!dir$ ivdep - do i=start(1,c),isize -c--------------------------------------------------------------------- -c rhs(jsize) = rhs(jsize) - A*rhs(jsize-1) -c--------------------------------------------------------------------- - call matvec_sub(lhsa(1,1,i,jsize), - > rhs(1,i,jsize-1,k,c),rhs(1,i,jsize,k,c)) - -c--------------------------------------------------------------------- -c B(jsize) = B(jsize) - C(jsize-1)*A(jsize) -c call matmul_sub(aa,i,jsize,k,c, -c $ cc,i,jsize-1,k,c,bb,i,jsize,k,c) -c--------------------------------------------------------------------- - call matmul_sub(lhsa(1,1,i,jsize), - > lhsc(1,1,i,jsize-1,k,c), - > lhsb(1,1,i,jsize)) - -c--------------------------------------------------------------------- -c multiply rhs(jsize) by b_inverse(jsize) and copy to rhs -c--------------------------------------------------------------------- - call binvrhs( lhsb(1,1,i,jsize), - > rhs(1,i,jsize,k,c) ) - enddo - - endif - enddo - - - return - end - - - diff --git a/examples/smpi/NAS/BT/z_solve.f b/examples/smpi/NAS/BT/z_solve.f deleted file mode 100644 index d7a5a2f1ec..0000000000 --- a/examples/smpi/NAS/BT/z_solve.f +++ /dev/null @@ -1,776 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_solve - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Performs line solves in Z direction by first factoring -c the block-tridiagonal matrix into an upper triangular matrix, -c and then performing back substitution to solve for the unknow -c vectors of each line. -c -c Make sure we treat elements zero to cell_size in the direction -c of the sweep. -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer c, kstart, stage, - > first, last, recv_id, error, r_status(MPI_STATUS_SIZE), - > isize,jsize,ksize,send_id - - kstart = 0 - -c--------------------------------------------------------------------- -c in our terminology stage is the number of the cell in the y-direction -c i.e. stage = 1 means the start of the line stage=ncells means end -c--------------------------------------------------------------------- - do stage = 1,ncells - c = slice(3,stage) - isize = cell_size(1,c) - 1 - jsize = cell_size(2,c) - 1 - ksize = cell_size(3,c) - 1 -c--------------------------------------------------------------------- -c set last-cell flag -c--------------------------------------------------------------------- - if (stage .eq. ncells) then - last = 1 - else - last = 0 - endif - - if (stage .eq. 1) then -c--------------------------------------------------------------------- -c This is the first cell, so solve without receiving data -c--------------------------------------------------------------------- - first = 1 -c call lhsz(c) - call z_solve_cell(first,last,c) - else -c--------------------------------------------------------------------- -c Not the first cell of this line, so receive info from -c processor working on preceeding cell -c--------------------------------------------------------------------- - first = 0 - call z_receive_solve_info(recv_id,c) -c--------------------------------------------------------------------- -c overlap computations and communications -c--------------------------------------------------------------------- -c call lhsz(c) -c--------------------------------------------------------------------- -c wait for completion -c--------------------------------------------------------------------- - call mpi_wait(send_id,r_status,error) - call mpi_wait(recv_id,r_status,error) -c--------------------------------------------------------------------- -c install C'(kstart+1) and rhs'(kstart+1) to be used in this cell -c--------------------------------------------------------------------- - call z_unpack_solve_info(c) - call z_solve_cell(first,last,c) - endif - - if (last .eq. 0) call z_send_solve_info(send_id,c) - enddo - -c--------------------------------------------------------------------- -c now perform backsubstitution in reverse direction -c--------------------------------------------------------------------- - do stage = ncells, 1, -1 - c = slice(3,stage) - first = 0 - last = 0 - if (stage .eq. 1) first = 1 - if (stage .eq. ncells) then - last = 1 -c--------------------------------------------------------------------- -c last cell, so perform back substitute without waiting -c--------------------------------------------------------------------- - call z_backsubstitute(first, last,c) - else - call z_receive_backsub_info(recv_id,c) - call mpi_wait(send_id,r_status,error) - call mpi_wait(recv_id,r_status,error) - call z_unpack_backsub_info(c) - call z_backsubstitute(first,last,c) - endif - if (first .eq. 0) call z_send_backsub_info(send_id,c) - enddo - - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_unpack_solve_info(c) -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c unpack C'(-1) and rhs'(-1) for -c all i and j -c--------------------------------------------------------------------- - - include 'header.h' - - integer i,j,m,n,ptr,c,kstart - - kstart = 0 - ptr = 0 - do j=0,JMAX-1 - do i=0,IMAX-1 - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - lhsc(m,n,i,j,kstart-1,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - do n=1,BLOCK_SIZE - rhs(n,i,j,kstart-1,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_send_solve_info(send_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c pack up and send C'(kend) and rhs'(kend) for -c all i and j -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer i,j,m,n,ksize,ptr,c,ip,jp - integer error,send_id,buffer_size - - ksize = cell_size(3,c)-1 - ip = cell_coord(1,c) - 1 - jp = cell_coord(2,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM* - > (BLOCK_SIZE*BLOCK_SIZE + BLOCK_SIZE) - -c--------------------------------------------------------------------- -c pack up buffer -c--------------------------------------------------------------------- - ptr = 0 - do j=0,JMAX-1 - do i=0,IMAX-1 - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = lhsc(m,n,i,j,ksize,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = rhs(n,i,j,ksize,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - -c--------------------------------------------------------------------- -c send buffer -c--------------------------------------------------------------------- - call mpi_isend(in_buffer, buffer_size, - > dp_type, successor(3), - > BOTTOM+ip+jp*NCELLS, comm_solve, - > send_id,error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_send_backsub_info(send_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c pack up and send U(jstart) for all i and j -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer i,j,n,ptr,c,kstart,ip,jp - integer error,send_id,buffer_size - -c--------------------------------------------------------------------- -c Send element 0 to previous processor -c--------------------------------------------------------------------- - kstart = 0 - ip = cell_coord(1,c)-1 - jp = cell_coord(2,c)-1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM*BLOCK_SIZE - ptr = 0 - do j=0,JMAX-1 - do i=0,IMAX-1 - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = rhs(n,i,j,kstart,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - - call mpi_isend(in_buffer, buffer_size, - > dp_type, predecessor(3), - > TOP+ip+jp*NCELLS, comm_solve, - > send_id,error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_unpack_backsub_info(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c unpack U(ksize) for all i and j -c--------------------------------------------------------------------- - - include 'header.h' - - integer i,j,n,ptr,c - - ptr = 0 - do j=0,JMAX-1 - do i=0,IMAX-1 - do n=1,BLOCK_SIZE - backsub_info(n,i,j,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_receive_backsub_info(recv_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c post mpi receives -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer error,recv_id,ip,jp,c,buffer_size - ip = cell_coord(1,c) - 1 - jp = cell_coord(2,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM*BLOCK_SIZE - call mpi_irecv(out_buffer, buffer_size, - > dp_type, successor(3), - > TOP+ip+jp*NCELLS, comm_solve, - > recv_id, error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_receive_solve_info(recv_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c post mpi receives -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer ip,jp,recv_id,error,c,buffer_size - ip = cell_coord(1,c) - 1 - jp = cell_coord(2,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM* - > (BLOCK_SIZE*BLOCK_SIZE + BLOCK_SIZE) - call mpi_irecv(out_buffer, buffer_size, - > dp_type, predecessor(3), - > BOTTOM+ip+jp*NCELLS, comm_solve, - > recv_id, error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_backsubstitute(first, last, c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c back solve: if last cell, then generate U(ksize)=rhs(ksize) -c else assume U(ksize) is loaded in un pack backsub_info -c so just use it -c after call u(kstart) will be sent to next cell -c--------------------------------------------------------------------- - - include 'header.h' - - integer first, last, c, i, k - integer m,n,j,jsize,isize,ksize,kstart - - kstart = 0 - isize = cell_size(1,c)-end(1,c)-1 - jsize = cell_size(2,c)-end(2,c)-1 - ksize = cell_size(3,c)-1 - if (last .eq. 0) then - do j=start(2,c),jsize - do i=start(1,c),isize -c--------------------------------------------------------------------- -c U(jsize) uses info from previous cell if not last cell -c--------------------------------------------------------------------- - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - rhs(m,i,j,ksize,c) = rhs(m,i,j,ksize,c) - > - lhsc(m,n,i,j,ksize,c)* - > backsub_info(n,i,j,c) - enddo - enddo - enddo - enddo - endif - do k=ksize-1,kstart,-1 - do j=start(2,c),jsize - do i=start(1,c),isize - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - > - lhsc(m,n,i,j,k,c)*rhs(n,i,j,k+1,c) - enddo - enddo - enddo - enddo - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_solve_cell(first,last,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c performs guaussian elimination on this cell. -c -c assumes that unpacking routines for non-first cells -c preload C' and rhs' from previous cell. -c -c assumed send happens outside this routine, but that -c c'(KMAX) and rhs'(KMAX) will be sent to next cell. -c--------------------------------------------------------------------- - - include 'header.h' - include 'work_lhs.h' - - integer first,last,c - integer i,j,k,isize,ksize,jsize,kstart - double precision utmp(6,-2:KMAX+1) - - kstart = 0 - isize = cell_size(1,c)-end(1,c)-1 - jsize = cell_size(2,c)-end(2,c)-1 - ksize = cell_size(3,c)-1 - - call lhsabinit(lhsa, lhsb, ksize) - - do j=start(2,c),jsize - do i=start(1,c),isize - -c--------------------------------------------------------------------- -c This function computes the left hand side for the three z-factors -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Compute the indices for storing the block-diagonal matrix; -c determine c (labeled f) and s jacobians for cell c -c--------------------------------------------------------------------- - do k = start(3,c)-1, cell_size(3,c)-end(3,c) - utmp(1,k) = 1.0d0 / u(1,i,j,k,c) - utmp(2,k) = u(2,i,j,k,c) - utmp(3,k) = u(3,i,j,k,c) - utmp(4,k) = u(4,i,j,k,c) - utmp(5,k) = u(5,i,j,k,c) - utmp(6,k) = qs(i,j,k,c) - end do - - do k = start(3,c)-1, cell_size(3,c)-end(3,c) - - tmp1 = utmp(1,k) - tmp2 = tmp1 * tmp1 - tmp3 = tmp1 * tmp2 - - fjac(1,1,k) = 0.0d+00 - fjac(1,2,k) = 0.0d+00 - fjac(1,3,k) = 0.0d+00 - fjac(1,4,k) = 1.0d+00 - fjac(1,5,k) = 0.0d+00 - - fjac(2,1,k) = - ( utmp(2,k)*utmp(4,k) ) - > * tmp2 - fjac(2,2,k) = utmp(4,k) * tmp1 - fjac(2,3,k) = 0.0d+00 - fjac(2,4,k) = utmp(2,k) * tmp1 - fjac(2,5,k) = 0.0d+00 - - fjac(3,1,k) = - ( utmp(3,k)*utmp(4,k) ) - > * tmp2 - fjac(3,2,k) = 0.0d+00 - fjac(3,3,k) = utmp(4,k) * tmp1 - fjac(3,4,k) = utmp(3,k) * tmp1 - fjac(3,5,k) = 0.0d+00 - - fjac(4,1,k) = - (utmp(4,k)*utmp(4,k) * tmp2 ) - > + c2 * utmp(6,k) - fjac(4,2,k) = - c2 * utmp(2,k) * tmp1 - fjac(4,3,k) = - c2 * utmp(3,k) * tmp1 - fjac(4,4,k) = ( 2.0d+00 - c2 ) - > * utmp(4,k) * tmp1 - fjac(4,5,k) = c2 - - fjac(5,1,k) = ( c2 * 2.0d0 * utmp(6,k) - > - c1 * ( utmp(5,k) * tmp1 ) ) - > * ( utmp(4,k) * tmp1 ) - fjac(5,2,k) = - c2 * ( utmp(2,k)*utmp(4,k) ) - > * tmp2 - fjac(5,3,k) = - c2 * ( utmp(3,k)*utmp(4,k) ) - > * tmp2 - fjac(5,4,k) = c1 * ( utmp(5,k) * tmp1 ) - > - c2 * ( utmp(6,k) - > + utmp(4,k)*utmp(4,k) * tmp2 ) - fjac(5,5,k) = c1 * utmp(4,k) * tmp1 - - njac(1,1,k) = 0.0d+00 - njac(1,2,k) = 0.0d+00 - njac(1,3,k) = 0.0d+00 - njac(1,4,k) = 0.0d+00 - njac(1,5,k) = 0.0d+00 - - njac(2,1,k) = - c3c4 * tmp2 * utmp(2,k) - njac(2,2,k) = c3c4 * tmp1 - njac(2,3,k) = 0.0d+00 - njac(2,4,k) = 0.0d+00 - njac(2,5,k) = 0.0d+00 - - njac(3,1,k) = - c3c4 * tmp2 * utmp(3,k) - njac(3,2,k) = 0.0d+00 - njac(3,3,k) = c3c4 * tmp1 - njac(3,4,k) = 0.0d+00 - njac(3,5,k) = 0.0d+00 - - njac(4,1,k) = - con43 * c3c4 * tmp2 * utmp(4,k) - njac(4,2,k) = 0.0d+00 - njac(4,3,k) = 0.0d+00 - njac(4,4,k) = con43 * c3 * c4 * tmp1 - njac(4,5,k) = 0.0d+00 - - njac(5,1,k) = - ( c3c4 - > - c1345 ) * tmp3 * (utmp(2,k)**2) - > - ( c3c4 - c1345 ) * tmp3 * (utmp(3,k)**2) - > - ( con43 * c3c4 - > - c1345 ) * tmp3 * (utmp(4,k)**2) - > - c1345 * tmp2 * utmp(5,k) - - njac(5,2,k) = ( c3c4 - c1345 ) * tmp2 * utmp(2,k) - njac(5,3,k) = ( c3c4 - c1345 ) * tmp2 * utmp(3,k) - njac(5,4,k) = ( con43 * c3c4 - > - c1345 ) * tmp2 * utmp(4,k) - njac(5,5,k) = ( c1345 )* tmp1 - - - enddo - -c--------------------------------------------------------------------- -c now joacobians set, so form left hand side in z direction -c--------------------------------------------------------------------- - do k = start(3,c), ksize-end(3,c) - - tmp1 = dt * tz1 - tmp2 = dt * tz2 - - lhsa(1,1,k) = - tmp2 * fjac(1,1,k-1) - > - tmp1 * njac(1,1,k-1) - > - tmp1 * dz1 - lhsa(1,2,k) = - tmp2 * fjac(1,2,k-1) - > - tmp1 * njac(1,2,k-1) - lhsa(1,3,k) = - tmp2 * fjac(1,3,k-1) - > - tmp1 * njac(1,3,k-1) - lhsa(1,4,k) = - tmp2 * fjac(1,4,k-1) - > - tmp1 * njac(1,4,k-1) - lhsa(1,5,k) = - tmp2 * fjac(1,5,k-1) - > - tmp1 * njac(1,5,k-1) - - lhsa(2,1,k) = - tmp2 * fjac(2,1,k-1) - > - tmp1 * njac(2,1,k-1) - lhsa(2,2,k) = - tmp2 * fjac(2,2,k-1) - > - tmp1 * njac(2,2,k-1) - > - tmp1 * dz2 - lhsa(2,3,k) = - tmp2 * fjac(2,3,k-1) - > - tmp1 * njac(2,3,k-1) - lhsa(2,4,k) = - tmp2 * fjac(2,4,k-1) - > - tmp1 * njac(2,4,k-1) - lhsa(2,5,k) = - tmp2 * fjac(2,5,k-1) - > - tmp1 * njac(2,5,k-1) - - lhsa(3,1,k) = - tmp2 * fjac(3,1,k-1) - > - tmp1 * njac(3,1,k-1) - lhsa(3,2,k) = - tmp2 * fjac(3,2,k-1) - > - tmp1 * njac(3,2,k-1) - lhsa(3,3,k) = - tmp2 * fjac(3,3,k-1) - > - tmp1 * njac(3,3,k-1) - > - tmp1 * dz3 - lhsa(3,4,k) = - tmp2 * fjac(3,4,k-1) - > - tmp1 * njac(3,4,k-1) - lhsa(3,5,k) = - tmp2 * fjac(3,5,k-1) - > - tmp1 * njac(3,5,k-1) - - lhsa(4,1,k) = - tmp2 * fjac(4,1,k-1) - > - tmp1 * njac(4,1,k-1) - lhsa(4,2,k) = - tmp2 * fjac(4,2,k-1) - > - tmp1 * njac(4,2,k-1) - lhsa(4,3,k) = - tmp2 * fjac(4,3,k-1) - > - tmp1 * njac(4,3,k-1) - lhsa(4,4,k) = - tmp2 * fjac(4,4,k-1) - > - tmp1 * njac(4,4,k-1) - > - tmp1 * dz4 - lhsa(4,5,k) = - tmp2 * fjac(4,5,k-1) - > - tmp1 * njac(4,5,k-1) - - lhsa(5,1,k) = - tmp2 * fjac(5,1,k-1) - > - tmp1 * njac(5,1,k-1) - lhsa(5,2,k) = - tmp2 * fjac(5,2,k-1) - > - tmp1 * njac(5,2,k-1) - lhsa(5,3,k) = - tmp2 * fjac(5,3,k-1) - > - tmp1 * njac(5,3,k-1) - lhsa(5,4,k) = - tmp2 * fjac(5,4,k-1) - > - tmp1 * njac(5,4,k-1) - lhsa(5,5,k) = - tmp2 * fjac(5,5,k-1) - > - tmp1 * njac(5,5,k-1) - > - tmp1 * dz5 - - lhsb(1,1,k) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(1,1,k) - > + tmp1 * 2.0d+00 * dz1 - lhsb(1,2,k) = tmp1 * 2.0d+00 * njac(1,2,k) - lhsb(1,3,k) = tmp1 * 2.0d+00 * njac(1,3,k) - lhsb(1,4,k) = tmp1 * 2.0d+00 * njac(1,4,k) - lhsb(1,5,k) = tmp1 * 2.0d+00 * njac(1,5,k) - - lhsb(2,1,k) = tmp1 * 2.0d+00 * njac(2,1,k) - lhsb(2,2,k) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(2,2,k) - > + tmp1 * 2.0d+00 * dz2 - lhsb(2,3,k) = tmp1 * 2.0d+00 * njac(2,3,k) - lhsb(2,4,k) = tmp1 * 2.0d+00 * njac(2,4,k) - lhsb(2,5,k) = tmp1 * 2.0d+00 * njac(2,5,k) - - lhsb(3,1,k) = tmp1 * 2.0d+00 * njac(3,1,k) - lhsb(3,2,k) = tmp1 * 2.0d+00 * njac(3,2,k) - lhsb(3,3,k) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(3,3,k) - > + tmp1 * 2.0d+00 * dz3 - lhsb(3,4,k) = tmp1 * 2.0d+00 * njac(3,4,k) - lhsb(3,5,k) = tmp1 * 2.0d+00 * njac(3,5,k) - - lhsb(4,1,k) = tmp1 * 2.0d+00 * njac(4,1,k) - lhsb(4,2,k) = tmp1 * 2.0d+00 * njac(4,2,k) - lhsb(4,3,k) = tmp1 * 2.0d+00 * njac(4,3,k) - lhsb(4,4,k) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(4,4,k) - > + tmp1 * 2.0d+00 * dz4 - lhsb(4,5,k) = tmp1 * 2.0d+00 * njac(4,5,k) - - lhsb(5,1,k) = tmp1 * 2.0d+00 * njac(5,1,k) - lhsb(5,2,k) = tmp1 * 2.0d+00 * njac(5,2,k) - lhsb(5,3,k) = tmp1 * 2.0d+00 * njac(5,3,k) - lhsb(5,4,k) = tmp1 * 2.0d+00 * njac(5,4,k) - lhsb(5,5,k) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(5,5,k) - > + tmp1 * 2.0d+00 * dz5 - - lhsc(1,1,i,j,k,c) = tmp2 * fjac(1,1,k+1) - > - tmp1 * njac(1,1,k+1) - > - tmp1 * dz1 - lhsc(1,2,i,j,k,c) = tmp2 * fjac(1,2,k+1) - > - tmp1 * njac(1,2,k+1) - lhsc(1,3,i,j,k,c) = tmp2 * fjac(1,3,k+1) - > - tmp1 * njac(1,3,k+1) - lhsc(1,4,i,j,k,c) = tmp2 * fjac(1,4,k+1) - > - tmp1 * njac(1,4,k+1) - lhsc(1,5,i,j,k,c) = tmp2 * fjac(1,5,k+1) - > - tmp1 * njac(1,5,k+1) - - lhsc(2,1,i,j,k,c) = tmp2 * fjac(2,1,k+1) - > - tmp1 * njac(2,1,k+1) - lhsc(2,2,i,j,k,c) = tmp2 * fjac(2,2,k+1) - > - tmp1 * njac(2,2,k+1) - > - tmp1 * dz2 - lhsc(2,3,i,j,k,c) = tmp2 * fjac(2,3,k+1) - > - tmp1 * njac(2,3,k+1) - lhsc(2,4,i,j,k,c) = tmp2 * fjac(2,4,k+1) - > - tmp1 * njac(2,4,k+1) - lhsc(2,5,i,j,k,c) = tmp2 * fjac(2,5,k+1) - > - tmp1 * njac(2,5,k+1) - - lhsc(3,1,i,j,k,c) = tmp2 * fjac(3,1,k+1) - > - tmp1 * njac(3,1,k+1) - lhsc(3,2,i,j,k,c) = tmp2 * fjac(3,2,k+1) - > - tmp1 * njac(3,2,k+1) - lhsc(3,3,i,j,k,c) = tmp2 * fjac(3,3,k+1) - > - tmp1 * njac(3,3,k+1) - > - tmp1 * dz3 - lhsc(3,4,i,j,k,c) = tmp2 * fjac(3,4,k+1) - > - tmp1 * njac(3,4,k+1) - lhsc(3,5,i,j,k,c) = tmp2 * fjac(3,5,k+1) - > - tmp1 * njac(3,5,k+1) - - lhsc(4,1,i,j,k,c) = tmp2 * fjac(4,1,k+1) - > - tmp1 * njac(4,1,k+1) - lhsc(4,2,i,j,k,c) = tmp2 * fjac(4,2,k+1) - > - tmp1 * njac(4,2,k+1) - lhsc(4,3,i,j,k,c) = tmp2 * fjac(4,3,k+1) - > - tmp1 * njac(4,3,k+1) - lhsc(4,4,i,j,k,c) = tmp2 * fjac(4,4,k+1) - > - tmp1 * njac(4,4,k+1) - > - tmp1 * dz4 - lhsc(4,5,i,j,k,c) = tmp2 * fjac(4,5,k+1) - > - tmp1 * njac(4,5,k+1) - - lhsc(5,1,i,j,k,c) = tmp2 * fjac(5,1,k+1) - > - tmp1 * njac(5,1,k+1) - lhsc(5,2,i,j,k,c) = tmp2 * fjac(5,2,k+1) - > - tmp1 * njac(5,2,k+1) - lhsc(5,3,i,j,k,c) = tmp2 * fjac(5,3,k+1) - > - tmp1 * njac(5,3,k+1) - lhsc(5,4,i,j,k,c) = tmp2 * fjac(5,4,k+1) - > - tmp1 * njac(5,4,k+1) - lhsc(5,5,i,j,k,c) = tmp2 * fjac(5,5,k+1) - > - tmp1 * njac(5,5,k+1) - > - tmp1 * dz5 - - enddo - - -c--------------------------------------------------------------------- -c outer most do loops - sweeping in i direction -c--------------------------------------------------------------------- - if (first .eq. 1) then - -c--------------------------------------------------------------------- -c multiply c(i,j,kstart) by b_inverse and copy back to c -c multiply rhs(kstart) by b_inverse(kstart) and copy to rhs -c--------------------------------------------------------------------- - call binvcrhs( lhsb(1,1,kstart), - > lhsc(1,1,i,j,kstart,c), - > rhs(1,i,j,kstart,c) ) - - endif - -c--------------------------------------------------------------------- -c begin inner most do loop -c do all the elements of the cell unless last -c--------------------------------------------------------------------- - do k=kstart+first,ksize-last - -c--------------------------------------------------------------------- -c subtract A*lhs_vector(k-1) from lhs_vector(k) -c -c rhs(k) = rhs(k) - A*rhs(k-1) -c--------------------------------------------------------------------- - call matvec_sub(lhsa(1,1,k), - > rhs(1,i,j,k-1,c),rhs(1,i,j,k,c)) - -c--------------------------------------------------------------------- -c B(k) = B(k) - C(k-1)*A(k) -c call matmul_sub(aa,i,j,k,c,cc,i,j,k-1,c,bb,i,j,k,c) -c--------------------------------------------------------------------- - call matmul_sub(lhsa(1,1,k), - > lhsc(1,1,i,j,k-1,c), - > lhsb(1,1,k)) - -c--------------------------------------------------------------------- -c multiply c(i,j,k) by b_inverse and copy back to c -c multiply rhs(i,j,1) by b_inverse(i,j,1) and copy to rhs -c--------------------------------------------------------------------- - call binvcrhs( lhsb(1,1,k), - > lhsc(1,1,i,j,k,c), - > rhs(1,i,j,k,c) ) - - enddo - -c--------------------------------------------------------------------- -c Now finish up special cases for last cell -c--------------------------------------------------------------------- - if (last .eq. 1) then - -c--------------------------------------------------------------------- -c rhs(ksize) = rhs(ksize) - A*rhs(ksize-1) -c--------------------------------------------------------------------- - call matvec_sub(lhsa(1,1,ksize), - > rhs(1,i,j,ksize-1,c),rhs(1,i,j,ksize,c)) - -c--------------------------------------------------------------------- -c B(ksize) = B(ksize) - C(ksize-1)*A(ksize) -c call matmul_sub(aa,i,j,ksize,c, -c $ cc,i,j,ksize-1,c,bb,i,j,ksize,c) -c--------------------------------------------------------------------- - call matmul_sub(lhsa(1,1,ksize), - > lhsc(1,1,i,j,ksize-1,c), - > lhsb(1,1,ksize)) - -c--------------------------------------------------------------------- -c multiply rhs(ksize) by b_inverse(ksize) and copy to rhs -c--------------------------------------------------------------------- - call binvrhs( lhsb(1,1,ksize), - > rhs(1,i,j,ksize,c) ) - - endif - enddo - enddo - - - return - end - - - - - - diff --git a/examples/smpi/NAS/BT/z_solve_vec.f b/examples/smpi/NAS/BT/z_solve_vec.f deleted file mode 100644 index 2c27fb00d1..0000000000 --- a/examples/smpi/NAS/BT/z_solve_vec.f +++ /dev/null @@ -1,793 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_solve - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Performs line solves in Z direction by first factoring -c the block-tridiagonal matrix into an upper triangular matrix, -c and then performing back substitution to solve for the unknow -c vectors of each line. -c -c Make sure we treat elements zero to cell_size in the direction -c of the sweep. -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer c, kstart, stage, - > first, last, recv_id, error, r_status(MPI_STATUS_SIZE), - > isize,jsize,ksize,send_id - - kstart = 0 - -c--------------------------------------------------------------------- -c in our terminology stage is the number of the cell in the y-direct -c i.e. stage = 1 means the start of the line stage=ncells means end -c--------------------------------------------------------------------- - do stage = 1,ncells - c = slice(3,stage) - isize = cell_size(1,c) - 1 - jsize = cell_size(2,c) - 1 - ksize = cell_size(3,c) - 1 -c--------------------------------------------------------------------- -c set last-cell flag -c--------------------------------------------------------------------- - if (stage .eq. ncells) then - last = 1 - else - last = 0 - endif - - if (stage .eq. 1) then -c--------------------------------------------------------------------- -c This is the first cell, so solve without receiving data -c--------------------------------------------------------------------- - first = 1 -c call lhsz(c) - call z_solve_cell(first,last,c) - else -c--------------------------------------------------------------------- -c Not the first cell of this line, so receive info from -c processor working on preceeding cell -c--------------------------------------------------------------------- - first = 0 - call z_receive_solve_info(recv_id,c) -c--------------------------------------------------------------------- -c overlap computations and communications -c--------------------------------------------------------------------- -c call lhsz(c) -c--------------------------------------------------------------------- -c wait for completion -c--------------------------------------------------------------------- - call mpi_wait(send_id,r_status,error) - call mpi_wait(recv_id,r_status,error) -c--------------------------------------------------------------------- -c install C'(kstart+1) and rhs'(kstart+1) to be used in this cell -c--------------------------------------------------------------------- - call z_unpack_solve_info(c) - call z_solve_cell(first,last,c) - endif - - if (last .eq. 0) call z_send_solve_info(send_id,c) - enddo - -c--------------------------------------------------------------------- -c now perform backsubstitution in reverse direction -c--------------------------------------------------------------------- - do stage = ncells, 1, -1 - c = slice(3,stage) - first = 0 - last = 0 - if (stage .eq. 1) first = 1 - if (stage .eq. ncells) then - last = 1 -c--------------------------------------------------------------------- -c last cell, so perform back substitute without waiting -c--------------------------------------------------------------------- - call z_backsubstitute(first, last,c) - else - call z_receive_backsub_info(recv_id,c) - call mpi_wait(send_id,r_status,error) - call mpi_wait(recv_id,r_status,error) - call z_unpack_backsub_info(c) - call z_backsubstitute(first,last,c) - endif - if (first .eq. 0) call z_send_backsub_info(send_id,c) - enddo - - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_unpack_solve_info(c) -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c unpack C'(-1) and rhs'(-1) for -c all i and j -c--------------------------------------------------------------------- - - include 'header.h' - - integer i,j,m,n,ptr,c,kstart - - kstart = 0 - ptr = 0 - do j=0,JMAX-1 - do i=0,IMAX-1 - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - lhsc(m,n,i,j,kstart-1,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - do n=1,BLOCK_SIZE - rhs(n,i,j,kstart-1,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_send_solve_info(send_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c pack up and send C'(kend) and rhs'(kend) for -c all i and j -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer i,j,m,n,ksize,ptr,c,ip,jp - integer error,send_id,buffer_size - - ksize = cell_size(3,c)-1 - ip = cell_coord(1,c) - 1 - jp = cell_coord(2,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM* - > (BLOCK_SIZE*BLOCK_SIZE + BLOCK_SIZE) - -c--------------------------------------------------------------------- -c pack up buffer -c--------------------------------------------------------------------- - ptr = 0 - do j=0,JMAX-1 - do i=0,IMAX-1 - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = lhsc(m,n,i,j,ksize,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = rhs(n,i,j,ksize,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - -c--------------------------------------------------------------------- -c send buffer -c--------------------------------------------------------------------- - call mpi_isend(in_buffer, buffer_size, - > dp_type, successor(3), - > BOTTOM+ip+jp*NCELLS, comm_solve, - > send_id,error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_send_backsub_info(send_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c pack up and send U(jstart) for all i and j -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer i,j,n,ptr,c,kstart,ip,jp - integer error,send_id,buffer_size - -c--------------------------------------------------------------------- -c Send element 0 to previous processor -c--------------------------------------------------------------------- - kstart = 0 - ip = cell_coord(1,c)-1 - jp = cell_coord(2,c)-1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM*BLOCK_SIZE - ptr = 0 - do j=0,JMAX-1 - do i=0,IMAX-1 - do n=1,BLOCK_SIZE - in_buffer(ptr+n) = rhs(n,i,j,kstart,c) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - - call mpi_isend(in_buffer, buffer_size, - > dp_type, predecessor(3), - > TOP+ip+jp*NCELLS, comm_solve, - > send_id,error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_unpack_backsub_info(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c unpack U(ksize) for all i and j -c--------------------------------------------------------------------- - - include 'header.h' - - integer i,j,n,ptr,c - - ptr = 0 - do j=0,JMAX-1 - do i=0,IMAX-1 - do n=1,BLOCK_SIZE - backsub_info(n,i,j,c) = out_buffer(ptr+n) - enddo - ptr = ptr+BLOCK_SIZE - enddo - enddo - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_receive_backsub_info(recv_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c post mpi receives -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer error,recv_id,ip,jp,c,buffer_size - ip = cell_coord(1,c) - 1 - jp = cell_coord(2,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM*BLOCK_SIZE - call mpi_irecv(out_buffer, buffer_size, - > dp_type, successor(3), - > TOP+ip+jp*NCELLS, comm_solve, - > recv_id, error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_receive_solve_info(recv_id,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c post mpi receives -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer ip,jp,recv_id,error,c,buffer_size - ip = cell_coord(1,c) - 1 - jp = cell_coord(2,c) - 1 - buffer_size=MAX_CELL_DIM*MAX_CELL_DIM* - > (BLOCK_SIZE*BLOCK_SIZE + BLOCK_SIZE) - call mpi_irecv(out_buffer, buffer_size, - > dp_type, predecessor(3), - > BOTTOM+ip+jp*NCELLS, comm_solve, - > recv_id, error) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_backsubstitute(first, last, c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c back solve: if last cell, then generate U(ksize)=rhs(ksize) -c else assume U(ksize) is loaded in un pack backsub_info -c so just use it -c after call u(kstart) will be sent to next cell -c--------------------------------------------------------------------- - - include 'header.h' - - integer first, last, c, i, k - integer m,n,j,jsize,isize,ksize,kstart - - kstart = 0 - isize = cell_size(1,c)-end(1,c)-1 - jsize = cell_size(2,c)-end(2,c)-1 - ksize = cell_size(3,c)-1 - if (last .eq. 0) then - do j=start(2,c),jsize - do i=start(1,c),isize -c--------------------------------------------------------------------- -c U(jsize) uses info from previous cell if not last cell -c--------------------------------------------------------------------- - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - rhs(m,i,j,ksize,c) = rhs(m,i,j,ksize,c) - > - lhsc(m,n,i,j,ksize,c)* - > backsub_info(n,i,j,c) - enddo - enddo - enddo - enddo - endif - do k=ksize-1,kstart,-1 - do j=start(2,c),jsize - do i=start(1,c),isize - do m=1,BLOCK_SIZE - do n=1,BLOCK_SIZE - rhs(m,i,j,k,c) = rhs(m,i,j,k,c) - > - lhsc(m,n,i,j,k,c)*rhs(n,i,j,k+1,c) - enddo - enddo - enddo - enddo - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_solve_cell(first,last,c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c performs guaussian elimination on this cell. -c -c assumes that unpacking routines for non-first cells -c preload C' and rhs' from previous cell. -c -c assumed send happens outside this routine, but that -c c'(KMAX) and rhs'(KMAX) will be sent to next cell. -c--------------------------------------------------------------------- - - include 'header.h' - include 'work_lhs_vec.h' - - integer first,last,c - integer i,j,k,m,n,isize,ksize,jsize,kstart - - kstart = 0 - isize = cell_size(1,c)-end(1,c)-1 - jsize = cell_size(2,c)-end(2,c)-1 - ksize = cell_size(3,c)-1 - -c--------------------------------------------------------------------- -c zero the left hand side for starters -c set diagonal values to 1. This is overkill, but convenient -c--------------------------------------------------------------------- - do i = 0, isize - do m = 1, 5 - do n = 1, 5 - lhsa(m,n,i,0) = 0.0d0 - lhsb(m,n,i,0) = 0.0d0 - lhsa(m,n,i,ksize) = 0.0d0 - lhsb(m,n,i,ksize) = 0.0d0 - enddo - lhsb(m,m,i,0) = 1.0d0 - lhsb(m,m,i,ksize) = 1.0d0 - enddo - enddo - - do j=start(2,c),jsize - -c--------------------------------------------------------------------- -c This function computes the left hand side for the three z-factors -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Compute the indices for storing the block-diagonal matrix; -c determine c (labeled f) and s jacobians for cell c -c--------------------------------------------------------------------- - - do k = start(3,c)-1, cell_size(3,c)-end(3,c) - do i=start(1,c),isize - - tmp1 = 1.0d0 / u(1,i,j,k,c) - tmp2 = tmp1 * tmp1 - tmp3 = tmp1 * tmp2 - - fjac(1,1,i,k) = 0.0d+00 - fjac(1,2,i,k) = 0.0d+00 - fjac(1,3,i,k) = 0.0d+00 - fjac(1,4,i,k) = 1.0d+00 - fjac(1,5,i,k) = 0.0d+00 - - fjac(2,1,i,k) = - ( u(2,i,j,k,c)*u(4,i,j,k,c) ) - > * tmp2 - fjac(2,2,i,k) = u(4,i,j,k,c) * tmp1 - fjac(2,3,i,k) = 0.0d+00 - fjac(2,4,i,k) = u(2,i,j,k,c) * tmp1 - fjac(2,5,i,k) = 0.0d+00 - - fjac(3,1,i,k) = - ( u(3,i,j,k,c)*u(4,i,j,k,c) ) - > * tmp2 - fjac(3,2,i,k) = 0.0d+00 - fjac(3,3,i,k) = u(4,i,j,k,c) * tmp1 - fjac(3,4,i,k) = u(3,i,j,k,c) * tmp1 - fjac(3,5,i,k) = 0.0d+00 - - fjac(4,1,i,k) = - (u(4,i,j,k,c)*u(4,i,j,k,c) * tmp2 ) - > + c2 * qs(i,j,k,c) - fjac(4,2,i,k) = - c2 * u(2,i,j,k,c) * tmp1 - fjac(4,3,i,k) = - c2 * u(3,i,j,k,c) * tmp1 - fjac(4,4,i,k) = ( 2.0d+00 - c2 ) - > * u(4,i,j,k,c) * tmp1 - fjac(4,5,i,k) = c2 - - fjac(5,1,i,k) = ( c2 * 2.0d0 * qs(i,j,k,c) - > - c1 * ( u(5,i,j,k,c) * tmp1 ) ) - > * ( u(4,i,j,k,c) * tmp1 ) - fjac(5,2,i,k) = - c2 * ( u(2,i,j,k,c)*u(4,i,j,k,c) ) - > * tmp2 - fjac(5,3,i,k) = - c2 * ( u(3,i,j,k,c)*u(4,i,j,k,c) ) - > * tmp2 - fjac(5,4,i,k) = c1 * ( u(5,i,j,k,c) * tmp1 ) - > - c2 * ( qs(i,j,k,c) - > + u(4,i,j,k,c)*u(4,i,j,k,c) * tmp2 ) - fjac(5,5,i,k) = c1 * u(4,i,j,k,c) * tmp1 - - njac(1,1,i,k) = 0.0d+00 - njac(1,2,i,k) = 0.0d+00 - njac(1,3,i,k) = 0.0d+00 - njac(1,4,i,k) = 0.0d+00 - njac(1,5,i,k) = 0.0d+00 - - njac(2,1,i,k) = - c3c4 * tmp2 * u(2,i,j,k,c) - njac(2,2,i,k) = c3c4 * tmp1 - njac(2,3,i,k) = 0.0d+00 - njac(2,4,i,k) = 0.0d+00 - njac(2,5,i,k) = 0.0d+00 - - njac(3,1,i,k) = - c3c4 * tmp2 * u(3,i,j,k,c) - njac(3,2,i,k) = 0.0d+00 - njac(3,3,i,k) = c3c4 * tmp1 - njac(3,4,i,k) = 0.0d+00 - njac(3,5,i,k) = 0.0d+00 - - njac(4,1,i,k) = - con43 * c3c4 * tmp2 * u(4,i,j,k,c) - njac(4,2,i,k) = 0.0d+00 - njac(4,3,i,k) = 0.0d+00 - njac(4,4,i,k) = con43 * c3 * c4 * tmp1 - njac(4,5,i,k) = 0.0d+00 - - njac(5,1,i,k) = - ( c3c4 - > - c1345 ) * tmp3 * (u(2,i,j,k,c)**2) - > - ( c3c4 - c1345 ) * tmp3 * (u(3,i,j,k,c)**2) - > - ( con43 * c3c4 - > - c1345 ) * tmp3 * (u(4,i,j,k,c)**2) - > - c1345 * tmp2 * u(5,i,j,k,c) - - njac(5,2,i,k) = ( c3c4 - c1345 ) * tmp2 * u(2,i,j,k,c) - njac(5,3,i,k) = ( c3c4 - c1345 ) * tmp2 * u(3,i,j,k,c) - njac(5,4,i,k) = ( con43 * c3c4 - > - c1345 ) * tmp2 * u(4,i,j,k,c) - njac(5,5,i,k) = ( c1345 )* tmp1 - - - enddo - enddo - -c--------------------------------------------------------------------- -c now joacobians set, so form left hand side in z direction -c--------------------------------------------------------------------- - do k = start(3,c), ksize-end(3,c) - do i=start(1,c),isize - - tmp1 = dt * tz1 - tmp2 = dt * tz2 - - lhsa(1,1,i,k) = - tmp2 * fjac(1,1,i,k-1) - > - tmp1 * njac(1,1,i,k-1) - > - tmp1 * dz1 - lhsa(1,2,i,k) = - tmp2 * fjac(1,2,i,k-1) - > - tmp1 * njac(1,2,i,k-1) - lhsa(1,3,i,k) = - tmp2 * fjac(1,3,i,k-1) - > - tmp1 * njac(1,3,i,k-1) - lhsa(1,4,i,k) = - tmp2 * fjac(1,4,i,k-1) - > - tmp1 * njac(1,4,i,k-1) - lhsa(1,5,i,k) = - tmp2 * fjac(1,5,i,k-1) - > - tmp1 * njac(1,5,i,k-1) - - lhsa(2,1,i,k) = - tmp2 * fjac(2,1,i,k-1) - > - tmp1 * njac(2,1,i,k-1) - lhsa(2,2,i,k) = - tmp2 * fjac(2,2,i,k-1) - > - tmp1 * njac(2,2,i,k-1) - > - tmp1 * dz2 - lhsa(2,3,i,k) = - tmp2 * fjac(2,3,i,k-1) - > - tmp1 * njac(2,3,i,k-1) - lhsa(2,4,i,k) = - tmp2 * fjac(2,4,i,k-1) - > - tmp1 * njac(2,4,i,k-1) - lhsa(2,5,i,k) = - tmp2 * fjac(2,5,i,k-1) - > - tmp1 * njac(2,5,i,k-1) - - lhsa(3,1,i,k) = - tmp2 * fjac(3,1,i,k-1) - > - tmp1 * njac(3,1,i,k-1) - lhsa(3,2,i,k) = - tmp2 * fjac(3,2,i,k-1) - > - tmp1 * njac(3,2,i,k-1) - lhsa(3,3,i,k) = - tmp2 * fjac(3,3,i,k-1) - > - tmp1 * njac(3,3,i,k-1) - > - tmp1 * dz3 - lhsa(3,4,i,k) = - tmp2 * fjac(3,4,i,k-1) - > - tmp1 * njac(3,4,i,k-1) - lhsa(3,5,i,k) = - tmp2 * fjac(3,5,i,k-1) - > - tmp1 * njac(3,5,i,k-1) - - lhsa(4,1,i,k) = - tmp2 * fjac(4,1,i,k-1) - > - tmp1 * njac(4,1,i,k-1) - lhsa(4,2,i,k) = - tmp2 * fjac(4,2,i,k-1) - > - tmp1 * njac(4,2,i,k-1) - lhsa(4,3,i,k) = - tmp2 * fjac(4,3,i,k-1) - > - tmp1 * njac(4,3,i,k-1) - lhsa(4,4,i,k) = - tmp2 * fjac(4,4,i,k-1) - > - tmp1 * njac(4,4,i,k-1) - > - tmp1 * dz4 - lhsa(4,5,i,k) = - tmp2 * fjac(4,5,i,k-1) - > - tmp1 * njac(4,5,i,k-1) - - lhsa(5,1,i,k) = - tmp2 * fjac(5,1,i,k-1) - > - tmp1 * njac(5,1,i,k-1) - lhsa(5,2,i,k) = - tmp2 * fjac(5,2,i,k-1) - > - tmp1 * njac(5,2,i,k-1) - lhsa(5,3,i,k) = - tmp2 * fjac(5,3,i,k-1) - > - tmp1 * njac(5,3,i,k-1) - lhsa(5,4,i,k) = - tmp2 * fjac(5,4,i,k-1) - > - tmp1 * njac(5,4,i,k-1) - lhsa(5,5,i,k) = - tmp2 * fjac(5,5,i,k-1) - > - tmp1 * njac(5,5,i,k-1) - > - tmp1 * dz5 - - lhsb(1,1,i,k) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(1,1,i,k) - > + tmp1 * 2.0d+00 * dz1 - lhsb(1,2,i,k) = tmp1 * 2.0d+00 * njac(1,2,i,k) - lhsb(1,3,i,k) = tmp1 * 2.0d+00 * njac(1,3,i,k) - lhsb(1,4,i,k) = tmp1 * 2.0d+00 * njac(1,4,i,k) - lhsb(1,5,i,k) = tmp1 * 2.0d+00 * njac(1,5,i,k) - - lhsb(2,1,i,k) = tmp1 * 2.0d+00 * njac(2,1,i,k) - lhsb(2,2,i,k) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(2,2,i,k) - > + tmp1 * 2.0d+00 * dz2 - lhsb(2,3,i,k) = tmp1 * 2.0d+00 * njac(2,3,i,k) - lhsb(2,4,i,k) = tmp1 * 2.0d+00 * njac(2,4,i,k) - lhsb(2,5,i,k) = tmp1 * 2.0d+00 * njac(2,5,i,k) - - lhsb(3,1,i,k) = tmp1 * 2.0d+00 * njac(3,1,i,k) - lhsb(3,2,i,k) = tmp1 * 2.0d+00 * njac(3,2,i,k) - lhsb(3,3,i,k) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(3,3,i,k) - > + tmp1 * 2.0d+00 * dz3 - lhsb(3,4,i,k) = tmp1 * 2.0d+00 * njac(3,4,i,k) - lhsb(3,5,i,k) = tmp1 * 2.0d+00 * njac(3,5,i,k) - - lhsb(4,1,i,k) = tmp1 * 2.0d+00 * njac(4,1,i,k) - lhsb(4,2,i,k) = tmp1 * 2.0d+00 * njac(4,2,i,k) - lhsb(4,3,i,k) = tmp1 * 2.0d+00 * njac(4,3,i,k) - lhsb(4,4,i,k) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(4,4,i,k) - > + tmp1 * 2.0d+00 * dz4 - lhsb(4,5,i,k) = tmp1 * 2.0d+00 * njac(4,5,i,k) - - lhsb(5,1,i,k) = tmp1 * 2.0d+00 * njac(5,1,i,k) - lhsb(5,2,i,k) = tmp1 * 2.0d+00 * njac(5,2,i,k) - lhsb(5,3,i,k) = tmp1 * 2.0d+00 * njac(5,3,i,k) - lhsb(5,4,i,k) = tmp1 * 2.0d+00 * njac(5,4,i,k) - lhsb(5,5,i,k) = 1.0d+00 - > + tmp1 * 2.0d+00 * njac(5,5,i,k) - > + tmp1 * 2.0d+00 * dz5 - - lhsc(1,1,i,j,k,c) = tmp2 * fjac(1,1,i,k+1) - > - tmp1 * njac(1,1,i,k+1) - > - tmp1 * dz1 - lhsc(1,2,i,j,k,c) = tmp2 * fjac(1,2,i,k+1) - > - tmp1 * njac(1,2,i,k+1) - lhsc(1,3,i,j,k,c) = tmp2 * fjac(1,3,i,k+1) - > - tmp1 * njac(1,3,i,k+1) - lhsc(1,4,i,j,k,c) = tmp2 * fjac(1,4,i,k+1) - > - tmp1 * njac(1,4,i,k+1) - lhsc(1,5,i,j,k,c) = tmp2 * fjac(1,5,i,k+1) - > - tmp1 * njac(1,5,i,k+1) - - lhsc(2,1,i,j,k,c) = tmp2 * fjac(2,1,i,k+1) - > - tmp1 * njac(2,1,i,k+1) - lhsc(2,2,i,j,k,c) = tmp2 * fjac(2,2,i,k+1) - > - tmp1 * njac(2,2,i,k+1) - > - tmp1 * dz2 - lhsc(2,3,i,j,k,c) = tmp2 * fjac(2,3,i,k+1) - > - tmp1 * njac(2,3,i,k+1) - lhsc(2,4,i,j,k,c) = tmp2 * fjac(2,4,i,k+1) - > - tmp1 * njac(2,4,i,k+1) - lhsc(2,5,i,j,k,c) = tmp2 * fjac(2,5,i,k+1) - > - tmp1 * njac(2,5,i,k+1) - - lhsc(3,1,i,j,k,c) = tmp2 * fjac(3,1,i,k+1) - > - tmp1 * njac(3,1,i,k+1) - lhsc(3,2,i,j,k,c) = tmp2 * fjac(3,2,i,k+1) - > - tmp1 * njac(3,2,i,k+1) - lhsc(3,3,i,j,k,c) = tmp2 * fjac(3,3,i,k+1) - > - tmp1 * njac(3,3,i,k+1) - > - tmp1 * dz3 - lhsc(3,4,i,j,k,c) = tmp2 * fjac(3,4,i,k+1) - > - tmp1 * njac(3,4,i,k+1) - lhsc(3,5,i,j,k,c) = tmp2 * fjac(3,5,i,k+1) - > - tmp1 * njac(3,5,i,k+1) - - lhsc(4,1,i,j,k,c) = tmp2 * fjac(4,1,i,k+1) - > - tmp1 * njac(4,1,i,k+1) - lhsc(4,2,i,j,k,c) = tmp2 * fjac(4,2,i,k+1) - > - tmp1 * njac(4,2,i,k+1) - lhsc(4,3,i,j,k,c) = tmp2 * fjac(4,3,i,k+1) - > - tmp1 * njac(4,3,i,k+1) - lhsc(4,4,i,j,k,c) = tmp2 * fjac(4,4,i,k+1) - > - tmp1 * njac(4,4,i,k+1) - > - tmp1 * dz4 - lhsc(4,5,i,j,k,c) = tmp2 * fjac(4,5,i,k+1) - > - tmp1 * njac(4,5,i,k+1) - - lhsc(5,1,i,j,k,c) = tmp2 * fjac(5,1,i,k+1) - > - tmp1 * njac(5,1,i,k+1) - lhsc(5,2,i,j,k,c) = tmp2 * fjac(5,2,i,k+1) - > - tmp1 * njac(5,2,i,k+1) - lhsc(5,3,i,j,k,c) = tmp2 * fjac(5,3,i,k+1) - > - tmp1 * njac(5,3,i,k+1) - lhsc(5,4,i,j,k,c) = tmp2 * fjac(5,4,i,k+1) - > - tmp1 * njac(5,4,i,k+1) - lhsc(5,5,i,j,k,c) = tmp2 * fjac(5,5,i,k+1) - > - tmp1 * njac(5,5,i,k+1) - > - tmp1 * dz5 - - enddo - enddo - - -c--------------------------------------------------------------------- -c outer most do loops - sweeping in i direction -c--------------------------------------------------------------------- - if (first .eq. 1) then - -c--------------------------------------------------------------------- -c multiply c(i,j,kstart) by b_inverse and copy back to c -c multiply rhs(kstart) by b_inverse(kstart) and copy to rhs -c--------------------------------------------------------------------- -!dir$ ivdep - do i=start(1,c),isize - call binvcrhs( lhsb(1,1,i,kstart), - > lhsc(1,1,i,j,kstart,c), - > rhs(1,i,j,kstart,c) ) - enddo - - endif - -c--------------------------------------------------------------------- -c begin inner most do loop -c do all the elements of the cell unless last -c--------------------------------------------------------------------- - do k=kstart+first,ksize-last -!dir$ ivdep - do i=start(1,c),isize - -c--------------------------------------------------------------------- -c subtract A*lhs_vector(k-1) from lhs_vector(k) -c -c rhs(k) = rhs(k) - A*rhs(k-1) -c--------------------------------------------------------------------- - call matvec_sub(lhsa(1,1,i,k), - > rhs(1,i,j,k-1,c),rhs(1,i,j,k,c)) - -c--------------------------------------------------------------------- -c B(k) = B(k) - C(k-1)*A(k) -c call matmul_sub(aa,i,j,k,c,cc,i,j,k-1,c,bb,i,j,k,c) -c--------------------------------------------------------------------- - call matmul_sub(lhsa(1,1,i,k), - > lhsc(1,1,i,j,k-1,c), - > lhsb(1,1,i,k)) - -c--------------------------------------------------------------------- -c multiply c(i,j,k) by b_inverse and copy back to c -c multiply rhs(i,j,1) by b_inverse(i,j,1) and copy to rhs -c--------------------------------------------------------------------- - call binvcrhs( lhsb(1,1,i,k), - > lhsc(1,1,i,j,k,c), - > rhs(1,i,j,k,c) ) - - enddo - enddo - -c--------------------------------------------------------------------- -c Now finish up special cases for last cell -c--------------------------------------------------------------------- - if (last .eq. 1) then - -!dir$ ivdep - do i=start(1,c),isize -c--------------------------------------------------------------------- -c rhs(ksize) = rhs(ksize) - A*rhs(ksize-1) -c--------------------------------------------------------------------- - call matvec_sub(lhsa(1,1,i,ksize), - > rhs(1,i,j,ksize-1,c),rhs(1,i,j,ksize,c)) - -c--------------------------------------------------------------------- -c B(ksize) = B(ksize) - C(ksize-1)*A(ksize) -c call matmul_sub(aa,i,j,ksize,c, -c $ cc,i,j,ksize-1,c,bb,i,j,ksize,c) -c--------------------------------------------------------------------- - call matmul_sub(lhsa(1,1,i,ksize), - > lhsc(1,1,i,j,ksize-1,c), - > lhsb(1,1,i,ksize)) - -c--------------------------------------------------------------------- -c multiply rhs(ksize) by b_inverse(ksize) and copy to rhs -c--------------------------------------------------------------------- - call binvrhs( lhsb(1,1,i,ksize), - > rhs(1,i,j,ksize,c) ) - enddo - - endif - enddo - - - return - end - - - - - - diff --git a/examples/smpi/NAS/CG/Makefile b/examples/smpi/NAS/CG/Makefile deleted file mode 100644 index 33e52c697b..0000000000 --- a/examples/smpi/NAS/CG/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -SHELL=/bin/sh -BENCHMARK=cg -BENCHMARKU=CG - -include ../config/make.def - -OBJS = cg.o ${COMMON}/print_results.o \ - ${COMMON}/${RAND}.o ${COMMON}/timers.o - -include ../sys/make.common - -${PROGRAM}: config ${OBJS} - ${FLINK} ${FLINKFLAGS} -o ${PROGRAM} ${OBJS} ${FMPI_LIB} - -cg.o: cg.f mpinpb.h npbparams.h - ${FCOMPILE} cg.f - -clean: - - rm -f *.o *~ - - rm -f npbparams.h core - - - diff --git a/examples/smpi/NAS/CG/cg.f b/examples/smpi/NAS/CG/cg.f deleted file mode 100644 index 0d425d78a4..0000000000 --- a/examples/smpi/NAS/CG/cg.f +++ /dev/null @@ -1,1787 +0,0 @@ -!-------------------------------------------------------------------------! -! ! -! N A S P A R A L L E L B E N C H M A R K S 3.3 ! -! ! -! C G ! -! ! -!-------------------------------------------------------------------------! -! ! -! This benchmark is part of the NAS Parallel Benchmark 3.3 suite. ! -! It is described in NAS Technical Reports 95-020 and 02-007 ! -! ! -! Permission to use, copy, distribute and modify this software ! -! for any purpose with or without fee is hereby granted. We ! -! request, however, that all derived work reference the NAS ! -! Parallel Benchmarks 3.3. This software is provided "as is" ! -! without express or implied warranty. ! -! ! -! Information on NPB 3.3, including the technical report, the ! -! original specifications, source code, results and information ! -! on how to submit new results, is available at: ! -! ! -! http://www.nas.nasa.gov/Software/NPB/ ! -! ! -! Send comments or suggestions to npb@nas.nasa.gov ! -! ! -! NAS Parallel Benchmarks Group ! -! NASA Ames Research Center ! -! Mail Stop: T27A-1 ! -! Moffett Field, CA 94035-1000 ! -! ! -! E-mail: npb@nas.nasa.gov ! -! Fax: (650) 604-3957 ! -! ! -!-------------------------------------------------------------------------! - - -c--------------------------------------------------------------------- -c -c Authors: M. Yarrow -c C. Kuszmaul -c R. F. Van der Wijngaart -c H. Jin -c -c--------------------------------------------------------------------- - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - program cg -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - - implicit none - - include 'mpinpb.h' - integer status(MPI_STATUS_SIZE), request, ierr - - include 'npbparams.h' - -c--------------------------------------------------------------------- -c num_procs must be a power of 2, and num_procs=num_proc_cols*num_proc_rows. -c num_proc_cols and num_proc_cols are to be found in npbparams.h. -c When num_procs is not square, then num_proc_cols must be = 2*num_proc_rows. -c--------------------------------------------------------------------- - integer num_procs - parameter( num_procs = num_proc_cols * num_proc_rows ) - - - -c--------------------------------------------------------------------- -c Class specific parameters: -c It appears here for reference only. -c These are their values, however, this info is imported in the npbparams.h -c include file, which is written by the sys/setparams.c program. -c--------------------------------------------------------------------- - -C---------- -C Class S: -C---------- -CC parameter( na=1400, -CC > nonzer=7, -CC > shift=10., -CC > niter=15, -CC > rcond=1.0d-1 ) -C---------- -C Class W: -C---------- -CC parameter( na=7000, -CC > nonzer=8, -CC > shift=12., -CC > niter=15, -CC > rcond=1.0d-1 ) -C---------- -C Class A: -C---------- -CC parameter( na=14000, -CC > nonzer=11, -CC > shift=20., -CC > niter=15, -CC > rcond=1.0d-1 ) -C---------- -C Class B: -C---------- -CC parameter( na=75000, -CC > nonzer=13, -CC > shift=60., -CC > niter=75, -CC > rcond=1.0d-1 ) -C---------- -C Class C: -C---------- -CC parameter( na=150000, -CC > nonzer=15, -CC > shift=110., -CC > niter=75, -CC > rcond=1.0d-1 ) -C---------- -C Class D: -C---------- -CC parameter( na=1500000, -CC > nonzer=21, -CC > shift=500., -CC > niter=100, -CC > rcond=1.0d-1 ) -C---------- -C Class E: -C---------- -CC parameter( na=9000000, -CC > nonzer=26, -CC > shift=1500., -CC > niter=100, -CC > rcond=1.0d-1 ) - - - - integer nz - parameter( nz = na*(nonzer+1)/num_procs*(nonzer+1)+nonzer - > + na*(nonzer+2+num_procs/256)/num_proc_cols ) - - - - common / partit_size / naa, nzz, - > npcols, nprows, - > proc_col, proc_row, - > firstrow, - > lastrow, - > firstcol, - > lastcol, - > exch_proc, - > exch_recv_length, - > send_start, - > send_len - integer naa, nzz, - > npcols, nprows, - > proc_col, proc_row, - > firstrow, - > lastrow, - > firstcol, - > lastcol, - > exch_proc, - > exch_recv_length, - > send_start, - > send_len - - - common / main_int_mem / colidx, rowstr, - > iv, arow, acol - integer colidx(nz), rowstr(na+1), - > iv(2*na+1), arow(nz), acol(nz) - - - common / main_flt_mem / v, aelt, a, - > x, - > z, - > p, - > q, - > r, - > w - double precision v(na+1), aelt(nz), a(nz), - > x(na/num_proc_rows+2), - > z(na/num_proc_rows+2), - > p(na/num_proc_rows+2), - > q(na/num_proc_rows+2), - > r(na/num_proc_rows+2), - > w(na/num_proc_rows+2) - - - common /urando/ amult, tran - double precision amult, tran - - - - integer l2npcols - integer reduce_exch_proc(num_proc_cols) - integer reduce_send_starts(num_proc_cols) - integer reduce_send_lengths(num_proc_cols) - integer reduce_recv_starts(num_proc_cols) - integer reduce_recv_lengths(num_proc_cols) - - integer i, j, k, it - - double precision zeta, randlc - external randlc - double precision rnorm - double precision norm_temp1(2), norm_temp2(2) - - double precision t, tmax, mflops - external timer_read - double precision timer_read - character class - logical verified - double precision zeta_verify_value, epsilon, err - - -c--------------------------------------------------------------------- -c Set up mpi initialization and number of proc testing -c--------------------------------------------------------------------- - call initialize_mpi - - - if( na .eq. 1400 .and. - & nonzer .eq. 7 .and. - & niter .eq. 15 .and. - & shift .eq. 10.d0 ) then - class = 'S' - zeta_verify_value = 8.5971775078648d0 - else if( na .eq. 7000 .and. - & nonzer .eq. 8 .and. - & niter .eq. 15 .and. - & shift .eq. 12.d0 ) then - class = 'W' - zeta_verify_value = 10.362595087124d0 - else if( na .eq. 14000 .and. - & nonzer .eq. 11 .and. - & niter .eq. 15 .and. - & shift .eq. 20.d0 ) then - class = 'A' - zeta_verify_value = 17.130235054029d0 - else if( na .eq. 75000 .and. - & nonzer .eq. 13 .and. - & niter .eq. 75 .and. - & shift .eq. 60.d0 ) then - class = 'B' - zeta_verify_value = 22.712745482631d0 - else if( na .eq. 150000 .and. - & nonzer .eq. 15 .and. - & niter .eq. 75 .and. - & shift .eq. 110.d0 ) then - class = 'C' - zeta_verify_value = 28.973605592845d0 - else if( na .eq. 1500000 .and. - & nonzer .eq. 21 .and. - & niter .eq. 100 .and. - & shift .eq. 500.d0 ) then - class = 'D' - zeta_verify_value = 52.514532105794d0 - else if( na .eq. 9000000 .and. - & nonzer .eq. 26 .and. - & niter .eq. 100 .and. - & shift .eq. 1.5d3 ) then - class = 'E' - zeta_verify_value = 77.522164599383d0 - else - class = 'U' - endif - - if( me .eq. root )then - write( *,1000 ) - write( *,1001 ) na - write( *,1002 ) niter - write( *,1003 ) nprocs - write( *,1004 ) nonzer - write( *,1005 ) shift - 1000 format(//,' NAS Parallel Benchmarks 3.3 -- CG Benchmark', /) - 1001 format(' Size: ', i10 ) - 1002 format(' Iterations: ', i5 ) - 1003 format(' Number of active processes: ', i5 ) - 1004 format(' Number of nonzeroes per row: ', i8) - 1005 format(' Eigenvalue shift: ', e8.3) - endif - - if (.not. convertdouble) then - dp_type = MPI_DOUBLE_PRECISION - else - dp_type = MPI_REAL - endif - - - naa = na - nzz = nz - - -c--------------------------------------------------------------------- -c Set up processor info, such as whether sq num of procs, etc -c--------------------------------------------------------------------- - call setup_proc_info( num_procs, - > num_proc_rows, - > num_proc_cols ) - - -c--------------------------------------------------------------------- -c Set up partition's submatrix info: firstcol, lastcol, firstrow, lastrow -c--------------------------------------------------------------------- - call setup_submatrix_info( l2npcols, - > reduce_exch_proc, - > reduce_send_starts, - > reduce_send_lengths, - > reduce_recv_starts, - > reduce_recv_lengths ) - - - -c--------------------------------------------------------------------- -c Inialize random number generator -c--------------------------------------------------------------------- - tran = 314159265.0D0 - amult = 1220703125.0D0 - zeta = randlc( tran, amult ) - -c--------------------------------------------------------------------- -c Set up partition's sparse random matrix for given class size -c--------------------------------------------------------------------- - call makea(naa, nzz, a, colidx, rowstr, nonzer, - > firstrow, lastrow, firstcol, lastcol, - > rcond, arow, acol, aelt, v, iv, shift) - - - -c--------------------------------------------------------------------- -c Note: as a result of the above call to makea: -c values of j used in indexing rowstr go from 1 --> lastrow-firstrow+1 -c values of colidx which are col indexes go from firstcol --> lastcol -c So: -c Shift the col index vals from actual (firstcol --> lastcol ) -c to local, i.e., (1 --> lastcol-firstcol+1) -c--------------------------------------------------------------------- - do j=1,lastrow-firstrow+1 - do k=rowstr(j),rowstr(j+1)-1 - colidx(k) = colidx(k) - firstcol + 1 - enddo - enddo - -c--------------------------------------------------------------------- -c set starting vector to (1, 1, .... 1) -c--------------------------------------------------------------------- - do i = 1, na/num_proc_rows+1 - x(i) = 1.0D0 - enddo - - zeta = 0.0d0 - -c--------------------------------------------------------------------- -c----> -c Do one iteration untimed to init all code and data page tables -c----> (then reinit, start timing, to niter its) -c--------------------------------------------------------------------- - do it = 1, 1 - -c--------------------------------------------------------------------- -c The call to the conjugate gradient routine: -c--------------------------------------------------------------------- - call conj_grad ( colidx, - > rowstr, - > x, - > z, - > a, - > p, - > q, - > r, - > w, - > rnorm, - > l2npcols, - > reduce_exch_proc, - > reduce_send_starts, - > reduce_send_lengths, - > reduce_recv_starts, - > reduce_recv_lengths ) - -c--------------------------------------------------------------------- -c zeta = shift + 1/(x.z) -c So, first: (x.z) -c Also, find norm of z -c So, first: (z.z) -c--------------------------------------------------------------------- - norm_temp1(1) = 0.0d0 - norm_temp1(2) = 0.0d0 - do j=1, lastcol-firstcol+1 - norm_temp1(1) = norm_temp1(1) + x(j)*z(j) - norm_temp1(2) = norm_temp1(2) + z(j)*z(j) - enddo - - do i = 1, l2npcols - call mpi_irecv( norm_temp2, - > 2, - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > request, - > ierr ) - call mpi_send( norm_temp1, - > 2, - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > ierr ) - call mpi_wait( request, status, ierr ) - - norm_temp1(1) = norm_temp1(1) + norm_temp2(1) - norm_temp1(2) = norm_temp1(2) + norm_temp2(2) - enddo - - norm_temp1(2) = 1.0d0 / sqrt( norm_temp1(2) ) - - -c--------------------------------------------------------------------- -c Normalize z to obtain x -c--------------------------------------------------------------------- - do j=1, lastcol-firstcol+1 - x(j) = norm_temp1(2)*z(j) - enddo - - - enddo ! end of do one iteration untimed - - -c--------------------------------------------------------------------- -c set starting vector to (1, 1, .... 1) -c--------------------------------------------------------------------- -c -c NOTE: a questionable limit on size: should this be na/num_proc_cols+1 ? -c - do i = 1, na/num_proc_rows+1 - x(i) = 1.0D0 - enddo - - zeta = 0.0d0 - -c--------------------------------------------------------------------- -c Synchronize and start timing -c--------------------------------------------------------------------- - call mpi_barrier( mpi_comm_world, - > ierr ) - - call timer_clear( 1 ) - call timer_start( 1 ) - -c--------------------------------------------------------------------- -c----> -c Main Iteration for inverse power method -c----> -c--------------------------------------------------------------------- - do it = 1, niter - -c--------------------------------------------------------------------- -c The call to the conjugate gradient routine: -c--------------------------------------------------------------------- - call conj_grad ( colidx, - > rowstr, - > x, - > z, - > a, - > p, - > q, - > r, - > w, - > rnorm, - > l2npcols, - > reduce_exch_proc, - > reduce_send_starts, - > reduce_send_lengths, - > reduce_recv_starts, - > reduce_recv_lengths ) - - -c--------------------------------------------------------------------- -c zeta = shift + 1/(x.z) -c So, first: (x.z) -c Also, find norm of z -c So, first: (z.z) -c--------------------------------------------------------------------- - norm_temp1(1) = 0.0d0 - norm_temp1(2) = 0.0d0 - do j=1, lastcol-firstcol+1 - norm_temp1(1) = norm_temp1(1) + x(j)*z(j) - norm_temp1(2) = norm_temp1(2) + z(j)*z(j) - enddo - - do i = 1, l2npcols - call mpi_irecv( norm_temp2, - > 2, - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > request, - > ierr ) - call mpi_send( norm_temp1, - > 2, - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > ierr ) - call mpi_wait( request, status, ierr ) - - norm_temp1(1) = norm_temp1(1) + norm_temp2(1) - norm_temp1(2) = norm_temp1(2) + norm_temp2(2) - enddo - - norm_temp1(2) = 1.0d0 / sqrt( norm_temp1(2) ) - - - if( me .eq. root )then - zeta = shift + 1.0d0 / norm_temp1(1) - if( it .eq. 1 ) write( *,9000 ) - write( *,9001 ) it, rnorm, zeta - endif - 9000 format( /,' iteration ||r|| zeta' ) - 9001 format( 4x, i5, 7x, e20.14, f20.13 ) - -c--------------------------------------------------------------------- -c Normalize z to obtain x -c--------------------------------------------------------------------- - do j=1, lastcol-firstcol+1 - x(j) = norm_temp1(2)*z(j) - enddo - - - enddo ! end of main iter inv pow meth - - call timer_stop( 1 ) - -c--------------------------------------------------------------------- -c End of timed section -c--------------------------------------------------------------------- - - t = timer_read( 1 ) - - call mpi_reduce( t, - > tmax, - > 1, - > dp_type, - > MPI_MAX, - > root, - > mpi_comm_world, - > ierr ) - - if( me .eq. root )then - write(*,100) - 100 format(' Benchmark completed ') - - epsilon = 1.d-10 - if (class .ne. 'U') then - - err = abs( zeta - zeta_verify_value )/zeta_verify_value - if( err .le. epsilon ) then - verified = .TRUE. - write(*, 200) - write(*, 201) zeta - write(*, 202) err - 200 format(' VERIFICATION SUCCESSFUL ') - 201 format(' Zeta is ', E20.13) - 202 format(' Error is ', E20.13) - else - verified = .FALSE. - write(*, 300) - write(*, 301) zeta - write(*, 302) zeta_verify_value - 300 format(' VERIFICATION FAILED') - 301 format(' Zeta ', E20.13) - 302 format(' The correct zeta is ', E20.13) - endif - else - verified = .FALSE. - write (*, 400) - write (*, 401) - write (*, 201) zeta - 400 format(' Problem size unknown') - 401 format(' NO VERIFICATION PERFORMED') - endif - - - if( tmax .ne. 0. ) then - mflops = float( 2*niter*na ) - & * ( 3.+float( nonzer*(nonzer+1) ) - & + 25.*(5.+float( nonzer*(nonzer+1) )) - & + 3. ) / tmax / 1000000.0 - else - mflops = 0.0 - endif - - call print_results('CG', class, na, 0, 0, - > niter, nnodes_compiled, nprocs, tmax, - > mflops, ' floating point', - > verified, npbversion, compiletime, - > cs1, cs2, cs3, cs4, cs5, cs6, cs7) - - - endif - - - call mpi_finalize(ierr) - - - - end ! end main - - - - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - subroutine initialize_mpi -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - - integer ierr - - - call mpi_init( ierr ) - call mpi_comm_rank( mpi_comm_world, me, ierr ) - call mpi_comm_size( mpi_comm_world, nprocs, ierr ) - root = 0 - - - return - end - - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - subroutine setup_proc_info( num_procs, - > num_proc_rows, - > num_proc_cols ) -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - - common / partit_size / naa, nzz, - > npcols, nprows, - > proc_col, proc_row, - > firstrow, - > lastrow, - > firstcol, - > lastcol, - > exch_proc, - > exch_recv_length, - > send_start, - > send_len - integer naa, nzz, - > npcols, nprows, - > proc_col, proc_row, - > firstrow, - > lastrow, - > firstcol, - > lastcol, - > exch_proc, - > exch_recv_length, - > send_start, - > send_len - - integer num_procs, num_proc_cols, num_proc_rows - integer i, ierr - integer log2nprocs - -c--------------------------------------------------------------------- -c num_procs must be a power of 2, and num_procs=num_proc_cols*num_proc_rows -c When num_procs is not square, then num_proc_cols = 2*num_proc_rows -c--------------------------------------------------------------------- -c First, number of procs must be power of two. -c--------------------------------------------------------------------- - if( nprocs .ne. num_procs )then - if( me .eq. root ) write( *,9000 ) nprocs, num_procs - 9000 format( /,'Error: ',/,'num of procs allocated (', - > i4, ' )', - > /,'is not equal to',/, - > 'compiled number of procs (', - > i4, ' )',/ ) - call mpi_finalize(ierr) - stop - endif - - - i = num_proc_cols - 100 continue - if( i .ne. 1 .and. i/2*2 .ne. i )then - if ( me .eq. root ) then - write( *,* ) 'Error: num_proc_cols is ', - > num_proc_cols, - > ' which is not a power of two' - endif - call mpi_finalize(ierr) - stop - endif - i = i / 2 - if( i .ne. 0 )then - goto 100 - endif - - i = num_proc_rows - 200 continue - if( i .ne. 1 .and. i/2*2 .ne. i )then - if ( me .eq. root ) then - write( *,* ) 'Error: num_proc_rows is ', - > num_proc_rows, - > ' which is not a power of two' - endif - call mpi_finalize(ierr) - stop - endif - i = i / 2 - if( i .ne. 0 )then - goto 200 - endif - - log2nprocs = 0 - i = nprocs - 300 continue - if( i .ne. 1 .and. i/2*2 .ne. i )then - write( *,* ) 'Error: nprocs is ', - > nprocs, - > ' which is not a power of two' - call mpi_finalize(ierr) - stop - endif - i = i / 2 - if( i .ne. 0 )then - log2nprocs = log2nprocs + 1 - goto 300 - endif - -CC write( *,* ) 'nprocs, log2nprocs: ',nprocs,log2nprocs - - - npcols = num_proc_cols - nprows = num_proc_rows - - - return - end - - - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - subroutine setup_submatrix_info( l2npcols, - > reduce_exch_proc, - > reduce_send_starts, - > reduce_send_lengths, - > reduce_recv_starts, - > reduce_recv_lengths ) - > -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - - integer col_size, row_size - - common / partit_size / naa, nzz, - > npcols, nprows, - > proc_col, proc_row, - > firstrow, - > lastrow, - > firstcol, - > lastcol, - > exch_proc, - > exch_recv_length, - > send_start, - > send_len - integer naa, nzz, - > npcols, nprows, - > proc_col, proc_row, - > firstrow, - > lastrow, - > firstcol, - > lastcol, - > exch_proc, - > exch_recv_length, - > send_start, - > send_len - - integer reduce_exch_proc(*) - integer reduce_send_starts(*) - integer reduce_send_lengths(*) - integer reduce_recv_starts(*) - integer reduce_recv_lengths(*) - - integer i, j - integer div_factor - integer l2npcols - - - proc_row = me / npcols - proc_col = me - proc_row*npcols - - - -c--------------------------------------------------------------------- -c If naa evenly divisible by npcols, then it is evenly divisible -c by nprows -c--------------------------------------------------------------------- - - if( naa/npcols*npcols .eq. naa )then - col_size = naa/npcols - firstcol = proc_col*col_size + 1 - lastcol = firstcol - 1 + col_size - row_size = naa/nprows - firstrow = proc_row*row_size + 1 - lastrow = firstrow - 1 + row_size -c--------------------------------------------------------------------- -c If naa not evenly divisible by npcols, then first subdivide for nprows -c and then, if npcols not equal to nprows (i.e., not a sq number of procs), -c get col subdivisions by dividing by 2 each row subdivision. -c--------------------------------------------------------------------- - else - if( proc_row .lt. naa - naa/nprows*nprows)then - row_size = naa/nprows+ 1 - firstrow = proc_row*row_size + 1 - lastrow = firstrow - 1 + row_size - else - row_size = naa/nprows - firstrow = (naa - naa/nprows*nprows)*(row_size+1) - > + (proc_row-(naa-naa/nprows*nprows)) - > *row_size + 1 - lastrow = firstrow - 1 + row_size - endif - if( npcols .eq. nprows )then - if( proc_col .lt. naa - naa/npcols*npcols )then - col_size = naa/npcols+ 1 - firstcol = proc_col*col_size + 1 - lastcol = firstcol - 1 + col_size - else - col_size = naa/npcols - firstcol = (naa - naa/npcols*npcols)*(col_size+1) - > + (proc_col-(naa-naa/npcols*npcols)) - > *col_size + 1 - lastcol = firstcol - 1 + col_size - endif - else - if( (proc_col/2) .lt. - > naa - naa/(npcols/2)*(npcols/2) )then - col_size = naa/(npcols/2) + 1 - firstcol = (proc_col/2)*col_size + 1 - lastcol = firstcol - 1 + col_size - else - col_size = naa/(npcols/2) - firstcol = (naa - naa/(npcols/2)*(npcols/2)) - > *(col_size+1) - > + ((proc_col/2)-(naa-naa/(npcols/2)*(npcols/2))) - > *col_size + 1 - lastcol = firstcol - 1 + col_size - endif -CC write( *,* ) col_size,firstcol,lastcol - if( mod( me,2 ) .eq. 0 )then - lastcol = firstcol - 1 + (col_size-1)/2 + 1 - else - firstcol = firstcol + (col_size-1)/2 + 1 - lastcol = firstcol - 1 + col_size/2 -CC write( *,* ) firstcol,lastcol - endif - endif - endif - - - - if( npcols .eq. nprows )then - send_start = 1 - send_len = lastrow - firstrow + 1 - else - if( mod( me,2 ) .eq. 0 )then - send_start = 1 - send_len = (1 + lastrow-firstrow+1)/2 - else - send_start = (1 + lastrow-firstrow+1)/2 + 1 - send_len = (lastrow-firstrow+1)/2 - endif - endif - - - - -c--------------------------------------------------------------------- -c Transpose exchange processor -c--------------------------------------------------------------------- - - if( npcols .eq. nprows )then - exch_proc = mod( me,nprows )*nprows + me/nprows - else - exch_proc = 2*(mod( me/2,nprows )*nprows + me/2/nprows) - > + mod( me,2 ) - endif - - - - i = npcols / 2 - l2npcols = 0 - do while( i .gt. 0 ) - l2npcols = l2npcols + 1 - i = i / 2 - enddo - - -c--------------------------------------------------------------------- -c Set up the reduce phase schedules... -c--------------------------------------------------------------------- - - div_factor = npcols - do i = 1, l2npcols - - j = mod( proc_col+div_factor/2, div_factor ) - > + proc_col / div_factor * div_factor - reduce_exch_proc(i) = proc_row*npcols + j - - div_factor = div_factor / 2 - - enddo - - - do i = l2npcols, 1, -1 - - if( nprows .eq. npcols )then - reduce_send_starts(i) = send_start - reduce_send_lengths(i) = send_len - reduce_recv_lengths(i) = lastrow - firstrow + 1 - else - reduce_recv_lengths(i) = send_len - if( i .eq. l2npcols )then - reduce_send_lengths(i) = lastrow-firstrow+1 - send_len - if( me/2*2 .eq. me )then - reduce_send_starts(i) = send_start + send_len - else - reduce_send_starts(i) = 1 - endif - else - reduce_send_lengths(i) = send_len - reduce_send_starts(i) = send_start - endif - endif - reduce_recv_starts(i) = send_start - - enddo - - - exch_recv_length = lastcol - firstcol + 1 - - - return - end - - - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - subroutine conj_grad ( colidx, - > rowstr, - > x, - > z, - > a, - > p, - > q, - > r, - > w, - > rnorm, - > l2npcols, - > reduce_exch_proc, - > reduce_send_starts, - > reduce_send_lengths, - > reduce_recv_starts, - > reduce_recv_lengths ) -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Floaging point arrays here are named as in NPB1 spec discussion of -c CG algorithm -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - - integer status(MPI_STATUS_SIZE ), request - - - common / partit_size / naa, nzz, - > npcols, nprows, - > proc_col, proc_row, - > firstrow, - > lastrow, - > firstcol, - > lastcol, - > exch_proc, - > exch_recv_length, - > send_start, - > send_len - integer naa, nzz, - > npcols, nprows, - > proc_col, proc_row, - > firstrow, - > lastrow, - > firstcol, - > lastcol, - > exch_proc, - > exch_recv_length, - > send_start, - > send_len - - - - double precision x(*), - > z(*), - > a(nzz) - integer colidx(nzz), rowstr(naa+1) - - double precision p(*), - > q(*), - > r(*), - > w(*) ! used as work temporary - - integer l2npcols - integer reduce_exch_proc(l2npcols) - integer reduce_send_starts(l2npcols) - integer reduce_send_lengths(l2npcols) - integer reduce_recv_starts(l2npcols) - integer reduce_recv_lengths(l2npcols) - - integer i, j, k, ierr - integer cgit, cgitmax - - double precision d, sum, rho, rho0, alpha, beta, rnorm - - external timer_read - double precision timer_read - - data cgitmax / 25 / - - -c--------------------------------------------------------------------- -c Initialize the CG algorithm: -c--------------------------------------------------------------------- - do j=1,naa/nprows+1 - q(j) = 0.0d0 - z(j) = 0.0d0 - r(j) = x(j) - p(j) = r(j) - w(j) = 0.0d0 - enddo - - -c--------------------------------------------------------------------- -c rho = r.r -c Now, obtain the norm of r: First, sum squares of r elements locally... -c--------------------------------------------------------------------- - sum = 0.0d0 - do j=1, lastcol-firstcol+1 - sum = sum + r(j)*r(j) - enddo - -c--------------------------------------------------------------------- -c Exchange and sum with procs identified in reduce_exch_proc -c (This is equivalent to mpi_allreduce.) -c Sum the partial sums of rho, leaving rho on all processors -c--------------------------------------------------------------------- - do i = 1, l2npcols - call mpi_irecv( rho, - > 1, - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > request, - > ierr ) - call mpi_send( sum, - > 1, - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > ierr ) - call mpi_wait( request, status, ierr ) - - sum = sum + rho - enddo - rho = sum - - - -c--------------------------------------------------------------------- -c----> -c The conj grad iteration loop -c----> -c--------------------------------------------------------------------- - do cgit = 1, cgitmax - - -c--------------------------------------------------------------------- -c q = A.p -c The partition submatrix-vector multiply: use workspace w -c--------------------------------------------------------------------- - do j=1,lastrow-firstrow+1 - sum = 0.d0 - do k=rowstr(j),rowstr(j+1)-1 - sum = sum + a(k)*p(colidx(k)) - enddo - w(j) = sum - enddo - -c--------------------------------------------------------------------- -c Sum the partition submatrix-vec A.p's across rows -c Exchange and sum piece of w with procs identified in reduce_exch_proc -c--------------------------------------------------------------------- - do i = l2npcols, 1, -1 - call mpi_irecv( q(reduce_recv_starts(i)), - > reduce_recv_lengths(i), - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > request, - > ierr ) - call mpi_send( w(reduce_send_starts(i)), - > reduce_send_lengths(i), - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > ierr ) - call mpi_wait( request, status, ierr ) - do j=send_start,send_start + reduce_recv_lengths(i) - 1 - w(j) = w(j) + q(j) - enddo - enddo - - -c--------------------------------------------------------------------- -c Exchange piece of q with transpose processor: -c--------------------------------------------------------------------- - if( l2npcols .ne. 0 )then - call mpi_irecv( q, - > exch_recv_length, - > dp_type, - > exch_proc, - > 1, - > mpi_comm_world, - > request, - > ierr ) - - call mpi_send( w(send_start), - > send_len, - > dp_type, - > exch_proc, - > 1, - > mpi_comm_world, - > ierr ) - call mpi_wait( request, status, ierr ) - else - do j=1,exch_recv_length - q(j) = w(j) - enddo - endif - - -c--------------------------------------------------------------------- -c Clear w for reuse... -c--------------------------------------------------------------------- - do j=1, max( lastrow-firstrow+1, lastcol-firstcol+1 ) - w(j) = 0.0d0 - enddo - - -c--------------------------------------------------------------------- -c Obtain p.q -c--------------------------------------------------------------------- - sum = 0.0d0 - do j=1, lastcol-firstcol+1 - sum = sum + p(j)*q(j) - enddo - -c--------------------------------------------------------------------- -c Obtain d with a sum-reduce -c--------------------------------------------------------------------- - do i = 1, l2npcols - call mpi_irecv( d, - > 1, - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > request, - > ierr ) - call mpi_send( sum, - > 1, - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > ierr ) - - call mpi_wait( request, status, ierr ) - - sum = sum + d - enddo - d = sum - - -c--------------------------------------------------------------------- -c Obtain alpha = rho / (p.q) -c--------------------------------------------------------------------- - alpha = rho / d - -c--------------------------------------------------------------------- -c Save a temporary of rho -c--------------------------------------------------------------------- - rho0 = rho - -c--------------------------------------------------------------------- -c Obtain z = z + alpha*p -c and r = r - alpha*q -c--------------------------------------------------------------------- - do j=1, lastcol-firstcol+1 - z(j) = z(j) + alpha*p(j) - r(j) = r(j) - alpha*q(j) - enddo - -c--------------------------------------------------------------------- -c rho = r.r -c Now, obtain the norm of r: First, sum squares of r elements locally... -c--------------------------------------------------------------------- - sum = 0.0d0 - do j=1, lastcol-firstcol+1 - sum = sum + r(j)*r(j) - enddo - -c--------------------------------------------------------------------- -c Obtain rho with a sum-reduce -c--------------------------------------------------------------------- - do i = 1, l2npcols - call mpi_irecv( rho, - > 1, - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > request, - > ierr ) - call mpi_send( sum, - > 1, - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > ierr ) - call mpi_wait( request, status, ierr ) - - sum = sum + rho - enddo - rho = sum - -c--------------------------------------------------------------------- -c Obtain beta: -c--------------------------------------------------------------------- - beta = rho / rho0 - -c--------------------------------------------------------------------- -c p = r + beta*p -c--------------------------------------------------------------------- - do j=1, lastcol-firstcol+1 - p(j) = r(j) + beta*p(j) - enddo - - - - enddo ! end of do cgit=1,cgitmax - - - -c--------------------------------------------------------------------- -c Compute residual norm explicitly: ||r|| = ||x - A.z|| -c First, form A.z -c The partition submatrix-vector multiply -c--------------------------------------------------------------------- - do j=1,lastrow-firstrow+1 - sum = 0.d0 - do k=rowstr(j),rowstr(j+1)-1 - sum = sum + a(k)*z(colidx(k)) - enddo - w(j) = sum - enddo - - - -c--------------------------------------------------------------------- -c Sum the partition submatrix-vec A.z's across rows -c--------------------------------------------------------------------- - do i = l2npcols, 1, -1 - call mpi_irecv( r(reduce_recv_starts(i)), - > reduce_recv_lengths(i), - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > request, - > ierr ) - call mpi_send( w(reduce_send_starts(i)), - > reduce_send_lengths(i), - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > ierr ) - call mpi_wait( request, status, ierr ) - - do j=send_start,send_start + reduce_recv_lengths(i) - 1 - w(j) = w(j) + r(j) - enddo - enddo - - -c--------------------------------------------------------------------- -c Exchange piece of q with transpose processor: -c--------------------------------------------------------------------- - if( l2npcols .ne. 0 )then - call mpi_irecv( r, - > exch_recv_length, - > dp_type, - > exch_proc, - > 1, - > mpi_comm_world, - > request, - > ierr ) - - call mpi_send( w(send_start), - > send_len, - > dp_type, - > exch_proc, - > 1, - > mpi_comm_world, - > ierr ) - call mpi_wait( request, status, ierr ) - else - do j=1,exch_recv_length - r(j) = w(j) - enddo - endif - - -c--------------------------------------------------------------------- -c At this point, r contains A.z -c--------------------------------------------------------------------- - sum = 0.0d0 - do j=1, lastcol-firstcol+1 - d = x(j) - r(j) - sum = sum + d*d - enddo - -c--------------------------------------------------------------------- -c Obtain d with a sum-reduce -c--------------------------------------------------------------------- - do i = 1, l2npcols - call mpi_irecv( d, - > 1, - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > request, - > ierr ) - call mpi_send( sum, - > 1, - > dp_type, - > reduce_exch_proc(i), - > i, - > mpi_comm_world, - > ierr ) - call mpi_wait( request, status, ierr ) - - sum = sum + d - enddo - d = sum - - - if( me .eq. root ) rnorm = sqrt( d ) - - - - return - end ! end of routine conj_grad - - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - subroutine makea( n, nz, a, colidx, rowstr, nonzer, - > firstrow, lastrow, firstcol, lastcol, - > rcond, arow, acol, aelt, v, iv, shift ) -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - integer n, nz - integer firstrow, lastrow, firstcol, lastcol - integer colidx(nz), rowstr(n+1) - integer iv(2*n+1), arow(nz), acol(nz) - double precision v(n+1), aelt(nz) - double precision rcond, a(nz), shift - -c--------------------------------------------------------------------- -c generate the test problem for benchmark 6 -c makea generates a sparse matrix with a -c prescribed sparsity distribution -c -c parameter type usage -c -c input -c -c n i number of cols/rows of matrix -c nz i nonzeros as declared array size -c rcond r*8 condition number -c shift r*8 main diagonal shift -c -c output -c -c a r*8 array for nonzeros -c colidx i col indices -c rowstr i row pointers -c -c workspace -c -c iv, arow, acol i -c v, aelt r*8 -c--------------------------------------------------------------------- - - integer i, nnza, iouter, ivelt, ivelt1, irow, nzv, NONZER - -c--------------------------------------------------------------------- -c nonzer is approximately (int(sqrt(nnza /n))); -c--------------------------------------------------------------------- - - double precision size, ratio, scale - external sparse, sprnvc, vecset - - size = 1.0D0 - ratio = rcond ** (1.0D0 / dfloat(n)) - nnza = 0 - -c--------------------------------------------------------------------- -c Initialize iv(n+1 .. 2n) to zero. -c Used by sprnvc to mark nonzero positions -c--------------------------------------------------------------------- - - do i = 1, n - iv(n+i) = 0 - enddo - do iouter = 1, n - nzv = nonzer - call sprnvc( n, nzv, v, colidx, iv(1), iv(n+1) ) - call vecset( n, v, colidx, nzv, iouter, .5D0 ) - do ivelt = 1, nzv - jcol = colidx(ivelt) - if (jcol.ge.firstcol .and. jcol.le.lastcol) then - scale = size * v(ivelt) - do ivelt1 = 1, nzv - irow = colidx(ivelt1) - if (irow.ge.firstrow .and. irow.le.lastrow) then - nnza = nnza + 1 - if (nnza .gt. nz) goto 9999 - acol(nnza) = jcol - arow(nnza) = irow - aelt(nnza) = v(ivelt1) * scale - endif - enddo - endif - enddo - size = size * ratio - enddo - - -c--------------------------------------------------------------------- -c ... add the identity * rcond to the generated matrix to bound -c the smallest eigenvalue from below by rcond -c--------------------------------------------------------------------- - do i = firstrow, lastrow - if (i.ge.firstcol .and. i.le.lastcol) then - iouter = n + i - nnza = nnza + 1 - if (nnza .gt. nz) goto 9999 - acol(nnza) = i - arow(nnza) = i - aelt(nnza) = rcond - shift - endif - enddo - - -c--------------------------------------------------------------------- -c ... make the sparse matrix from list of elements with duplicates -c (v and iv are used as workspace) -c--------------------------------------------------------------------- - call sparse( a, colidx, rowstr, n, arow, acol, aelt, - > firstrow, lastrow, - > v, iv(1), iv(n+1), nnza ) - return - - 9999 continue - write(*,*) 'Space for matrix elements exceeded in makea' - write(*,*) 'nnza, nzmax = ',nnza, nz - write(*,*) ' iouter = ',iouter - - stop - end -c-------end of makea------------------------------ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - subroutine sparse( a, colidx, rowstr, n, arow, acol, aelt, - > firstrow, lastrow, - > x, mark, nzloc, nnza ) -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit logical (a-z) - integer colidx(*), rowstr(*) - integer firstrow, lastrow - integer n, arow(*), acol(*), nnza - double precision a(*), aelt(*) - -c--------------------------------------------------------------------- -c rows range from firstrow to lastrow -c the rowstr pointers are defined for nrows = lastrow-firstrow+1 values -c--------------------------------------------------------------------- - integer nzloc(n), nrows - double precision x(n) - logical mark(n) - -c--------------------------------------------------- -c generate a sparse matrix from a list of -c [col, row, element] tri -c--------------------------------------------------- - - integer i, j, jajp1, nza, k, nzrow - double precision xi - -c--------------------------------------------------------------------- -c how many rows of result -c--------------------------------------------------------------------- - nrows = lastrow - firstrow + 1 - -c--------------------------------------------------------------------- -c ...count the number of triples in each row -c--------------------------------------------------------------------- - do j = 1, n - rowstr(j) = 0 - mark(j) = .false. - enddo - rowstr(n+1) = 0 - - do nza = 1, nnza - j = (arow(nza) - firstrow + 1) + 1 - rowstr(j) = rowstr(j) + 1 - enddo - - rowstr(1) = 1 - do j = 2, nrows+1 - rowstr(j) = rowstr(j) + rowstr(j-1) - enddo - - -c--------------------------------------------------------------------- -c ... rowstr(j) now is the location of the first nonzero -c of row j of a -c--------------------------------------------------------------------- - - -c--------------------------------------------------------------------- -c ... do a bucket sort of the triples on the row index -c--------------------------------------------------------------------- - do nza = 1, nnza - j = arow(nza) - firstrow + 1 - k = rowstr(j) - a(k) = aelt(nza) - colidx(k) = acol(nza) - rowstr(j) = rowstr(j) + 1 - enddo - - -c--------------------------------------------------------------------- -c ... rowstr(j) now points to the first element of row j+1 -c--------------------------------------------------------------------- - do j = nrows, 1, -1 - rowstr(j+1) = rowstr(j) - enddo - rowstr(1) = 1 - - -c--------------------------------------------------------------------- -c ... generate the actual output rows by adding elements -c--------------------------------------------------------------------- - nza = 0 - do i = 1, n - x(i) = 0.0 - mark(i) = .false. - enddo - - jajp1 = rowstr(1) - do j = 1, nrows - nzrow = 0 - -c--------------------------------------------------------------------- -c ...loop over the jth row of a -c--------------------------------------------------------------------- - do k = jajp1 , rowstr(j+1)-1 - i = colidx(k) - x(i) = x(i) + a(k) - if ( (.not. mark(i)) .and. (x(i) .ne. 0.D0)) then - mark(i) = .true. - nzrow = nzrow + 1 - nzloc(nzrow) = i - endif - enddo - -c--------------------------------------------------------------------- -c ... extract the nonzeros of this row -c--------------------------------------------------------------------- - do k = 1, nzrow - i = nzloc(k) - mark(i) = .false. - xi = x(i) - x(i) = 0.D0 - if (xi .ne. 0.D0) then - nza = nza + 1 - a(nza) = xi - colidx(nza) = i - endif - enddo - jajp1 = rowstr(j+1) - rowstr(j+1) = nza + rowstr(1) - enddo -CC write (*, 11000) nza - return -11000 format ( //,'final nonzero count in sparse ', - 1 /,'number of nonzeros = ', i16 ) - end -c-------end of sparse----------------------------- - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - subroutine sprnvc( n, nz, v, iv, nzloc, mark ) -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit logical (a-z) - double precision v(*) - integer n, nz, iv(*), nzloc(n), nn1 - integer mark(n) - common /urando/ amult, tran - double precision amult, tran - - -c--------------------------------------------------------------------- -c generate a sparse n-vector (v, iv) -c having nzv nonzeros -c -c mark(i) is set to 1 if position i is nonzero. -c mark is all zero on entry and is reset to all zero before exit -c this corrects a performance bug found by John G. Lewis, caused by -c reinitialization of mark on every one of the n calls to sprnvc -c--------------------------------------------------------------------- - - integer nzrow, nzv, ii, i, icnvrt - - external randlc, icnvrt - double precision randlc, vecelt, vecloc - - - nzv = 0 - nzrow = 0 - nn1 = 1 - 50 continue - nn1 = 2 * nn1 - if (nn1 .lt. n) goto 50 - -c--------------------------------------------------------------------- -c nn1 is the smallest power of two not less than n -c--------------------------------------------------------------------- - -100 continue - if (nzv .ge. nz) goto 110 - vecelt = randlc( tran, amult ) - -c--------------------------------------------------------------------- -c generate an integer between 1 and n in a portable manner -c--------------------------------------------------------------------- - vecloc = randlc(tran, amult) - i = icnvrt(vecloc, nn1) + 1 - if (i .gt. n) goto 100 - -c--------------------------------------------------------------------- -c was this integer generated already? -c--------------------------------------------------------------------- - if (mark(i) .eq. 0) then - mark(i) = 1 - nzrow = nzrow + 1 - nzloc(nzrow) = i - nzv = nzv + 1 - v(nzv) = vecelt - iv(nzv) = i - endif - goto 100 -110 continue - do ii = 1, nzrow - i = nzloc(ii) - mark(i) = 0 - enddo - return - end -c-------end of sprnvc----------------------------- - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - function icnvrt(x, ipwr2) -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit logical (a-z) - double precision x - integer ipwr2, icnvrt - -c--------------------------------------------------------------------- -c scale a double precision number x in (0,1) by a power of 2 and chop it -c--------------------------------------------------------------------- - icnvrt = int(ipwr2 * x) - - return - end -c-------end of icnvrt----------------------------- - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - subroutine vecset(n, v, iv, nzv, i, val) -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit logical (a-z) - integer n, iv(*), nzv, i, k - double precision v(*), val - -c--------------------------------------------------------------------- -c set ith element of sparse vector (v, iv) with -c nzv nonzeros to val -c--------------------------------------------------------------------- - - logical set - - set = .false. - do k = 1, nzv - if (iv(k) .eq. i) then - v(k) = val - set = .true. - endif - enddo - if (.not. set) then - nzv = nzv + 1 - v(nzv) = val - iv(nzv) = i - endif - return - end -c-------end of vecset----------------------------- - diff --git a/examples/smpi/NAS/CG/mpinpb.h b/examples/smpi/NAS/CG/mpinpb.h deleted file mode 100644 index 1f0368c0b7..0000000000 --- a/examples/smpi/NAS/CG/mpinpb.h +++ /dev/null @@ -1,9 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'mpif.h' - - integer me, nprocs, root, dp_type - common /mpistuff/ me, nprocs, root, dp_type - diff --git a/examples/smpi/NAS/FT/Makefile b/examples/smpi/NAS/FT/Makefile deleted file mode 100644 index 1cc6e1416b..0000000000 --- a/examples/smpi/NAS/FT/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -SHELL=/bin/sh -BENCHMARK=ft -BENCHMARKU=FT - -include ../config/make.def - -include ../sys/make.common - -OBJS = ft.o ${COMMON}/${RAND}.o ${COMMON}/print_results.o ${COMMON}/timers.o - -${PROGRAM}: config ${OBJS} - ${FLINK} ${FLINKFLAGS} -o ${PROGRAM} ${OBJS} ${FMPI_LIB} - - - -.f.o: - ${FCOMPILE} $< - -ft.o: ft.f global.h mpinpb.h npbparams.h - -clean: - - rm -f *.o *~ mputil* - - rm -f ft npbparams.h core diff --git a/examples/smpi/NAS/FT/README b/examples/smpi/NAS/FT/README deleted file mode 100644 index ab08b363b2..0000000000 --- a/examples/smpi/NAS/FT/README +++ /dev/null @@ -1,5 +0,0 @@ -This code implements the time integration of a three-dimensional -partial differential equation using the Fast Fourier Transform. -Some of the dimension statements are not F77 conforming and will -not work using the g77 compiler. All dimension statements, -however, are legal F90. \ No newline at end of file diff --git a/examples/smpi/NAS/FT/ft.f b/examples/smpi/NAS/FT/ft.f deleted file mode 100644 index 5e3a3b0b40..0000000000 --- a/examples/smpi/NAS/FT/ft.f +++ /dev/null @@ -1,1998 +0,0 @@ -!-------------------------------------------------------------------------! -! ! -! N A S P A R A L L E L B E N C H M A R K S 3.3 ! -! ! -! F T ! -! ! -!-------------------------------------------------------------------------! -! ! -! This benchmark is part of the NAS Parallel Benchmark 3.3 suite. ! -! It is described in NAS Technical Reports 95-020 and 02-007 ! -! ! -! Permission to use, copy, distribute and modify this software ! -! for any purpose with or without fee is hereby granted. We ! -! request, however, that all derived work reference the NAS ! -! Parallel Benchmarks 3.3. This software is provided "as is" ! -! without express or implied warranty. ! -! ! -! Information on NPB 3.3, including the technical report, the ! -! original specifications, source code, results and information ! -! on how to submit new results, is available at: ! -! ! -! http://www.nas.nasa.gov/Software/NPB/ ! -! ! -! Send comments or suggestions to npb@nas.nasa.gov ! -! ! -! NAS Parallel Benchmarks Group ! -! NASA Ames Research Center ! -! Mail Stop: T27A-1 ! -! Moffett Field, CA 94035-1000 ! -! ! -! E-mail: npb@nas.nasa.gov ! -! Fax: (650) 604-3957 ! -! ! -!-------------------------------------------------------------------------! - -!TO REDUCE THE AMOUNT OF MEMORY REQUIRED BY THE BENCHMARK WE NO LONGER -!STORE THE ENTIRE TIME EVOLUTION ARRAY "EX" FOR ALL TIME STEPS, BUT -!JUST FOR THE FIRST. ALSO, IT IS STORED ONLY FOR THE PART OF THE GRID -!FOR WHICH THE CALLING PROCESSOR IS RESPONSIBLE, SO THAT THE MEMORY -!USAGE BECOMES SCALABLE. THIS NEW ARRAY IS CALLED "TWIDDLE" (SEE -!NPB3.0-SER) - -!TO AVOID PROBLEMS WITH VERY LARGE ARRAY SIZES THAT ARE COMPUTED BY -!MULTIPLYING GRID DIMENSIONS (CAUSING INTEGER OVERFLOW IN THE VARIABLE -!NTOTAL) AND SUBSEQUENTLY DIVIDING BY THE NUMBER OF PROCESSORS, WE -!COMPUTE THE SIZE OF ARRAY PARTITIONS MORE CONSERVATIVELY AS -!((NX*NY)/NP)*NZ, WHERE NX, NY, AND NZ ARE GRID DIMENSIONS AND NP IS -!THE NUMBER OF PROCESSORS, THE RESULT IS STORED IN "NTDIVNP". FOR THE -!PERFORMANCE CALCULATION WE STORE THE TOTAL NUMBER OF GRID POINTS IN A -!FLOATING POINT NUMBER "NTOTAL_F" INSTEAD OF AN INTEGER. -!THIS FIX WILL FAIL IF THE NUMBER OF PROCESSORS IS SMALL. - -!UGLY HACK OF SUBROUTINE IPOW46: FOR VERY LARGE GRIDS THE SINGLE EXPONENT -!FROM NPB2.3 MAY NOT FIT IN A 32-BIT INTEGER. HOWEVER, WE KNOW THAT THE -!"EXPONENT" ARGUMENT OF THIS ROUTINE CAN ALWAYS BE FACTORED INTO A TERM -!DIVISIBLE BY NX (EXP_1) AND ANOTHER TERM (EXP_2). NX IS USUALLY A POWER -!OF TWO, SO WE CAN KEEP HALVING IT UNTIL THE PRODUCT OF EXP_1 -!AND EXP_2 IS SMALL ENOUGH (NAMELY EXP_2 ITSELF). THIS UPDATED VERSION -!OF IPWO46, WHICH NOW TAKES THE TWO FACTORS OF "EXPONENT" AS SEPARATE -!ARGUMENTS, MAY BREAK DOWN IF EXP_1 DOES NOT CONTAIN A LARGE POWER OF TWO. - -c--------------------------------------------------------------------- -c -c Authors: D. Bailey -c W. Saphir -c R. F. Van der Wijngaart -c -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c FT benchmark -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - program ft - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpif.h' - include 'global.h' - integer i, ierr - -c--------------------------------------------------------------------- -c u0, u1, u2 are the main arrays in the problem. -c Depending on the decomposition, these arrays will have different -c dimensions. To accomodate all possibilities, we allocate them as -c one-dimensional arrays and pass them to subroutines for different -c views -c - u0 contains the initial (transformed) initial condition -c - u1 and u2 are working arrays -c--------------------------------------------------------------------- - - double complex u0(ntdivnp), - > u1(ntdivnp), - > u2(ntdivnp) - double precision twiddle(ntdivnp) -c--------------------------------------------------------------------- -c Large arrays are in common so that they are allocated on the -c heap rather than the stack. This common block is not -c referenced directly anywhere else. Padding is to avoid accidental -c cache problems, since all array sizes are powers of two. -c--------------------------------------------------------------------- - - double complex pad1(3), pad2(3), pad3(3) - common /bigarrays/ u0, pad1, u1, pad2, u2, pad3, twiddle - - integer iter - double precision total_time, mflops - logical verified - character class - - call MPI_Init(ierr) - -c--------------------------------------------------------------------- -c Run the entire problem once to make sure all data is touched. -c This reduces variable startup costs, which is important for such a -c short benchmark. The other NPB 2 implementations are similar. -c--------------------------------------------------------------------- - do i = 1, t_max - call timer_clear(i) - end do - - call setup() - call compute_indexmap(twiddle, dims(1,3), dims(2,3), dims(3,3)) - call compute_initial_conditions(u1, dims(1,1), dims(2,1), - > dims(3,1)) - call fft_init (dims(1,1)) - call fft(1, u1, u0) - -c--------------------------------------------------------------------- -c Start over from the beginning. Note that all operations must -c be timed, in contrast to other benchmarks. -c--------------------------------------------------------------------- - do i = 1, t_max - call timer_clear(i) - end do - call MPI_Barrier(MPI_COMM_WORLD, ierr) - - call timer_start(T_total) - if (timers_enabled) call timer_start(T_setup) - - call compute_indexmap(twiddle, dims(1,3), dims(2,3), dims(3,3)) - call compute_initial_conditions(u1, dims(1,1), dims(2,1), - > dims(3,1)) - call fft_init (dims(1,1)) - - if (timers_enabled) call synchup() - if (timers_enabled) call timer_stop(T_setup) - - if (timers_enabled) call timer_start(T_fft) - call fft(1, u1, u0) - if (timers_enabled) call timer_stop(T_fft) - - do iter = 1, niter - if (timers_enabled) call timer_start(T_evolve) - call evolve(u0, u1, twiddle, dims(1,1), dims(2,1), dims(3,1)) - if (timers_enabled) call timer_stop(T_evolve) - if (timers_enabled) call timer_start(T_fft) - call fft(-1, u1, u2) - if (timers_enabled) call timer_stop(T_fft) - if (timers_enabled) call synchup() - if (timers_enabled) call timer_start(T_checksum) - call checksum(iter, u2, dims(1,1), dims(2,1), dims(3,1)) - if (timers_enabled) call timer_stop(T_checksum) - end do - - call verify(nx, ny, nz, niter, verified, class) - call timer_stop(t_total) - if (np .ne. np_min) verified = .false. - total_time = timer_read(t_total) - - if( total_time .ne. 0. ) then - mflops = 1.0d-6*ntotal_f * - > (14.8157+7.19641*log(ntotal_f) - > + (5.23518+7.21113*log(ntotal_f))*niter) - > /total_time - else - mflops = 0.0 - endif - if (me .eq. 0) then - call print_results('FT', class, nx, ny, nz, niter, np_min, np, - > total_time, mflops, ' floating point', verified, - > npbversion, compiletime, cs1, cs2, cs3, cs4, cs5, cs6, cs7) - endif - if (timers_enabled) call print_timers() - call MPI_Finalize(ierr) - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine evolve(u0, u1, twiddle, d1, d2, d3) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c evolve u0 -> u1 (t time steps) in fourier space -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - integer d1, d2, d3 - double precision exi - double complex u0(d1,d2,d3) - double complex u1(d1,d2,d3) - double precision twiddle(d1,d2,d3) - integer i, j, k - - do k = 1, d3 - do j = 1, d2 - do i = 1, d1 - u0(i,j,k) = u0(i,j,k)*(twiddle(i,j,k)) - u1(i,j,k) = u0(i,j,k) - end do - end do - end do - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine compute_initial_conditions(u0, d1, d2, d3) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Fill in array u0 with initial conditions from -c random number generator -c--------------------------------------------------------------------- - implicit none - include 'global.h' - integer d1, d2, d3 - double complex u0(d1, d2, d3) - integer k - double precision x0, start, an, dummy - -c--------------------------------------------------------------------- -c 0-D and 1-D layouts are easy because each processor gets a contiguous -c chunk of the array, in the Fortran ordering sense. -c For a 2-D layout, it's a bit more complicated. We always -c have entire x-lines (contiguous) in processor. -c We can do ny/np1 of them at a time since we have -c ny/np1 contiguous in y-direction. But then we jump -c by z-planes (nz/np2 of them, total). -c For the 0-D and 1-D layouts we could do larger chunks, but -c this turns out to have no measurable impact on performance. -c--------------------------------------------------------------------- - - - start = seed -c--------------------------------------------------------------------- -c Jump to the starting element for our first plane. -c--------------------------------------------------------------------- - call ipow46(a, 2*nx, (zstart(1)-1)*ny + (ystart(1)-1), an) - dummy = randlc(start, an) - call ipow46(a, 2*nx, ny, an) - -c--------------------------------------------------------------------- -c Go through by z planes filling in one square at a time. -c--------------------------------------------------------------------- - do k = 1, dims(3, 1) ! nz/np2 - x0 = start - call vranlc(2*nx*dims(2, 1), x0, a, u0(1, 1, k)) - if (k .ne. dims(3, 1)) dummy = randlc(start, an) - end do - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine ipow46(a, exp_1, exp_2, result) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c compute a^exponent mod 2^46 -c--------------------------------------------------------------------- - - implicit none - double precision a, result, dummy, q, r - integer exp_1, exp_2, n, n2, ierr - external randlc - double precision randlc - logical two_pow -c--------------------------------------------------------------------- -c Use -c a^n = a^(n/2)*a^(n/2) if n even else -c a^n = a*a^(n-1) if n odd -c--------------------------------------------------------------------- - result = 1 - if (exp_2 .eq. 0 .or. exp_1 .eq. 0) return - q = a - r = 1 - n = exp_1 - two_pow = .true. - - do while (two_pow) - n2 = n/2 - if (n2 * 2 .eq. n) then - dummy = randlc(q, q) - n = n2 - else - n = n * exp_2 - two_pow = .false. - endif - end do - - do while (n .gt. 1) - n2 = n/2 - if (n2 * 2 .eq. n) then - dummy = randlc(q, q) - n = n2 - else - dummy = randlc(r, q) - n = n-1 - endif - end do - dummy = randlc(r, q) - result = r - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine setup - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'mpinpb.h' - include 'global.h' - - integer ierr, i, j, fstatus - debug = .FALSE. - - call MPI_Comm_size(MPI_COMM_WORLD, np, ierr) - call MPI_Comm_rank(MPI_COMM_WORLD, me, ierr) - - if (.not. convertdouble) then - dc_type = MPI_DOUBLE_COMPLEX - else - dc_type = MPI_COMPLEX - endif - - - if (me .eq. 0) then - write(*, 1000) - open (unit=2,file='inputft.data',status='old', iostat=fstatus) - - if (fstatus .eq. 0) then - write(*,233) - 233 format(' Reading from input file inputft.data') - read (2,*) niter - read (2,*) layout_type - read (2,*) np1, np2 - close(2) - -c--------------------------------------------------------------------- -c check to make sure input data is consistent -c--------------------------------------------------------------------- - - -c--------------------------------------------------------------------- -c 1. product of processor grid dims must equal number of processors -c--------------------------------------------------------------------- - - if (np1 * np2 .ne. np) then - write(*, 238) - 238 format(' np1 and np2 given in input file are not valid.') - write(*, 239) np1*np2, np - 239 format(' Product is ', i5, ' and should be ', i5) - call MPI_Abort(MPI_COMM_WORLD, 1, ierr) - stop - endif - -c--------------------------------------------------------------------- -c 2. layout type must be valid -c--------------------------------------------------------------------- - - if (layout_type .ne. layout_0D .and. - > layout_type .ne. layout_1D .and. - > layout_type .ne. layout_2D) then - write(*, 240) - 240 format(' Layout type specified in inputft.data is - > invalid ') - call MPI_Abort(MPI_COMM_WORLD, 1, ierr) - stop - endif - -c--------------------------------------------------------------------- -c 3. 0D layout must be 1x1 grid -c--------------------------------------------------------------------- - - if (layout_type .eq. layout_0D .and. - > (np1 .ne.1 .or. np2 .ne. 1)) then - write(*, 241) - 241 format(' For 0D layout, both np1 and np2 must be 1 ') - call MPI_Abort(MPI_COMM_WORLD, 1, ierr) - stop - endif -c--------------------------------------------------------------------- -c 4. 1D layout must be 1xN grid -c--------------------------------------------------------------------- - - if (layout_type .eq. layout_1D .and. np1 .ne. 1) then - write(*, 242) - 242 format(' For 1D layout, np1 must be 1 ') - call MPI_Abort(MPI_COMM_WORLD, 1, ierr) - stop - endif - - else - write(*,234) - niter = niter_default - if (np .eq. 1) then - np1 = 1 - np2 = 1 - layout_type = layout_0D - else if (np .le. nz) then - np1 = 1 - np2 = np - layout_type = layout_1D - else - np1 = nz - np2 = np/nz - layout_type = layout_2D - endif - endif - - if (np .lt. np_min) then - write(*, 10) np_min - 10 format(' Error: Compiled for ', I5, ' processors. ') - write(*, 11) np - 11 format(' Only ', i5, ' processors found ') - call MPI_Abort(MPI_COMM_WORLD, 1, ierr) - stop - endif - - 234 format(' No input file inputft.data. Using compiled defaults') - write(*, 1001) nx, ny, nz - write(*, 1002) niter - write(*, 1004) np - write(*, 1005) np1, np2 - if (np .ne. np_min) write(*, 1006) np_min - - if (layout_type .eq. layout_0D) then - write(*, 1010) '0D' - else if (layout_type .eq. layout_1D) then - write(*, 1010) '1D' - else - write(*, 1010) '2D' - endif - - 1000 format(//,' NAS Parallel Benchmarks 3.3 -- FT Benchmark',/) - 1001 format(' Size : ', i4, 'x', i4, 'x', i4) - 1002 format(' Iterations : ', 7x, i7) - 1004 format(' Number of processes : ', 7x, i7) - 1005 format(' Processor array : ', 5x, i4, 'x', i4) - 1006 format(' WARNING: compiled for ', i5, ' processes. ', - > ' Will not verify. ') - 1010 format(' Layout type : ', 9x, A5) - endif - - -c--------------------------------------------------------------------- -c Since np1, np2 and layout_type are in a common block, -c this sends all three. -c--------------------------------------------------------------------- - call MPI_BCAST(np1, 3, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) - call MPI_BCAST(niter, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) - - if (np1 .eq. 1 .and. np2 .eq. 1) then - layout_type = layout_0D - else if (np1 .eq. 1) then - layout_type = layout_1D - else - layout_type = layout_2D - endif - - if (layout_type .eq. layout_0D) then - do i = 1, 3 - dims(1, i) = nx - dims(2, i) = ny - dims(3, i) = nz - end do - else if (layout_type .eq. layout_1D) then - dims(1, 1) = nx - dims(2, 1) = ny - dims(3, 1) = nz - - dims(1, 2) = nx - dims(2, 2) = ny - dims(3, 2) = nz - - dims(1, 3) = nz - dims(2, 3) = nx - dims(3, 3) = ny - else if (layout_type .eq. layout_2D) then - dims(1, 1) = nx - dims(2, 1) = ny - dims(3, 1) = nz - - dims(1, 2) = ny - dims(2, 2) = nx - dims(3, 2) = nz - - dims(1, 3) = nz - dims(2, 3) = nx - dims(3, 3) = ny - - endif - do i = 1, 3 - dims(2, i) = dims(2, i) / np1 - dims(3, i) = dims(3, i) / np2 - end do - - -c--------------------------------------------------------------------- -c Determine processor coordinates of this processor -c Processor grid is np1xnp2. -c Arrays are always (n1, n2/np1, n3/np2) -c Processor coords are zero-based. -c--------------------------------------------------------------------- - me2 = mod(me, np2) ! goes from 0...np2-1 - me1 = me/np2 ! goes from 0...np1-1 -c--------------------------------------------------------------------- -c Communicators for rows/columns of processor grid. -c commslice1 is communicator of all procs with same me1, ranked as me2 -c commslice2 is communicator of all procs with same me2, ranked as me1 -c mpi_comm_split(comm, color, key, ...) -c--------------------------------------------------------------------- - call MPI_Comm_split(MPI_COMM_WORLD, me1, me2, commslice1, ierr) - call MPI_Comm_split(MPI_COMM_WORLD, me2, me1, commslice2, ierr) - if (timers_enabled) call synchup() - - if (debug) print *, 'proc coords: ', me, me1, me2 - -c--------------------------------------------------------------------- -c Determine which section of the grid is owned by this -c processor. -c--------------------------------------------------------------------- - if (layout_type .eq. layout_0d) then - - do i = 1, 3 - xstart(i) = 1 - xend(i) = nx - ystart(i) = 1 - yend(i) = ny - zstart(i) = 1 - zend(i) = nz - end do - - else if (layout_type .eq. layout_1d) then - - xstart(1) = 1 - xend(1) = nx - ystart(1) = 1 - yend(1) = ny - zstart(1) = 1 + me2 * nz/np2 - zend(1) = (me2+1) * nz/np2 - - xstart(2) = 1 - xend(2) = nx - ystart(2) = 1 - yend(2) = ny - zstart(2) = 1 + me2 * nz/np2 - zend(2) = (me2+1) * nz/np2 - - xstart(3) = 1 - xend(3) = nx - ystart(3) = 1 + me2 * ny/np2 - yend(3) = (me2+1) * ny/np2 - zstart(3) = 1 - zend(3) = nz - - else if (layout_type .eq. layout_2d) then - - xstart(1) = 1 - xend(1) = nx - ystart(1) = 1 + me1 * ny/np1 - yend(1) = (me1+1) * ny/np1 - zstart(1) = 1 + me2 * nz/np2 - zend(1) = (me2+1) * nz/np2 - - xstart(2) = 1 + me1 * nx/np1 - xend(2) = (me1+1)*nx/np1 - ystart(2) = 1 - yend(2) = ny - zstart(2) = zstart(1) - zend(2) = zend(1) - - xstart(3) = xstart(2) - xend(3) = xend(2) - ystart(3) = 1 + me2 *ny/np2 - yend(3) = (me2+1)*ny/np2 - zstart(3) = 1 - zend(3) = nz - endif - -c--------------------------------------------------------------------- -c Set up info for blocking of ffts and transposes. This improves -c performance on cache-based systems. Blocking involves -c working on a chunk of the problem at a time, taking chunks -c along the first, second, or third dimension. -c -c - In cffts1 blocking is on 2nd dimension (with fft on 1st dim) -c - In cffts2/3 blocking is on 1st dimension (with fft on 2nd and 3rd dims) - -c Since 1st dim is always in processor, we'll assume it's long enough -c (default blocking factor is 16 so min size for 1st dim is 16) -c The only case we have to worry about is cffts1 in a 2d decomposition. -c so the blocking factor should not be larger than the 2nd dimension. -c--------------------------------------------------------------------- - - fftblock = fftblock_default - fftblockpad = fftblockpad_default - - if (layout_type .eq. layout_2d) then - if (dims(2, 1) .lt. fftblock) fftblock = dims(2, 1) - if (dims(2, 2) .lt. fftblock) fftblock = dims(2, 2) - if (dims(2, 3) .lt. fftblock) fftblock = dims(2, 3) - endif - - if (fftblock .ne. fftblock_default) fftblockpad = fftblock+3 - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine compute_indexmap(twiddle, d1, d2, d3) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c compute function from local (i,j,k) to ibar^2+jbar^2+kbar^2 -c for time evolution exponent. -c--------------------------------------------------------------------- - - implicit none - include 'mpinpb.h' - include 'global.h' - integer d1, d2, d3 - integer i, j, k, ii, ii2, jj, ij2, kk - double precision ap, twiddle(d1, d2, d3) - -c--------------------------------------------------------------------- -c this function is very different depending on whether -c we are in the 0d, 1d or 2d layout. Compute separately. -c basically we want to convert the fortran indices -c 1 2 3 4 5 6 7 8 -c to -c 0 1 2 3 -4 -3 -2 -1 -c The following magic formula does the trick: -c mod(i-1+n/2, n) - n/2 -c--------------------------------------------------------------------- - - ap = - 4.d0 * alpha * pi *pi - - if (layout_type .eq. layout_0d) then ! xyz layout - do i = 1, dims(1,3) - ii = mod(i+xstart(3)-2+nx/2, nx) - nx/2 - ii2 = ii*ii - do j = 1, dims(2,3) - jj = mod(j+ystart(3)-2+ny/2, ny) - ny/2 - ij2 = jj*jj+ii2 - do k = 1, dims(3,3) - kk = mod(k+zstart(3)-2+nz/2, nz) - nz/2 - twiddle(i,j,k) = dexp(ap*dfloat(kk*kk+ij2)) - end do - end do - end do - else if (layout_type .eq. layout_1d) then ! zxy layout - do i = 1,dims(2,3) - ii = mod(i+xstart(3)-2+nx/2, nx) - nx/2 - ii2 = ii*ii - do j = 1,dims(3,3) - jj = mod(j+ystart(3)-2+ny/2, ny) - ny/2 - ij2 = jj*jj+ii2 - do k = 1,dims(1,3) - kk = mod(k+zstart(3)-2+nz/2, nz) - nz/2 - twiddle(k,i,j) = dexp(ap*dfloat(kk*kk+ij2)) - end do - end do - end do - else if (layout_type .eq. layout_2d) then ! zxy layout - do i = 1,dims(2,3) - ii = mod(i+xstart(3)-2+nx/2, nx) - nx/2 - ii2 = ii*ii - do j = 1, dims(3,3) - jj = mod(j+ystart(3)-2+ny/2, ny) - ny/2 - ij2 = jj*jj+ii2 - do k =1,dims(1,3) - kk = mod(k+zstart(3)-2+nz/2, nz) - nz/2 - twiddle(k,i,j) = dexp(ap*dfloat(kk*kk+ij2)) - end do - end do - end do - else - print *, ' Unknown layout type ', layout_type - stop - endif - - return - end - - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine print_timers() - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - integer i - include 'global.h' - character*25 tstrings(T_max) - data tstrings / ' total ', - > ' setup ', - > ' fft ', - > ' evolve ', - > ' checksum ', - > ' fftlow ', - > ' fftcopy ', - > ' transpose ', - > ' transpose1_loc ', - > ' transpose1_glo ', - > ' transpose1_fin ', - > ' transpose2_loc ', - > ' transpose2_glo ', - > ' transpose2_fin ', - > ' sync ' / - - if (me .ne. 0) return - do i = 1, t_max - if (timer_read(i) .ne. 0.0d0) then - write(*, 100) i, tstrings(i), timer_read(i) - endif - end do - 100 format(' timer ', i2, '(', A16, ') :', F10.6) - return - end - - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine fft(dir, x1, x2) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - integer dir - double complex x1(ntdivnp), x2(ntdivnp) - - double complex scratch(fftblockpad_default*maxdim*2) - -c--------------------------------------------------------------------- -c note: args x1, x2 must be different arrays -c note: args for cfftsx are (direction, layout, xin, xout, scratch) -c xin/xout may be the same and it can be somewhat faster -c if they are -c note: args for transpose are (layout1, layout2, xin, xout) -c xin/xout must be different -c--------------------------------------------------------------------- - - if (dir .eq. 1) then - if (layout_type .eq. layout_0d) then - call cffts1(1, dims(1,1), dims(2,1), dims(3,1), - > x1, x1, scratch) - call cffts2(1, dims(1,2), dims(2,2), dims(3,2), - > x1, x1, scratch) - call cffts3(1, dims(1,3), dims(2,3), dims(3,3), - > x1, x2, scratch) - else if (layout_type .eq. layout_1d) then - call cffts1(1, dims(1,1), dims(2,1), dims(3,1), - > x1, x1, scratch) - call cffts2(1, dims(1,2), dims(2,2), dims(3,2), - > x1, x1, scratch) - if (timers_enabled) call timer_start(T_transpose) - call transpose_xy_z(2, 3, x1, x2) - if (timers_enabled) call timer_stop(T_transpose) - call cffts1(1, dims(1,3), dims(2,3), dims(3,3), - > x2, x2, scratch) - else if (layout_type .eq. layout_2d) then - call cffts1(1, dims(1,1), dims(2,1), dims(3,1), - > x1, x1, scratch) - if (timers_enabled) call timer_start(T_transpose) - call transpose_x_y(1, 2, x1, x2) - if (timers_enabled) call timer_stop(T_transpose) - call cffts1(1, dims(1,2), dims(2,2), dims(3,2), - > x2, x2, scratch) - if (timers_enabled) call timer_start(T_transpose) - call transpose_x_z(2, 3, x2, x1) - if (timers_enabled) call timer_stop(T_transpose) - call cffts1(1, dims(1,3), dims(2,3), dims(3,3), - > x1, x2, scratch) - endif - else - if (layout_type .eq. layout_0d) then - call cffts3(-1, dims(1,3), dims(2,3), dims(3,3), - > x1, x1, scratch) - call cffts2(-1, dims(1,2), dims(2,2), dims(3,2), - > x1, x1, scratch) - call cffts1(-1, dims(1,1), dims(2,1), dims(3,1), - > x1, x2, scratch) - else if (layout_type .eq. layout_1d) then - call cffts1(-1, dims(1,3), dims(2,3), dims(3,3), - > x1, x1, scratch) - if (timers_enabled) call timer_start(T_transpose) - call transpose_x_yz(3, 2, x1, x2) - if (timers_enabled) call timer_stop(T_transpose) - call cffts2(-1, dims(1,2), dims(2,2), dims(3,2), - > x2, x2, scratch) - call cffts1(-1, dims(1,1), dims(2,1), dims(3,1), - > x2, x2, scratch) - else if (layout_type .eq. layout_2d) then - call cffts1(-1, dims(1,3), dims(2,3), dims(3,3), - > x1, x1, scratch) - if (timers_enabled) call timer_start(T_transpose) - call transpose_x_z(3, 2, x1, x2) - if (timers_enabled) call timer_stop(T_transpose) - call cffts1(-1, dims(1,2), dims(2,2), dims(3,2), - > x2, x2, scratch) - if (timers_enabled) call timer_start(T_transpose) - call transpose_x_y(2, 1, x2, x1) - if (timers_enabled) call timer_stop(T_transpose) - call cffts1(-1, dims(1,1), dims(2,1), dims(3,1), - > x1, x2, scratch) - endif - endif - return - end - - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine cffts1(is, d1, d2, d3, x, xout, y) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'global.h' - integer is, d1, d2, d3, logd1 - double complex x(d1,d2,d3) - double complex xout(d1,d2,d3) - double complex y(fftblockpad, d1, 2) - integer i, j, k, jj - - logd1 = ilog2(d1) - - do k = 1, d3 - do jj = 0, d2 - fftblock, fftblock - if (timers_enabled) call timer_start(T_fftcopy) - do j = 1, fftblock - do i = 1, d1 - y(j,i,1) = x(i,j+jj,k) - enddo - enddo - if (timers_enabled) call timer_stop(T_fftcopy) - - if (timers_enabled) call timer_start(T_fftlow) - call cfftz (is, logd1, d1, y, y(1,1,2)) - if (timers_enabled) call timer_stop(T_fftlow) - - if (timers_enabled) call timer_start(T_fftcopy) - do j = 1, fftblock - do i = 1, d1 - xout(i,j+jj,k) = y(j,i,1) - enddo - enddo - if (timers_enabled) call timer_stop(T_fftcopy) - enddo - enddo - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine cffts2(is, d1, d2, d3, x, xout, y) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'global.h' - integer is, d1, d2, d3, logd2 - double complex x(d1,d2,d3) - double complex xout(d1,d2,d3) - double complex y(fftblockpad, d2, 2) - integer i, j, k, ii - - logd2 = ilog2(d2) - - do k = 1, d3 - do ii = 0, d1 - fftblock, fftblock - if (timers_enabled) call timer_start(T_fftcopy) - do j = 1, d2 - do i = 1, fftblock - y(i,j,1) = x(i+ii,j,k) - enddo - enddo - if (timers_enabled) call timer_stop(T_fftcopy) - - if (timers_enabled) call timer_start(T_fftlow) - call cfftz (is, logd2, d2, y, y(1, 1, 2)) - if (timers_enabled) call timer_stop(T_fftlow) - - if (timers_enabled) call timer_start(T_fftcopy) - do j = 1, d2 - do i = 1, fftblock - xout(i+ii,j,k) = y(i,j,1) - enddo - enddo - if (timers_enabled) call timer_stop(T_fftcopy) - enddo - enddo - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine cffts3(is, d1, d2, d3, x, xout, y) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'global.h' - integer is, d1, d2, d3, logd3 - double complex x(d1,d2,d3) - double complex xout(d1,d2,d3) - double complex y(fftblockpad, d3, 2) - integer i, j, k, ii - - logd3 = ilog2(d3) - - do j = 1, d2 - do ii = 0, d1 - fftblock, fftblock - if (timers_enabled) call timer_start(T_fftcopy) - do k = 1, d3 - do i = 1, fftblock - y(i,k,1) = x(i+ii,j,k) - enddo - enddo - if (timers_enabled) call timer_stop(T_fftcopy) - - if (timers_enabled) call timer_start(T_fftlow) - call cfftz (is, logd3, d3, y, y(1, 1, 2)) - if (timers_enabled) call timer_stop(T_fftlow) - - if (timers_enabled) call timer_start(T_fftcopy) - do k = 1, d3 - do i = 1, fftblock - xout(i+ii,j,k) = y(i,k,1) - enddo - enddo - if (timers_enabled) call timer_stop(T_fftcopy) - enddo - enddo - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine fft_init (n) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c compute the roots-of-unity array that will be used for subsequent FFTs. -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - - integer m,n,nu,ku,i,j,ln - double precision t, ti - - -c--------------------------------------------------------------------- -c Initialize the U array with sines and cosines in a manner that permits -c stride one access at each FFT iteration. -c--------------------------------------------------------------------- - nu = n - m = ilog2(n) - u(1) = m - ku = 2 - ln = 1 - - do j = 1, m - t = pi / ln - - do i = 0, ln - 1 - ti = i * t - u(i+ku) = dcmplx (cos (ti), sin(ti)) - enddo - - ku = ku + ln - ln = 2 * ln - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine cfftz (is, m, n, x, y) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Computes NY N-point complex-to-complex FFTs of X using an algorithm due -c to Swarztrauber. X is both the input and the output array, while Y is a -c scratch array. It is assumed that N = 2^M. Before calling CFFTZ to -c perform FFTs, the array U must be initialized by calling CFFTZ with IS -c set to 0 and M set to MX, where MX is the maximum value of M for any -c subsequent call. -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - - integer is,m,n,i,j,l,mx - double complex x, y - - dimension x(fftblockpad,n), y(fftblockpad,n) - -c--------------------------------------------------------------------- -c Check if input parameters are invalid. -c--------------------------------------------------------------------- - mx = u(1) - if ((is .ne. 1 .and. is .ne. -1) .or. m .lt. 1 .or. m .gt. mx) - > then - write (*, 1) is, m, mx - 1 format ('CFFTZ: Either U has not been initialized, or else'/ - > 'one of the input parameters is invalid', 3I5) - stop - endif - -c--------------------------------------------------------------------- -c Perform one variant of the Stockham FFT. -c--------------------------------------------------------------------- - do l = 1, m, 2 - call fftz2 (is, l, m, n, fftblock, fftblockpad, u, x, y) - if (l .eq. m) goto 160 - call fftz2 (is, l + 1, m, n, fftblock, fftblockpad, u, y, x) - enddo - - goto 180 - -c--------------------------------------------------------------------- -c Copy Y to X. -c--------------------------------------------------------------------- - 160 do j = 1, n - do i = 1, fftblock - x(i,j) = y(i,j) - enddo - enddo - - 180 continue - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine fftz2 (is, l, m, n, ny, ny1, u, x, y) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Performs the L-th iteration of the second variant of the Stockham FFT. -c--------------------------------------------------------------------- - - implicit none - - integer is,k,l,m,n,ny,ny1,n1,li,lj,lk,ku,i,j,i11,i12,i21,i22 - double complex u,x,y,u1,x11,x21 - dimension u(n), x(ny1,n), y(ny1,n) - - -c--------------------------------------------------------------------- -c Set initial parameters. -c--------------------------------------------------------------------- - - n1 = n / 2 - lk = 2 ** (l - 1) - li = 2 ** (m - l) - lj = 2 * lk - ku = li + 1 - - do i = 0, li - 1 - i11 = i * lk + 1 - i12 = i11 + n1 - i21 = i * lj + 1 - i22 = i21 + lk - if (is .ge. 1) then - u1 = u(ku+i) - else - u1 = dconjg (u(ku+i)) - endif - -c--------------------------------------------------------------------- -c This loop is vectorizable. -c--------------------------------------------------------------------- - do k = 0, lk - 1 - do j = 1, ny - x11 = x(j,i11+k) - x21 = x(j,i12+k) - y(j,i21+k) = x11 + x21 - y(j,i22+k) = u1 * (x11 - x21) - enddo - enddo - enddo - - return - end - -c--------------------------------------------------------------------- - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - integer function ilog2(n) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - integer n, nn, lg - if (n .eq. 1) then - ilog2=0 - return - endif - lg = 1 - nn = 2 - do while (nn .lt. n) - nn = nn*2 - lg = lg+1 - end do - ilog2 = lg - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine transpose_x_yz(l1, l2, xin, xout) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - integer l1, l2 - double complex xin(ntdivnp), xout(ntdivnp) - - call transpose2_local(dims(1,l1),dims(2, l1)*dims(3, l1), - > xin, xout) - - call transpose2_global(xout, xin) - - call transpose2_finish(dims(1,l1),dims(2, l1)*dims(3, l1), - > xin, xout) - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine transpose_xy_z(l1, l2, xin, xout) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - integer l1, l2 - double complex xin(ntdivnp), xout(ntdivnp) - - call transpose2_local(dims(1,l1)*dims(2, l1),dims(3, l1), - > xin, xout) - call transpose2_global(xout, xin) - call transpose2_finish(dims(1,l1)*dims(2, l1),dims(3, l1), - > xin, xout) - - return - end - - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine transpose2_local(n1, n2, xin, xout) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'mpinpb.h' - include 'global.h' - integer n1, n2 - double complex xin(n1, n2), xout(n2, n1) - - double complex z(transblockpad, transblock) - - integer i, j, ii, jj - - if (timers_enabled) call timer_start(T_transxzloc) - -c--------------------------------------------------------------------- -c If possible, block the transpose for cache memory systems. -c How much does this help? Example: R8000 Power Challenge (90 MHz) -c Blocked version decreases time spend in this routine -c from 14 seconds to 5.2 seconds on 8 nodes class A. -c--------------------------------------------------------------------- - - if (n1 .lt. transblock .or. n2 .lt. transblock) then - if (n1 .ge. n2) then - do j = 1, n2 - do i = 1, n1 - xout(j, i) = xin(i, j) - end do - end do - else - do i = 1, n1 - do j = 1, n2 - xout(j, i) = xin(i, j) - end do - end do - endif - else - do j = 0, n2-1, transblock - do i = 0, n1-1, transblock - -c--------------------------------------------------------------------- -c Note: compiler should be able to take j+jj out of inner loop -c--------------------------------------------------------------------- - do jj = 1, transblock - do ii = 1, transblock - z(jj,ii) = xin(i+ii, j+jj) - end do - end do - - do ii = 1, transblock - do jj = 1, transblock - xout(j+jj, i+ii) = z(jj,ii) - end do - end do - - end do - end do - endif - if (timers_enabled) call timer_stop(T_transxzloc) - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine transpose2_global(xin, xout) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - include 'mpinpb.h' - double complex xin(ntdivnp) - double complex xout(ntdivnp) - integer ierr - - if (timers_enabled) call synchup() - - if (timers_enabled) call timer_start(T_transxzglo) - call mpi_alltoall(xin, ntdivnp/np, dc_type, - > xout, ntdivnp/np, dc_type, - > commslice1, ierr) - if (timers_enabled) call timer_stop(T_transxzglo) - - return - end - - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine transpose2_finish(n1, n2, xin, xout) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - integer n1, n2, ioff - double complex xin(n2, n1/np2, 0:np2-1), xout(n2*np2, n1/np2) - - integer i, j, p - - if (timers_enabled) call timer_start(T_transxzfin) - do p = 0, np2-1 - ioff = p*n2 - do j = 1, n1/np2 - do i = 1, n2 - xout(i+ioff, j) = xin(i, j, p) - end do - end do - end do - if (timers_enabled) call timer_stop(T_transxzfin) - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine transpose_x_z(l1, l2, xin, xout) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - integer l1, l2 - double complex xin(ntdivnp), xout(ntdivnp) - - call transpose_x_z_local(dims(1,l1),dims(2,l1),dims(3,l1), - > xin, xout) - call transpose_x_z_global(dims(1,l1),dims(2,l1),dims(3,l1), - > xout, xin) - call transpose_x_z_finish(dims(1,l2),dims(2,l2),dims(3,l2), - > xin, xout) - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine transpose_x_z_local(d1, d2, d3, xin, xout) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - integer d1, d2, d3 - double complex xin(d1,d2,d3) - double complex xout(d3,d2,d1) - integer block1, block3 - integer i, j, k, kk, ii, i1, k1 - - double complex buf(transblockpad, maxdim) - if (timers_enabled) call timer_start(T_transxzloc) - if (d1 .lt. 32) goto 100 - block3 = d3 - if (block3 .eq. 1) goto 100 - if (block3 .gt. transblock) block3 = transblock - block1 = d1 - if (block1*block3 .gt. transblock*transblock) - > block1 = transblock*transblock/block3 -c--------------------------------------------------------------------- -c blocked transpose -c--------------------------------------------------------------------- - do j = 1, d2 - do kk = 0, d3-block3, block3 - do ii = 0, d1-block1, block1 - - do k = 1, block3 - k1 = k + kk - do i = 1, block1 - buf(k, i) = xin(i+ii, j, k1) - end do - end do - - do i = 1, block1 - i1 = i + ii - do k = 1, block3 - xout(k+kk, j, i1) = buf(k, i) - end do - end do - - end do - end do - end do - goto 200 - - -c--------------------------------------------------------------------- -c basic transpose -c--------------------------------------------------------------------- - 100 continue - - do j = 1, d2 - do k = 1, d3 - do i = 1, d1 - xout(k, j, i) = xin(i, j, k) - end do - end do - end do - -c--------------------------------------------------------------------- -c all done -c--------------------------------------------------------------------- - 200 continue - - if (timers_enabled) call timer_stop(T_transxzloc) - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine transpose_x_z_global(d1, d2, d3, xin, xout) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - include 'mpinpb.h' - integer d1, d2, d3 - double complex xin(d3,d2,d1) - double complex xout(d3,d2,d1) ! not real layout, but right size - integer ierr - - if (timers_enabled) call synchup() - -c--------------------------------------------------------------------- -c do transpose among all processes with same 1-coord (me1) -c--------------------------------------------------------------------- - if (timers_enabled)call timer_start(T_transxzglo) - call mpi_alltoall(xin, d1*d2*d3/np2, dc_type, - > xout, d1*d2*d3/np2, dc_type, - > commslice1, ierr) - if (timers_enabled) call timer_stop(T_transxzglo) - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine transpose_x_z_finish(d1, d2, d3, xin, xout) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - integer d1, d2, d3 - double complex xin(d1/np2, d2, d3, 0:np2-1) - double complex xout(d1,d2,d3) - integer i, j, k, p, ioff - if (timers_enabled) call timer_start(T_transxzfin) -c--------------------------------------------------------------------- -c this is the most straightforward way of doing it. the -c calculation in the inner loop doesn't help. -c do i = 1, d1/np2 -c do j = 1, d2 -c do k = 1, d3 -c do p = 0, np2-1 -c ii = i + p*d1/np2 -c xout(ii, j, k) = xin(i, j, k, p) -c end do -c end do -c end do -c end do -c--------------------------------------------------------------------- - - do p = 0, np2-1 - ioff = p*d1/np2 - do k = 1, d3 - do j = 1, d2 - do i = 1, d1/np2 - xout(i+ioff, j, k) = xin(i, j, k, p) - end do - end do - end do - end do - if (timers_enabled) call timer_stop(T_transxzfin) - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine transpose_x_y(l1, l2, xin, xout) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - integer l1, l2 - double complex xin(ntdivnp), xout(ntdivnp) - -c--------------------------------------------------------------------- -c xy transpose is a little tricky, since we don't want -c to touch 3rd axis. But alltoall must involve 3rd axis (most -c slowly varying) to be efficient. So we do -c (nx, ny/np1, nz/np2) -> (ny/np1, nz/np2, nx) (local) -c (ny/np1, nz/np2, nx) -> ((ny/np1*nz/np2)*np1, nx/np1) (global) -c then local finish. -c--------------------------------------------------------------------- - - - call transpose_x_y_local(dims(1,l1),dims(2,l1),dims(3,l1), - > xin, xout) - call transpose_x_y_global(dims(1,l1),dims(2,l1),dims(3,l1), - > xout, xin) - call transpose_x_y_finish(dims(1,l2),dims(2,l2),dims(3,l2), - > xin, xout) - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine transpose_x_y_local(d1, d2, d3, xin, xout) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - integer d1, d2, d3 - double complex xin(d1, d2, d3) - double complex xout(d2, d3, d1) - integer i, j, k - if (timers_enabled) call timer_start(T_transxyloc) - - do k = 1, d3 - do i = 1, d1 - do j = 1, d2 - xout(j,k,i)=xin(i,j,k) - end do - end do - end do - if (timers_enabled) call timer_stop(T_transxyloc) - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine transpose_x_y_global(d1, d2, d3, xin, xout) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - include 'mpinpb.h' - integer d1, d2, d3 -c--------------------------------------------------------------------- -c array is in form (ny/np1, nz/np2, nx) -c--------------------------------------------------------------------- - double complex xin(d2,d3,d1) - double complex xout(d2,d3,d1) ! not real layout but right size - integer ierr - - if (timers_enabled) call synchup() - -c--------------------------------------------------------------------- -c do transpose among all processes with same 1-coord (me1) -c--------------------------------------------------------------------- - if (timers_enabled) call timer_start(T_transxyglo) - call mpi_alltoall(xin, d1*d2*d3/np1, dc_type, - > xout, d1*d2*d3/np1, dc_type, - > commslice2, ierr) - if (timers_enabled) call timer_stop(T_transxyglo) - - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine transpose_x_y_finish(d1, d2, d3, xin, xout) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - integer d1, d2, d3 - double complex xin(d1/np1, d3, d2, 0:np1-1) - double complex xout(d1,d2,d3) - integer i, j, k, p, ioff - if (timers_enabled) call timer_start(T_transxyfin) -c--------------------------------------------------------------------- -c this is the most straightforward way of doing it. the -c calculation in the inner loop doesn't help. -c do i = 1, d1/np1 -c do j = 1, d2 -c do k = 1, d3 -c do p = 0, np1-1 -c ii = i + p*d1/np1 -c note order is screwy bcz we have (ny/np1, nz/np2, nx) -> (ny, nx/np1, nz/np2) -c xout(ii, j, k) = xin(i, k, j, p) -c end do -c end do -c end do -c end do -c--------------------------------------------------------------------- - - do p = 0, np1-1 - ioff = p*d1/np1 - do k = 1, d3 - do j = 1, d2 - do i = 1, d1/np1 - xout(i+ioff, j, k) = xin(i, k, j, p) - end do - end do - end do - end do - if (timers_enabled) call timer_stop(T_transxyfin) - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine checksum(i, u1, d1, d2, d3) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - include 'mpinpb.h' - integer i, d1, d2, d3 - double complex u1(d1, d2, d3) - integer j, q,r,s, ierr - double complex chk,allchk - chk = (0.0,0.0) - - do j=1,1024 - q = mod(j, nx)+1 - if (q .ge. xstart(1) .and. q .le. xend(1)) then - r = mod(3*j,ny)+1 - if (r .ge. ystart(1) .and. r .le. yend(1)) then - s = mod(5*j,nz)+1 - if (s .ge. zstart(1) .and. s .le. zend(1)) then - chk=chk+u1(q-xstart(1)+1,r-ystart(1)+1,s-zstart(1)+1) - end if - end if - end if - end do - chk = chk/ntotal_f - - call MPI_Reduce(chk, allchk, 1, dc_type, MPI_SUM, - > 0, MPI_COMM_WORLD, ierr) - if (me .eq. 0) then - write (*, 30) i, allchk - 30 format (' T =',I5,5X,'Checksum =',1P2D22.12) - endif - -c sums(i) = allchk -c If we compute the checksum for diagnostic purposes, we let i be -c negative, so the result will not be stored in an array - if (i .gt. 0) sums(i) = allchk - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine synchup - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - include 'mpinpb.h' - integer ierr - call timer_start(T_synch) - call mpi_barrier(MPI_COMM_WORLD, ierr) - call timer_stop(T_synch) - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine verify (d1, d2, d3, nt, verified, class) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - include 'global.h' - include 'mpinpb.h' - integer d1, d2, d3, nt - character class - logical verified - integer ierr, size, i - double precision err, epsilon - -c--------------------------------------------------------------------- -c Reference checksums -c--------------------------------------------------------------------- - double complex csum_ref(25) - - - class = 'U' - - if (me .ne. 0) return - - epsilon = 1.0d-12 - verified = .FALSE. - - if (d1 .eq. 64 .and. - > d2 .eq. 64 .and. - > d3 .eq. 64 .and. - > nt .eq. 6) then -c--------------------------------------------------------------------- -c Sample size reference checksums -c--------------------------------------------------------------------- - class = 'S' - csum_ref(1) = dcmplx(5.546087004964D+02, 4.845363331978D+02) - csum_ref(2) = dcmplx(5.546385409189D+02, 4.865304269511D+02) - csum_ref(3) = dcmplx(5.546148406171D+02, 4.883910722336D+02) - csum_ref(4) = dcmplx(5.545423607415D+02, 4.901273169046D+02) - csum_ref(5) = dcmplx(5.544255039624D+02, 4.917475857993D+02) - csum_ref(6) = dcmplx(5.542683411902D+02, 4.932597244941D+02) - - else if (d1 .eq. 128 .and. - > d2 .eq. 128 .and. - > d3 .eq. 32 .and. - > nt .eq. 6) then -c--------------------------------------------------------------------- -c Class W size reference checksums -c--------------------------------------------------------------------- - class = 'W' - csum_ref(1) = dcmplx(5.673612178944D+02, 5.293246849175D+02) - csum_ref(2) = dcmplx(5.631436885271D+02, 5.282149986629D+02) - csum_ref(3) = dcmplx(5.594024089970D+02, 5.270996558037D+02) - csum_ref(4) = dcmplx(5.560698047020D+02, 5.260027904925D+02) - csum_ref(5) = dcmplx(5.530898991250D+02, 5.249400845633D+02) - csum_ref(6) = dcmplx(5.504159734538D+02, 5.239212247086D+02) - - else if (d1 .eq. 256 .and. - > d2 .eq. 256 .and. - > d3 .eq. 128 .and. - > nt .eq. 6) then -c--------------------------------------------------------------------- -c Class A size reference checksums -c--------------------------------------------------------------------- - class = 'A' - csum_ref(1) = dcmplx(5.046735008193D+02, 5.114047905510D+02) - csum_ref(2) = dcmplx(5.059412319734D+02, 5.098809666433D+02) - csum_ref(3) = dcmplx(5.069376896287D+02, 5.098144042213D+02) - csum_ref(4) = dcmplx(5.077892868474D+02, 5.101336130759D+02) - csum_ref(5) = dcmplx(5.085233095391D+02, 5.104914655194D+02) - csum_ref(6) = dcmplx(5.091487099959D+02, 5.107917842803D+02) - - else if (d1 .eq. 512 .and. - > d2 .eq. 256 .and. - > d3 .eq. 256 .and. - > nt .eq. 20) then -c--------------------------------------------------------------------- -c Class B size reference checksums -c--------------------------------------------------------------------- - class = 'B' - csum_ref(1) = dcmplx(5.177643571579D+02, 5.077803458597D+02) - csum_ref(2) = dcmplx(5.154521291263D+02, 5.088249431599D+02) - csum_ref(3) = dcmplx(5.146409228649D+02, 5.096208912659D+02) - csum_ref(4) = dcmplx(5.142378756213D+02, 5.101023387619D+02) - csum_ref(5) = dcmplx(5.139626667737D+02, 5.103976610617D+02) - csum_ref(6) = dcmplx(5.137423460082D+02, 5.105948019802D+02) - csum_ref(7) = dcmplx(5.135547056878D+02, 5.107404165783D+02) - csum_ref(8) = dcmplx(5.133910925466D+02, 5.108576573661D+02) - csum_ref(9) = dcmplx(5.132470705390D+02, 5.109577278523D+02) - csum_ref(10) = dcmplx(5.131197729984D+02, 5.110460304483D+02) - csum_ref(11) = dcmplx(5.130070319283D+02, 5.111252433800D+02) - csum_ref(12) = dcmplx(5.129070537032D+02, 5.111968077718D+02) - csum_ref(13) = dcmplx(5.128182883502D+02, 5.112616233064D+02) - csum_ref(14) = dcmplx(5.127393733383D+02, 5.113203605551D+02) - csum_ref(15) = dcmplx(5.126691062020D+02, 5.113735928093D+02) - csum_ref(16) = dcmplx(5.126064276004D+02, 5.114218460548D+02) - csum_ref(17) = dcmplx(5.125504076570D+02, 5.114656139760D+02) - csum_ref(18) = dcmplx(5.125002331720D+02, 5.115053595966D+02) - csum_ref(19) = dcmplx(5.124551951846D+02, 5.115415130407D+02) - csum_ref(20) = dcmplx(5.124146770029D+02, 5.115744692211D+02) - - else if (d1 .eq. 512 .and. - > d2 .eq. 512 .and. - > d3 .eq. 512 .and. - > nt .eq. 20) then -c--------------------------------------------------------------------- -c Class C size reference checksums -c--------------------------------------------------------------------- - class = 'C' - csum_ref(1) = dcmplx(5.195078707457D+02, 5.149019699238D+02) - csum_ref(2) = dcmplx(5.155422171134D+02, 5.127578201997D+02) - csum_ref(3) = dcmplx(5.144678022222D+02, 5.122251847514D+02) - csum_ref(4) = dcmplx(5.140150594328D+02, 5.121090289018D+02) - csum_ref(5) = dcmplx(5.137550426810D+02, 5.121143685824D+02) - csum_ref(6) = dcmplx(5.135811056728D+02, 5.121496764568D+02) - csum_ref(7) = dcmplx(5.134569343165D+02, 5.121870921893D+02) - csum_ref(8) = dcmplx(5.133651975661D+02, 5.122193250322D+02) - csum_ref(9) = dcmplx(5.132955192805D+02, 5.122454735794D+02) - csum_ref(10) = dcmplx(5.132410471738D+02, 5.122663649603D+02) - csum_ref(11) = dcmplx(5.131971141679D+02, 5.122830879827D+02) - csum_ref(12) = dcmplx(5.131605205716D+02, 5.122965869718D+02) - csum_ref(13) = dcmplx(5.131290734194D+02, 5.123075927445D+02) - csum_ref(14) = dcmplx(5.131012720314D+02, 5.123166486553D+02) - csum_ref(15) = dcmplx(5.130760908195D+02, 5.123241541685D+02) - csum_ref(16) = dcmplx(5.130528295923D+02, 5.123304037599D+02) - csum_ref(17) = dcmplx(5.130310107773D+02, 5.123356167976D+02) - csum_ref(18) = dcmplx(5.130103090133D+02, 5.123399592211D+02) - csum_ref(19) = dcmplx(5.129905029333D+02, 5.123435588985D+02) - csum_ref(20) = dcmplx(5.129714421109D+02, 5.123465164008D+02) - - else if (d1 .eq. 2048 .and. - > d2 .eq. 1024 .and. - > d3 .eq. 1024 .and. - > nt .eq. 25) then -c--------------------------------------------------------------------- -c Class D size reference checksums -c--------------------------------------------------------------------- - class = 'D' - csum_ref(1) = dcmplx(5.122230065252D+02, 5.118534037109D+02) - csum_ref(2) = dcmplx(5.120463975765D+02, 5.117061181082D+02) - csum_ref(3) = dcmplx(5.119865766760D+02, 5.117096364601D+02) - csum_ref(4) = dcmplx(5.119518799488D+02, 5.117373863950D+02) - csum_ref(5) = dcmplx(5.119269088223D+02, 5.117680347632D+02) - csum_ref(6) = dcmplx(5.119082416858D+02, 5.117967875532D+02) - csum_ref(7) = dcmplx(5.118943814638D+02, 5.118225281841D+02) - csum_ref(8) = dcmplx(5.118842385057D+02, 5.118451629348D+02) - csum_ref(9) = dcmplx(5.118769435632D+02, 5.118649119387D+02) - csum_ref(10) = dcmplx(5.118718203448D+02, 5.118820803844D+02) - csum_ref(11) = dcmplx(5.118683569061D+02, 5.118969781011D+02) - csum_ref(12) = dcmplx(5.118661708593D+02, 5.119098918835D+02) - csum_ref(13) = dcmplx(5.118649768950D+02, 5.119210777066D+02) - csum_ref(14) = dcmplx(5.118645605626D+02, 5.119307604484D+02) - csum_ref(15) = dcmplx(5.118647586618D+02, 5.119391362671D+02) - csum_ref(16) = dcmplx(5.118654451572D+02, 5.119463757241D+02) - csum_ref(17) = dcmplx(5.118665212451D+02, 5.119526269238D+02) - csum_ref(18) = dcmplx(5.118679083821D+02, 5.119580184108D+02) - csum_ref(19) = dcmplx(5.118695433664D+02, 5.119626617538D+02) - csum_ref(20) = dcmplx(5.118713748264D+02, 5.119666538138D+02) - csum_ref(21) = dcmplx(5.118733606701D+02, 5.119700787219D+02) - csum_ref(22) = dcmplx(5.118754661974D+02, 5.119730095953D+02) - csum_ref(23) = dcmplx(5.118776626738D+02, 5.119755100241D+02) - csum_ref(24) = dcmplx(5.118799262314D+02, 5.119776353561D+02) - csum_ref(25) = dcmplx(5.118822370068D+02, 5.119794338060D+02) - - else if (d1 .eq. 4096 .and. - > d2 .eq. 2048 .and. - > d3 .eq. 2048 .and. - > nt .eq. 25) then -c--------------------------------------------------------------------- -c Class E size reference checksums -c--------------------------------------------------------------------- - class = 'E' - csum_ref(1) = dcmplx(5.121601045346D+02, 5.117395998266D+02) - csum_ref(2) = dcmplx(5.120905403678D+02, 5.118614716182D+02) - csum_ref(3) = dcmplx(5.120623229306D+02, 5.119074203747D+02) - csum_ref(4) = dcmplx(5.120438418997D+02, 5.119345900733D+02) - csum_ref(5) = dcmplx(5.120311521872D+02, 5.119551325550D+02) - csum_ref(6) = dcmplx(5.120226088809D+02, 5.119720179919D+02) - csum_ref(7) = dcmplx(5.120169296534D+02, 5.119861371665D+02) - csum_ref(8) = dcmplx(5.120131225172D+02, 5.119979364402D+02) - csum_ref(9) = dcmplx(5.120104767108D+02, 5.120077674092D+02) - csum_ref(10) = dcmplx(5.120085127969D+02, 5.120159443121D+02) - csum_ref(11) = dcmplx(5.120069224127D+02, 5.120227453670D+02) - csum_ref(12) = dcmplx(5.120055158164D+02, 5.120284096041D+02) - csum_ref(13) = dcmplx(5.120041820159D+02, 5.120331373793D+02) - csum_ref(14) = dcmplx(5.120028605402D+02, 5.120370938679D+02) - csum_ref(15) = dcmplx(5.120015223011D+02, 5.120404138831D+02) - csum_ref(16) = dcmplx(5.120001570022D+02, 5.120432068837D+02) - csum_ref(17) = dcmplx(5.119987650555D+02, 5.120455615860D+02) - csum_ref(18) = dcmplx(5.119973525091D+02, 5.120475499442D+02) - csum_ref(19) = dcmplx(5.119959279472D+02, 5.120492304629D+02) - csum_ref(20) = dcmplx(5.119945006558D+02, 5.120506508902D+02) - csum_ref(21) = dcmplx(5.119930795911D+02, 5.120518503782D+02) - csum_ref(22) = dcmplx(5.119916728462D+02, 5.120528612016D+02) - csum_ref(23) = dcmplx(5.119902874185D+02, 5.120537101195D+02) - csum_ref(24) = dcmplx(5.119889291565D+02, 5.120544194514D+02) - csum_ref(25) = dcmplx(5.119876028049D+02, 5.120550079284D+02) - - endif - - - if (class .ne. 'U') then - - do i = 1, nt - err = abs( (sums(i) - csum_ref(i)) / csum_ref(i) ) - if (.not.(err .le. epsilon)) goto 100 - end do - verified = .TRUE. - 100 continue - - endif - - call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierr) - if (size .ne. np) then - write(*, 4010) np - write(*, 4011) - write(*, 4012) -c--------------------------------------------------------------------- -c multiple statements because some Fortran compilers have -c problems with long strings. -c--------------------------------------------------------------------- - 4010 format( ' Warning: benchmark was compiled for ', i5, - > 'processors') - 4011 format( ' Must be run on this many processors for official', - > ' verification') - 4012 format( ' so memory access is repeatable') - verified = .false. - endif - - if (class .ne. 'U') then - if (verified) then - write(*,2000) - 2000 format(' Result verification successful') - else - write(*,2001) - 2001 format(' Result verification failed') - endif - endif - print *, 'class = ', class - - return - end - - diff --git a/examples/smpi/NAS/FT/global.h b/examples/smpi/NAS/FT/global.h deleted file mode 100644 index 3e534bb48d..0000000000 --- a/examples/smpi/NAS/FT/global.h +++ /dev/null @@ -1,134 +0,0 @@ - include 'npbparams.h' - -c 2D processor array -> 2D grid decomposition (by pencils) -c If processor array is 1xN or -> 1D grid decomposition (by planes) -c If processor array is 1x1 -> 0D grid decomposition -c For simplicity, do not treat Nx1 (np2 = 1) specially - integer np1, np2, np - -c basic decomposition strategy - integer layout_type - integer layout_0D, layout_1D, layout_2D - parameter (layout_0D = 0, layout_1D = 1, layout_2D = 2) - - common /procgrid/ np1, np2, layout_type, np - - -c Cache blocking params. These values are good for most -c RISC processors. -c FFT parameters: -c fftblock controls how many ffts are done at a time. -c The default is appropriate for most cache-based machines -c On vector machines, the FFT can be vectorized with vector -c length equal to the block size, so the block size should -c be as large as possible. This is the size of the smallest -c dimension of the problem: 128 for class A, 256 for class B and -c 512 for class C. -c Transpose parameters: -c transblock is the blocking factor for the transposes when there -c is a 1-D layout. On vector machines it should probably be -c large (largest dimension of the problem). - - - integer fftblock_default, fftblockpad_default - parameter (fftblock_default=16, fftblockpad_default=18) - integer transblock, transblockpad - parameter(transblock=32, transblockpad=34) - - integer fftblock, fftblockpad - common /blockinfo/ fftblock, fftblockpad - -c we need a bunch of logic to keep track of how -c arrays are laid out. -c coords of this processor - integer me, me1, me2 - common /coords/ me, me1, me2 -c need a communicator for row/col in processor grid - integer commslice1, commslice2 - common /comms/ commslice1, commslice2 - - - -c There are basically three stages -c 1: x-y-z layout -c 2: after x-transform (before y) -c 3: after y-transform (before z) -c The computation proceeds logically as - -c set up initial conditions -c fftx(1) -c transpose (1->2) -c ffty(2) -c transpose (2->3) -c fftz(3) -c time evolution -c fftz(3) -c transpose (3->2) -c ffty(2) -c transpose (2->1) -c fftx(1) -c compute residual(1) - -c for the 0D, 1D, 2D strategies, the layouts look like xxx -c -c 0D 1D 2D -c 1: xyz xyz xyz -c 2: xyz xyz yxz -c 3: xyz zyx zxy - -c the array dimensions are stored in dims(coord, phase) - integer dims(3, 3) - integer xstart(3), ystart(3), zstart(3) - integer xend(3), yend(3), zend(3) - common /layout/ dims, - > xstart, ystart, zstart, - > xend, yend, zend - - integer T_total, T_setup, T_fft, T_evolve, T_checksum, - > T_fftlow, T_fftcopy, T_transpose, - > T_transxzloc, T_transxzglo, T_transxzfin, - > T_transxyloc, T_transxyglo, T_transxyfin, - > T_synch, T_max - parameter (T_total = 1, T_setup = 2, T_fft = 3, - > T_evolve = 4, T_checksum = 5, - > T_fftlow = 6, T_fftcopy = 7, T_transpose = 8, - > T_transxzloc = 9, T_transxzglo = 10, T_transxzfin = 11, - > T_transxyloc = 12, T_transxyglo = 13, - > T_transxyfin = 14, T_synch = 15, T_max = 15) - - - - logical timers_enabled - parameter (timers_enabled = .false.) - - - external timer_read - double precision timer_read - external ilog2 - integer ilog2 - - external randlc - double precision randlc - - -c other stuff - logical debug, debugsynch - common /dbg/ debug, debugsynch - - double precision seed, a, pi, alpha - parameter (seed = 314159265.d0, a = 1220703125.d0, - > pi = 3.141592653589793238d0, alpha=1.0d-6) - -c roots of unity array -c relies on x being largest dimension? - double complex u(nx) - common /ucomm/ u - - -c for checksum data - double complex sums(0:niter_default) - common /sumcomm/ sums - -c number of iterations - integer niter - common /iter/ niter diff --git a/examples/smpi/NAS/FT/inputft.data.sample b/examples/smpi/NAS/FT/inputft.data.sample deleted file mode 100644 index 448ac42bc0..0000000000 --- a/examples/smpi/NAS/FT/inputft.data.sample +++ /dev/null @@ -1,3 +0,0 @@ -6 ! number of iterations -2 ! layout type. 0 = 0d, 1 = 1d, 2 = 2d -2 4 ! processor layout. 0d must be "1 1"; 1d must be "1 N" diff --git a/examples/smpi/NAS/FT/mpinpb.h b/examples/smpi/NAS/FT/mpinpb.h deleted file mode 100644 index e43e552a84..0000000000 --- a/examples/smpi/NAS/FT/mpinpb.h +++ /dev/null @@ -1,4 +0,0 @@ - include 'mpif.h' -c mpi data types - integer dc_type - common /mpistuff/ dc_type diff --git a/examples/smpi/NAS/LU/Makefile b/examples/smpi/NAS/LU/Makefile deleted file mode 100644 index a05c94dc4a..0000000000 --- a/examples/smpi/NAS/LU/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -SHELL=/bin/sh -BENCHMARK=lu -BENCHMARKU=LU -VEC= - -include ../config/make.def - -OBJS = lu.o init_comm.o read_input.o bcast_inputs.o proc_grid.o neighbors.o \ - nodedim.o subdomain.o setcoeff.o sethyper.o setbv.o exact.o setiv.o \ - erhs.o ssor.o exchange_1.o exchange_3.o exchange_4.o exchange_5.o \ - exchange_6.o rhs.o l2norm.o jacld.o blts$(VEC).o jacu.o buts$(VEC).o \ - error.o pintgr.o verify.o ${COMMON}/print_results.o ${COMMON}/timers.o - -include ../sys/make.common - - -# npbparams.h is included by applu.incl -# The following rule should do the trick but many make programs (not gmake) -# will do the wrong thing and rebuild the world every time (because the -# mod time on header.h is not changed. One solution would be to -# touch header.h but this might cause confusion if someone has -# accidentally deleted it. Instead, make the dependency on npbparams.h -# explicit in all the lines below (even though dependence is indirect). - -# applu.incl: npbparams.h - -${PROGRAM}: config - @if [ x$(VERSION) = xvec ] ; then \ - ${MAKE} VEC=_vec exec; \ - elif [ x$(VERSION) = xVEC ] ; then \ - ${MAKE} VEC=_vec exec; \ - else \ - ${MAKE} exec; \ - fi - -exec: $(OBJS) - ${FLINK} ${FLINKFLAGS} -o ${PROGRAM} ${OBJS} ${FMPI_LIB} - -.f.o : - ${FCOMPILE} $< - -lu.o: lu.f applu.incl npbparams.h -bcast_inputs.o: bcast_inputs.f applu.incl npbparams.h mpinpb.h -blts$(VEC).o: blts$(VEC).f -buts$(VEC).o: buts$(VEC).f -erhs.o: erhs.f applu.incl npbparams.h -error.o: error.f applu.incl npbparams.h mpinpb.h -exact.o: exact.f applu.incl npbparams.h -exchange_1.o: exchange_1.f applu.incl npbparams.h mpinpb.h -exchange_3.o: exchange_3.f applu.incl npbparams.h mpinpb.h -exchange_4.o: exchange_4.f applu.incl npbparams.h mpinpb.h -exchange_5.o: exchange_5.f applu.incl npbparams.h mpinpb.h -exchange_6.o: exchange_6.f applu.incl npbparams.h mpinpb.h -init_comm.o: init_comm.f applu.incl npbparams.h mpinpb.h -jacld.o: jacld.f applu.incl npbparams.h -jacu.o: jacu.f applu.incl npbparams.h -l2norm.o: l2norm.f mpinpb.h -neighbors.o: neighbors.f applu.incl npbparams.h -nodedim.o: nodedim.f -pintgr.o: pintgr.f applu.incl npbparams.h mpinpb.h -proc_grid.o: proc_grid.f applu.incl npbparams.h -read_input.o: read_input.f applu.incl npbparams.h mpinpb.h -rhs.o: rhs.f applu.incl npbparams.h -setbv.o: setbv.f applu.incl npbparams.h -setiv.o: setiv.f applu.incl npbparams.h -setcoeff.o: setcoeff.f applu.incl npbparams.h -sethyper.o: sethyper.f applu.incl npbparams.h -ssor.o: ssor.f applu.incl npbparams.h mpinpb.h -subdomain.o: subdomain.f applu.incl npbparams.h mpinpb.h -verify.o: verify.f applu.incl npbparams.h - -clean: - - /bin/rm -f npbparams.h - - /bin/rm -f *.o *~ diff --git a/examples/smpi/NAS/LU/applu.incl b/examples/smpi/NAS/LU/applu.incl deleted file mode 100644 index 413fc834e3..0000000000 --- a/examples/smpi/NAS/LU/applu.incl +++ /dev/null @@ -1,153 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- -c--- applu.incl -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c npbparams.h defines parameters that depend on the class and -c number of nodes -c--------------------------------------------------------------------- - - include 'npbparams.h' - -c--------------------------------------------------------------------- -c parameters which can be overridden in runtime config file -c (in addition to size of problem - isiz01,02,03 give the maximum size) -c ipr = 1 to print out verbose information -c omega = 2.0 is correct for all classes -c tolrsd is tolerance levels for steady state residuals -c--------------------------------------------------------------------- - integer ipr_default - parameter (ipr_default = 1) - double precision omega_default - parameter (omega_default = 1.2d0) - double precision tolrsd1_def, tolrsd2_def, tolrsd3_def, - > tolrsd4_def, tolrsd5_def - parameter (tolrsd1_def=1.0e-08, - > tolrsd2_def=1.0e-08, tolrsd3_def=1.0e-08, - > tolrsd4_def=1.0e-08, tolrsd5_def=1.0e-08) - - double precision c1, c2, c3, c4, c5 - parameter( c1 = 1.40d+00, c2 = 0.40d+00, - > c3 = 1.00d-01, c4 = 1.00d+00, - > c5 = 1.40d+00 ) - -c--------------------------------------------------------------------- -c grid -c--------------------------------------------------------------------- - integer nx, ny, nz - integer nx0, ny0, nz0 - integer ipt, ist, iend - integer jpt, jst, jend - integer ii1, ii2 - integer ji1, ji2 - integer ki1, ki2 - double precision dxi, deta, dzeta - double precision tx1, tx2, tx3 - double precision ty1, ty2, ty3 - double precision tz1, tz2, tz3 - - common/cgcon/ dxi, deta, dzeta, - > tx1, tx2, tx3, - > ty1, ty2, ty3, - > tz1, tz2, tz3, - > nx, ny, nz, - > nx0, ny0, nz0, - > ipt, ist, iend, - > jpt, jst, jend, - > ii1, ii2, - > ji1, ji2, - > ki1, ki2 - -c--------------------------------------------------------------------- -c dissipation -c--------------------------------------------------------------------- - double precision dx1, dx2, dx3, dx4, dx5 - double precision dy1, dy2, dy3, dy4, dy5 - double precision dz1, dz2, dz3, dz4, dz5 - double precision dssp - - common/disp/ dx1,dx2,dx3,dx4,dx5, - > dy1,dy2,dy3,dy4,dy5, - > dz1,dz2,dz3,dz4,dz5, - > dssp - -c--------------------------------------------------------------------- -c field variables and residuals -c--------------------------------------------------------------------- - double precision u(5,-1:isiz1+2,-1:isiz2+2,isiz3), - > rsd(5,-1:isiz1+2,-1:isiz2+2,isiz3), - > frct(5,-1:isiz1+2,-1:isiz2+2,isiz3), - > flux(5,0:isiz1+1,0:isiz2+1,isiz3) - - common/cvar/ u, - > rsd, - > frct, - > flux - - -c--------------------------------------------------------------------- -c output control parameters -c--------------------------------------------------------------------- - integer ipr, inorm - - common/cprcon/ ipr, inorm - -c--------------------------------------------------------------------- -c newton-raphson iteration control parameters -c--------------------------------------------------------------------- - integer itmax, invert - double precision dt, omega, tolrsd(5), - > rsdnm(5), errnm(5), frc, ttotal - - common/ctscon/ dt, omega, tolrsd, - > rsdnm, errnm, frc, ttotal, - > itmax, invert - - double precision a(5,5,isiz1,isiz2), - > b(5,5,isiz1,isiz2), - > c(5,5,isiz1,isiz2), - > d(5,5,isiz1,isiz2) - - common/cjac/ a, b, c, d - -c--------------------------------------------------------------------- -c coefficients of the exact solution -c--------------------------------------------------------------------- - double precision ce(5,13) - - common/cexact/ ce - -c--------------------------------------------------------------------- -c multi-processor common blocks -c--------------------------------------------------------------------- - integer id, ndim, num, xdim, ydim, row, col - common/dim/ id,ndim,num,xdim,ydim,row,col - - integer north,south,east,west - common/neigh/ north,south,east, west - - integer from_s,from_n,from_e,from_w - parameter (from_s=1,from_n=2,from_e=3,from_w=4) - - integer npmax - parameter (npmax=isiz01+isiz02) - - logical icommn(npmax+1),icomms(npmax+1), - > icomme(npmax+1),icommw(npmax+1) - double precision buf(5,2*isiz2*isiz3), - > buf1(5,2*isiz2*isiz3) - - common/comm/ buf, buf1, - > icommn,icomms, - > icomme,icommw - - double precision maxtime - common/timer/maxtime - - -c--------------------------------------------------------------------- -c end of include file -c--------------------------------------------------------------------- diff --git a/examples/smpi/NAS/LU/bcast_inputs.f b/examples/smpi/NAS/LU/bcast_inputs.f deleted file mode 100644 index c606724bec..0000000000 --- a/examples/smpi/NAS/LU/bcast_inputs.f +++ /dev/null @@ -1,41 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine bcast_inputs - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - include 'applu.incl' - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer ierr - -c--------------------------------------------------------------------- -c root broadcasts the data -c The data isn't contiguous or of the same type, so it's not -c clear how to send it in the "MPI" way. -c We could pack the info into a buffer or we could create -c an obscene datatype to handle it all at once. Since we only -c broadcast the data once, just use a separate broadcast for -c each piece. -c--------------------------------------------------------------------- - call MPI_BCAST(ipr, 1, MPI_INTEGER, root, MPI_COMM_WORLD, ierr) - call MPI_BCAST(inorm, 1, MPI_INTEGER, root, MPI_COMM_WORLD, ierr) - call MPI_BCAST(itmax, 1, MPI_INTEGER, root, MPI_COMM_WORLD, ierr) - call MPI_BCAST(dt, 1, dp_type, root, MPI_COMM_WORLD, ierr) - call MPI_BCAST(omega, 1, dp_type, root, MPI_COMM_WORLD, ierr) - call MPI_BCAST(tolrsd, 5, dp_type, root, MPI_COMM_WORLD, ierr) - call MPI_BCAST(nx0, 1, MPI_INTEGER, root, MPI_COMM_WORLD, ierr) - call MPI_BCAST(ny0, 1, MPI_INTEGER, root, MPI_COMM_WORLD, ierr) - call MPI_BCAST(nz0, 1, MPI_INTEGER, root, MPI_COMM_WORLD, ierr) - - return - end - - diff --git a/examples/smpi/NAS/LU/blts.f b/examples/smpi/NAS/LU/blts.f deleted file mode 100644 index 9861261b03..0000000000 --- a/examples/smpi/NAS/LU/blts.f +++ /dev/null @@ -1,261 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine blts ( ldmx, ldmy, ldmz, - > nx, ny, nz, k, - > omega, - > v, - > ldz, ldy, ldx, d, - > ist, iend, jst, jend, - > nx0, ny0, ipt, jpt) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c compute the regular-sparse, block lower triangular solution: -c -c v <-- ( L-inv ) * v -c -c--------------------------------------------------------------------- - - implicit none - -c--------------------------------------------------------------------- -c input parameters -c--------------------------------------------------------------------- - integer ldmx, ldmy, ldmz - integer nx, ny, nz - integer k - double precision omega - double precision v( 5, -1:ldmx+2, -1:ldmy+2, *), - > ldz( 5, 5, ldmx, ldmy), - > ldy( 5, 5, ldmx, ldmy), - > ldx( 5, 5, ldmx, ldmy), - > d( 5, 5, ldmx, ldmy) - integer ist, iend - integer jst, jend - integer nx0, ny0 - integer ipt, jpt - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j, m - integer iex - double precision tmp, tmp1 - double precision tmat(5,5) - - -c--------------------------------------------------------------------- -c receive data from north and west -c--------------------------------------------------------------------- - iex = 0 - call exchange_1( v,k,iex ) - - - do j = jst, jend - do i = ist, iend - do m = 1, 5 - - v( m, i, j, k ) = v( m, i, j, k ) - > - omega * ( ldz( m, 1, i, j ) * v( 1, i, j, k-1 ) - > + ldz( m, 2, i, j ) * v( 2, i, j, k-1 ) - > + ldz( m, 3, i, j ) * v( 3, i, j, k-1 ) - > + ldz( m, 4, i, j ) * v( 4, i, j, k-1 ) - > + ldz( m, 5, i, j ) * v( 5, i, j, k-1 ) ) - - end do - end do - end do - - - do j=jst,jend - do i = ist, iend - - do m = 1, 5 - - v( m, i, j, k ) = v( m, i, j, k ) - > - omega * ( ldy( m, 1, i, j ) * v( 1, i, j-1, k ) - > + ldx( m, 1, i, j ) * v( 1, i-1, j, k ) - > + ldy( m, 2, i, j ) * v( 2, i, j-1, k ) - > + ldx( m, 2, i, j ) * v( 2, i-1, j, k ) - > + ldy( m, 3, i, j ) * v( 3, i, j-1, k ) - > + ldx( m, 3, i, j ) * v( 3, i-1, j, k ) - > + ldy( m, 4, i, j ) * v( 4, i, j-1, k ) - > + ldx( m, 4, i, j ) * v( 4, i-1, j, k ) - > + ldy( m, 5, i, j ) * v( 5, i, j-1, k ) - > + ldx( m, 5, i, j ) * v( 5, i-1, j, k ) ) - - end do - -c--------------------------------------------------------------------- -c diagonal block inversion -c -c forward elimination -c--------------------------------------------------------------------- - do m = 1, 5 - tmat( m, 1 ) = d( m, 1, i, j ) - tmat( m, 2 ) = d( m, 2, i, j ) - tmat( m, 3 ) = d( m, 3, i, j ) - tmat( m, 4 ) = d( m, 4, i, j ) - tmat( m, 5 ) = d( m, 5, i, j ) - end do - - tmp1 = 1.0d+00 / tmat( 1, 1 ) - tmp = tmp1 * tmat( 2, 1 ) - tmat( 2, 2 ) = tmat( 2, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 2, 3 ) = tmat( 2, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 2, 4 ) = tmat( 2, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 2, 5 ) = tmat( 2, 5 ) - > - tmp * tmat( 1, 5 ) - v( 2, i, j, k ) = v( 2, i, j, k ) - > - v( 1, i, j, k ) * tmp - - tmp = tmp1 * tmat( 3, 1 ) - tmat( 3, 2 ) = tmat( 3, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 3, 3 ) = tmat( 3, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 3, 4 ) = tmat( 3, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 3, 5 ) = tmat( 3, 5 ) - > - tmp * tmat( 1, 5 ) - v( 3, i, j, k ) = v( 3, i, j, k ) - > - v( 1, i, j, k ) * tmp - - tmp = tmp1 * tmat( 4, 1 ) - tmat( 4, 2 ) = tmat( 4, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 4, 3 ) = tmat( 4, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 4, 4 ) = tmat( 4, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 4, 5 ) = tmat( 4, 5 ) - > - tmp * tmat( 1, 5 ) - v( 4, i, j, k ) = v( 4, i, j, k ) - > - v( 1, i, j, k ) * tmp - - tmp = tmp1 * tmat( 5, 1 ) - tmat( 5, 2 ) = tmat( 5, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 5, 3 ) = tmat( 5, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 5, 4 ) = tmat( 5, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 1, 5 ) - v( 5, i, j, k ) = v( 5, i, j, k ) - > - v( 1, i, j, k ) * tmp - - - - tmp1 = 1.0d+00 / tmat( 2, 2 ) - tmp = tmp1 * tmat( 3, 2 ) - tmat( 3, 3 ) = tmat( 3, 3 ) - > - tmp * tmat( 2, 3 ) - tmat( 3, 4 ) = tmat( 3, 4 ) - > - tmp * tmat( 2, 4 ) - tmat( 3, 5 ) = tmat( 3, 5 ) - > - tmp * tmat( 2, 5 ) - v( 3, i, j, k ) = v( 3, i, j, k ) - > - v( 2, i, j, k ) * tmp - - tmp = tmp1 * tmat( 4, 2 ) - tmat( 4, 3 ) = tmat( 4, 3 ) - > - tmp * tmat( 2, 3 ) - tmat( 4, 4 ) = tmat( 4, 4 ) - > - tmp * tmat( 2, 4 ) - tmat( 4, 5 ) = tmat( 4, 5 ) - > - tmp * tmat( 2, 5 ) - v( 4, i, j, k ) = v( 4, i, j, k ) - > - v( 2, i, j, k ) * tmp - - tmp = tmp1 * tmat( 5, 2 ) - tmat( 5, 3 ) = tmat( 5, 3 ) - > - tmp * tmat( 2, 3 ) - tmat( 5, 4 ) = tmat( 5, 4 ) - > - tmp * tmat( 2, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 2, 5 ) - v( 5, i, j, k ) = v( 5, i, j, k ) - > - v( 2, i, j, k ) * tmp - - - - tmp1 = 1.0d+00 / tmat( 3, 3 ) - tmp = tmp1 * tmat( 4, 3 ) - tmat( 4, 4 ) = tmat( 4, 4 ) - > - tmp * tmat( 3, 4 ) - tmat( 4, 5 ) = tmat( 4, 5 ) - > - tmp * tmat( 3, 5 ) - v( 4, i, j, k ) = v( 4, i, j, k ) - > - v( 3, i, j, k ) * tmp - - tmp = tmp1 * tmat( 5, 3 ) - tmat( 5, 4 ) = tmat( 5, 4 ) - > - tmp * tmat( 3, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 3, 5 ) - v( 5, i, j, k ) = v( 5, i, j, k ) - > - v( 3, i, j, k ) * tmp - - - - tmp1 = 1.0d+00 / tmat( 4, 4 ) - tmp = tmp1 * tmat( 5, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 4, 5 ) - v( 5, i, j, k ) = v( 5, i, j, k ) - > - v( 4, i, j, k ) * tmp - -c--------------------------------------------------------------------- -c back substitution -c--------------------------------------------------------------------- - v( 5, i, j, k ) = v( 5, i, j, k ) - > / tmat( 5, 5 ) - - v( 4, i, j, k ) = v( 4, i, j, k ) - > - tmat( 4, 5 ) * v( 5, i, j, k ) - v( 4, i, j, k ) = v( 4, i, j, k ) - > / tmat( 4, 4 ) - - v( 3, i, j, k ) = v( 3, i, j, k ) - > - tmat( 3, 4 ) * v( 4, i, j, k ) - > - tmat( 3, 5 ) * v( 5, i, j, k ) - v( 3, i, j, k ) = v( 3, i, j, k ) - > / tmat( 3, 3 ) - - v( 2, i, j, k ) = v( 2, i, j, k ) - > - tmat( 2, 3 ) * v( 3, i, j, k ) - > - tmat( 2, 4 ) * v( 4, i, j, k ) - > - tmat( 2, 5 ) * v( 5, i, j, k ) - v( 2, i, j, k ) = v( 2, i, j, k ) - > / tmat( 2, 2 ) - - v( 1, i, j, k ) = v( 1, i, j, k ) - > - tmat( 1, 2 ) * v( 2, i, j, k ) - > - tmat( 1, 3 ) * v( 3, i, j, k ) - > - tmat( 1, 4 ) * v( 4, i, j, k ) - > - tmat( 1, 5 ) * v( 5, i, j, k ) - v( 1, i, j, k ) = v( 1, i, j, k ) - > / tmat( 1, 1 ) - - - enddo - enddo - -c--------------------------------------------------------------------- -c send data to east and south -c--------------------------------------------------------------------- - iex = 2 - call exchange_1( v,k,iex ) - - return - end - - diff --git a/examples/smpi/NAS/LU/blts_vec.f b/examples/smpi/NAS/LU/blts_vec.f deleted file mode 100644 index f90ea84560..0000000000 --- a/examples/smpi/NAS/LU/blts_vec.f +++ /dev/null @@ -1,334 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine blts ( ldmx, ldmy, ldmz, - > nx, ny, nz, k, - > omega, - > v, - > ldz, ldy, ldx, d, - > ist, iend, jst, jend, - > nx0, ny0, ipt, jpt) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c compute the regular-sparse, block lower triangular solution: -c -c v <-- ( L-inv ) * v -c -c--------------------------------------------------------------------- - - implicit none - -c--------------------------------------------------------------------- -c input parameters -c--------------------------------------------------------------------- - integer ldmx, ldmy, ldmz - integer nx, ny, nz - integer k - double precision omega - double precision v( 5, -1:ldmx+2, -1:ldmy+2, *), - > ldz( 5, 5, ldmx, ldmy), - > ldy( 5, 5, ldmx, ldmy), - > ldx( 5, 5, ldmx, ldmy), - > d( 5, 5, ldmx, ldmy) - integer ist, iend - integer jst, jend - integer nx0, ny0 - integer ipt, jpt - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j, m, l, istp, iendp - integer iex - double precision tmp, tmp1 - double precision tmat(5,5) - - -c--------------------------------------------------------------------- -c receive data from north and west -c--------------------------------------------------------------------- - iex = 0 - call exchange_1( v,k,iex ) - - - do j = jst, jend - do i = ist, iend - do m = 1, 5 - - v( m, i, j, k ) = v( m, i, j, k ) - > - omega * ( ldz( m, 1, i, j ) * v( 1, i, j, k-1 ) - > + ldz( m, 2, i, j ) * v( 2, i, j, k-1 ) - > + ldz( m, 3, i, j ) * v( 3, i, j, k-1 ) - > + ldz( m, 4, i, j ) * v( 4, i, j, k-1 ) - > + ldz( m, 5, i, j ) * v( 5, i, j, k-1 ) ) - - end do - end do - end do - - - do l = ist+jst, iend+jend - istp = max(l - jend, ist) - iendp = min(l - jst, iend) - -!dir$ ivdep - do i = istp, iendp - j = l - i - -!!dir$ unroll 5 -! manually unroll the loop -! do m = 1, 5 - - v( 1, i, j, k ) = v( 1, i, j, k ) - > - omega * ( ldy( 1, 1, i, j ) * v( 1, i, j-1, k ) - > + ldx( 1, 1, i, j ) * v( 1, i-1, j, k ) - > + ldy( 1, 2, i, j ) * v( 2, i, j-1, k ) - > + ldx( 1, 2, i, j ) * v( 2, i-1, j, k ) - > + ldy( 1, 3, i, j ) * v( 3, i, j-1, k ) - > + ldx( 1, 3, i, j ) * v( 3, i-1, j, k ) - > + ldy( 1, 4, i, j ) * v( 4, i, j-1, k ) - > + ldx( 1, 4, i, j ) * v( 4, i-1, j, k ) - > + ldy( 1, 5, i, j ) * v( 5, i, j-1, k ) - > + ldx( 1, 5, i, j ) * v( 5, i-1, j, k ) ) - v( 2, i, j, k ) = v( 2, i, j, k ) - > - omega * ( ldy( 2, 1, i, j ) * v( 1, i, j-1, k ) - > + ldx( 2, 1, i, j ) * v( 1, i-1, j, k ) - > + ldy( 2, 2, i, j ) * v( 2, i, j-1, k ) - > + ldx( 2, 2, i, j ) * v( 2, i-1, j, k ) - > + ldy( 2, 3, i, j ) * v( 3, i, j-1, k ) - > + ldx( 2, 3, i, j ) * v( 3, i-1, j, k ) - > + ldy( 2, 4, i, j ) * v( 4, i, j-1, k ) - > + ldx( 2, 4, i, j ) * v( 4, i-1, j, k ) - > + ldy( 2, 5, i, j ) * v( 5, i, j-1, k ) - > + ldx( 2, 5, i, j ) * v( 5, i-1, j, k ) ) - v( 3, i, j, k ) = v( 3, i, j, k ) - > - omega * ( ldy( 3, 1, i, j ) * v( 1, i, j-1, k ) - > + ldx( 3, 1, i, j ) * v( 1, i-1, j, k ) - > + ldy( 3, 2, i, j ) * v( 2, i, j-1, k ) - > + ldx( 3, 2, i, j ) * v( 2, i-1, j, k ) - > + ldy( 3, 3, i, j ) * v( 3, i, j-1, k ) - > + ldx( 3, 3, i, j ) * v( 3, i-1, j, k ) - > + ldy( 3, 4, i, j ) * v( 4, i, j-1, k ) - > + ldx( 3, 4, i, j ) * v( 4, i-1, j, k ) - > + ldy( 3, 5, i, j ) * v( 5, i, j-1, k ) - > + ldx( 3, 5, i, j ) * v( 5, i-1, j, k ) ) - v( 4, i, j, k ) = v( 4, i, j, k ) - > - omega * ( ldy( 4, 1, i, j ) * v( 1, i, j-1, k ) - > + ldx( 4, 1, i, j ) * v( 1, i-1, j, k ) - > + ldy( 4, 2, i, j ) * v( 2, i, j-1, k ) - > + ldx( 4, 2, i, j ) * v( 2, i-1, j, k ) - > + ldy( 4, 3, i, j ) * v( 3, i, j-1, k ) - > + ldx( 4, 3, i, j ) * v( 3, i-1, j, k ) - > + ldy( 4, 4, i, j ) * v( 4, i, j-1, k ) - > + ldx( 4, 4, i, j ) * v( 4, i-1, j, k ) - > + ldy( 4, 5, i, j ) * v( 5, i, j-1, k ) - > + ldx( 4, 5, i, j ) * v( 5, i-1, j, k ) ) - v( 5, i, j, k ) = v( 5, i, j, k ) - > - omega * ( ldy( 5, 1, i, j ) * v( 1, i, j-1, k ) - > + ldx( 5, 1, i, j ) * v( 1, i-1, j, k ) - > + ldy( 5, 2, i, j ) * v( 2, i, j-1, k ) - > + ldx( 5, 2, i, j ) * v( 2, i-1, j, k ) - > + ldy( 5, 3, i, j ) * v( 3, i, j-1, k ) - > + ldx( 5, 3, i, j ) * v( 3, i-1, j, k ) - > + ldy( 5, 4, i, j ) * v( 4, i, j-1, k ) - > + ldx( 5, 4, i, j ) * v( 4, i-1, j, k ) - > + ldy( 5, 5, i, j ) * v( 5, i, j-1, k ) - > + ldx( 5, 5, i, j ) * v( 5, i-1, j, k ) ) - -! end do - -c--------------------------------------------------------------------- -c diagonal block inversion -c -c forward elimination -c--------------------------------------------------------------------- -!!dir$ unroll 5 -! manually unroll the loop -! do m = 1, 5 - tmat( 1, 1 ) = d( 1, 1, i, j ) - tmat( 1, 2 ) = d( 1, 2, i, j ) - tmat( 1, 3 ) = d( 1, 3, i, j ) - tmat( 1, 4 ) = d( 1, 4, i, j ) - tmat( 1, 5 ) = d( 1, 5, i, j ) - tmat( 2, 1 ) = d( 2, 1, i, j ) - tmat( 2, 2 ) = d( 2, 2, i, j ) - tmat( 2, 3 ) = d( 2, 3, i, j ) - tmat( 2, 4 ) = d( 2, 4, i, j ) - tmat( 2, 5 ) = d( 2, 5, i, j ) - tmat( 3, 1 ) = d( 3, 1, i, j ) - tmat( 3, 2 ) = d( 3, 2, i, j ) - tmat( 3, 3 ) = d( 3, 3, i, j ) - tmat( 3, 4 ) = d( 3, 4, i, j ) - tmat( 3, 5 ) = d( 3, 5, i, j ) - tmat( 4, 1 ) = d( 4, 1, i, j ) - tmat( 4, 2 ) = d( 4, 2, i, j ) - tmat( 4, 3 ) = d( 4, 3, i, j ) - tmat( 4, 4 ) = d( 4, 4, i, j ) - tmat( 4, 5 ) = d( 4, 5, i, j ) - tmat( 5, 1 ) = d( 5, 1, i, j ) - tmat( 5, 2 ) = d( 5, 2, i, j ) - tmat( 5, 3 ) = d( 5, 3, i, j ) - tmat( 5, 4 ) = d( 5, 4, i, j ) - tmat( 5, 5 ) = d( 5, 5, i, j ) -! end do - - tmp1 = 1.0d+00 / tmat( 1, 1 ) - tmp = tmp1 * tmat( 2, 1 ) - tmat( 2, 2 ) = tmat( 2, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 2, 3 ) = tmat( 2, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 2, 4 ) = tmat( 2, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 2, 5 ) = tmat( 2, 5 ) - > - tmp * tmat( 1, 5 ) - v( 2, i, j, k ) = v( 2, i, j, k ) - > - v( 1, i, j, k ) * tmp - - tmp = tmp1 * tmat( 3, 1 ) - tmat( 3, 2 ) = tmat( 3, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 3, 3 ) = tmat( 3, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 3, 4 ) = tmat( 3, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 3, 5 ) = tmat( 3, 5 ) - > - tmp * tmat( 1, 5 ) - v( 3, i, j, k ) = v( 3, i, j, k ) - > - v( 1, i, j, k ) * tmp - - tmp = tmp1 * tmat( 4, 1 ) - tmat( 4, 2 ) = tmat( 4, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 4, 3 ) = tmat( 4, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 4, 4 ) = tmat( 4, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 4, 5 ) = tmat( 4, 5 ) - > - tmp * tmat( 1, 5 ) - v( 4, i, j, k ) = v( 4, i, j, k ) - > - v( 1, i, j, k ) * tmp - - tmp = tmp1 * tmat( 5, 1 ) - tmat( 5, 2 ) = tmat( 5, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 5, 3 ) = tmat( 5, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 5, 4 ) = tmat( 5, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 1, 5 ) - v( 5, i, j, k ) = v( 5, i, j, k ) - > - v( 1, i, j, k ) * tmp - - - - tmp1 = 1.0d+00 / tmat( 2, 2 ) - tmp = tmp1 * tmat( 3, 2 ) - tmat( 3, 3 ) = tmat( 3, 3 ) - > - tmp * tmat( 2, 3 ) - tmat( 3, 4 ) = tmat( 3, 4 ) - > - tmp * tmat( 2, 4 ) - tmat( 3, 5 ) = tmat( 3, 5 ) - > - tmp * tmat( 2, 5 ) - v( 3, i, j, k ) = v( 3, i, j, k ) - > - v( 2, i, j, k ) * tmp - - tmp = tmp1 * tmat( 4, 2 ) - tmat( 4, 3 ) = tmat( 4, 3 ) - > - tmp * tmat( 2, 3 ) - tmat( 4, 4 ) = tmat( 4, 4 ) - > - tmp * tmat( 2, 4 ) - tmat( 4, 5 ) = tmat( 4, 5 ) - > - tmp * tmat( 2, 5 ) - v( 4, i, j, k ) = v( 4, i, j, k ) - > - v( 2, i, j, k ) * tmp - - tmp = tmp1 * tmat( 5, 2 ) - tmat( 5, 3 ) = tmat( 5, 3 ) - > - tmp * tmat( 2, 3 ) - tmat( 5, 4 ) = tmat( 5, 4 ) - > - tmp * tmat( 2, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 2, 5 ) - v( 5, i, j, k ) = v( 5, i, j, k ) - > - v( 2, i, j, k ) * tmp - - - - tmp1 = 1.0d+00 / tmat( 3, 3 ) - tmp = tmp1 * tmat( 4, 3 ) - tmat( 4, 4 ) = tmat( 4, 4 ) - > - tmp * tmat( 3, 4 ) - tmat( 4, 5 ) = tmat( 4, 5 ) - > - tmp * tmat( 3, 5 ) - v( 4, i, j, k ) = v( 4, i, j, k ) - > - v( 3, i, j, k ) * tmp - - tmp = tmp1 * tmat( 5, 3 ) - tmat( 5, 4 ) = tmat( 5, 4 ) - > - tmp * tmat( 3, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 3, 5 ) - v( 5, i, j, k ) = v( 5, i, j, k ) - > - v( 3, i, j, k ) * tmp - - - - tmp1 = 1.0d+00 / tmat( 4, 4 ) - tmp = tmp1 * tmat( 5, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 4, 5 ) - v( 5, i, j, k ) = v( 5, i, j, k ) - > - v( 4, i, j, k ) * tmp - -c--------------------------------------------------------------------- -c back substitution -c--------------------------------------------------------------------- - v( 5, i, j, k ) = v( 5, i, j, k ) - > / tmat( 5, 5 ) - - v( 4, i, j, k ) = v( 4, i, j, k ) - > - tmat( 4, 5 ) * v( 5, i, j, k ) - v( 4, i, j, k ) = v( 4, i, j, k ) - > / tmat( 4, 4 ) - - v( 3, i, j, k ) = v( 3, i, j, k ) - > - tmat( 3, 4 ) * v( 4, i, j, k ) - > - tmat( 3, 5 ) * v( 5, i, j, k ) - v( 3, i, j, k ) = v( 3, i, j, k ) - > / tmat( 3, 3 ) - - v( 2, i, j, k ) = v( 2, i, j, k ) - > - tmat( 2, 3 ) * v( 3, i, j, k ) - > - tmat( 2, 4 ) * v( 4, i, j, k ) - > - tmat( 2, 5 ) * v( 5, i, j, k ) - v( 2, i, j, k ) = v( 2, i, j, k ) - > / tmat( 2, 2 ) - - v( 1, i, j, k ) = v( 1, i, j, k ) - > - tmat( 1, 2 ) * v( 2, i, j, k ) - > - tmat( 1, 3 ) * v( 3, i, j, k ) - > - tmat( 1, 4 ) * v( 4, i, j, k ) - > - tmat( 1, 5 ) * v( 5, i, j, k ) - v( 1, i, j, k ) = v( 1, i, j, k ) - > / tmat( 1, 1 ) - - - enddo - enddo - -c--------------------------------------------------------------------- -c send data to east and south -c--------------------------------------------------------------------- - iex = 2 - call exchange_1( v,k,iex ) - - return - end - - diff --git a/examples/smpi/NAS/LU/buts.f b/examples/smpi/NAS/LU/buts.f deleted file mode 100644 index a6fc3d6217..0000000000 --- a/examples/smpi/NAS/LU/buts.f +++ /dev/null @@ -1,259 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine buts( ldmx, ldmy, ldmz, - > nx, ny, nz, k, - > omega, - > v, tv, - > d, udx, udy, udz, - > ist, iend, jst, jend, - > nx0, ny0, ipt, jpt ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c compute the regular-sparse, block upper triangular solution: -c -c v <-- ( U-inv ) * v -c -c--------------------------------------------------------------------- - - implicit none - -c--------------------------------------------------------------------- -c input parameters -c--------------------------------------------------------------------- - integer ldmx, ldmy, ldmz - integer nx, ny, nz - integer k - double precision omega - double precision v( 5, -1:ldmx+2, -1:ldmy+2, *), - > tv(5, ldmx, ldmy), - > d( 5, 5, ldmx, ldmy), - > udx( 5, 5, ldmx, ldmy), - > udy( 5, 5, ldmx, ldmy), - > udz( 5, 5, ldmx, ldmy ) - integer ist, iend - integer jst, jend - integer nx0, ny0 - integer ipt, jpt - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j, m - integer iex - double precision tmp, tmp1 - double precision tmat(5,5) - - -c--------------------------------------------------------------------- -c receive data from south and east -c--------------------------------------------------------------------- - iex = 1 - call exchange_1( v,k,iex ) - - do j = jend, jst, -1 - do i = iend, ist, -1 - do m = 1, 5 - tv( m, i, j ) = - > omega * ( udz( m, 1, i, j ) * v( 1, i, j, k+1 ) - > + udz( m, 2, i, j ) * v( 2, i, j, k+1 ) - > + udz( m, 3, i, j ) * v( 3, i, j, k+1 ) - > + udz( m, 4, i, j ) * v( 4, i, j, k+1 ) - > + udz( m, 5, i, j ) * v( 5, i, j, k+1 ) ) - end do - end do - end do - - - do j = jend,jst,-1 - do i = iend,ist,-1 - - do m = 1, 5 - tv( m, i, j ) = tv( m, i, j ) - > + omega * ( udy( m, 1, i, j ) * v( 1, i, j+1, k ) - > + udx( m, 1, i, j ) * v( 1, i+1, j, k ) - > + udy( m, 2, i, j ) * v( 2, i, j+1, k ) - > + udx( m, 2, i, j ) * v( 2, i+1, j, k ) - > + udy( m, 3, i, j ) * v( 3, i, j+1, k ) - > + udx( m, 3, i, j ) * v( 3, i+1, j, k ) - > + udy( m, 4, i, j ) * v( 4, i, j+1, k ) - > + udx( m, 4, i, j ) * v( 4, i+1, j, k ) - > + udy( m, 5, i, j ) * v( 5, i, j+1, k ) - > + udx( m, 5, i, j ) * v( 5, i+1, j, k ) ) - end do - -c--------------------------------------------------------------------- -c diagonal block inversion -c--------------------------------------------------------------------- - do m = 1, 5 - tmat( m, 1 ) = d( m, 1, i, j ) - tmat( m, 2 ) = d( m, 2, i, j ) - tmat( m, 3 ) = d( m, 3, i, j ) - tmat( m, 4 ) = d( m, 4, i, j ) - tmat( m, 5 ) = d( m, 5, i, j ) - end do - - tmp1 = 1.0d+00 / tmat( 1, 1 ) - tmp = tmp1 * tmat( 2, 1 ) - tmat( 2, 2 ) = tmat( 2, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 2, 3 ) = tmat( 2, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 2, 4 ) = tmat( 2, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 2, 5 ) = tmat( 2, 5 ) - > - tmp * tmat( 1, 5 ) - tv( 2, i, j ) = tv( 2, i, j ) - > - tv( 1, i, j ) * tmp - - tmp = tmp1 * tmat( 3, 1 ) - tmat( 3, 2 ) = tmat( 3, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 3, 3 ) = tmat( 3, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 3, 4 ) = tmat( 3, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 3, 5 ) = tmat( 3, 5 ) - > - tmp * tmat( 1, 5 ) - tv( 3, i, j ) = tv( 3, i, j ) - > - tv( 1, i, j ) * tmp - - tmp = tmp1 * tmat( 4, 1 ) - tmat( 4, 2 ) = tmat( 4, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 4, 3 ) = tmat( 4, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 4, 4 ) = tmat( 4, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 4, 5 ) = tmat( 4, 5 ) - > - tmp * tmat( 1, 5 ) - tv( 4, i, j ) = tv( 4, i, j ) - > - tv( 1, i, j ) * tmp - - tmp = tmp1 * tmat( 5, 1 ) - tmat( 5, 2 ) = tmat( 5, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 5, 3 ) = tmat( 5, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 5, 4 ) = tmat( 5, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 1, 5 ) - tv( 5, i, j ) = tv( 5, i, j ) - > - tv( 1, i, j ) * tmp - - - - tmp1 = 1.0d+00 / tmat( 2, 2 ) - tmp = tmp1 * tmat( 3, 2 ) - tmat( 3, 3 ) = tmat( 3, 3 ) - > - tmp * tmat( 2, 3 ) - tmat( 3, 4 ) = tmat( 3, 4 ) - > - tmp * tmat( 2, 4 ) - tmat( 3, 5 ) = tmat( 3, 5 ) - > - tmp * tmat( 2, 5 ) - tv( 3, i, j ) = tv( 3, i, j ) - > - tv( 2, i, j ) * tmp - - tmp = tmp1 * tmat( 4, 2 ) - tmat( 4, 3 ) = tmat( 4, 3 ) - > - tmp * tmat( 2, 3 ) - tmat( 4, 4 ) = tmat( 4, 4 ) - > - tmp * tmat( 2, 4 ) - tmat( 4, 5 ) = tmat( 4, 5 ) - > - tmp * tmat( 2, 5 ) - tv( 4, i, j ) = tv( 4, i, j ) - > - tv( 2, i, j ) * tmp - - tmp = tmp1 * tmat( 5, 2 ) - tmat( 5, 3 ) = tmat( 5, 3 ) - > - tmp * tmat( 2, 3 ) - tmat( 5, 4 ) = tmat( 5, 4 ) - > - tmp * tmat( 2, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 2, 5 ) - tv( 5, i, j ) = tv( 5, i, j ) - > - tv( 2, i, j ) * tmp - - - - tmp1 = 1.0d+00 / tmat( 3, 3 ) - tmp = tmp1 * tmat( 4, 3 ) - tmat( 4, 4 ) = tmat( 4, 4 ) - > - tmp * tmat( 3, 4 ) - tmat( 4, 5 ) = tmat( 4, 5 ) - > - tmp * tmat( 3, 5 ) - tv( 4, i, j ) = tv( 4, i, j ) - > - tv( 3, i, j ) * tmp - - tmp = tmp1 * tmat( 5, 3 ) - tmat( 5, 4 ) = tmat( 5, 4 ) - > - tmp * tmat( 3, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 3, 5 ) - tv( 5, i, j ) = tv( 5, i, j ) - > - tv( 3, i, j ) * tmp - - - - tmp1 = 1.0d+00 / tmat( 4, 4 ) - tmp = tmp1 * tmat( 5, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 4, 5 ) - tv( 5, i, j ) = tv( 5, i, j ) - > - tv( 4, i, j ) * tmp - -c--------------------------------------------------------------------- -c back substitution -c--------------------------------------------------------------------- - tv( 5, i, j ) = tv( 5, i, j ) - > / tmat( 5, 5 ) - - tv( 4, i, j ) = tv( 4, i, j ) - > - tmat( 4, 5 ) * tv( 5, i, j ) - tv( 4, i, j ) = tv( 4, i, j ) - > / tmat( 4, 4 ) - - tv( 3, i, j ) = tv( 3, i, j ) - > - tmat( 3, 4 ) * tv( 4, i, j ) - > - tmat( 3, 5 ) * tv( 5, i, j ) - tv( 3, i, j ) = tv( 3, i, j ) - > / tmat( 3, 3 ) - - tv( 2, i, j ) = tv( 2, i, j ) - > - tmat( 2, 3 ) * tv( 3, i, j ) - > - tmat( 2, 4 ) * tv( 4, i, j ) - > - tmat( 2, 5 ) * tv( 5, i, j ) - tv( 2, i, j ) = tv( 2, i, j ) - > / tmat( 2, 2 ) - - tv( 1, i, j ) = tv( 1, i, j ) - > - tmat( 1, 2 ) * tv( 2, i, j ) - > - tmat( 1, 3 ) * tv( 3, i, j ) - > - tmat( 1, 4 ) * tv( 4, i, j ) - > - tmat( 1, 5 ) * tv( 5, i, j ) - tv( 1, i, j ) = tv( 1, i, j ) - > / tmat( 1, 1 ) - - v( 1, i, j, k ) = v( 1, i, j, k ) - tv( 1, i, j ) - v( 2, i, j, k ) = v( 2, i, j, k ) - tv( 2, i, j ) - v( 3, i, j, k ) = v( 3, i, j, k ) - tv( 3, i, j ) - v( 4, i, j, k ) = v( 4, i, j, k ) - tv( 4, i, j ) - v( 5, i, j, k ) = v( 5, i, j, k ) - tv( 5, i, j ) - - - enddo - end do - -c--------------------------------------------------------------------- -c send data to north and west -c--------------------------------------------------------------------- - iex = 3 - call exchange_1( v,k,iex ) - - return - end diff --git a/examples/smpi/NAS/LU/buts_vec.f b/examples/smpi/NAS/LU/buts_vec.f deleted file mode 100644 index 813105d270..0000000000 --- a/examples/smpi/NAS/LU/buts_vec.f +++ /dev/null @@ -1,332 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine buts( ldmx, ldmy, ldmz, - > nx, ny, nz, k, - > omega, - > v, tv, - > d, udx, udy, udz, - > ist, iend, jst, jend, - > nx0, ny0, ipt, jpt ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c compute the regular-sparse, block upper triangular solution: -c -c v <-- ( U-inv ) * v -c -c--------------------------------------------------------------------- - - implicit none - -c--------------------------------------------------------------------- -c input parameters -c--------------------------------------------------------------------- - integer ldmx, ldmy, ldmz - integer nx, ny, nz - integer k - double precision omega - double precision v( 5, -1:ldmx+2, -1:ldmy+2, *), - > tv(5, ldmx, ldmy), - > d( 5, 5, ldmx, ldmy), - > udx( 5, 5, ldmx, ldmy), - > udy( 5, 5, ldmx, ldmy), - > udz( 5, 5, ldmx, ldmy ) - integer ist, iend - integer jst, jend - integer nx0, ny0 - integer ipt, jpt - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j, m, l, istp, iendp - integer iex - double precision tmp, tmp1 - double precision tmat(5,5) - - -c--------------------------------------------------------------------- -c receive data from south and east -c--------------------------------------------------------------------- - iex = 1 - call exchange_1( v,k,iex ) - - do j = jend, jst, -1 - do i = iend, ist, -1 - do m = 1, 5 - tv( m, i, j ) = - > omega * ( udz( m, 1, i, j ) * v( 1, i, j, k+1 ) - > + udz( m, 2, i, j ) * v( 2, i, j, k+1 ) - > + udz( m, 3, i, j ) * v( 3, i, j, k+1 ) - > + udz( m, 4, i, j ) * v( 4, i, j, k+1 ) - > + udz( m, 5, i, j ) * v( 5, i, j, k+1 ) ) - end do - end do - end do - - - do l = iend+jend, ist+jst, -1 - istp = max(l - jend, ist) - iendp = min(l - jst, iend) - -!dir$ ivdep - do i = istp, iendp - j = l - i - -!!dir$ unroll 5 -! manually unroll the loop -! do m = 1, 5 - tv( 1, i, j ) = tv( 1, i, j ) - > + omega * ( udy( 1, 1, i, j ) * v( 1, i, j+1, k ) - > + udx( 1, 1, i, j ) * v( 1, i+1, j, k ) - > + udy( 1, 2, i, j ) * v( 2, i, j+1, k ) - > + udx( 1, 2, i, j ) * v( 2, i+1, j, k ) - > + udy( 1, 3, i, j ) * v( 3, i, j+1, k ) - > + udx( 1, 3, i, j ) * v( 3, i+1, j, k ) - > + udy( 1, 4, i, j ) * v( 4, i, j+1, k ) - > + udx( 1, 4, i, j ) * v( 4, i+1, j, k ) - > + udy( 1, 5, i, j ) * v( 5, i, j+1, k ) - > + udx( 1, 5, i, j ) * v( 5, i+1, j, k ) ) - tv( 2, i, j ) = tv( 2, i, j ) - > + omega * ( udy( 2, 1, i, j ) * v( 1, i, j+1, k ) - > + udx( 2, 1, i, j ) * v( 1, i+1, j, k ) - > + udy( 2, 2, i, j ) * v( 2, i, j+1, k ) - > + udx( 2, 2, i, j ) * v( 2, i+1, j, k ) - > + udy( 2, 3, i, j ) * v( 3, i, j+1, k ) - > + udx( 2, 3, i, j ) * v( 3, i+1, j, k ) - > + udy( 2, 4, i, j ) * v( 4, i, j+1, k ) - > + udx( 2, 4, i, j ) * v( 4, i+1, j, k ) - > + udy( 2, 5, i, j ) * v( 5, i, j+1, k ) - > + udx( 2, 5, i, j ) * v( 5, i+1, j, k ) ) - tv( 3, i, j ) = tv( 3, i, j ) - > + omega * ( udy( 3, 1, i, j ) * v( 1, i, j+1, k ) - > + udx( 3, 1, i, j ) * v( 1, i+1, j, k ) - > + udy( 3, 2, i, j ) * v( 2, i, j+1, k ) - > + udx( 3, 2, i, j ) * v( 2, i+1, j, k ) - > + udy( 3, 3, i, j ) * v( 3, i, j+1, k ) - > + udx( 3, 3, i, j ) * v( 3, i+1, j, k ) - > + udy( 3, 4, i, j ) * v( 4, i, j+1, k ) - > + udx( 3, 4, i, j ) * v( 4, i+1, j, k ) - > + udy( 3, 5, i, j ) * v( 5, i, j+1, k ) - > + udx( 3, 5, i, j ) * v( 5, i+1, j, k ) ) - tv( 4, i, j ) = tv( 4, i, j ) - > + omega * ( udy( 4, 1, i, j ) * v( 1, i, j+1, k ) - > + udx( 4, 1, i, j ) * v( 1, i+1, j, k ) - > + udy( 4, 2, i, j ) * v( 2, i, j+1, k ) - > + udx( 4, 2, i, j ) * v( 2, i+1, j, k ) - > + udy( 4, 3, i, j ) * v( 3, i, j+1, k ) - > + udx( 4, 3, i, j ) * v( 3, i+1, j, k ) - > + udy( 4, 4, i, j ) * v( 4, i, j+1, k ) - > + udx( 4, 4, i, j ) * v( 4, i+1, j, k ) - > + udy( 4, 5, i, j ) * v( 5, i, j+1, k ) - > + udx( 4, 5, i, j ) * v( 5, i+1, j, k ) ) - tv( 5, i, j ) = tv( 5, i, j ) - > + omega * ( udy( 5, 1, i, j ) * v( 1, i, j+1, k ) - > + udx( 5, 1, i, j ) * v( 1, i+1, j, k ) - > + udy( 5, 2, i, j ) * v( 2, i, j+1, k ) - > + udx( 5, 2, i, j ) * v( 2, i+1, j, k ) - > + udy( 5, 3, i, j ) * v( 3, i, j+1, k ) - > + udx( 5, 3, i, j ) * v( 3, i+1, j, k ) - > + udy( 5, 4, i, j ) * v( 4, i, j+1, k ) - > + udx( 5, 4, i, j ) * v( 4, i+1, j, k ) - > + udy( 5, 5, i, j ) * v( 5, i, j+1, k ) - > + udx( 5, 5, i, j ) * v( 5, i+1, j, k ) ) -! end do - -c--------------------------------------------------------------------- -c diagonal block inversion -c--------------------------------------------------------------------- -!!dir$ unroll 5 -! manually unroll the loop -! do m = 1, 5 - tmat( 1, 1 ) = d( 1, 1, i, j ) - tmat( 1, 2 ) = d( 1, 2, i, j ) - tmat( 1, 3 ) = d( 1, 3, i, j ) - tmat( 1, 4 ) = d( 1, 4, i, j ) - tmat( 1, 5 ) = d( 1, 5, i, j ) - tmat( 2, 1 ) = d( 2, 1, i, j ) - tmat( 2, 2 ) = d( 2, 2, i, j ) - tmat( 2, 3 ) = d( 2, 3, i, j ) - tmat( 2, 4 ) = d( 2, 4, i, j ) - tmat( 2, 5 ) = d( 2, 5, i, j ) - tmat( 3, 1 ) = d( 3, 1, i, j ) - tmat( 3, 2 ) = d( 3, 2, i, j ) - tmat( 3, 3 ) = d( 3, 3, i, j ) - tmat( 3, 4 ) = d( 3, 4, i, j ) - tmat( 3, 5 ) = d( 3, 5, i, j ) - tmat( 4, 1 ) = d( 4, 1, i, j ) - tmat( 4, 2 ) = d( 4, 2, i, j ) - tmat( 4, 3 ) = d( 4, 3, i, j ) - tmat( 4, 4 ) = d( 4, 4, i, j ) - tmat( 4, 5 ) = d( 4, 5, i, j ) - tmat( 5, 1 ) = d( 5, 1, i, j ) - tmat( 5, 2 ) = d( 5, 2, i, j ) - tmat( 5, 3 ) = d( 5, 3, i, j ) - tmat( 5, 4 ) = d( 5, 4, i, j ) - tmat( 5, 5 ) = d( 5, 5, i, j ) -! end do - - tmp1 = 1.0d+00 / tmat( 1, 1 ) - tmp = tmp1 * tmat( 2, 1 ) - tmat( 2, 2 ) = tmat( 2, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 2, 3 ) = tmat( 2, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 2, 4 ) = tmat( 2, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 2, 5 ) = tmat( 2, 5 ) - > - tmp * tmat( 1, 5 ) - tv( 2, i, j ) = tv( 2, i, j ) - > - tv( 1, i, j ) * tmp - - tmp = tmp1 * tmat( 3, 1 ) - tmat( 3, 2 ) = tmat( 3, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 3, 3 ) = tmat( 3, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 3, 4 ) = tmat( 3, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 3, 5 ) = tmat( 3, 5 ) - > - tmp * tmat( 1, 5 ) - tv( 3, i, j ) = tv( 3, i, j ) - > - tv( 1, i, j ) * tmp - - tmp = tmp1 * tmat( 4, 1 ) - tmat( 4, 2 ) = tmat( 4, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 4, 3 ) = tmat( 4, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 4, 4 ) = tmat( 4, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 4, 5 ) = tmat( 4, 5 ) - > - tmp * tmat( 1, 5 ) - tv( 4, i, j ) = tv( 4, i, j ) - > - tv( 1, i, j ) * tmp - - tmp = tmp1 * tmat( 5, 1 ) - tmat( 5, 2 ) = tmat( 5, 2 ) - > - tmp * tmat( 1, 2 ) - tmat( 5, 3 ) = tmat( 5, 3 ) - > - tmp * tmat( 1, 3 ) - tmat( 5, 4 ) = tmat( 5, 4 ) - > - tmp * tmat( 1, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 1, 5 ) - tv( 5, i, j ) = tv( 5, i, j ) - > - tv( 1, i, j ) * tmp - - - - tmp1 = 1.0d+00 / tmat( 2, 2 ) - tmp = tmp1 * tmat( 3, 2 ) - tmat( 3, 3 ) = tmat( 3, 3 ) - > - tmp * tmat( 2, 3 ) - tmat( 3, 4 ) = tmat( 3, 4 ) - > - tmp * tmat( 2, 4 ) - tmat( 3, 5 ) = tmat( 3, 5 ) - > - tmp * tmat( 2, 5 ) - tv( 3, i, j ) = tv( 3, i, j ) - > - tv( 2, i, j ) * tmp - - tmp = tmp1 * tmat( 4, 2 ) - tmat( 4, 3 ) = tmat( 4, 3 ) - > - tmp * tmat( 2, 3 ) - tmat( 4, 4 ) = tmat( 4, 4 ) - > - tmp * tmat( 2, 4 ) - tmat( 4, 5 ) = tmat( 4, 5 ) - > - tmp * tmat( 2, 5 ) - tv( 4, i, j ) = tv( 4, i, j ) - > - tv( 2, i, j ) * tmp - - tmp = tmp1 * tmat( 5, 2 ) - tmat( 5, 3 ) = tmat( 5, 3 ) - > - tmp * tmat( 2, 3 ) - tmat( 5, 4 ) = tmat( 5, 4 ) - > - tmp * tmat( 2, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 2, 5 ) - tv( 5, i, j ) = tv( 5, i, j ) - > - tv( 2, i, j ) * tmp - - - - tmp1 = 1.0d+00 / tmat( 3, 3 ) - tmp = tmp1 * tmat( 4, 3 ) - tmat( 4, 4 ) = tmat( 4, 4 ) - > - tmp * tmat( 3, 4 ) - tmat( 4, 5 ) = tmat( 4, 5 ) - > - tmp * tmat( 3, 5 ) - tv( 4, i, j ) = tv( 4, i, j ) - > - tv( 3, i, j ) * tmp - - tmp = tmp1 * tmat( 5, 3 ) - tmat( 5, 4 ) = tmat( 5, 4 ) - > - tmp * tmat( 3, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 3, 5 ) - tv( 5, i, j ) = tv( 5, i, j ) - > - tv( 3, i, j ) * tmp - - - - tmp1 = 1.0d+00 / tmat( 4, 4 ) - tmp = tmp1 * tmat( 5, 4 ) - tmat( 5, 5 ) = tmat( 5, 5 ) - > - tmp * tmat( 4, 5 ) - tv( 5, i, j ) = tv( 5, i, j ) - > - tv( 4, i, j ) * tmp - -c--------------------------------------------------------------------- -c back substitution -c--------------------------------------------------------------------- - tv( 5, i, j ) = tv( 5, i, j ) - > / tmat( 5, 5 ) - - tv( 4, i, j ) = tv( 4, i, j ) - > - tmat( 4, 5 ) * tv( 5, i, j ) - tv( 4, i, j ) = tv( 4, i, j ) - > / tmat( 4, 4 ) - - tv( 3, i, j ) = tv( 3, i, j ) - > - tmat( 3, 4 ) * tv( 4, i, j ) - > - tmat( 3, 5 ) * tv( 5, i, j ) - tv( 3, i, j ) = tv( 3, i, j ) - > / tmat( 3, 3 ) - - tv( 2, i, j ) = tv( 2, i, j ) - > - tmat( 2, 3 ) * tv( 3, i, j ) - > - tmat( 2, 4 ) * tv( 4, i, j ) - > - tmat( 2, 5 ) * tv( 5, i, j ) - tv( 2, i, j ) = tv( 2, i, j ) - > / tmat( 2, 2 ) - - tv( 1, i, j ) = tv( 1, i, j ) - > - tmat( 1, 2 ) * tv( 2, i, j ) - > - tmat( 1, 3 ) * tv( 3, i, j ) - > - tmat( 1, 4 ) * tv( 4, i, j ) - > - tmat( 1, 5 ) * tv( 5, i, j ) - tv( 1, i, j ) = tv( 1, i, j ) - > / tmat( 1, 1 ) - - v( 1, i, j, k ) = v( 1, i, j, k ) - tv( 1, i, j ) - v( 2, i, j, k ) = v( 2, i, j, k ) - tv( 2, i, j ) - v( 3, i, j, k ) = v( 3, i, j, k ) - tv( 3, i, j ) - v( 4, i, j, k ) = v( 4, i, j, k ) - tv( 4, i, j ) - v( 5, i, j, k ) = v( 5, i, j, k ) - tv( 5, i, j ) - - - enddo - end do - -c--------------------------------------------------------------------- -c send data to north and west -c--------------------------------------------------------------------- - iex = 3 - call exchange_1( v,k,iex ) - - return - end diff --git a/examples/smpi/NAS/LU/erhs.f b/examples/smpi/NAS/LU/erhs.f deleted file mode 100644 index 928e2a9f50..0000000000 --- a/examples/smpi/NAS/LU/erhs.f +++ /dev/null @@ -1,536 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine erhs - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c compute the right hand side based on exact solution -c -c--------------------------------------------------------------------- - - implicit none - - include 'applu.incl' - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j, k, m - integer iglob, jglob - integer iex - integer L1, L2 - integer ist1, iend1 - integer jst1, jend1 - double precision dsspm - double precision xi, eta, zeta - double precision q - double precision u21, u31, u41 - double precision tmp - double precision u21i, u31i, u41i, u51i - double precision u21j, u31j, u41j, u51j - double precision u21k, u31k, u41k, u51k - double precision u21im1, u31im1, u41im1, u51im1 - double precision u21jm1, u31jm1, u41jm1, u51jm1 - double precision u21km1, u31km1, u41km1, u51km1 - - dsspm = dssp - - - do k = 1, nz - do j = 1, ny - do i = 1, nx - do m = 1, 5 - frct( m, i, j, k ) = 0.0d+00 - end do - end do - end do - end do - - do k = 1, nz - zeta = ( dble(k-1) ) / ( nz - 1 ) - do j = 1, ny - jglob = jpt + j - eta = ( dble(jglob-1) ) / ( ny0 - 1 ) - do i = 1, nx - iglob = ipt + i - xi = ( dble(iglob-1) ) / ( nx0 - 1 ) - do m = 1, 5 - rsd(m,i,j,k) = ce(m,1) - > + ce(m,2) * xi - > + ce(m,3) * eta - > + ce(m,4) * zeta - > + ce(m,5) * xi * xi - > + ce(m,6) * eta * eta - > + ce(m,7) * zeta * zeta - > + ce(m,8) * xi * xi * xi - > + ce(m,9) * eta * eta * eta - > + ce(m,10) * zeta * zeta * zeta - > + ce(m,11) * xi * xi * xi * xi - > + ce(m,12) * eta * eta * eta * eta - > + ce(m,13) * zeta * zeta * zeta * zeta - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c xi-direction flux differences -c--------------------------------------------------------------------- -c -c iex = flag : iex = 0 north/south communication -c : iex = 1 east/west communication -c -c--------------------------------------------------------------------- - iex = 0 - -c--------------------------------------------------------------------- -c communicate and receive/send two rows of data -c--------------------------------------------------------------------- - call exchange_3 (rsd,iex) - - L1 = 0 - if (north.eq.-1) L1 = 1 - L2 = nx + 1 - if (south.eq.-1) L2 = nx - - ist1 = 1 - iend1 = nx - if (north.eq.-1) ist1 = 4 - if (south.eq.-1) iend1 = nx - 3 - - do k = 2, nz - 1 - do j = jst, jend - do i = L1, L2 - flux(1,i,j,k) = rsd(2,i,j,k) - u21 = rsd(2,i,j,k) / rsd(1,i,j,k) - q = 0.50d+00 * ( rsd(2,i,j,k) * rsd(2,i,j,k) - > + rsd(3,i,j,k) * rsd(3,i,j,k) - > + rsd(4,i,j,k) * rsd(4,i,j,k) ) - > / rsd(1,i,j,k) - flux(2,i,j,k) = rsd(2,i,j,k) * u21 + c2 * - > ( rsd(5,i,j,k) - q ) - flux(3,i,j,k) = rsd(3,i,j,k) * u21 - flux(4,i,j,k) = rsd(4,i,j,k) * u21 - flux(5,i,j,k) = ( c1 * rsd(5,i,j,k) - c2 * q ) * u21 - end do - end do - end do - - do k = 2, nz - 1 - do j = jst, jend - do i = ist, iend - do m = 1, 5 - frct(m,i,j,k) = frct(m,i,j,k) - > - tx2 * ( flux(m,i+1,j,k) - flux(m,i-1,j,k) ) - end do - end do - do i = ist, L2 - tmp = 1.0d+00 / rsd(1,i,j,k) - - u21i = tmp * rsd(2,i,j,k) - u31i = tmp * rsd(3,i,j,k) - u41i = tmp * rsd(4,i,j,k) - u51i = tmp * rsd(5,i,j,k) - - tmp = 1.0d+00 / rsd(1,i-1,j,k) - - u21im1 = tmp * rsd(2,i-1,j,k) - u31im1 = tmp * rsd(3,i-1,j,k) - u41im1 = tmp * rsd(4,i-1,j,k) - u51im1 = tmp * rsd(5,i-1,j,k) - - flux(2,i,j,k) = (4.0d+00/3.0d+00) * tx3 * - > ( u21i - u21im1 ) - flux(3,i,j,k) = tx3 * ( u31i - u31im1 ) - flux(4,i,j,k) = tx3 * ( u41i - u41im1 ) - flux(5,i,j,k) = 0.50d+00 * ( 1.0d+00 - c1*c5 ) - > * tx3 * ( ( u21i **2 + u31i **2 + u41i **2 ) - > - ( u21im1**2 + u31im1**2 + u41im1**2 ) ) - > + (1.0d+00/6.0d+00) - > * tx3 * ( u21i**2 - u21im1**2 ) - > + c1 * c5 * tx3 * ( u51i - u51im1 ) - end do - - do i = ist, iend - frct(1,i,j,k) = frct(1,i,j,k) - > + dx1 * tx1 * ( rsd(1,i-1,j,k) - > - 2.0d+00 * rsd(1,i,j,k) - > + rsd(1,i+1,j,k) ) - frct(2,i,j,k) = frct(2,i,j,k) - > + tx3 * c3 * c4 * ( flux(2,i+1,j,k) - flux(2,i,j,k) ) - > + dx2 * tx1 * ( rsd(2,i-1,j,k) - > - 2.0d+00 * rsd(2,i,j,k) - > + rsd(2,i+1,j,k) ) - frct(3,i,j,k) = frct(3,i,j,k) - > + tx3 * c3 * c4 * ( flux(3,i+1,j,k) - flux(3,i,j,k) ) - > + dx3 * tx1 * ( rsd(3,i-1,j,k) - > - 2.0d+00 * rsd(3,i,j,k) - > + rsd(3,i+1,j,k) ) - frct(4,i,j,k) = frct(4,i,j,k) - > + tx3 * c3 * c4 * ( flux(4,i+1,j,k) - flux(4,i,j,k) ) - > + dx4 * tx1 * ( rsd(4,i-1,j,k) - > - 2.0d+00 * rsd(4,i,j,k) - > + rsd(4,i+1,j,k) ) - frct(5,i,j,k) = frct(5,i,j,k) - > + tx3 * c3 * c4 * ( flux(5,i+1,j,k) - flux(5,i,j,k) ) - > + dx5 * tx1 * ( rsd(5,i-1,j,k) - > - 2.0d+00 * rsd(5,i,j,k) - > + rsd(5,i+1,j,k) ) - end do - -c--------------------------------------------------------------------- -c Fourth-order dissipation -c--------------------------------------------------------------------- - IF (north.eq.-1) then - do m = 1, 5 - frct(m,2,j,k) = frct(m,2,j,k) - > - dsspm * ( + 5.0d+00 * rsd(m,2,j,k) - > - 4.0d+00 * rsd(m,3,j,k) - > + rsd(m,4,j,k) ) - frct(m,3,j,k) = frct(m,3,j,k) - > - dsspm * ( - 4.0d+00 * rsd(m,2,j,k) - > + 6.0d+00 * rsd(m,3,j,k) - > - 4.0d+00 * rsd(m,4,j,k) - > + rsd(m,5,j,k) ) - end do - END IF - - do i = ist1,iend1 - do m = 1, 5 - frct(m,i,j,k) = frct(m,i,j,k) - > - dsspm * ( rsd(m,i-2,j,k) - > - 4.0d+00 * rsd(m,i-1,j,k) - > + 6.0d+00 * rsd(m,i,j,k) - > - 4.0d+00 * rsd(m,i+1,j,k) - > + rsd(m,i+2,j,k) ) - end do - end do - - IF (south.eq.-1) then - do m = 1, 5 - frct(m,nx-2,j,k) = frct(m,nx-2,j,k) - > - dsspm * ( rsd(m,nx-4,j,k) - > - 4.0d+00 * rsd(m,nx-3,j,k) - > + 6.0d+00 * rsd(m,nx-2,j,k) - > - 4.0d+00 * rsd(m,nx-1,j,k) ) - frct(m,nx-1,j,k) = frct(m,nx-1,j,k) - > - dsspm * ( rsd(m,nx-3,j,k) - > - 4.0d+00 * rsd(m,nx-2,j,k) - > + 5.0d+00 * rsd(m,nx-1,j,k) ) - end do - END IF - - end do - end do - -c--------------------------------------------------------------------- -c eta-direction flux differences -c--------------------------------------------------------------------- -c -c iex = flag : iex = 0 north/south communication -c : iex = 1 east/west communication -c -c--------------------------------------------------------------------- - iex = 1 - -c--------------------------------------------------------------------- -c communicate and receive/send two rows of data -c--------------------------------------------------------------------- - call exchange_3 (rsd,iex) - - L1 = 0 - if (west.eq.-1) L1 = 1 - L2 = ny + 1 - if (east.eq.-1) L2 = ny - - jst1 = 1 - jend1 = ny - if (west.eq.-1) jst1 = 4 - if (east.eq.-1) jend1 = ny - 3 - - do k = 2, nz - 1 - do j = L1, L2 - do i = ist, iend - flux(1,i,j,k) = rsd(3,i,j,k) - u31 = rsd(3,i,j,k) / rsd(1,i,j,k) - q = 0.50d+00 * ( rsd(2,i,j,k) * rsd(2,i,j,k) - > + rsd(3,i,j,k) * rsd(3,i,j,k) - > + rsd(4,i,j,k) * rsd(4,i,j,k) ) - > / rsd(1,i,j,k) - flux(2,i,j,k) = rsd(2,i,j,k) * u31 - flux(3,i,j,k) = rsd(3,i,j,k) * u31 + c2 * - > ( rsd(5,i,j,k) - q ) - flux(4,i,j,k) = rsd(4,i,j,k) * u31 - flux(5,i,j,k) = ( c1 * rsd(5,i,j,k) - c2 * q ) * u31 - end do - end do - end do - - do k = 2, nz - 1 - do i = ist, iend - do j = jst, jend - do m = 1, 5 - frct(m,i,j,k) = frct(m,i,j,k) - > - ty2 * ( flux(m,i,j+1,k) - flux(m,i,j-1,k) ) - end do - end do - end do - - do j = jst, L2 - do i = ist, iend - tmp = 1.0d+00 / rsd(1,i,j,k) - - u21j = tmp * rsd(2,i,j,k) - u31j = tmp * rsd(3,i,j,k) - u41j = tmp * rsd(4,i,j,k) - u51j = tmp * rsd(5,i,j,k) - - tmp = 1.0d+00 / rsd(1,i,j-1,k) - - u21jm1 = tmp * rsd(2,i,j-1,k) - u31jm1 = tmp * rsd(3,i,j-1,k) - u41jm1 = tmp * rsd(4,i,j-1,k) - u51jm1 = tmp * rsd(5,i,j-1,k) - - flux(2,i,j,k) = ty3 * ( u21j - u21jm1 ) - flux(3,i,j,k) = (4.0d+00/3.0d+00) * ty3 * - > ( u31j - u31jm1 ) - flux(4,i,j,k) = ty3 * ( u41j - u41jm1 ) - flux(5,i,j,k) = 0.50d+00 * ( 1.0d+00 - c1*c5 ) - > * ty3 * ( ( u21j **2 + u31j **2 + u41j **2 ) - > - ( u21jm1**2 + u31jm1**2 + u41jm1**2 ) ) - > + (1.0d+00/6.0d+00) - > * ty3 * ( u31j**2 - u31jm1**2 ) - > + c1 * c5 * ty3 * ( u51j - u51jm1 ) - end do - end do - - do j = jst, jend - do i = ist, iend - frct(1,i,j,k) = frct(1,i,j,k) - > + dy1 * ty1 * ( rsd(1,i,j-1,k) - > - 2.0d+00 * rsd(1,i,j,k) - > + rsd(1,i,j+1,k) ) - frct(2,i,j,k) = frct(2,i,j,k) - > + ty3 * c3 * c4 * ( flux(2,i,j+1,k) - flux(2,i,j,k) ) - > + dy2 * ty1 * ( rsd(2,i,j-1,k) - > - 2.0d+00 * rsd(2,i,j,k) - > + rsd(2,i,j+1,k) ) - frct(3,i,j,k) = frct(3,i,j,k) - > + ty3 * c3 * c4 * ( flux(3,i,j+1,k) - flux(3,i,j,k) ) - > + dy3 * ty1 * ( rsd(3,i,j-1,k) - > - 2.0d+00 * rsd(3,i,j,k) - > + rsd(3,i,j+1,k) ) - frct(4,i,j,k) = frct(4,i,j,k) - > + ty3 * c3 * c4 * ( flux(4,i,j+1,k) - flux(4,i,j,k) ) - > + dy4 * ty1 * ( rsd(4,i,j-1,k) - > - 2.0d+00 * rsd(4,i,j,k) - > + rsd(4,i,j+1,k) ) - frct(5,i,j,k) = frct(5,i,j,k) - > + ty3 * c3 * c4 * ( flux(5,i,j+1,k) - flux(5,i,j,k) ) - > + dy5 * ty1 * ( rsd(5,i,j-1,k) - > - 2.0d+00 * rsd(5,i,j,k) - > + rsd(5,i,j+1,k) ) - end do - end do - -c--------------------------------------------------------------------- -c fourth-order dissipation -c--------------------------------------------------------------------- - IF (west.eq.-1) then - do i = ist, iend - do m = 1, 5 - frct(m,i,2,k) = frct(m,i,2,k) - > - dsspm * ( + 5.0d+00 * rsd(m,i,2,k) - > - 4.0d+00 * rsd(m,i,3,k) - > + rsd(m,i,4,k) ) - frct(m,i,3,k) = frct(m,i,3,k) - > - dsspm * ( - 4.0d+00 * rsd(m,i,2,k) - > + 6.0d+00 * rsd(m,i,3,k) - > - 4.0d+00 * rsd(m,i,4,k) - > + rsd(m,i,5,k) ) - end do - end do - END IF - - do j = jst1, jend1 - do i = ist, iend - do m = 1, 5 - frct(m,i,j,k) = frct(m,i,j,k) - > - dsspm * ( rsd(m,i,j-2,k) - > - 4.0d+00 * rsd(m,i,j-1,k) - > + 6.0d+00 * rsd(m,i,j,k) - > - 4.0d+00 * rsd(m,i,j+1,k) - > + rsd(m,i,j+2,k) ) - end do - end do - end do - - IF (east.eq.-1) then - do i = ist, iend - do m = 1, 5 - frct(m,i,ny-2,k) = frct(m,i,ny-2,k) - > - dsspm * ( rsd(m,i,ny-4,k) - > - 4.0d+00 * rsd(m,i,ny-3,k) - > + 6.0d+00 * rsd(m,i,ny-2,k) - > - 4.0d+00 * rsd(m,i,ny-1,k) ) - frct(m,i,ny-1,k) = frct(m,i,ny-1,k) - > - dsspm * ( rsd(m,i,ny-3,k) - > - 4.0d+00 * rsd(m,i,ny-2,k) - > + 5.0d+00 * rsd(m,i,ny-1,k) ) - end do - end do - END IF - - end do - -c--------------------------------------------------------------------- -c zeta-direction flux differences -c--------------------------------------------------------------------- - do k = 1, nz - do j = jst, jend - do i = ist, iend - flux(1,i,j,k) = rsd(4,i,j,k) - u41 = rsd(4,i,j,k) / rsd(1,i,j,k) - q = 0.50d+00 * ( rsd(2,i,j,k) * rsd(2,i,j,k) - > + rsd(3,i,j,k) * rsd(3,i,j,k) - > + rsd(4,i,j,k) * rsd(4,i,j,k) ) - > / rsd(1,i,j,k) - flux(2,i,j,k) = rsd(2,i,j,k) * u41 - flux(3,i,j,k) = rsd(3,i,j,k) * u41 - flux(4,i,j,k) = rsd(4,i,j,k) * u41 + c2 * - > ( rsd(5,i,j,k) - q ) - flux(5,i,j,k) = ( c1 * rsd(5,i,j,k) - c2 * q ) * u41 - end do - end do - end do - - do k = 2, nz - 1 - do j = jst, jend - do i = ist, iend - do m = 1, 5 - frct(m,i,j,k) = frct(m,i,j,k) - > - tz2 * ( flux(m,i,j,k+1) - flux(m,i,j,k-1) ) - end do - end do - end do - end do - - do k = 2, nz - do j = jst, jend - do i = ist, iend - tmp = 1.0d+00 / rsd(1,i,j,k) - - u21k = tmp * rsd(2,i,j,k) - u31k = tmp * rsd(3,i,j,k) - u41k = tmp * rsd(4,i,j,k) - u51k = tmp * rsd(5,i,j,k) - - tmp = 1.0d+00 / rsd(1,i,j,k-1) - - u21km1 = tmp * rsd(2,i,j,k-1) - u31km1 = tmp * rsd(3,i,j,k-1) - u41km1 = tmp * rsd(4,i,j,k-1) - u51km1 = tmp * rsd(5,i,j,k-1) - - flux(2,i,j,k) = tz3 * ( u21k - u21km1 ) - flux(3,i,j,k) = tz3 * ( u31k - u31km1 ) - flux(4,i,j,k) = (4.0d+00/3.0d+00) * tz3 * ( u41k - > - u41km1 ) - flux(5,i,j,k) = 0.50d+00 * ( 1.0d+00 - c1*c5 ) - > * tz3 * ( ( u21k **2 + u31k **2 + u41k **2 ) - > - ( u21km1**2 + u31km1**2 + u41km1**2 ) ) - > + (1.0d+00/6.0d+00) - > * tz3 * ( u41k**2 - u41km1**2 ) - > + c1 * c5 * tz3 * ( u51k - u51km1 ) - end do - end do - end do - - do k = 2, nz - 1 - do j = jst, jend - do i = ist, iend - frct(1,i,j,k) = frct(1,i,j,k) - > + dz1 * tz1 * ( rsd(1,i,j,k+1) - > - 2.0d+00 * rsd(1,i,j,k) - > + rsd(1,i,j,k-1) ) - frct(2,i,j,k) = frct(2,i,j,k) - > + tz3 * c3 * c4 * ( flux(2,i,j,k+1) - flux(2,i,j,k) ) - > + dz2 * tz1 * ( rsd(2,i,j,k+1) - > - 2.0d+00 * rsd(2,i,j,k) - > + rsd(2,i,j,k-1) ) - frct(3,i,j,k) = frct(3,i,j,k) - > + tz3 * c3 * c4 * ( flux(3,i,j,k+1) - flux(3,i,j,k) ) - > + dz3 * tz1 * ( rsd(3,i,j,k+1) - > - 2.0d+00 * rsd(3,i,j,k) - > + rsd(3,i,j,k-1) ) - frct(4,i,j,k) = frct(4,i,j,k) - > + tz3 * c3 * c4 * ( flux(4,i,j,k+1) - flux(4,i,j,k) ) - > + dz4 * tz1 * ( rsd(4,i,j,k+1) - > - 2.0d+00 * rsd(4,i,j,k) - > + rsd(4,i,j,k-1) ) - frct(5,i,j,k) = frct(5,i,j,k) - > + tz3 * c3 * c4 * ( flux(5,i,j,k+1) - flux(5,i,j,k) ) - > + dz5 * tz1 * ( rsd(5,i,j,k+1) - > - 2.0d+00 * rsd(5,i,j,k) - > + rsd(5,i,j,k-1) ) - end do - end do - end do - -c--------------------------------------------------------------------- -c fourth-order dissipation -c--------------------------------------------------------------------- - do j = jst, jend - do i = ist, iend - do m = 1, 5 - frct(m,i,j,2) = frct(m,i,j,2) - > - dsspm * ( + 5.0d+00 * rsd(m,i,j,2) - > - 4.0d+00 * rsd(m,i,j,3) - > + rsd(m,i,j,4) ) - frct(m,i,j,3) = frct(m,i,j,3) - > - dsspm * (- 4.0d+00 * rsd(m,i,j,2) - > + 6.0d+00 * rsd(m,i,j,3) - > - 4.0d+00 * rsd(m,i,j,4) - > + rsd(m,i,j,5) ) - end do - end do - end do - - do k = 4, nz - 3 - do j = jst, jend - do i = ist, iend - do m = 1, 5 - frct(m,i,j,k) = frct(m,i,j,k) - > - dsspm * ( rsd(m,i,j,k-2) - > - 4.0d+00 * rsd(m,i,j,k-1) - > + 6.0d+00 * rsd(m,i,j,k) - > - 4.0d+00 * rsd(m,i,j,k+1) - > + rsd(m,i,j,k+2) ) - end do - end do - end do - end do - - do j = jst, jend - do i = ist, iend - do m = 1, 5 - frct(m,i,j,nz-2) = frct(m,i,j,nz-2) - > - dsspm * ( rsd(m,i,j,nz-4) - > - 4.0d+00 * rsd(m,i,j,nz-3) - > + 6.0d+00 * rsd(m,i,j,nz-2) - > - 4.0d+00 * rsd(m,i,j,nz-1) ) - frct(m,i,j,nz-1) = frct(m,i,j,nz-1) - > - dsspm * ( rsd(m,i,j,nz-3) - > - 4.0d+00 * rsd(m,i,j,nz-2) - > + 5.0d+00 * rsd(m,i,j,nz-1) ) - end do - end do - end do - - return - end diff --git a/examples/smpi/NAS/LU/error.f b/examples/smpi/NAS/LU/error.f deleted file mode 100644 index e83f74912f..0000000000 --- a/examples/smpi/NAS/LU/error.f +++ /dev/null @@ -1,81 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine error - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c compute the solution error -c -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - include 'applu.incl' - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j, k, m - integer iglob, jglob - double precision tmp - double precision u000ijk(5), dummy(5) - - integer IERROR - - - do m = 1, 5 - errnm(m) = 0.0d+00 - dummy(m) = 0.0d+00 - end do - - do k = 2, nz-1 - do j = jst, jend - jglob = jpt + j - do i = ist, iend - iglob = ipt + i - call exact( iglob, jglob, k, u000ijk ) - do m = 1, 5 - tmp = ( u000ijk(m) - u(m,i,j,k) ) - dummy(m) = dummy(m) + tmp ** 2 - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c compute the global sum of individual contributions to dot product. -c--------------------------------------------------------------------- - call MPI_ALLREDUCE( dummy, - > errnm, - > 5, - > dp_type, - > MPI_SUM, - > MPI_COMM_WORLD, - > IERROR ) - - do m = 1, 5 - errnm(m) = sqrt ( errnm(m) / ( (nx0-2)*(ny0-2)*(nz0-2) ) ) - end do - -c if (id.eq.0) then -c write (*,1002) ( errnm(m), m = 1, 5 ) -c end if - - 1002 format (1x/1x,'RMS-norm of error in soln. to ', - > 'first pde = ',1pe12.5/, - > 1x,'RMS-norm of error in soln. to ', - > 'second pde = ',1pe12.5/, - > 1x,'RMS-norm of error in soln. to ', - > 'third pde = ',1pe12.5/, - > 1x,'RMS-norm of error in soln. to ', - > 'fourth pde = ',1pe12.5/, - > 1x,'RMS-norm of error in soln. to ', - > 'fifth pde = ',1pe12.5) - - return - end diff --git a/examples/smpi/NAS/LU/exact.f b/examples/smpi/NAS/LU/exact.f deleted file mode 100644 index 19e14c3d5f..0000000000 --- a/examples/smpi/NAS/LU/exact.f +++ /dev/null @@ -1,53 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine exact( i, j, k, u000ijk ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c compute the exact solution at (i,j,k) -c -c--------------------------------------------------------------------- - - implicit none - - include 'applu.incl' - -c--------------------------------------------------------------------- -c input parameters -c--------------------------------------------------------------------- - integer i, j, k - double precision u000ijk(*) - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer m - double precision xi, eta, zeta - - xi = ( dble ( i - 1 ) ) / ( nx0 - 1 ) - eta = ( dble ( j - 1 ) ) / ( ny0 - 1 ) - zeta = ( dble ( k - 1 ) ) / ( nz - 1 ) - - - do m = 1, 5 - u000ijk(m) = ce(m,1) - > + ce(m,2) * xi - > + ce(m,3) * eta - > + ce(m,4) * zeta - > + ce(m,5) * xi * xi - > + ce(m,6) * eta * eta - > + ce(m,7) * zeta * zeta - > + ce(m,8) * xi * xi * xi - > + ce(m,9) * eta * eta * eta - > + ce(m,10) * zeta * zeta * zeta - > + ce(m,11) * xi * xi * xi * xi - > + ce(m,12) * eta * eta * eta * eta - > + ce(m,13) * zeta * zeta * zeta * zeta - end do - - return - end diff --git a/examples/smpi/NAS/LU/exchange_1.f b/examples/smpi/NAS/LU/exchange_1.f deleted file mode 100644 index 2bf7d28b94..0000000000 --- a/examples/smpi/NAS/LU/exchange_1.f +++ /dev/null @@ -1,180 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine exchange_1( g,k,iex ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - - implicit none - - include 'mpinpb.h' - include 'applu.incl' - - double precision g(5,-1:isiz1+2,-1:isiz2+2,isiz3) - integer k - integer iex - integer i, j - double precision dum(5,isiz1+isiz2), dum1(5,isiz1+isiz2) - - integer STATUS(MPI_STATUS_SIZE) - integer IERROR - - - - if( iex .eq. 0 ) then - - if( north .ne. -1 ) then - call MPI_RECV( dum1(1,jst), - > 5*(jend-jst+1), - > dp_type, - > north, - > from_n, - > MPI_COMM_WORLD, - > status, - > IERROR ) - do j=jst,jend - g(1,0,j,k) = dum1(1,j) - g(2,0,j,k) = dum1(2,j) - g(3,0,j,k) = dum1(3,j) - g(4,0,j,k) = dum1(4,j) - g(5,0,j,k) = dum1(5,j) - enddo - endif - - if( west .ne. -1 ) then - call MPI_RECV( dum1(1,ist), - > 5*(iend-ist+1), - > dp_type, - > west, - > from_w, - > MPI_COMM_WORLD, - > status, - > IERROR ) - do i=ist,iend - g(1,i,0,k) = dum1(1,i) - g(2,i,0,k) = dum1(2,i) - g(3,i,0,k) = dum1(3,i) - g(4,i,0,k) = dum1(4,i) - g(5,i,0,k) = dum1(5,i) - enddo - endif - - else if( iex .eq. 1 ) then - - if( south .ne. -1 ) then - call MPI_RECV( dum1(1,jst), - > 5*(jend-jst+1), - > dp_type, - > south, - > from_s, - > MPI_COMM_WORLD, - > status, - > IERROR ) - do j=jst,jend - g(1,nx+1,j,k) = dum1(1,j) - g(2,nx+1,j,k) = dum1(2,j) - g(3,nx+1,j,k) = dum1(3,j) - g(4,nx+1,j,k) = dum1(4,j) - g(5,nx+1,j,k) = dum1(5,j) - enddo - endif - - if( east .ne. -1 ) then - call MPI_RECV( dum1(1,ist), - > 5*(iend-ist+1), - > dp_type, - > east, - > from_e, - > MPI_COMM_WORLD, - > status, - > IERROR ) - do i=ist,iend - g(1,i,ny+1,k) = dum1(1,i) - g(2,i,ny+1,k) = dum1(2,i) - g(3,i,ny+1,k) = dum1(3,i) - g(4,i,ny+1,k) = dum1(4,i) - g(5,i,ny+1,k) = dum1(5,i) - enddo - endif - - else if( iex .eq. 2 ) then - - if( south .ne. -1 ) then - do j=jst,jend - dum(1,j) = g(1,nx,j,k) - dum(2,j) = g(2,nx,j,k) - dum(3,j) = g(3,nx,j,k) - dum(4,j) = g(4,nx,j,k) - dum(5,j) = g(5,nx,j,k) - enddo - call MPI_SEND( dum(1,jst), - > 5*(jend-jst+1), - > dp_type, - > south, - > from_n, - > MPI_COMM_WORLD, - > IERROR ) - endif - - if( east .ne. -1 ) then - do i=ist,iend - dum(1,i) = g(1,i,ny,k) - dum(2,i) = g(2,i,ny,k) - dum(3,i) = g(3,i,ny,k) - dum(4,i) = g(4,i,ny,k) - dum(5,i) = g(5,i,ny,k) - enddo - call MPI_SEND( dum(1,ist), - > 5*(iend-ist+1), - > dp_type, - > east, - > from_w, - > MPI_COMM_WORLD, - > IERROR ) - endif - - else - - if( north .ne. -1 ) then - do j=jst,jend - dum(1,j) = g(1,1,j,k) - dum(2,j) = g(2,1,j,k) - dum(3,j) = g(3,1,j,k) - dum(4,j) = g(4,1,j,k) - dum(5,j) = g(5,1,j,k) - enddo - call MPI_SEND( dum(1,jst), - > 5*(jend-jst+1), - > dp_type, - > north, - > from_s, - > MPI_COMM_WORLD, - > IERROR ) - endif - - if( west .ne. -1 ) then - do i=ist,iend - dum(1,i) = g(1,i,1,k) - dum(2,i) = g(2,i,1,k) - dum(3,i) = g(3,i,1,k) - dum(4,i) = g(4,i,1,k) - dum(5,i) = g(5,i,1,k) - enddo - call MPI_SEND( dum(1,ist), - > 5*(iend-ist+1), - > dp_type, - > west, - > from_e, - > MPI_COMM_WORLD, - > IERROR ) - endif - - endif - - end - - - diff --git a/examples/smpi/NAS/LU/exchange_3.f b/examples/smpi/NAS/LU/exchange_3.f deleted file mode 100644 index d52ae7ef4d..0000000000 --- a/examples/smpi/NAS/LU/exchange_3.f +++ /dev/null @@ -1,312 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine exchange_3(g,iex) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c compute the right hand side based on exact solution -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - include 'applu.incl' - -c--------------------------------------------------------------------- -c input parameters -c--------------------------------------------------------------------- - double precision g(5,-1:isiz1+2,-1:isiz2+2,isiz3) - integer iex - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j, k - integer ipos1, ipos2 - - integer mid - integer STATUS(MPI_STATUS_SIZE) - integer IERROR - - - - if (iex.eq.0) then -c--------------------------------------------------------------------- -c communicate in the south and north directions -c--------------------------------------------------------------------- - if (north.ne.-1) then - call MPI_IRECV( buf1, - > 10*ny*nz, - > dp_type, - > MPI_ANY_SOURCE, - > from_n, - > MPI_COMM_WORLD, - > mid, - > IERROR ) - end if - -c--------------------------------------------------------------------- -c send south -c--------------------------------------------------------------------- - if (south.ne.-1) then - do k = 1,nz - do j = 1,ny - ipos1 = (k-1)*ny + j - ipos2 = ipos1 + ny*nz - buf(1,ipos1) = g(1,nx-1,j,k) - buf(2,ipos1) = g(2,nx-1,j,k) - buf(3,ipos1) = g(3,nx-1,j,k) - buf(4,ipos1) = g(4,nx-1,j,k) - buf(5,ipos1) = g(5,nx-1,j,k) - buf(1,ipos2) = g(1,nx,j,k) - buf(2,ipos2) = g(2,nx,j,k) - buf(3,ipos2) = g(3,nx,j,k) - buf(4,ipos2) = g(4,nx,j,k) - buf(5,ipos2) = g(5,nx,j,k) - end do - end do - - call MPI_SEND( buf, - > 10*ny*nz, - > dp_type, - > south, - > from_n, - > MPI_COMM_WORLD, - > IERROR ) - end if - -c--------------------------------------------------------------------- -c receive from north -c--------------------------------------------------------------------- - if (north.ne.-1) then - call MPI_WAIT( mid, STATUS, IERROR ) - - do k = 1,nz - do j = 1,ny - ipos1 = (k-1)*ny + j - ipos2 = ipos1 + ny*nz - g(1,-1,j,k) = buf1(1,ipos1) - g(2,-1,j,k) = buf1(2,ipos1) - g(3,-1,j,k) = buf1(3,ipos1) - g(4,-1,j,k) = buf1(4,ipos1) - g(5,-1,j,k) = buf1(5,ipos1) - g(1,0,j,k) = buf1(1,ipos2) - g(2,0,j,k) = buf1(2,ipos2) - g(3,0,j,k) = buf1(3,ipos2) - g(4,0,j,k) = buf1(4,ipos2) - g(5,0,j,k) = buf1(5,ipos2) - end do - end do - - end if - - if (south.ne.-1) then - call MPI_IRECV( buf1, - > 10*ny*nz, - > dp_type, - > MPI_ANY_SOURCE, - > from_s, - > MPI_COMM_WORLD, - > mid, - > IERROR ) - end if - -c--------------------------------------------------------------------- -c send north -c--------------------------------------------------------------------- - if (north.ne.-1) then - do k = 1,nz - do j = 1,ny - ipos1 = (k-1)*ny + j - ipos2 = ipos1 + ny*nz - buf(1,ipos1) = g(1,2,j,k) - buf(2,ipos1) = g(2,2,j,k) - buf(3,ipos1) = g(3,2,j,k) - buf(4,ipos1) = g(4,2,j,k) - buf(5,ipos1) = g(5,2,j,k) - buf(1,ipos2) = g(1,1,j,k) - buf(2,ipos2) = g(2,1,j,k) - buf(3,ipos2) = g(3,1,j,k) - buf(4,ipos2) = g(4,1,j,k) - buf(5,ipos2) = g(5,1,j,k) - end do - end do - - call MPI_SEND( buf, - > 10*ny*nz, - > dp_type, - > north, - > from_s, - > MPI_COMM_WORLD, - > IERROR ) - end if - -c--------------------------------------------------------------------- -c receive from south -c--------------------------------------------------------------------- - if (south.ne.-1) then - call MPI_WAIT( mid, STATUS, IERROR ) - - do k = 1,nz - do j = 1,ny - ipos1 = (k-1)*ny + j - ipos2 = ipos1 + ny*nz - g(1,nx+2,j,k) = buf1(1,ipos1) - g(2,nx+2,j,k) = buf1(2,ipos1) - g(3,nx+2,j,k) = buf1(3,ipos1) - g(4,nx+2,j,k) = buf1(4,ipos1) - g(5,nx+2,j,k) = buf1(5,ipos1) - g(1,nx+1,j,k) = buf1(1,ipos2) - g(2,nx+1,j,k) = buf1(2,ipos2) - g(3,nx+1,j,k) = buf1(3,ipos2) - g(4,nx+1,j,k) = buf1(4,ipos2) - g(5,nx+1,j,k) = buf1(5,ipos2) - end do - end do - end if - - else - -c--------------------------------------------------------------------- -c communicate in the east and west directions -c--------------------------------------------------------------------- - if (west.ne.-1) then - call MPI_IRECV( buf1, - > 10*nx*nz, - > dp_type, - > MPI_ANY_SOURCE, - > from_w, - > MPI_COMM_WORLD, - > mid, - > IERROR ) - end if - -c--------------------------------------------------------------------- -c send east -c--------------------------------------------------------------------- - if (east.ne.-1) then - do k = 1,nz - do i = 1,nx - ipos1 = (k-1)*nx + i - ipos2 = ipos1 + nx*nz - buf(1,ipos1) = g(1,i,ny-1,k) - buf(2,ipos1) = g(2,i,ny-1,k) - buf(3,ipos1) = g(3,i,ny-1,k) - buf(4,ipos1) = g(4,i,ny-1,k) - buf(5,ipos1) = g(5,i,ny-1,k) - buf(1,ipos2) = g(1,i,ny,k) - buf(2,ipos2) = g(2,i,ny,k) - buf(3,ipos2) = g(3,i,ny,k) - buf(4,ipos2) = g(4,i,ny,k) - buf(5,ipos2) = g(5,i,ny,k) - end do - end do - - call MPI_SEND( buf, - > 10*nx*nz, - > dp_type, - > east, - > from_w, - > MPI_COMM_WORLD, - > IERROR ) - end if - -c--------------------------------------------------------------------- -c receive from west -c--------------------------------------------------------------------- - if (west.ne.-1) then - call MPI_WAIT( mid, STATUS, IERROR ) - - do k = 1,nz - do i = 1,nx - ipos1 = (k-1)*nx + i - ipos2 = ipos1 + nx*nz - g(1,i,-1,k) = buf1(1,ipos1) - g(2,i,-1,k) = buf1(2,ipos1) - g(3,i,-1,k) = buf1(3,ipos1) - g(4,i,-1,k) = buf1(4,ipos1) - g(5,i,-1,k) = buf1(5,ipos1) - g(1,i,0,k) = buf1(1,ipos2) - g(2,i,0,k) = buf1(2,ipos2) - g(3,i,0,k) = buf1(3,ipos2) - g(4,i,0,k) = buf1(4,ipos2) - g(5,i,0,k) = buf1(5,ipos2) - end do - end do - - end if - - if (east.ne.-1) then - call MPI_IRECV( buf1, - > 10*nx*nz, - > dp_type, - > MPI_ANY_SOURCE, - > from_e, - > MPI_COMM_WORLD, - > mid, - > IERROR ) - end if - -c--------------------------------------------------------------------- -c send west -c--------------------------------------------------------------------- - if (west.ne.-1) then - do k = 1,nz - do i = 1,nx - ipos1 = (k-1)*nx + i - ipos2 = ipos1 + nx*nz - buf(1,ipos1) = g(1,i,2,k) - buf(2,ipos1) = g(2,i,2,k) - buf(3,ipos1) = g(3,i,2,k) - buf(4,ipos1) = g(4,i,2,k) - buf(5,ipos1) = g(5,i,2,k) - buf(1,ipos2) = g(1,i,1,k) - buf(2,ipos2) = g(2,i,1,k) - buf(3,ipos2) = g(3,i,1,k) - buf(4,ipos2) = g(4,i,1,k) - buf(5,ipos2) = g(5,i,1,k) - end do - end do - - call MPI_SEND( buf, - > 10*nx*nz, - > dp_type, - > west, - > from_e, - > MPI_COMM_WORLD, - > IERROR ) - end if - -c--------------------------------------------------------------------- -c receive from east -c--------------------------------------------------------------------- - if (east.ne.-1) then - call MPI_WAIT( mid, STATUS, IERROR ) - - do k = 1,nz - do i = 1,nx - ipos1 = (k-1)*nx + i - ipos2 = ipos1 + nx*nz - g(1,i,ny+2,k) = buf1(1,ipos1) - g(2,i,ny+2,k) = buf1(2,ipos1) - g(3,i,ny+2,k) = buf1(3,ipos1) - g(4,i,ny+2,k) = buf1(4,ipos1) - g(5,i,ny+2,k) = buf1(5,ipos1) - g(1,i,ny+1,k) = buf1(1,ipos2) - g(2,i,ny+1,k) = buf1(2,ipos2) - g(3,i,ny+1,k) = buf1(3,ipos2) - g(4,i,ny+1,k) = buf1(4,ipos2) - g(5,i,ny+1,k) = buf1(5,ipos2) - end do - end do - - end if - - end if - - return - end diff --git a/examples/smpi/NAS/LU/exchange_4.f b/examples/smpi/NAS/LU/exchange_4.f deleted file mode 100644 index 1c4c38e218..0000000000 --- a/examples/smpi/NAS/LU/exchange_4.f +++ /dev/null @@ -1,133 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine exchange_4(g,h,ibeg,ifin1,jbeg,jfin1) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c compute the right hand side based on exact solution -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - include 'applu.incl' - -c--------------------------------------------------------------------- -c input parameters -c--------------------------------------------------------------------- - double precision g(0:isiz2+1,0:isiz3+1), - > h(0:isiz2+1,0:isiz3+1) - integer ibeg, ifin1 - integer jbeg, jfin1 - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j - integer ny2 - double precision dum(1024) - - integer msgid1, msgid3 - integer STATUS(MPI_STATUS_SIZE) - integer IERROR - - - - ny2 = ny + 2 - -c--------------------------------------------------------------------- -c communicate in the east and west directions -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c receive from east -c--------------------------------------------------------------------- - if (jfin1.eq.ny) then - call MPI_IRECV( dum, - > 2*nx, - > dp_type, - > MPI_ANY_SOURCE, - > from_e, - > MPI_COMM_WORLD, - > msgid3, - > IERROR ) - - call MPI_WAIT( msgid3, STATUS, IERROR ) - - do i = 1,nx - g(i,ny+1) = dum(i) - h(i,ny+1) = dum(i+nx) - end do - - end if - -c--------------------------------------------------------------------- -c send west -c--------------------------------------------------------------------- - if (jbeg.eq.1) then - do i = 1,nx - dum(i) = g(i,1) - dum(i+nx) = h(i,1) - end do - - call MPI_SEND( dum, - > 2*nx, - > dp_type, - > west, - > from_e, - > MPI_COMM_WORLD, - > IERROR ) - - end if - -c--------------------------------------------------------------------- -c communicate in the south and north directions -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c receive from south -c--------------------------------------------------------------------- - if (ifin1.eq.nx) then - call MPI_IRECV( dum, - > 2*ny2, - > dp_type, - > MPI_ANY_SOURCE, - > from_s, - > MPI_COMM_WORLD, - > msgid1, - > IERROR ) - - call MPI_WAIT( msgid1, STATUS, IERROR ) - - do j = 0,ny+1 - g(nx+1,j) = dum(j+1) - h(nx+1,j) = dum(j+ny2+1) - end do - - end if - -c--------------------------------------------------------------------- -c send north -c--------------------------------------------------------------------- - if (ibeg.eq.1) then - do j = 0,ny+1 - dum(j+1) = g(1,j) - dum(j+ny2+1) = h(1,j) - end do - - call MPI_SEND( dum, - > 2*ny2, - > dp_type, - > north, - > from_s, - > MPI_COMM_WORLD, - > IERROR ) - - end if - - return - end diff --git a/examples/smpi/NAS/LU/exchange_5.f b/examples/smpi/NAS/LU/exchange_5.f deleted file mode 100644 index e4cc66f5bf..0000000000 --- a/examples/smpi/NAS/LU/exchange_5.f +++ /dev/null @@ -1,81 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine exchange_5(g,ibeg,ifin1) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c compute the right hand side based on exact solution -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - include 'applu.incl' - -c--------------------------------------------------------------------- -c input parameters -c--------------------------------------------------------------------- - double precision g(0:isiz2+1,0:isiz3+1) - integer ibeg, ifin1 - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer k - double precision dum(1024) - - integer msgid1 - integer STATUS(MPI_STATUS_SIZE) - integer IERROR - - - -c--------------------------------------------------------------------- -c communicate in the south and north directions -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c receive from south -c--------------------------------------------------------------------- - if (ifin1.eq.nx) then - call MPI_IRECV( dum, - > nz, - > dp_type, - > MPI_ANY_SOURCE, - > from_s, - > MPI_COMM_WORLD, - > msgid1, - > IERROR ) - - call MPI_WAIT( msgid1, STATUS, IERROR ) - - do k = 1,nz - g(nx+1,k) = dum(k) - end do - - end if - -c--------------------------------------------------------------------- -c send north -c--------------------------------------------------------------------- - if (ibeg.eq.1) then - do k = 1,nz - dum(k) = g(1,k) - end do - - call MPI_SEND( dum, - > nz, - > dp_type, - > north, - > from_s, - > MPI_COMM_WORLD, - > IERROR ) - - end if - - return - end diff --git a/examples/smpi/NAS/LU/exchange_6.f b/examples/smpi/NAS/LU/exchange_6.f deleted file mode 100644 index 0626609547..0000000000 --- a/examples/smpi/NAS/LU/exchange_6.f +++ /dev/null @@ -1,81 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine exchange_6(g,jbeg,jfin1) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c compute the right hand side based on exact solution -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - include 'applu.incl' - -c--------------------------------------------------------------------- -c input parameters -c--------------------------------------------------------------------- - double precision g(0:isiz2+1,0:isiz3+1) - integer jbeg, jfin1 - -c--------------------------------------------------------------------- -c local parameters -c--------------------------------------------------------------------- - integer k - double precision dum(1024) - - integer msgid3 - integer STATUS(MPI_STATUS_SIZE) - integer IERROR - - - -c--------------------------------------------------------------------- -c communicate in the east and west directions -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c receive from east -c--------------------------------------------------------------------- - if (jfin1.eq.ny) then - call MPI_IRECV( dum, - > nz, - > dp_type, - > MPI_ANY_SOURCE, - > from_e, - > MPI_COMM_WORLD, - > msgid3, - > IERROR ) - - call MPI_WAIT( msgid3, STATUS, IERROR ) - - do k = 1,nz - g(ny+1,k) = dum(k) - end do - - end if - -c--------------------------------------------------------------------- -c send west -c--------------------------------------------------------------------- - if (jbeg.eq.1) then - do k = 1,nz - dum(k) = g(1,k) - end do - - call MPI_SEND( dum, - > nz, - > dp_type, - > west, - > from_e, - > MPI_COMM_WORLD, - > IERROR ) - - end if - - return - end diff --git a/examples/smpi/NAS/LU/init_comm.f b/examples/smpi/NAS/LU/init_comm.f deleted file mode 100644 index 72ece00ac4..0000000000 --- a/examples/smpi/NAS/LU/init_comm.f +++ /dev/null @@ -1,57 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine init_comm - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c initialize MPI and establish rank and size -c -c This is a module in the MPI implementation of LUSSOR -c pseudo application from the NAS Parallel Benchmarks. -c -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - include 'applu.incl' - - integer nodedim - integer IERROR - - -c--------------------------------------------------------------------- -c initialize MPI communication -c--------------------------------------------------------------------- - call MPI_INIT( IERROR ) - -c--------------------------------------------------------------------- -c establish the global rank of this process -c--------------------------------------------------------------------- - call MPI_COMM_RANK( MPI_COMM_WORLD, - > id, - > IERROR ) - -c--------------------------------------------------------------------- -c establish the size of the global group -c--------------------------------------------------------------------- - call MPI_COMM_SIZE( MPI_COMM_WORLD, - > num, - > IERROR ) - - ndim = nodedim(num) - - if (.not. convertdouble) then - dp_type = MPI_DOUBLE_PRECISION - else - dp_type = MPI_REAL - endif - - - return - end diff --git a/examples/smpi/NAS/LU/inputlu.data.sample b/examples/smpi/NAS/LU/inputlu.data.sample deleted file mode 100644 index 9ef5a7be00..0000000000 --- a/examples/smpi/NAS/LU/inputlu.data.sample +++ /dev/null @@ -1,24 +0,0 @@ -c -c***controls printing of the progress of iterations: ipr inorm - 1 250 -c -c***the maximum no. of pseudo-time steps to be performed: nitmax - 250 -c -c***magnitude of the time step: dt - 2.0e+00 -c -c***relaxation factor for SSOR iterations: omega - 1.2 -c -c***tolerance levels for steady-state residuals: tolnwt(m),m=1,5 - 1.0e-08 1.0e-08 1.0e-08 1.0e-08 1.0e-08 -c -c***number of grid points in xi and eta and zeta directions: nx ny nz - 64 64 64 -c - - - - - diff --git a/examples/smpi/NAS/LU/jacld.f b/examples/smpi/NAS/LU/jacld.f deleted file mode 100644 index 9580d080ab..0000000000 --- a/examples/smpi/NAS/LU/jacld.f +++ /dev/null @@ -1,384 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine jacld(k) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - -c--------------------------------------------------------------------- -c compute the lower triangular part of the jacobian matrix -c--------------------------------------------------------------------- - - implicit none - - include 'applu.incl' - -c--------------------------------------------------------------------- -c input parameters -c--------------------------------------------------------------------- - integer k - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j - double precision r43 - double precision c1345 - double precision c34 - double precision tmp1, tmp2, tmp3 - - - - r43 = ( 4.0d+00 / 3.0d+00 ) - c1345 = c1 * c3 * c4 * c5 - c34 = c3 * c4 - - do j = jst, jend - do i = ist, iend - -c--------------------------------------------------------------------- -c form the block daigonal -c--------------------------------------------------------------------- - tmp1 = 1.0d+00 / u(1,i,j,k) - tmp2 = tmp1 * tmp1 - tmp3 = tmp1 * tmp2 - - d(1,1,i,j) = 1.0d+00 - > + dt * 2.0d+00 * ( tx1 * dx1 - > + ty1 * dy1 - > + tz1 * dz1 ) - d(1,2,i,j) = 0.0d+00 - d(1,3,i,j) = 0.0d+00 - d(1,4,i,j) = 0.0d+00 - d(1,5,i,j) = 0.0d+00 - - d(2,1,i,j) = dt * 2.0d+00 - > * ( tx1 * ( - r43 * c34 * tmp2 * u(2,i,j,k) ) - > + ty1 * ( - c34 * tmp2 * u(2,i,j,k) ) - > + tz1 * ( - c34 * tmp2 * u(2,i,j,k) ) ) - d(2,2,i,j) = 1.0d+00 - > + dt * 2.0d+00 - > * ( tx1 * r43 * c34 * tmp1 - > + ty1 * c34 * tmp1 - > + tz1 * c34 * tmp1 ) - > + dt * 2.0d+00 * ( tx1 * dx2 - > + ty1 * dy2 - > + tz1 * dz2 ) - d(2,3,i,j) = 0.0d+00 - d(2,4,i,j) = 0.0d+00 - d(2,5,i,j) = 0.0d+00 - - d(3,1,i,j) = dt * 2.0d+00 - > * ( tx1 * ( - c34 * tmp2 * u(3,i,j,k) ) - > + ty1 * ( - r43 * c34 * tmp2 * u(3,i,j,k) ) - > + tz1 * ( - c34 * tmp2 * u(3,i,j,k) ) ) - d(3,2,i,j) = 0.0d+00 - d(3,3,i,j) = 1.0d+00 - > + dt * 2.0d+00 - > * ( tx1 * c34 * tmp1 - > + ty1 * r43 * c34 * tmp1 - > + tz1 * c34 * tmp1 ) - > + dt * 2.0d+00 * ( tx1 * dx3 - > + ty1 * dy3 - > + tz1 * dz3 ) - d(3,4,i,j) = 0.0d+00 - d(3,5,i,j) = 0.0d+00 - - d(4,1,i,j) = dt * 2.0d+00 - > * ( tx1 * ( - c34 * tmp2 * u(4,i,j,k) ) - > + ty1 * ( - c34 * tmp2 * u(4,i,j,k) ) - > + tz1 * ( - r43 * c34 * tmp2 * u(4,i,j,k) ) ) - d(4,2,i,j) = 0.0d+00 - d(4,3,i,j) = 0.0d+00 - d(4,4,i,j) = 1.0d+00 - > + dt * 2.0d+00 - > * ( tx1 * c34 * tmp1 - > + ty1 * c34 * tmp1 - > + tz1 * r43 * c34 * tmp1 ) - > + dt * 2.0d+00 * ( tx1 * dx4 - > + ty1 * dy4 - > + tz1 * dz4 ) - d(4,5,i,j) = 0.0d+00 - - d(5,1,i,j) = dt * 2.0d+00 - > * ( tx1 * ( - ( r43*c34 - c1345 ) * tmp3 * ( u(2,i,j,k) ** 2 ) - > - ( c34 - c1345 ) * tmp3 * ( u(3,i,j,k) ** 2 ) - > - ( c34 - c1345 ) * tmp3 * ( u(4,i,j,k) ** 2 ) - > - ( c1345 ) * tmp2 * u(5,i,j,k) ) - > + ty1 * ( - ( c34 - c1345 ) * tmp3 * ( u(2,i,j,k) ** 2 ) - > - ( r43*c34 - c1345 ) * tmp3 * ( u(3,i,j,k) ** 2 ) - > - ( c34 - c1345 ) * tmp3 * ( u(4,i,j,k) ** 2 ) - > - ( c1345 ) * tmp2 * u(5,i,j,k) ) - > + tz1 * ( - ( c34 - c1345 ) * tmp3 * ( u(2,i,j,k) ** 2 ) - > - ( c34 - c1345 ) * tmp3 * ( u(3,i,j,k) ** 2 ) - > - ( r43*c34 - c1345 ) * tmp3 * ( u(4,i,j,k) ** 2 ) - > - ( c1345 ) * tmp2 * u(5,i,j,k) ) ) - d(5,2,i,j) = dt * 2.0d+00 - > * ( tx1 * ( r43*c34 - c1345 ) * tmp2 * u(2,i,j,k) - > + ty1 * ( c34 - c1345 ) * tmp2 * u(2,i,j,k) - > + tz1 * ( c34 - c1345 ) * tmp2 * u(2,i,j,k) ) - d(5,3,i,j) = dt * 2.0d+00 - > * ( tx1 * ( c34 - c1345 ) * tmp2 * u(3,i,j,k) - > + ty1 * ( r43*c34 -c1345 ) * tmp2 * u(3,i,j,k) - > + tz1 * ( c34 - c1345 ) * tmp2 * u(3,i,j,k) ) - d(5,4,i,j) = dt * 2.0d+00 - > * ( tx1 * ( c34 - c1345 ) * tmp2 * u(4,i,j,k) - > + ty1 * ( c34 - c1345 ) * tmp2 * u(4,i,j,k) - > + tz1 * ( r43*c34 - c1345 ) * tmp2 * u(4,i,j,k) ) - d(5,5,i,j) = 1.0d+00 - > + dt * 2.0d+00 * ( tx1 * c1345 * tmp1 - > + ty1 * c1345 * tmp1 - > + tz1 * c1345 * tmp1 ) - > + dt * 2.0d+00 * ( tx1 * dx5 - > + ty1 * dy5 - > + tz1 * dz5 ) - -c--------------------------------------------------------------------- -c form the first block sub-diagonal -c--------------------------------------------------------------------- - tmp1 = 1.0d+00 / u(1,i,j,k-1) - tmp2 = tmp1 * tmp1 - tmp3 = tmp1 * tmp2 - - a(1,1,i,j) = - dt * tz1 * dz1 - a(1,2,i,j) = 0.0d+00 - a(1,3,i,j) = 0.0d+00 - a(1,4,i,j) = - dt * tz2 - a(1,5,i,j) = 0.0d+00 - - a(2,1,i,j) = - dt * tz2 - > * ( - ( u(2,i,j,k-1)*u(4,i,j,k-1) ) * tmp2 ) - > - dt * tz1 * ( - c34 * tmp2 * u(2,i,j,k-1) ) - a(2,2,i,j) = - dt * tz2 * ( u(4,i,j,k-1) * tmp1 ) - > - dt * tz1 * c34 * tmp1 - > - dt * tz1 * dz2 - a(2,3,i,j) = 0.0d+00 - a(2,4,i,j) = - dt * tz2 * ( u(2,i,j,k-1) * tmp1 ) - a(2,5,i,j) = 0.0d+00 - - a(3,1,i,j) = - dt * tz2 - > * ( - ( u(3,i,j,k-1)*u(4,i,j,k-1) ) * tmp2 ) - > - dt * tz1 * ( - c34 * tmp2 * u(3,i,j,k-1) ) - a(3,2,i,j) = 0.0d+00 - a(3,3,i,j) = - dt * tz2 * ( u(4,i,j,k-1) * tmp1 ) - > - dt * tz1 * ( c34 * tmp1 ) - > - dt * tz1 * dz3 - a(3,4,i,j) = - dt * tz2 * ( u(3,i,j,k-1) * tmp1 ) - a(3,5,i,j) = 0.0d+00 - - a(4,1,i,j) = - dt * tz2 - > * ( - ( u(4,i,j,k-1) * tmp1 ) ** 2 - > + 0.50d+00 * c2 - > * ( ( u(2,i,j,k-1) * u(2,i,j,k-1) - > + u(3,i,j,k-1) * u(3,i,j,k-1) - > + u(4,i,j,k-1) * u(4,i,j,k-1) ) * tmp2 ) ) - > - dt * tz1 * ( - r43 * c34 * tmp2 * u(4,i,j,k-1) ) - a(4,2,i,j) = - dt * tz2 - > * ( - c2 * ( u(2,i,j,k-1) * tmp1 ) ) - a(4,3,i,j) = - dt * tz2 - > * ( - c2 * ( u(3,i,j,k-1) * tmp1 ) ) - a(4,4,i,j) = - dt * tz2 * ( 2.0d+00 - c2 ) - > * ( u(4,i,j,k-1) * tmp1 ) - > - dt * tz1 * ( r43 * c34 * tmp1 ) - > - dt * tz1 * dz4 - a(4,5,i,j) = - dt * tz2 * c2 - - a(5,1,i,j) = - dt * tz2 - > * ( ( c2 * ( u(2,i,j,k-1) * u(2,i,j,k-1) - > + u(3,i,j,k-1) * u(3,i,j,k-1) - > + u(4,i,j,k-1) * u(4,i,j,k-1) ) * tmp2 - > - c1 * ( u(5,i,j,k-1) * tmp1 ) ) - > * ( u(4,i,j,k-1) * tmp1 ) ) - > - dt * tz1 - > * ( - ( c34 - c1345 ) * tmp3 * (u(2,i,j,k-1)**2) - > - ( c34 - c1345 ) * tmp3 * (u(3,i,j,k-1)**2) - > - ( r43*c34 - c1345 )* tmp3 * (u(4,i,j,k-1)**2) - > - c1345 * tmp2 * u(5,i,j,k-1) ) - a(5,2,i,j) = - dt * tz2 - > * ( - c2 * ( u(2,i,j,k-1)*u(4,i,j,k-1) ) * tmp2 ) - > - dt * tz1 * ( c34 - c1345 ) * tmp2 * u(2,i,j,k-1) - a(5,3,i,j) = - dt * tz2 - > * ( - c2 * ( u(3,i,j,k-1)*u(4,i,j,k-1) ) * tmp2 ) - > - dt * tz1 * ( c34 - c1345 ) * tmp2 * u(3,i,j,k-1) - a(5,4,i,j) = - dt * tz2 - > * ( c1 * ( u(5,i,j,k-1) * tmp1 ) - > - 0.50d+00 * c2 - > * ( ( u(2,i,j,k-1)*u(2,i,j,k-1) - > + u(3,i,j,k-1)*u(3,i,j,k-1) - > + 3.0d+00*u(4,i,j,k-1)*u(4,i,j,k-1) ) * tmp2 ) ) - > - dt * tz1 * ( r43*c34 - c1345 ) * tmp2 * u(4,i,j,k-1) - a(5,5,i,j) = - dt * tz2 - > * ( c1 * ( u(4,i,j,k-1) * tmp1 ) ) - > - dt * tz1 * c1345 * tmp1 - > - dt * tz1 * dz5 - -c--------------------------------------------------------------------- -c form the second block sub-diagonal -c--------------------------------------------------------------------- - tmp1 = 1.0d+00 / u(1,i,j-1,k) - tmp2 = tmp1 * tmp1 - tmp3 = tmp1 * tmp2 - - b(1,1,i,j) = - dt * ty1 * dy1 - b(1,2,i,j) = 0.0d+00 - b(1,3,i,j) = - dt * ty2 - b(1,4,i,j) = 0.0d+00 - b(1,5,i,j) = 0.0d+00 - - b(2,1,i,j) = - dt * ty2 - > * ( - ( u(2,i,j-1,k)*u(3,i,j-1,k) ) * tmp2 ) - > - dt * ty1 * ( - c34 * tmp2 * u(2,i,j-1,k) ) - b(2,2,i,j) = - dt * ty2 * ( u(3,i,j-1,k) * tmp1 ) - > - dt * ty1 * ( c34 * tmp1 ) - > - dt * ty1 * dy2 - b(2,3,i,j) = - dt * ty2 * ( u(2,i,j-1,k) * tmp1 ) - b(2,4,i,j) = 0.0d+00 - b(2,5,i,j) = 0.0d+00 - - b(3,1,i,j) = - dt * ty2 - > * ( - ( u(3,i,j-1,k) * tmp1 ) ** 2 - > + 0.50d+00 * c2 * ( ( u(2,i,j-1,k) * u(2,i,j-1,k) - > + u(3,i,j-1,k) * u(3,i,j-1,k) - > + u(4,i,j-1,k) * u(4,i,j-1,k) ) - > * tmp2 ) ) - > - dt * ty1 * ( - r43 * c34 * tmp2 * u(3,i,j-1,k) ) - b(3,2,i,j) = - dt * ty2 - > * ( - c2 * ( u(2,i,j-1,k) * tmp1 ) ) - b(3,3,i,j) = - dt * ty2 * ( ( 2.0d+00 - c2 ) - > * ( u(3,i,j-1,k) * tmp1 ) ) - > - dt * ty1 * ( r43 * c34 * tmp1 ) - > - dt * ty1 * dy3 - b(3,4,i,j) = - dt * ty2 - > * ( - c2 * ( u(4,i,j-1,k) * tmp1 ) ) - b(3,5,i,j) = - dt * ty2 * c2 - - b(4,1,i,j) = - dt * ty2 - > * ( - ( u(3,i,j-1,k)*u(4,i,j-1,k) ) * tmp2 ) - > - dt * ty1 * ( - c34 * tmp2 * u(4,i,j-1,k) ) - b(4,2,i,j) = 0.0d+00 - b(4,3,i,j) = - dt * ty2 * ( u(4,i,j-1,k) * tmp1 ) - b(4,4,i,j) = - dt * ty2 * ( u(3,i,j-1,k) * tmp1 ) - > - dt * ty1 * ( c34 * tmp1 ) - > - dt * ty1 * dy4 - b(4,5,i,j) = 0.0d+00 - - b(5,1,i,j) = - dt * ty2 - > * ( ( c2 * ( u(2,i,j-1,k) * u(2,i,j-1,k) - > + u(3,i,j-1,k) * u(3,i,j-1,k) - > + u(4,i,j-1,k) * u(4,i,j-1,k) ) * tmp2 - > - c1 * ( u(5,i,j-1,k) * tmp1 ) ) - > * ( u(3,i,j-1,k) * tmp1 ) ) - > - dt * ty1 - > * ( - ( c34 - c1345 )*tmp3*(u(2,i,j-1,k)**2) - > - ( r43*c34 - c1345 )*tmp3*(u(3,i,j-1,k)**2) - > - ( c34 - c1345 )*tmp3*(u(4,i,j-1,k)**2) - > - c1345*tmp2*u(5,i,j-1,k) ) - b(5,2,i,j) = - dt * ty2 - > * ( - c2 * ( u(2,i,j-1,k)*u(3,i,j-1,k) ) * tmp2 ) - > - dt * ty1 - > * ( c34 - c1345 ) * tmp2 * u(2,i,j-1,k) - b(5,3,i,j) = - dt * ty2 - > * ( c1 * ( u(5,i,j-1,k) * tmp1 ) - > - 0.50d+00 * c2 - > * ( ( u(2,i,j-1,k)*u(2,i,j-1,k) - > + 3.0d+00 * u(3,i,j-1,k)*u(3,i,j-1,k) - > + u(4,i,j-1,k)*u(4,i,j-1,k) ) * tmp2 ) ) - > - dt * ty1 - > * ( r43*c34 - c1345 ) * tmp2 * u(3,i,j-1,k) - b(5,4,i,j) = - dt * ty2 - > * ( - c2 * ( u(3,i,j-1,k)*u(4,i,j-1,k) ) * tmp2 ) - > - dt * ty1 * ( c34 - c1345 ) * tmp2 * u(4,i,j-1,k) - b(5,5,i,j) = - dt * ty2 - > * ( c1 * ( u(3,i,j-1,k) * tmp1 ) ) - > - dt * ty1 * c1345 * tmp1 - > - dt * ty1 * dy5 - -c--------------------------------------------------------------------- -c form the third block sub-diagonal -c--------------------------------------------------------------------- - tmp1 = 1.0d+00 / u(1,i-1,j,k) - tmp2 = tmp1 * tmp1 - tmp3 = tmp1 * tmp2 - - c(1,1,i,j) = - dt * tx1 * dx1 - c(1,2,i,j) = - dt * tx2 - c(1,3,i,j) = 0.0d+00 - c(1,4,i,j) = 0.0d+00 - c(1,5,i,j) = 0.0d+00 - - c(2,1,i,j) = - dt * tx2 - > * ( - ( u(2,i-1,j,k) * tmp1 ) ** 2 - > + c2 * 0.50d+00 * ( u(2,i-1,j,k) * u(2,i-1,j,k) - > + u(3,i-1,j,k) * u(3,i-1,j,k) - > + u(4,i-1,j,k) * u(4,i-1,j,k) ) * tmp2 ) - > - dt * tx1 * ( - r43 * c34 * tmp2 * u(2,i-1,j,k) ) - c(2,2,i,j) = - dt * tx2 - > * ( ( 2.0d+00 - c2 ) * ( u(2,i-1,j,k) * tmp1 ) ) - > - dt * tx1 * ( r43 * c34 * tmp1 ) - > - dt * tx1 * dx2 - c(2,3,i,j) = - dt * tx2 - > * ( - c2 * ( u(3,i-1,j,k) * tmp1 ) ) - c(2,4,i,j) = - dt * tx2 - > * ( - c2 * ( u(4,i-1,j,k) * tmp1 ) ) - c(2,5,i,j) = - dt * tx2 * c2 - - c(3,1,i,j) = - dt * tx2 - > * ( - ( u(2,i-1,j,k) * u(3,i-1,j,k) ) * tmp2 ) - > - dt * tx1 * ( - c34 * tmp2 * u(3,i-1,j,k) ) - c(3,2,i,j) = - dt * tx2 * ( u(3,i-1,j,k) * tmp1 ) - c(3,3,i,j) = - dt * tx2 * ( u(2,i-1,j,k) * tmp1 ) - > - dt * tx1 * ( c34 * tmp1 ) - > - dt * tx1 * dx3 - c(3,4,i,j) = 0.0d+00 - c(3,5,i,j) = 0.0d+00 - - c(4,1,i,j) = - dt * tx2 - > * ( - ( u(2,i-1,j,k)*u(4,i-1,j,k) ) * tmp2 ) - > - dt * tx1 * ( - c34 * tmp2 * u(4,i-1,j,k) ) - c(4,2,i,j) = - dt * tx2 * ( u(4,i-1,j,k) * tmp1 ) - c(4,3,i,j) = 0.0d+00 - c(4,4,i,j) = - dt * tx2 * ( u(2,i-1,j,k) * tmp1 ) - > - dt * tx1 * ( c34 * tmp1 ) - > - dt * tx1 * dx4 - c(4,5,i,j) = 0.0d+00 - - c(5,1,i,j) = - dt * tx2 - > * ( ( c2 * ( u(2,i-1,j,k) * u(2,i-1,j,k) - > + u(3,i-1,j,k) * u(3,i-1,j,k) - > + u(4,i-1,j,k) * u(4,i-1,j,k) ) * tmp2 - > - c1 * ( u(5,i-1,j,k) * tmp1 ) ) - > * ( u(2,i-1,j,k) * tmp1 ) ) - > - dt * tx1 - > * ( - ( r43*c34 - c1345 ) * tmp3 * ( u(2,i-1,j,k)**2 ) - > - ( c34 - c1345 ) * tmp3 * ( u(3,i-1,j,k)**2 ) - > - ( c34 - c1345 ) * tmp3 * ( u(4,i-1,j,k)**2 ) - > - c1345 * tmp2 * u(5,i-1,j,k) ) - c(5,2,i,j) = - dt * tx2 - > * ( c1 * ( u(5,i-1,j,k) * tmp1 ) - > - 0.50d+00 * c2 - > * ( ( 3.0d+00*u(2,i-1,j,k)*u(2,i-1,j,k) - > + u(3,i-1,j,k)*u(3,i-1,j,k) - > + u(4,i-1,j,k)*u(4,i-1,j,k) ) * tmp2 ) ) - > - dt * tx1 - > * ( r43*c34 - c1345 ) * tmp2 * u(2,i-1,j,k) - c(5,3,i,j) = - dt * tx2 - > * ( - c2 * ( u(3,i-1,j,k)*u(2,i-1,j,k) ) * tmp2 ) - > - dt * tx1 - > * ( c34 - c1345 ) * tmp2 * u(3,i-1,j,k) - c(5,4,i,j) = - dt * tx2 - > * ( - c2 * ( u(4,i-1,j,k)*u(2,i-1,j,k) ) * tmp2 ) - > - dt * tx1 - > * ( c34 - c1345 ) * tmp2 * u(4,i-1,j,k) - c(5,5,i,j) = - dt * tx2 - > * ( c1 * ( u(2,i-1,j,k) * tmp1 ) ) - > - dt * tx1 * c1345 * tmp1 - > - dt * tx1 * dx5 - - end do - end do - - return - end diff --git a/examples/smpi/NAS/LU/jacu.f b/examples/smpi/NAS/LU/jacu.f deleted file mode 100644 index 6a3c5b8ddb..0000000000 --- a/examples/smpi/NAS/LU/jacu.f +++ /dev/null @@ -1,384 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine jacu(k) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c compute the upper triangular part of the jacobian matrix -c--------------------------------------------------------------------- - - - implicit none - - include 'applu.incl' - -c--------------------------------------------------------------------- -c input parameters -c--------------------------------------------------------------------- - integer k - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j - double precision r43 - double precision c1345 - double precision c34 - double precision tmp1, tmp2, tmp3 - - - - r43 = ( 4.0d+00 / 3.0d+00 ) - c1345 = c1 * c3 * c4 * c5 - c34 = c3 * c4 - - do j = jst, jend - do i = ist, iend - -c--------------------------------------------------------------------- -c form the block daigonal -c--------------------------------------------------------------------- - tmp1 = 1.0d+00 / u(1,i,j,k) - tmp2 = tmp1 * tmp1 - tmp3 = tmp1 * tmp2 - - d(1,1,i,j) = 1.0d+00 - > + dt * 2.0d+00 * ( tx1 * dx1 - > + ty1 * dy1 - > + tz1 * dz1 ) - d(1,2,i,j) = 0.0d+00 - d(1,3,i,j) = 0.0d+00 - d(1,4,i,j) = 0.0d+00 - d(1,5,i,j) = 0.0d+00 - - d(2,1,i,j) = dt * 2.0d+00 - > * ( tx1 * ( - r43 * c34 * tmp2 * u(2,i,j,k) ) - > + ty1 * ( - c34 * tmp2 * u(2,i,j,k) ) - > + tz1 * ( - c34 * tmp2 * u(2,i,j,k) ) ) - d(2,2,i,j) = 1.0d+00 - > + dt * 2.0d+00 - > * ( tx1 * r43 * c34 * tmp1 - > + ty1 * c34 * tmp1 - > + tz1 * c34 * tmp1 ) - > + dt * 2.0d+00 * ( tx1 * dx2 - > + ty1 * dy2 - > + tz1 * dz2 ) - d(2,3,i,j) = 0.0d+00 - d(2,4,i,j) = 0.0d+00 - d(2,5,i,j) = 0.0d+00 - - d(3,1,i,j) = dt * 2.0d+00 - > * ( tx1 * ( - c34 * tmp2 * u(3,i,j,k) ) - > + ty1 * ( - r43 * c34 * tmp2 * u(3,i,j,k) ) - > + tz1 * ( - c34 * tmp2 * u(3,i,j,k) ) ) - d(3,2,i,j) = 0.0d+00 - d(3,3,i,j) = 1.0d+00 - > + dt * 2.0d+00 - > * ( tx1 * c34 * tmp1 - > + ty1 * r43 * c34 * tmp1 - > + tz1 * c34 * tmp1 ) - > + dt * 2.0d+00 * ( tx1 * dx3 - > + ty1 * dy3 - > + tz1 * dz3 ) - d(3,4,i,j) = 0.0d+00 - d(3,5,i,j) = 0.0d+00 - - d(4,1,i,j) = dt * 2.0d+00 - > * ( tx1 * ( - c34 * tmp2 * u(4,i,j,k) ) - > + ty1 * ( - c34 * tmp2 * u(4,i,j,k) ) - > + tz1 * ( - r43 * c34 * tmp2 * u(4,i,j,k) ) ) - d(4,2,i,j) = 0.0d+00 - d(4,3,i,j) = 0.0d+00 - d(4,4,i,j) = 1.0d+00 - > + dt * 2.0d+00 - > * ( tx1 * c34 * tmp1 - > + ty1 * c34 * tmp1 - > + tz1 * r43 * c34 * tmp1 ) - > + dt * 2.0d+00 * ( tx1 * dx4 - > + ty1 * dy4 - > + tz1 * dz4 ) - d(4,5,i,j) = 0.0d+00 - - d(5,1,i,j) = dt * 2.0d+00 - > * ( tx1 * ( - ( r43*c34 - c1345 ) * tmp3 * ( u(2,i,j,k) ** 2 ) - > - ( c34 - c1345 ) * tmp3 * ( u(3,i,j,k) ** 2 ) - > - ( c34 - c1345 ) * tmp3 * ( u(4,i,j,k) ** 2 ) - > - ( c1345 ) * tmp2 * u(5,i,j,k) ) - > + ty1 * ( - ( c34 - c1345 ) * tmp3 * ( u(2,i,j,k) ** 2 ) - > - ( r43*c34 - c1345 ) * tmp3 * ( u(3,i,j,k) ** 2 ) - > - ( c34 - c1345 ) * tmp3 * ( u(4,i,j,k) ** 2 ) - > - ( c1345 ) * tmp2 * u(5,i,j,k) ) - > + tz1 * ( - ( c34 - c1345 ) * tmp3 * ( u(2,i,j,k) ** 2 ) - > - ( c34 - c1345 ) * tmp3 * ( u(3,i,j,k) ** 2 ) - > - ( r43*c34 - c1345 ) * tmp3 * ( u(4,i,j,k) ** 2 ) - > - ( c1345 ) * tmp2 * u(5,i,j,k) ) ) - d(5,2,i,j) = dt * 2.0d+00 - > * ( tx1 * ( r43*c34 - c1345 ) * tmp2 * u(2,i,j,k) - > + ty1 * ( c34 - c1345 ) * tmp2 * u(2,i,j,k) - > + tz1 * ( c34 - c1345 ) * tmp2 * u(2,i,j,k) ) - d(5,3,i,j) = dt * 2.0d+00 - > * ( tx1 * ( c34 - c1345 ) * tmp2 * u(3,i,j,k) - > + ty1 * ( r43*c34 -c1345 ) * tmp2 * u(3,i,j,k) - > + tz1 * ( c34 - c1345 ) * tmp2 * u(3,i,j,k) ) - d(5,4,i,j) = dt * 2.0d+00 - > * ( tx1 * ( c34 - c1345 ) * tmp2 * u(4,i,j,k) - > + ty1 * ( c34 - c1345 ) * tmp2 * u(4,i,j,k) - > + tz1 * ( r43*c34 - c1345 ) * tmp2 * u(4,i,j,k) ) - d(5,5,i,j) = 1.0d+00 - > + dt * 2.0d+00 * ( tx1 * c1345 * tmp1 - > + ty1 * c1345 * tmp1 - > + tz1 * c1345 * tmp1 ) - > + dt * 2.0d+00 * ( tx1 * dx5 - > + ty1 * dy5 - > + tz1 * dz5 ) - -c--------------------------------------------------------------------- -c form the first block sub-diagonal -c--------------------------------------------------------------------- - tmp1 = 1.0d+00 / u(1,i+1,j,k) - tmp2 = tmp1 * tmp1 - tmp3 = tmp1 * tmp2 - - a(1,1,i,j) = - dt * tx1 * dx1 - a(1,2,i,j) = dt * tx2 - a(1,3,i,j) = 0.0d+00 - a(1,4,i,j) = 0.0d+00 - a(1,5,i,j) = 0.0d+00 - - a(2,1,i,j) = dt * tx2 - > * ( - ( u(2,i+1,j,k) * tmp1 ) ** 2 - > + c2 * 0.50d+00 * ( u(2,i+1,j,k) * u(2,i+1,j,k) - > + u(3,i+1,j,k) * u(3,i+1,j,k) - > + u(4,i+1,j,k) * u(4,i+1,j,k) ) * tmp2 ) - > - dt * tx1 * ( - r43 * c34 * tmp2 * u(2,i+1,j,k) ) - a(2,2,i,j) = dt * tx2 - > * ( ( 2.0d+00 - c2 ) * ( u(2,i+1,j,k) * tmp1 ) ) - > - dt * tx1 * ( r43 * c34 * tmp1 ) - > - dt * tx1 * dx2 - a(2,3,i,j) = dt * tx2 - > * ( - c2 * ( u(3,i+1,j,k) * tmp1 ) ) - a(2,4,i,j) = dt * tx2 - > * ( - c2 * ( u(4,i+1,j,k) * tmp1 ) ) - a(2,5,i,j) = dt * tx2 * c2 - - a(3,1,i,j) = dt * tx2 - > * ( - ( u(2,i+1,j,k) * u(3,i+1,j,k) ) * tmp2 ) - > - dt * tx1 * ( - c34 * tmp2 * u(3,i+1,j,k) ) - a(3,2,i,j) = dt * tx2 * ( u(3,i+1,j,k) * tmp1 ) - a(3,3,i,j) = dt * tx2 * ( u(2,i+1,j,k) * tmp1 ) - > - dt * tx1 * ( c34 * tmp1 ) - > - dt * tx1 * dx3 - a(3,4,i,j) = 0.0d+00 - a(3,5,i,j) = 0.0d+00 - - a(4,1,i,j) = dt * tx2 - > * ( - ( u(2,i+1,j,k)*u(4,i+1,j,k) ) * tmp2 ) - > - dt * tx1 * ( - c34 * tmp2 * u(4,i+1,j,k) ) - a(4,2,i,j) = dt * tx2 * ( u(4,i+1,j,k) * tmp1 ) - a(4,3,i,j) = 0.0d+00 - a(4,4,i,j) = dt * tx2 * ( u(2,i+1,j,k) * tmp1 ) - > - dt * tx1 * ( c34 * tmp1 ) - > - dt * tx1 * dx4 - a(4,5,i,j) = 0.0d+00 - - a(5,1,i,j) = dt * tx2 - > * ( ( c2 * ( u(2,i+1,j,k) * u(2,i+1,j,k) - > + u(3,i+1,j,k) * u(3,i+1,j,k) - > + u(4,i+1,j,k) * u(4,i+1,j,k) ) * tmp2 - > - c1 * ( u(5,i+1,j,k) * tmp1 ) ) - > * ( u(2,i+1,j,k) * tmp1 ) ) - > - dt * tx1 - > * ( - ( r43*c34 - c1345 ) * tmp3 * ( u(2,i+1,j,k)**2 ) - > - ( c34 - c1345 ) * tmp3 * ( u(3,i+1,j,k)**2 ) - > - ( c34 - c1345 ) * tmp3 * ( u(4,i+1,j,k)**2 ) - > - c1345 * tmp2 * u(5,i+1,j,k) ) - a(5,2,i,j) = dt * tx2 - > * ( c1 * ( u(5,i+1,j,k) * tmp1 ) - > - 0.50d+00 * c2 - > * ( ( 3.0d+00*u(2,i+1,j,k)*u(2,i+1,j,k) - > + u(3,i+1,j,k)*u(3,i+1,j,k) - > + u(4,i+1,j,k)*u(4,i+1,j,k) ) * tmp2 ) ) - > - dt * tx1 - > * ( r43*c34 - c1345 ) * tmp2 * u(2,i+1,j,k) - a(5,3,i,j) = dt * tx2 - > * ( - c2 * ( u(3,i+1,j,k)*u(2,i+1,j,k) ) * tmp2 ) - > - dt * tx1 - > * ( c34 - c1345 ) * tmp2 * u(3,i+1,j,k) - a(5,4,i,j) = dt * tx2 - > * ( - c2 * ( u(4,i+1,j,k)*u(2,i+1,j,k) ) * tmp2 ) - > - dt * tx1 - > * ( c34 - c1345 ) * tmp2 * u(4,i+1,j,k) - a(5,5,i,j) = dt * tx2 - > * ( c1 * ( u(2,i+1,j,k) * tmp1 ) ) - > - dt * tx1 * c1345 * tmp1 - > - dt * tx1 * dx5 - -c--------------------------------------------------------------------- -c form the second block sub-diagonal -c--------------------------------------------------------------------- - tmp1 = 1.0d+00 / u(1,i,j+1,k) - tmp2 = tmp1 * tmp1 - tmp3 = tmp1 * tmp2 - - b(1,1,i,j) = - dt * ty1 * dy1 - b(1,2,i,j) = 0.0d+00 - b(1,3,i,j) = dt * ty2 - b(1,4,i,j) = 0.0d+00 - b(1,5,i,j) = 0.0d+00 - - b(2,1,i,j) = dt * ty2 - > * ( - ( u(2,i,j+1,k)*u(3,i,j+1,k) ) * tmp2 ) - > - dt * ty1 * ( - c34 * tmp2 * u(2,i,j+1,k) ) - b(2,2,i,j) = dt * ty2 * ( u(3,i,j+1,k) * tmp1 ) - > - dt * ty1 * ( c34 * tmp1 ) - > - dt * ty1 * dy2 - b(2,3,i,j) = dt * ty2 * ( u(2,i,j+1,k) * tmp1 ) - b(2,4,i,j) = 0.0d+00 - b(2,5,i,j) = 0.0d+00 - - b(3,1,i,j) = dt * ty2 - > * ( - ( u(3,i,j+1,k) * tmp1 ) ** 2 - > + 0.50d+00 * c2 * ( ( u(2,i,j+1,k) * u(2,i,j+1,k) - > + u(3,i,j+1,k) * u(3,i,j+1,k) - > + u(4,i,j+1,k) * u(4,i,j+1,k) ) - > * tmp2 ) ) - > - dt * ty1 * ( - r43 * c34 * tmp2 * u(3,i,j+1,k) ) - b(3,2,i,j) = dt * ty2 - > * ( - c2 * ( u(2,i,j+1,k) * tmp1 ) ) - b(3,3,i,j) = dt * ty2 * ( ( 2.0d+00 - c2 ) - > * ( u(3,i,j+1,k) * tmp1 ) ) - > - dt * ty1 * ( r43 * c34 * tmp1 ) - > - dt * ty1 * dy3 - b(3,4,i,j) = dt * ty2 - > * ( - c2 * ( u(4,i,j+1,k) * tmp1 ) ) - b(3,5,i,j) = dt * ty2 * c2 - - b(4,1,i,j) = dt * ty2 - > * ( - ( u(3,i,j+1,k)*u(4,i,j+1,k) ) * tmp2 ) - > - dt * ty1 * ( - c34 * tmp2 * u(4,i,j+1,k) ) - b(4,2,i,j) = 0.0d+00 - b(4,3,i,j) = dt * ty2 * ( u(4,i,j+1,k) * tmp1 ) - b(4,4,i,j) = dt * ty2 * ( u(3,i,j+1,k) * tmp1 ) - > - dt * ty1 * ( c34 * tmp1 ) - > - dt * ty1 * dy4 - b(4,5,i,j) = 0.0d+00 - - b(5,1,i,j) = dt * ty2 - > * ( ( c2 * ( u(2,i,j+1,k) * u(2,i,j+1,k) - > + u(3,i,j+1,k) * u(3,i,j+1,k) - > + u(4,i,j+1,k) * u(4,i,j+1,k) ) * tmp2 - > - c1 * ( u(5,i,j+1,k) * tmp1 ) ) - > * ( u(3,i,j+1,k) * tmp1 ) ) - > - dt * ty1 - > * ( - ( c34 - c1345 )*tmp3*(u(2,i,j+1,k)**2) - > - ( r43*c34 - c1345 )*tmp3*(u(3,i,j+1,k)**2) - > - ( c34 - c1345 )*tmp3*(u(4,i,j+1,k)**2) - > - c1345*tmp2*u(5,i,j+1,k) ) - b(5,2,i,j) = dt * ty2 - > * ( - c2 * ( u(2,i,j+1,k)*u(3,i,j+1,k) ) * tmp2 ) - > - dt * ty1 - > * ( c34 - c1345 ) * tmp2 * u(2,i,j+1,k) - b(5,3,i,j) = dt * ty2 - > * ( c1 * ( u(5,i,j+1,k) * tmp1 ) - > - 0.50d+00 * c2 - > * ( ( u(2,i,j+1,k)*u(2,i,j+1,k) - > + 3.0d+00 * u(3,i,j+1,k)*u(3,i,j+1,k) - > + u(4,i,j+1,k)*u(4,i,j+1,k) ) * tmp2 ) ) - > - dt * ty1 - > * ( r43*c34 - c1345 ) * tmp2 * u(3,i,j+1,k) - b(5,4,i,j) = dt * ty2 - > * ( - c2 * ( u(3,i,j+1,k)*u(4,i,j+1,k) ) * tmp2 ) - > - dt * ty1 * ( c34 - c1345 ) * tmp2 * u(4,i,j+1,k) - b(5,5,i,j) = dt * ty2 - > * ( c1 * ( u(3,i,j+1,k) * tmp1 ) ) - > - dt * ty1 * c1345 * tmp1 - > - dt * ty1 * dy5 - -c--------------------------------------------------------------------- -c form the third block sub-diagonal -c--------------------------------------------------------------------- - tmp1 = 1.0d+00 / u(1,i,j,k+1) - tmp2 = tmp1 * tmp1 - tmp3 = tmp1 * tmp2 - - c(1,1,i,j) = - dt * tz1 * dz1 - c(1,2,i,j) = 0.0d+00 - c(1,3,i,j) = 0.0d+00 - c(1,4,i,j) = dt * tz2 - c(1,5,i,j) = 0.0d+00 - - c(2,1,i,j) = dt * tz2 - > * ( - ( u(2,i,j,k+1)*u(4,i,j,k+1) ) * tmp2 ) - > - dt * tz1 * ( - c34 * tmp2 * u(2,i,j,k+1) ) - c(2,2,i,j) = dt * tz2 * ( u(4,i,j,k+1) * tmp1 ) - > - dt * tz1 * c34 * tmp1 - > - dt * tz1 * dz2 - c(2,3,i,j) = 0.0d+00 - c(2,4,i,j) = dt * tz2 * ( u(2,i,j,k+1) * tmp1 ) - c(2,5,i,j) = 0.0d+00 - - c(3,1,i,j) = dt * tz2 - > * ( - ( u(3,i,j,k+1)*u(4,i,j,k+1) ) * tmp2 ) - > - dt * tz1 * ( - c34 * tmp2 * u(3,i,j,k+1) ) - c(3,2,i,j) = 0.0d+00 - c(3,3,i,j) = dt * tz2 * ( u(4,i,j,k+1) * tmp1 ) - > - dt * tz1 * ( c34 * tmp1 ) - > - dt * tz1 * dz3 - c(3,4,i,j) = dt * tz2 * ( u(3,i,j,k+1) * tmp1 ) - c(3,5,i,j) = 0.0d+00 - - c(4,1,i,j) = dt * tz2 - > * ( - ( u(4,i,j,k+1) * tmp1 ) ** 2 - > + 0.50d+00 * c2 - > * ( ( u(2,i,j,k+1) * u(2,i,j,k+1) - > + u(3,i,j,k+1) * u(3,i,j,k+1) - > + u(4,i,j,k+1) * u(4,i,j,k+1) ) * tmp2 ) ) - > - dt * tz1 * ( - r43 * c34 * tmp2 * u(4,i,j,k+1) ) - c(4,2,i,j) = dt * tz2 - > * ( - c2 * ( u(2,i,j,k+1) * tmp1 ) ) - c(4,3,i,j) = dt * tz2 - > * ( - c2 * ( u(3,i,j,k+1) * tmp1 ) ) - c(4,4,i,j) = dt * tz2 * ( 2.0d+00 - c2 ) - > * ( u(4,i,j,k+1) * tmp1 ) - > - dt * tz1 * ( r43 * c34 * tmp1 ) - > - dt * tz1 * dz4 - c(4,5,i,j) = dt * tz2 * c2 - - c(5,1,i,j) = dt * tz2 - > * ( ( c2 * ( u(2,i,j,k+1) * u(2,i,j,k+1) - > + u(3,i,j,k+1) * u(3,i,j,k+1) - > + u(4,i,j,k+1) * u(4,i,j,k+1) ) * tmp2 - > - c1 * ( u(5,i,j,k+1) * tmp1 ) ) - > * ( u(4,i,j,k+1) * tmp1 ) ) - > - dt * tz1 - > * ( - ( c34 - c1345 ) * tmp3 * (u(2,i,j,k+1)**2) - > - ( c34 - c1345 ) * tmp3 * (u(3,i,j,k+1)**2) - > - ( r43*c34 - c1345 )* tmp3 * (u(4,i,j,k+1)**2) - > - c1345 * tmp2 * u(5,i,j,k+1) ) - c(5,2,i,j) = dt * tz2 - > * ( - c2 * ( u(2,i,j,k+1)*u(4,i,j,k+1) ) * tmp2 ) - > - dt * tz1 * ( c34 - c1345 ) * tmp2 * u(2,i,j,k+1) - c(5,3,i,j) = dt * tz2 - > * ( - c2 * ( u(3,i,j,k+1)*u(4,i,j,k+1) ) * tmp2 ) - > - dt * tz1 * ( c34 - c1345 ) * tmp2 * u(3,i,j,k+1) - c(5,4,i,j) = dt * tz2 - > * ( c1 * ( u(5,i,j,k+1) * tmp1 ) - > - 0.50d+00 * c2 - > * ( ( u(2,i,j,k+1)*u(2,i,j,k+1) - > + u(3,i,j,k+1)*u(3,i,j,k+1) - > + 3.0d+00*u(4,i,j,k+1)*u(4,i,j,k+1) ) * tmp2 ) ) - > - dt * tz1 * ( r43*c34 - c1345 ) * tmp2 * u(4,i,j,k+1) - c(5,5,i,j) = dt * tz2 - > * ( c1 * ( u(4,i,j,k+1) * tmp1 ) ) - > - dt * tz1 * c1345 * tmp1 - > - dt * tz1 * dz5 - - end do - end do - - return - end diff --git a/examples/smpi/NAS/LU/l2norm.f b/examples/smpi/NAS/LU/l2norm.f deleted file mode 100644 index 147b21deb4..0000000000 --- a/examples/smpi/NAS/LU/l2norm.f +++ /dev/null @@ -1,68 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - subroutine l2norm ( ldx, ldy, ldz, - > nx0, ny0, nz0, - > ist, iend, - > jst, jend, - > v, sum ) -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c to compute the l2-norm of vector v. -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - -c--------------------------------------------------------------------- -c input parameters -c--------------------------------------------------------------------- - integer ldx, ldy, ldz - integer nx0, ny0, nz0 - integer ist, iend - integer jst, jend - double precision v(5,-1:ldx+2,-1:ldy+2,*), sum(5) - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j, k, m - double precision dummy(5) - - integer IERROR - - - do m = 1, 5 - dummy(m) = 0.0d+00 - end do - - do k = 2, nz0-1 - do j = jst, jend - do i = ist, iend - do m = 1, 5 - dummy(m) = dummy(m) + v(m,i,j,k) * v(m,i,j,k) - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c compute the global sum of individual contributions to dot product. -c--------------------------------------------------------------------- - call MPI_ALLREDUCE( dummy, - > sum, - > 5, - > dp_type, - > MPI_SUM, - > MPI_COMM_WORLD, - > IERROR ) - - do m = 1, 5 - sum(m) = sqrt ( sum(m) / ( (nx0-2)*(ny0-2)*(nz0-2) ) ) - end do - - return - end diff --git a/examples/smpi/NAS/LU/lu.f b/examples/smpi/NAS/LU/lu.f deleted file mode 100644 index 543463a07b..0000000000 --- a/examples/smpi/NAS/LU/lu.f +++ /dev/null @@ -1,164 +0,0 @@ -!-------------------------------------------------------------------------! -! ! -! N A S P A R A L L E L B E N C H M A R K S 3.3 ! -! ! -! L U ! -! ! -!-------------------------------------------------------------------------! -! ! -! This benchmark is part of the NAS Parallel Benchmark 3.3 suite. ! -! It is described in NAS Technical Reports 95-020 and 02-007 ! -! ! -! Permission to use, copy, distribute and modify this software ! -! for any purpose with or without fee is hereby granted. We ! -! request, however, that all derived work reference the NAS ! -! Parallel Benchmarks 3.3. This software is provided "as is" ! -! without express or implied warranty. ! -! ! -! Information on NPB 3.3, including the technical report, the ! -! original specifications, source code, results and information ! -! on how to submit new results, is available at: ! -! ! -! http://www.nas.nasa.gov/Software/NPB/ ! -! ! -! Send comments or suggestions to npb@nas.nasa.gov ! -! ! -! NAS Parallel Benchmarks Group ! -! NASA Ames Research Center ! -! Mail Stop: T27A-1 ! -! Moffett Field, CA 94035-1000 ! -! ! -! E-mail: npb@nas.nasa.gov ! -! Fax: (650) 604-3957 ! -! ! -!-------------------------------------------------------------------------! - -c--------------------------------------------------------------------- -c -c Authors: S. Weeratunga -c V. Venkatakrishnan -c E. Barszcz -c M. Yarrow -c -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- - program applu -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c driver for the performance evaluation of the solver for -c five coupled parabolic/elliptic partial differential equations. -c -c--------------------------------------------------------------------- - - implicit none - - include 'applu.incl' - character class - logical verified - double precision mflops - integer ierr - -c--------------------------------------------------------------------- -c initialize communications -c--------------------------------------------------------------------- - call init_comm() - -c--------------------------------------------------------------------- -c read input data -c--------------------------------------------------------------------- - call read_input() - -c--------------------------------------------------------------------- -c set up processor grid -c--------------------------------------------------------------------- - call proc_grid() - -c--------------------------------------------------------------------- -c determine the neighbors -c--------------------------------------------------------------------- - call neighbors() - -c--------------------------------------------------------------------- -c set up sub-domain sizes -c--------------------------------------------------------------------- - call subdomain() - -c--------------------------------------------------------------------- -c set up coefficients -c--------------------------------------------------------------------- - call setcoeff() - -c--------------------------------------------------------------------- -c set the masks required for comm -c--------------------------------------------------------------------- - call sethyper() - -c--------------------------------------------------------------------- -c set the boundary values for dependent variables -c--------------------------------------------------------------------- - call setbv() - -c--------------------------------------------------------------------- -c set the initial values for dependent variables -c--------------------------------------------------------------------- - call setiv() - -c--------------------------------------------------------------------- -c compute the forcing term based on prescribed exact solution -c--------------------------------------------------------------------- - call erhs() - -c--------------------------------------------------------------------- -c perform one SSOR iteration to touch all data and program pages -c--------------------------------------------------------------------- - call ssor(1) - -c--------------------------------------------------------------------- -c reset the boundary and initial values -c--------------------------------------------------------------------- - call setbv() - call setiv() - -c--------------------------------------------------------------------- -c perform the SSOR iterations -c--------------------------------------------------------------------- - call ssor(itmax) - -c--------------------------------------------------------------------- -c compute the solution error -c--------------------------------------------------------------------- - call error() - -c--------------------------------------------------------------------- -c compute the surface integral -c--------------------------------------------------------------------- - call pintgr() - -c--------------------------------------------------------------------- -c verification test -c--------------------------------------------------------------------- - IF (id.eq.0) THEN - call verify ( rsdnm, errnm, frc, class, verified ) - mflops = float(itmax)*(1984.77*float( nx0 ) - > *float( ny0 ) - > *float( nz0 ) - > -10923.3*(float( nx0+ny0+nz0 )/3.)**2 - > +27770.9* float( nx0+ny0+nz0 )/3. - > -144010.) - > / (maxtime*1000000.) - - call print_results('LU', class, nx0, - > ny0, nz0, itmax, nnodes_compiled, - > num, maxtime, mflops, ' floating point', verified, - > npbversion, compiletime, cs1, cs2, cs3, cs4, cs5, cs6, - > '(none)') - - END IF - - call mpi_finalize(ierr) - end - - diff --git a/examples/smpi/NAS/LU/mpinpb.h b/examples/smpi/NAS/LU/mpinpb.h deleted file mode 100644 index ddbf1515f0..0000000000 --- a/examples/smpi/NAS/LU/mpinpb.h +++ /dev/null @@ -1,11 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'mpif.h' - - integer node, no_nodes, root, comm_setup, - > comm_solve, comm_rhs, dp_type - common /mpistuff/ node, no_nodes, root, comm_setup, - > comm_solve, comm_rhs, dp_type - diff --git a/examples/smpi/NAS/LU/neighbors.f b/examples/smpi/NAS/LU/neighbors.f deleted file mode 100644 index ed8a3126af..0000000000 --- a/examples/smpi/NAS/LU/neighbors.f +++ /dev/null @@ -1,48 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine neighbors () - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'applu.incl' - -c--------------------------------------------------------------------- -c figure out the neighbors and their wrap numbers for each processor -c--------------------------------------------------------------------- - - south = -1 - east = -1 - north = -1 - west = -1 - - if (row.gt.1) then - north = id -1 - else - north = -1 - end if - - if (row.lt.xdim) then - south = id + 1 - else - south = -1 - end if - - if (col.gt.1) then - west = id- xdim - else - west = -1 - end if - - if (col.lt.ydim) then - east = id + xdim - else - east = -1 - end if - - return - end diff --git a/examples/smpi/NAS/LU/nodedim.f b/examples/smpi/NAS/LU/nodedim.f deleted file mode 100644 index f4def3a01e..0000000000 --- a/examples/smpi/NAS/LU/nodedim.f +++ /dev/null @@ -1,36 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - integer function nodedim(num) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c compute the exponent where num = 2**nodedim -c NOTE: assumes a power-of-two number of nodes -c -c--------------------------------------------------------------------- - - implicit none - -c--------------------------------------------------------------------- -c input parameters -c--------------------------------------------------------------------- - integer num - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - double precision fnum - - - fnum = dble(num) - nodedim = log(fnum)/log(2.0d+0) + 0.00001 - - return - end - - diff --git a/examples/smpi/NAS/LU/pintgr.f b/examples/smpi/NAS/LU/pintgr.f deleted file mode 100644 index de514cccd2..0000000000 --- a/examples/smpi/NAS/LU/pintgr.f +++ /dev/null @@ -1,288 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine pintgr - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - include 'applu.incl' - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j, k - integer ibeg, ifin, ifin1 - integer jbeg, jfin, jfin1 - integer iglob, iglob1, iglob2 - integer jglob, jglob1, jglob2 - integer ind1, ind2 - double precision phi1(0:isiz2+1,0:isiz3+1), - > phi2(0:isiz2+1,0:isiz3+1) - double precision frc1, frc2, frc3 - double precision dummy - - integer IERROR - - -c--------------------------------------------------------------------- -c set up the sub-domains for integeration in each processor -c--------------------------------------------------------------------- - ibeg = nx + 1 - ifin = 0 - iglob1 = ipt + 1 - iglob2 = ipt + nx - if (iglob1.ge.ii1.and.iglob2.lt.ii2+nx) ibeg = 1 - if (iglob1.gt.ii1-nx.and.iglob2.le.ii2) ifin = nx - if (ii1.ge.iglob1.and.ii1.le.iglob2) ibeg = ii1 - ipt - if (ii2.ge.iglob1.and.ii2.le.iglob2) ifin = ii2 - ipt - jbeg = ny + 1 - jfin = 0 - jglob1 = jpt + 1 - jglob2 = jpt + ny - if (jglob1.ge.ji1.and.jglob2.lt.ji2+ny) jbeg = 1 - if (jglob1.gt.ji1-ny.and.jglob2.le.ji2) jfin = ny - if (ji1.ge.jglob1.and.ji1.le.jglob2) jbeg = ji1 - jpt - if (ji2.ge.jglob1.and.ji2.le.jglob2) jfin = ji2 - jpt - ifin1 = ifin - jfin1 = jfin - if (ipt + ifin1.eq.ii2) ifin1 = ifin -1 - if (jpt + jfin1.eq.ji2) jfin1 = jfin -1 - -c--------------------------------------------------------------------- -c initialize -c--------------------------------------------------------------------- - do i = 0,isiz2+1 - do k = 0,isiz3+1 - phi1(i,k) = 0. - phi2(i,k) = 0. - end do - end do - - do j = jbeg,jfin - jglob = jpt + j - do i = ibeg,ifin - iglob = ipt + i - - k = ki1 - - phi1(i,j) = c2*( u(5,i,j,k) - > - 0.50d+00 * ( u(2,i,j,k) ** 2 - > + u(3,i,j,k) ** 2 - > + u(4,i,j,k) ** 2 ) - > / u(1,i,j,k) ) - - k = ki2 - - phi2(i,j) = c2*( u(5,i,j,k) - > - 0.50d+00 * ( u(2,i,j,k) ** 2 - > + u(3,i,j,k) ** 2 - > + u(4,i,j,k) ** 2 ) - > / u(1,i,j,k) ) - end do - end do - -c--------------------------------------------------------------------- -c communicate in i and j directions -c--------------------------------------------------------------------- - call exchange_4(phi1,phi2,ibeg,ifin1,jbeg,jfin1) - - frc1 = 0.0d+00 - - do j = jbeg,jfin1 - do i = ibeg, ifin1 - frc1 = frc1 + ( phi1(i,j) - > + phi1(i+1,j) - > + phi1(i,j+1) - > + phi1(i+1,j+1) - > + phi2(i,j) - > + phi2(i+1,j) - > + phi2(i,j+1) - > + phi2(i+1,j+1) ) - end do - end do - -c--------------------------------------------------------------------- -c compute the global sum of individual contributions to frc1 -c--------------------------------------------------------------------- - dummy = frc1 - call MPI_ALLREDUCE( dummy, - > frc1, - > 1, - > dp_type, - > MPI_SUM, - > MPI_COMM_WORLD, - > IERROR ) - - frc1 = dxi * deta * frc1 - -c--------------------------------------------------------------------- -c initialize -c--------------------------------------------------------------------- - do i = 0,isiz2+1 - do k = 0,isiz3+1 - phi1(i,k) = 0. - phi2(i,k) = 0. - end do - end do - jglob = jpt + jbeg - ind1 = 0 - if (jglob.eq.ji1) then - ind1 = 1 - do k = ki1, ki2 - do i = ibeg, ifin - iglob = ipt + i - phi1(i,k) = c2*( u(5,i,jbeg,k) - > - 0.50d+00 * ( u(2,i,jbeg,k) ** 2 - > + u(3,i,jbeg,k) ** 2 - > + u(4,i,jbeg,k) ** 2 ) - > / u(1,i,jbeg,k) ) - end do - end do - end if - - jglob = jpt + jfin - ind2 = 0 - if (jglob.eq.ji2) then - ind2 = 1 - do k = ki1, ki2 - do i = ibeg, ifin - iglob = ipt + i - phi2(i,k) = c2*( u(5,i,jfin,k) - > - 0.50d+00 * ( u(2,i,jfin,k) ** 2 - > + u(3,i,jfin,k) ** 2 - > + u(4,i,jfin,k) ** 2 ) - > / u(1,i,jfin,k) ) - end do - end do - end if - -c--------------------------------------------------------------------- -c communicate in i direction -c--------------------------------------------------------------------- - if (ind1.eq.1) then - call exchange_5(phi1,ibeg,ifin1) - end if - if (ind2.eq.1) then - call exchange_5 (phi2,ibeg,ifin1) - end if - - frc2 = 0.0d+00 - do k = ki1, ki2-1 - do i = ibeg, ifin1 - frc2 = frc2 + ( phi1(i,k) - > + phi1(i+1,k) - > + phi1(i,k+1) - > + phi1(i+1,k+1) - > + phi2(i,k) - > + phi2(i+1,k) - > + phi2(i,k+1) - > + phi2(i+1,k+1) ) - end do - end do - -c--------------------------------------------------------------------- -c compute the global sum of individual contributions to frc2 -c--------------------------------------------------------------------- - dummy = frc2 - call MPI_ALLREDUCE( dummy, - > frc2, - > 1, - > dp_type, - > MPI_SUM, - > MPI_COMM_WORLD, - > IERROR ) - - frc2 = dxi * dzeta * frc2 - -c--------------------------------------------------------------------- -c initialize -c--------------------------------------------------------------------- - do i = 0,isiz2+1 - do k = 0,isiz3+1 - phi1(i,k) = 0. - phi2(i,k) = 0. - end do - end do - iglob = ipt + ibeg - ind1 = 0 - if (iglob.eq.ii1) then - ind1 = 1 - do k = ki1, ki2 - do j = jbeg, jfin - jglob = jpt + j - phi1(j,k) = c2*( u(5,ibeg,j,k) - > - 0.50d+00 * ( u(2,ibeg,j,k) ** 2 - > + u(3,ibeg,j,k) ** 2 - > + u(4,ibeg,j,k) ** 2 ) - > / u(1,ibeg,j,k) ) - end do - end do - end if - - iglob = ipt + ifin - ind2 = 0 - if (iglob.eq.ii2) then - ind2 = 1 - do k = ki1, ki2 - do j = jbeg, jfin - jglob = jpt + j - phi2(j,k) = c2*( u(5,ifin,j,k) - > - 0.50d+00 * ( u(2,ifin,j,k) ** 2 - > + u(3,ifin,j,k) ** 2 - > + u(4,ifin,j,k) ** 2 ) - > / u(1,ifin,j,k) ) - end do - end do - end if - -c--------------------------------------------------------------------- -c communicate in j direction -c--------------------------------------------------------------------- - if (ind1.eq.1) then - call exchange_6(phi1,jbeg,jfin1) - end if - if (ind2.eq.1) then - call exchange_6(phi2,jbeg,jfin1) - end if - - frc3 = 0.0d+00 - - do k = ki1, ki2-1 - do j = jbeg, jfin1 - frc3 = frc3 + ( phi1(j,k) - > + phi1(j+1,k) - > + phi1(j,k+1) - > + phi1(j+1,k+1) - > + phi2(j,k) - > + phi2(j+1,k) - > + phi2(j,k+1) - > + phi2(j+1,k+1) ) - end do - end do - -c--------------------------------------------------------------------- -c compute the global sum of individual contributions to frc3 -c--------------------------------------------------------------------- - dummy = frc3 - call MPI_ALLREDUCE( dummy, - > frc3, - > 1, - > dp_type, - > MPI_SUM, - > MPI_COMM_WORLD, - > IERROR ) - - frc3 = deta * dzeta * frc3 - frc = 0.25d+00 * ( frc1 + frc2 + frc3 ) -c if (id.eq.0) write (*,1001) frc - - return - - 1001 format (//5x,'surface integral = ',1pe12.5//) - - end diff --git a/examples/smpi/NAS/LU/proc_grid.f b/examples/smpi/NAS/LU/proc_grid.f deleted file mode 100644 index 40271c135e..0000000000 --- a/examples/smpi/NAS/LU/proc_grid.f +++ /dev/null @@ -1,36 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine proc_grid - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'applu.incl' - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c set up a two-d grid for processors: column-major ordering of unknowns -c NOTE: assumes a power-of-two number of processors -c -c--------------------------------------------------------------------- - - xdim = 2**(ndim/2) - if (mod(ndim,2).eq.1) xdim = xdim + xdim - ydim = num/xdim - - row = mod(id,xdim) + 1 - col = id/xdim + 1 - - - return - end - - diff --git a/examples/smpi/NAS/LU/read_input.f b/examples/smpi/NAS/LU/read_input.f deleted file mode 100644 index b2e5ff1e79..0000000000 --- a/examples/smpi/NAS/LU/read_input.f +++ /dev/null @@ -1,127 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine read_input - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - include 'applu.incl' - - integer IERROR, fstatus, nnodes - - -c--------------------------------------------------------------------- -c only root reads the input file -c if input file does not exist, it uses defaults -c ipr = 1 for detailed progress output -c inorm = how often the norm is printed (once every inorm iterations) -c itmax = number of pseudo time steps -c dt = time step -c omega 1 over-relaxation factor for SSOR -c tolrsd = steady state residual tolerance levels -c nx, ny, nz = number of grid points in x, y, z directions -c--------------------------------------------------------------------- - ROOT = 0 - if (id .eq. ROOT) then - - write(*, 1000) - - open (unit=3,file='inputlu.data',status='old', - > access='sequential',form='formatted', iostat=fstatus) - if (fstatus .eq. 0) then - - write(*, *) 'Reading from input file inputlu.data' - - read (3,*) - read (3,*) - read (3,*) ipr, inorm - read (3,*) - read (3,*) - read (3,*) itmax - read (3,*) - read (3,*) - read (3,*) dt - read (3,*) - read (3,*) - read (3,*) omega - read (3,*) - read (3,*) - read (3,*) tolrsd(1),tolrsd(2),tolrsd(3),tolrsd(4),tolrsd(5) - read (3,*) - read (3,*) - read (3,*) nx0, ny0, nz0 - close(3) - else - ipr = ipr_default - inorm = inorm_default - itmax = itmax_default - dt = dt_default - omega = omega_default - tolrsd(1) = tolrsd1_def - tolrsd(2) = tolrsd2_def - tolrsd(3) = tolrsd3_def - tolrsd(4) = tolrsd4_def - tolrsd(5) = tolrsd5_def - nx0 = isiz01 - ny0 = isiz02 - nz0 = isiz03 - endif - -c--------------------------------------------------------------------- -c check problem size -c--------------------------------------------------------------------- - call MPI_COMM_SIZE(MPI_COMM_WORLD, nnodes, ierror) - if (nnodes .ne. nnodes_compiled) then - write (*, 2000) nnodes, nnodes_compiled - 2000 format (5x,'Warning: program is running on',i3,' processors' - > /5x,'but was compiled for ', i3) - endif - - if ( ( nx0 .lt. 4 ) .or. - > ( ny0 .lt. 4 ) .or. - > ( nz0 .lt. 4 ) ) then - - write (*,2001) - 2001 format (5x,'PROBLEM SIZE IS TOO SMALL - ', - > /5x,'SET EACH OF NX, NY AND NZ AT LEAST EQUAL TO 5') - CALL MPI_ABORT( MPI_COMM_WORLD, MPI_ERR_OTHER, IERROR ) - - end if - - if ( ( nx0 .gt. isiz01 ) .or. - > ( ny0 .gt. isiz02 ) .or. - > ( nz0 .gt. isiz03 ) ) then - - write (*,2002) - 2002 format (5x,'PROBLEM SIZE IS TOO LARGE - ', - > /5x,'NX, NY AND NZ SHOULD BE LESS THAN OR EQUAL TO ', - > /5x,'ISIZ01, ISIZ02 AND ISIZ03 RESPECTIVELY') - CALL MPI_ABORT( MPI_COMM_WORLD, MPI_ERR_OTHER, IERROR ) - - end if - - - write(*, 1001) nx0, ny0, nz0 - write(*, 1002) itmax - write(*, 1003) nnodes - - 1000 format(//, ' NAS Parallel Benchmarks 3.3 -- LU Benchmark',/) - 1001 format(' Size: ', i4, 'x', i4, 'x', i4) - 1002 format(' Iterations: ', i4) - 1003 format(' Number of processes: ', i5, /) - - - - end if - - call bcast_inputs - - return - end - - diff --git a/examples/smpi/NAS/LU/rhs.f b/examples/smpi/NAS/LU/rhs.f deleted file mode 100644 index 3da39117a4..0000000000 --- a/examples/smpi/NAS/LU/rhs.f +++ /dev/null @@ -1,504 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine rhs - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c compute the right hand sides -c--------------------------------------------------------------------- - - implicit none - - include 'applu.incl' - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j, k, m - integer iex - integer L1, L2 - integer ist1, iend1 - integer jst1, jend1 - double precision q - double precision u21, u31, u41 - double precision tmp - double precision u21i, u31i, u41i, u51i - double precision u21j, u31j, u41j, u51j - double precision u21k, u31k, u41k, u51k - double precision u21im1, u31im1, u41im1, u51im1 - double precision u21jm1, u31jm1, u41jm1, u51jm1 - double precision u21km1, u31km1, u41km1, u51km1 - - - - do k = 1, nz - do j = 1, ny - do i = 1, nx - do m = 1, 5 - rsd(m,i,j,k) = - frct(m,i,j,k) - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c xi-direction flux differences -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c iex = flag : iex = 0 north/south communication -c : iex = 1 east/west communication -c--------------------------------------------------------------------- - iex = 0 - -c--------------------------------------------------------------------- -c communicate and receive/send two rows of data -c--------------------------------------------------------------------- - call exchange_3(u,iex) - - L1 = 0 - if (north.eq.-1) L1 = 1 - L2 = nx + 1 - if (south.eq.-1) L2 = nx - - ist1 = 1 - iend1 = nx - if (north.eq.-1) ist1 = 4 - if (south.eq.-1) iend1 = nx - 3 - - do k = 2, nz - 1 - do j = jst, jend - do i = L1, L2 - flux(1,i,j,k) = u(2,i,j,k) - u21 = u(2,i,j,k) / u(1,i,j,k) - - q = 0.50d+00 * ( u(2,i,j,k) * u(2,i,j,k) - > + u(3,i,j,k) * u(3,i,j,k) - > + u(4,i,j,k) * u(4,i,j,k) ) - > / u(1,i,j,k) - - flux(2,i,j,k) = u(2,i,j,k) * u21 + c2 * - > ( u(5,i,j,k) - q ) - flux(3,i,j,k) = u(3,i,j,k) * u21 - flux(4,i,j,k) = u(4,i,j,k) * u21 - flux(5,i,j,k) = ( c1 * u(5,i,j,k) - c2 * q ) * u21 - end do - - do i = ist, iend - do m = 1, 5 - rsd(m,i,j,k) = rsd(m,i,j,k) - > - tx2 * ( flux(m,i+1,j,k) - flux(m,i-1,j,k) ) - end do - end do - - do i = ist, L2 - tmp = 1.0d+00 / u(1,i,j,k) - - u21i = tmp * u(2,i,j,k) - u31i = tmp * u(3,i,j,k) - u41i = tmp * u(4,i,j,k) - u51i = tmp * u(5,i,j,k) - - tmp = 1.0d+00 / u(1,i-1,j,k) - - u21im1 = tmp * u(2,i-1,j,k) - u31im1 = tmp * u(3,i-1,j,k) - u41im1 = tmp * u(4,i-1,j,k) - u51im1 = tmp * u(5,i-1,j,k) - - flux(2,i,j,k) = (4.0d+00/3.0d+00) * tx3 * (u21i-u21im1) - flux(3,i,j,k) = tx3 * ( u31i - u31im1 ) - flux(4,i,j,k) = tx3 * ( u41i - u41im1 ) - flux(5,i,j,k) = 0.50d+00 * ( 1.0d+00 - c1*c5 ) - > * tx3 * ( ( u21i **2 + u31i **2 + u41i **2 ) - > - ( u21im1**2 + u31im1**2 + u41im1**2 ) ) - > + (1.0d+00/6.0d+00) - > * tx3 * ( u21i**2 - u21im1**2 ) - > + c1 * c5 * tx3 * ( u51i - u51im1 ) - end do - - do i = ist, iend - rsd(1,i,j,k) = rsd(1,i,j,k) - > + dx1 * tx1 * ( u(1,i-1,j,k) - > - 2.0d+00 * u(1,i,j,k) - > + u(1,i+1,j,k) ) - rsd(2,i,j,k) = rsd(2,i,j,k) - > + tx3 * c3 * c4 * ( flux(2,i+1,j,k) - flux(2,i,j,k) ) - > + dx2 * tx1 * ( u(2,i-1,j,k) - > - 2.0d+00 * u(2,i,j,k) - > + u(2,i+1,j,k) ) - rsd(3,i,j,k) = rsd(3,i,j,k) - > + tx3 * c3 * c4 * ( flux(3,i+1,j,k) - flux(3,i,j,k) ) - > + dx3 * tx1 * ( u(3,i-1,j,k) - > - 2.0d+00 * u(3,i,j,k) - > + u(3,i+1,j,k) ) - rsd(4,i,j,k) = rsd(4,i,j,k) - > + tx3 * c3 * c4 * ( flux(4,i+1,j,k) - flux(4,i,j,k) ) - > + dx4 * tx1 * ( u(4,i-1,j,k) - > - 2.0d+00 * u(4,i,j,k) - > + u(4,i+1,j,k) ) - rsd(5,i,j,k) = rsd(5,i,j,k) - > + tx3 * c3 * c4 * ( flux(5,i+1,j,k) - flux(5,i,j,k) ) - > + dx5 * tx1 * ( u(5,i-1,j,k) - > - 2.0d+00 * u(5,i,j,k) - > + u(5,i+1,j,k) ) - end do - -c--------------------------------------------------------------------- -c Fourth-order dissipation -c--------------------------------------------------------------------- - IF (north.eq.-1) then - do m = 1, 5 - rsd(m,2,j,k) = rsd(m,2,j,k) - > - dssp * ( + 5.0d+00 * u(m,2,j,k) - > - 4.0d+00 * u(m,3,j,k) - > + u(m,4,j,k) ) - rsd(m,3,j,k) = rsd(m,3,j,k) - > - dssp * ( - 4.0d+00 * u(m,2,j,k) - > + 6.0d+00 * u(m,3,j,k) - > - 4.0d+00 * u(m,4,j,k) - > + u(m,5,j,k) ) - end do - END IF - - do i = ist1,iend1 - do m = 1, 5 - rsd(m,i,j,k) = rsd(m,i,j,k) - > - dssp * ( u(m,i-2,j,k) - > - 4.0d+00 * u(m,i-1,j,k) - > + 6.0d+00 * u(m,i,j,k) - > - 4.0d+00 * u(m,i+1,j,k) - > + u(m,i+2,j,k) ) - end do - end do - - IF (south.eq.-1) then - do m = 1, 5 - rsd(m,nx-2,j,k) = rsd(m,nx-2,j,k) - > - dssp * ( u(m,nx-4,j,k) - > - 4.0d+00 * u(m,nx-3,j,k) - > + 6.0d+00 * u(m,nx-2,j,k) - > - 4.0d+00 * u(m,nx-1,j,k) ) - rsd(m,nx-1,j,k) = rsd(m,nx-1,j,k) - > - dssp * ( u(m,nx-3,j,k) - > - 4.0d+00 * u(m,nx-2,j,k) - > + 5.0d+00 * u(m,nx-1,j,k) ) - end do - END IF - - end do - end do - -c--------------------------------------------------------------------- -c eta-direction flux differences -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c iex = flag : iex = 0 north/south communication -c--------------------------------------------------------------------- - iex = 1 - -c--------------------------------------------------------------------- -c communicate and receive/send two rows of data -c--------------------------------------------------------------------- - call exchange_3(u,iex) - - L1 = 0 - if (west.eq.-1) L1 = 1 - L2 = ny + 1 - if (east.eq.-1) L2 = ny - - jst1 = 1 - jend1 = ny - if (west.eq.-1) jst1 = 4 - if (east.eq.-1) jend1 = ny - 3 - - do k = 2, nz - 1 - do j = L1, L2 - do i = ist, iend - flux(1,i,j,k) = u(3,i,j,k) - u31 = u(3,i,j,k) / u(1,i,j,k) - - q = 0.50d+00 * ( u(2,i,j,k) * u(2,i,j,k) - > + u(3,i,j,k) * u(3,i,j,k) - > + u(4,i,j,k) * u(4,i,j,k) ) - > / u(1,i,j,k) - - flux(2,i,j,k) = u(2,i,j,k) * u31 - flux(3,i,j,k) = u(3,i,j,k) * u31 + c2 * (u(5,i,j,k)-q) - flux(4,i,j,k) = u(4,i,j,k) * u31 - flux(5,i,j,k) = ( c1 * u(5,i,j,k) - c2 * q ) * u31 - end do - end do - - do j = jst, jend - do i = ist, iend - do m = 1, 5 - rsd(m,i,j,k) = rsd(m,i,j,k) - > - ty2 * ( flux(m,i,j+1,k) - flux(m,i,j-1,k) ) - end do - end do - end do - - do j = jst, L2 - do i = ist, iend - tmp = 1.0d+00 / u(1,i,j,k) - - u21j = tmp * u(2,i,j,k) - u31j = tmp * u(3,i,j,k) - u41j = tmp * u(4,i,j,k) - u51j = tmp * u(5,i,j,k) - - tmp = 1.0d+00 / u(1,i,j-1,k) - u21jm1 = tmp * u(2,i,j-1,k) - u31jm1 = tmp * u(3,i,j-1,k) - u41jm1 = tmp * u(4,i,j-1,k) - u51jm1 = tmp * u(5,i,j-1,k) - - flux(2,i,j,k) = ty3 * ( u21j - u21jm1 ) - flux(3,i,j,k) = (4.0d+00/3.0d+00) * ty3 * (u31j-u31jm1) - flux(4,i,j,k) = ty3 * ( u41j - u41jm1 ) - flux(5,i,j,k) = 0.50d+00 * ( 1.0d+00 - c1*c5 ) - > * ty3 * ( ( u21j **2 + u31j **2 + u41j **2 ) - > - ( u21jm1**2 + u31jm1**2 + u41jm1**2 ) ) - > + (1.0d+00/6.0d+00) - > * ty3 * ( u31j**2 - u31jm1**2 ) - > + c1 * c5 * ty3 * ( u51j - u51jm1 ) - end do - end do - - do j = jst, jend - do i = ist, iend - - rsd(1,i,j,k) = rsd(1,i,j,k) - > + dy1 * ty1 * ( u(1,i,j-1,k) - > - 2.0d+00 * u(1,i,j,k) - > + u(1,i,j+1,k) ) - - rsd(2,i,j,k) = rsd(2,i,j,k) - > + ty3 * c3 * c4 * ( flux(2,i,j+1,k) - flux(2,i,j,k) ) - > + dy2 * ty1 * ( u(2,i,j-1,k) - > - 2.0d+00 * u(2,i,j,k) - > + u(2,i,j+1,k) ) - - rsd(3,i,j,k) = rsd(3,i,j,k) - > + ty3 * c3 * c4 * ( flux(3,i,j+1,k) - flux(3,i,j,k) ) - > + dy3 * ty1 * ( u(3,i,j-1,k) - > - 2.0d+00 * u(3,i,j,k) - > + u(3,i,j+1,k) ) - - rsd(4,i,j,k) = rsd(4,i,j,k) - > + ty3 * c3 * c4 * ( flux(4,i,j+1,k) - flux(4,i,j,k) ) - > + dy4 * ty1 * ( u(4,i,j-1,k) - > - 2.0d+00 * u(4,i,j,k) - > + u(4,i,j+1,k) ) - - rsd(5,i,j,k) = rsd(5,i,j,k) - > + ty3 * c3 * c4 * ( flux(5,i,j+1,k) - flux(5,i,j,k) ) - > + dy5 * ty1 * ( u(5,i,j-1,k) - > - 2.0d+00 * u(5,i,j,k) - > + u(5,i,j+1,k) ) - - end do - end do - -c--------------------------------------------------------------------- -c fourth-order dissipation -c--------------------------------------------------------------------- - IF (west.eq.-1) then - do i = ist, iend - do m = 1, 5 - rsd(m,i,2,k) = rsd(m,i,2,k) - > - dssp * ( + 5.0d+00 * u(m,i,2,k) - > - 4.0d+00 * u(m,i,3,k) - > + u(m,i,4,k) ) - rsd(m,i,3,k) = rsd(m,i,3,k) - > - dssp * ( - 4.0d+00 * u(m,i,2,k) - > + 6.0d+00 * u(m,i,3,k) - > - 4.0d+00 * u(m,i,4,k) - > + u(m,i,5,k) ) - end do - end do - END IF - - do j = jst1, jend1 - do i = ist, iend - do m = 1, 5 - rsd(m,i,j,k) = rsd(m,i,j,k) - > - dssp * ( u(m,i,j-2,k) - > - 4.0d+00 * u(m,i,j-1,k) - > + 6.0d+00 * u(m,i,j,k) - > - 4.0d+00 * u(m,i,j+1,k) - > + u(m,i,j+2,k) ) - end do - end do - end do - - IF (east.eq.-1) then - do i = ist, iend - do m = 1, 5 - rsd(m,i,ny-2,k) = rsd(m,i,ny-2,k) - > - dssp * ( u(m,i,ny-4,k) - > - 4.0d+00 * u(m,i,ny-3,k) - > + 6.0d+00 * u(m,i,ny-2,k) - > - 4.0d+00 * u(m,i,ny-1,k) ) - rsd(m,i,ny-1,k) = rsd(m,i,ny-1,k) - > - dssp * ( u(m,i,ny-3,k) - > - 4.0d+00 * u(m,i,ny-2,k) - > + 5.0d+00 * u(m,i,ny-1,k) ) - end do - end do - END IF - - end do - -c--------------------------------------------------------------------- -c zeta-direction flux differences -c--------------------------------------------------------------------- - do k = 1, nz - do j = jst, jend - do i = ist, iend - flux(1,i,j,k) = u(4,i,j,k) - u41 = u(4,i,j,k) / u(1,i,j,k) - - q = 0.50d+00 * ( u(2,i,j,k) * u(2,i,j,k) - > + u(3,i,j,k) * u(3,i,j,k) - > + u(4,i,j,k) * u(4,i,j,k) ) - > / u(1,i,j,k) - - flux(2,i,j,k) = u(2,i,j,k) * u41 - flux(3,i,j,k) = u(3,i,j,k) * u41 - flux(4,i,j,k) = u(4,i,j,k) * u41 + c2 * (u(5,i,j,k)-q) - flux(5,i,j,k) = ( c1 * u(5,i,j,k) - c2 * q ) * u41 - end do - end do - end do - - do k = 2, nz - 1 - do j = jst, jend - do i = ist, iend - do m = 1, 5 - rsd(m,i,j,k) = rsd(m,i,j,k) - > - tz2 * ( flux(m,i,j,k+1) - flux(m,i,j,k-1) ) - end do - end do - end do - end do - - do k = 2, nz - do j = jst, jend - do i = ist, iend - tmp = 1.0d+00 / u(1,i,j,k) - - u21k = tmp * u(2,i,j,k) - u31k = tmp * u(3,i,j,k) - u41k = tmp * u(4,i,j,k) - u51k = tmp * u(5,i,j,k) - - tmp = 1.0d+00 / u(1,i,j,k-1) - - u21km1 = tmp * u(2,i,j,k-1) - u31km1 = tmp * u(3,i,j,k-1) - u41km1 = tmp * u(4,i,j,k-1) - u51km1 = tmp * u(5,i,j,k-1) - - flux(2,i,j,k) = tz3 * ( u21k - u21km1 ) - flux(3,i,j,k) = tz3 * ( u31k - u31km1 ) - flux(4,i,j,k) = (4.0d+00/3.0d+00) * tz3 * (u41k-u41km1) - flux(5,i,j,k) = 0.50d+00 * ( 1.0d+00 - c1*c5 ) - > * tz3 * ( ( u21k **2 + u31k **2 + u41k **2 ) - > - ( u21km1**2 + u31km1**2 + u41km1**2 ) ) - > + (1.0d+00/6.0d+00) - > * tz3 * ( u41k**2 - u41km1**2 ) - > + c1 * c5 * tz3 * ( u51k - u51km1 ) - end do - end do - end do - - do k = 2, nz - 1 - do j = jst, jend - do i = ist, iend - rsd(1,i,j,k) = rsd(1,i,j,k) - > + dz1 * tz1 * ( u(1,i,j,k-1) - > - 2.0d+00 * u(1,i,j,k) - > + u(1,i,j,k+1) ) - rsd(2,i,j,k) = rsd(2,i,j,k) - > + tz3 * c3 * c4 * ( flux(2,i,j,k+1) - flux(2,i,j,k) ) - > + dz2 * tz1 * ( u(2,i,j,k-1) - > - 2.0d+00 * u(2,i,j,k) - > + u(2,i,j,k+1) ) - rsd(3,i,j,k) = rsd(3,i,j,k) - > + tz3 * c3 * c4 * ( flux(3,i,j,k+1) - flux(3,i,j,k) ) - > + dz3 * tz1 * ( u(3,i,j,k-1) - > - 2.0d+00 * u(3,i,j,k) - > + u(3,i,j,k+1) ) - rsd(4,i,j,k) = rsd(4,i,j,k) - > + tz3 * c3 * c4 * ( flux(4,i,j,k+1) - flux(4,i,j,k) ) - > + dz4 * tz1 * ( u(4,i,j,k-1) - > - 2.0d+00 * u(4,i,j,k) - > + u(4,i,j,k+1) ) - rsd(5,i,j,k) = rsd(5,i,j,k) - > + tz3 * c3 * c4 * ( flux(5,i,j,k+1) - flux(5,i,j,k) ) - > + dz5 * tz1 * ( u(5,i,j,k-1) - > - 2.0d+00 * u(5,i,j,k) - > + u(5,i,j,k+1) ) - end do - end do - end do - -c--------------------------------------------------------------------- -c fourth-order dissipation -c--------------------------------------------------------------------- - do j = jst, jend - do i = ist, iend - do m = 1, 5 - rsd(m,i,j,2) = rsd(m,i,j,2) - > - dssp * ( + 5.0d+00 * u(m,i,j,2) - > - 4.0d+00 * u(m,i,j,3) - > + u(m,i,j,4) ) - rsd(m,i,j,3) = rsd(m,i,j,3) - > - dssp * ( - 4.0d+00 * u(m,i,j,2) - > + 6.0d+00 * u(m,i,j,3) - > - 4.0d+00 * u(m,i,j,4) - > + u(m,i,j,5) ) - end do - end do - end do - - do k = 4, nz - 3 - do j = jst, jend - do i = ist, iend - do m = 1, 5 - rsd(m,i,j,k) = rsd(m,i,j,k) - > - dssp * ( u(m,i,j,k-2) - > - 4.0d+00 * u(m,i,j,k-1) - > + 6.0d+00 * u(m,i,j,k) - > - 4.0d+00 * u(m,i,j,k+1) - > + u(m,i,j,k+2) ) - end do - end do - end do - end do - - do j = jst, jend - do i = ist, iend - do m = 1, 5 - rsd(m,i,j,nz-2) = rsd(m,i,j,nz-2) - > - dssp * ( u(m,i,j,nz-4) - > - 4.0d+00 * u(m,i,j,nz-3) - > + 6.0d+00 * u(m,i,j,nz-2) - > - 4.0d+00 * u(m,i,j,nz-1) ) - rsd(m,i,j,nz-1) = rsd(m,i,j,nz-1) - > - dssp * ( u(m,i,j,nz-3) - > - 4.0d+00 * u(m,i,j,nz-2) - > + 5.0d+00 * u(m,i,j,nz-1) ) - end do - end do - end do - - return - end diff --git a/examples/smpi/NAS/LU/setbv.f b/examples/smpi/NAS/LU/setbv.f deleted file mode 100644 index 56b0edf967..0000000000 --- a/examples/smpi/NAS/LU/setbv.f +++ /dev/null @@ -1,79 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine setbv - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c set the boundary values of dependent variables -c--------------------------------------------------------------------- - - implicit none - - include 'applu.incl' - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j, k - integer iglob, jglob - -c--------------------------------------------------------------------- -c set the dependent variable values along the top and bottom faces -c--------------------------------------------------------------------- - do j = 1, ny - jglob = jpt + j - do i = 1, nx - iglob = ipt + i - call exact( iglob, jglob, 1, u( 1, i, j, 1 ) ) - call exact( iglob, jglob, nz, u( 1, i, j, nz ) ) - end do - end do - -c--------------------------------------------------------------------- -c set the dependent variable values along north and south faces -c--------------------------------------------------------------------- - IF (west.eq.-1) then - do k = 1, nz - do i = 1, nx - iglob = ipt + i - call exact( iglob, 1, k, u( 1, i, 1, k ) ) - end do - end do - END IF - - IF (east.eq.-1) then - do k = 1, nz - do i = 1, nx - iglob = ipt + i - call exact( iglob, ny0, k, u( 1, i, ny, k ) ) - end do - end do - END IF - -c--------------------------------------------------------------------- -c set the dependent variable values along east and west faces -c--------------------------------------------------------------------- - IF (north.eq.-1) then - do k = 1, nz - do j = 1, ny - jglob = jpt + j - call exact( 1, jglob, k, u( 1, 1, j, k ) ) - end do - end do - END IF - - IF (south.eq.-1) then - do k = 1, nz - do j = 1, ny - jglob = jpt + j - call exact( nx0, jglob, k, u( 1, nx, j, k ) ) - end do - end do - END IF - - return - end diff --git a/examples/smpi/NAS/LU/setcoeff.f b/examples/smpi/NAS/LU/setcoeff.f deleted file mode 100644 index 8fc5c1840c..0000000000 --- a/examples/smpi/NAS/LU/setcoeff.f +++ /dev/null @@ -1,159 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine setcoeff - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'applu.incl' - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - - -c--------------------------------------------------------------------- -c set up coefficients -c--------------------------------------------------------------------- - dxi = 1.0d+00 / ( nx0 - 1 ) - deta = 1.0d+00 / ( ny0 - 1 ) - dzeta = 1.0d+00 / ( nz0 - 1 ) - - tx1 = 1.0d+00 / ( dxi * dxi ) - tx2 = 1.0d+00 / ( 2.0d+00 * dxi ) - tx3 = 1.0d+00 / dxi - - ty1 = 1.0d+00 / ( deta * deta ) - ty2 = 1.0d+00 / ( 2.0d+00 * deta ) - ty3 = 1.0d+00 / deta - - tz1 = 1.0d+00 / ( dzeta * dzeta ) - tz2 = 1.0d+00 / ( 2.0d+00 * dzeta ) - tz3 = 1.0d+00 / dzeta - - ii1 = 2 - ii2 = nx0 - 1 - ji1 = 2 - ji2 = ny0 - 2 - ki1 = 3 - ki2 = nz0 - 1 - -c--------------------------------------------------------------------- -c diffusion coefficients -c--------------------------------------------------------------------- - dx1 = 0.75d+00 - dx2 = dx1 - dx3 = dx1 - dx4 = dx1 - dx5 = dx1 - - dy1 = 0.75d+00 - dy2 = dy1 - dy3 = dy1 - dy4 = dy1 - dy5 = dy1 - - dz1 = 1.00d+00 - dz2 = dz1 - dz3 = dz1 - dz4 = dz1 - dz5 = dz1 - -c--------------------------------------------------------------------- -c fourth difference dissipation -c--------------------------------------------------------------------- - dssp = ( max (dx1, dy1, dz1 ) ) / 4.0d+00 - -c--------------------------------------------------------------------- -c coefficients of the exact solution to the first pde -c--------------------------------------------------------------------- - ce(1,1) = 2.0d+00 - ce(1,2) = 0.0d+00 - ce(1,3) = 0.0d+00 - ce(1,4) = 4.0d+00 - ce(1,5) = 5.0d+00 - ce(1,6) = 3.0d+00 - ce(1,7) = 5.0d-01 - ce(1,8) = 2.0d-02 - ce(1,9) = 1.0d-02 - ce(1,10) = 3.0d-02 - ce(1,11) = 5.0d-01 - ce(1,12) = 4.0d-01 - ce(1,13) = 3.0d-01 - -c--------------------------------------------------------------------- -c coefficients of the exact solution to the second pde -c--------------------------------------------------------------------- - ce(2,1) = 1.0d+00 - ce(2,2) = 0.0d+00 - ce(2,3) = 0.0d+00 - ce(2,4) = 0.0d+00 - ce(2,5) = 1.0d+00 - ce(2,6) = 2.0d+00 - ce(2,7) = 3.0d+00 - ce(2,8) = 1.0d-02 - ce(2,9) = 3.0d-02 - ce(2,10) = 2.0d-02 - ce(2,11) = 4.0d-01 - ce(2,12) = 3.0d-01 - ce(2,13) = 5.0d-01 - -c--------------------------------------------------------------------- -c coefficients of the exact solution to the third pde -c--------------------------------------------------------------------- - ce(3,1) = 2.0d+00 - ce(3,2) = 2.0d+00 - ce(3,3) = 0.0d+00 - ce(3,4) = 0.0d+00 - ce(3,5) = 0.0d+00 - ce(3,6) = 2.0d+00 - ce(3,7) = 3.0d+00 - ce(3,8) = 4.0d-02 - ce(3,9) = 3.0d-02 - ce(3,10) = 5.0d-02 - ce(3,11) = 3.0d-01 - ce(3,12) = 5.0d-01 - ce(3,13) = 4.0d-01 - -c--------------------------------------------------------------------- -c coefficients of the exact solution to the fourth pde -c--------------------------------------------------------------------- - ce(4,1) = 2.0d+00 - ce(4,2) = 2.0d+00 - ce(4,3) = 0.0d+00 - ce(4,4) = 0.0d+00 - ce(4,5) = 0.0d+00 - ce(4,6) = 2.0d+00 - ce(4,7) = 3.0d+00 - ce(4,8) = 3.0d-02 - ce(4,9) = 5.0d-02 - ce(4,10) = 4.0d-02 - ce(4,11) = 2.0d-01 - ce(4,12) = 1.0d-01 - ce(4,13) = 3.0d-01 - -c--------------------------------------------------------------------- -c coefficients of the exact solution to the fifth pde -c--------------------------------------------------------------------- - ce(5,1) = 5.0d+00 - ce(5,2) = 4.0d+00 - ce(5,3) = 3.0d+00 - ce(5,4) = 2.0d+00 - ce(5,5) = 1.0d-01 - ce(5,6) = 4.0d-01 - ce(5,7) = 3.0d-01 - ce(5,8) = 5.0d-02 - ce(5,9) = 4.0d-02 - ce(5,10) = 3.0d-02 - ce(5,11) = 1.0d-01 - ce(5,12) = 3.0d-01 - ce(5,13) = 2.0d-01 - - return - end - - diff --git a/examples/smpi/NAS/LU/sethyper.f b/examples/smpi/NAS/LU/sethyper.f deleted file mode 100644 index 15245d4c21..0000000000 --- a/examples/smpi/NAS/LU/sethyper.f +++ /dev/null @@ -1,94 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine sethyper - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c for each column in a hyperplane, istart = first row, -c--------------------------------------------------------------------- - - implicit none - - include 'applu.incl' - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j - integer iglob, jglob - integer kp - -c--------------------------------------------------------------------- -c compute the pointers for hyperplanes -c--------------------------------------------------------------------- - do kp = 2,nx0+ny0 - icomms(kp) = .false. - icommn(kp) = .false. - icomme(kp) = .false. - icommw(kp) = .false. - -c--------------------------------------------------------------------- -c check to see if comm. to south is required -c--------------------------------------------------------------------- - if (south.ne.-1) then - i = iend - iglob = ipt + i - jglob = kp - iglob - j = jglob - jpt - if (jglob.ge.2.and.jglob.le.ny0-1.and.j.ge.jst.and. - > j.le.jend) icomms(kp) = .true. - end if - -c--------------------------------------------------------------------- -c check to see if comm. to north is required -c--------------------------------------------------------------------- - if (north.ne.-1) then - i = ist - iglob = ipt + i - jglob = kp - iglob - j = jglob - jpt - if (jglob.ge.2.and.jglob.le.ny0-1.and.j.ge.jst.and. - > j.le.jend) icommn(kp) = .true. - end if - -c--------------------------------------------------------------------- -c check to see if comm. to east is required -c--------------------------------------------------------------------- - if (east.ne.-1) then - j = jend - jglob = jpt + j - iglob = kp - jglob - i = iglob - ipt - if (iglob.ge.2.and.iglob.le.nx0-1.and.i.ge.ist.and. - > i.le.iend) icomme(kp) = .true. - end if - -c--------------------------------------------------------------------- -c check to see if comm. to west is required -c--------------------------------------------------------------------- - if (west.ne.-1) then - j = jst - jglob = jpt + j - iglob = kp - jglob - i = iglob - ipt - if (iglob.ge.2.and.iglob.le.nx0-1.and.i.ge.ist.and. - > i.le.iend) icommw(kp) = .true. - end if - - end do - - icomms(1) = .false. - icommn(1) = .false. - icomme(1) = .false. - icommw(1) = .false. - icomms(nx0+ny0+1) = .false. - icommn(nx0+ny0+1) = .false. - icomme(nx0+ny0+1) = .false. - icommw(nx0+ny0+1) = .false. - - return - end diff --git a/examples/smpi/NAS/LU/setiv.f b/examples/smpi/NAS/LU/setiv.f deleted file mode 100644 index 73725cbe5c..0000000000 --- a/examples/smpi/NAS/LU/setiv.f +++ /dev/null @@ -1,67 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - subroutine setiv - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c -c set the initial values of independent variables based on tri-linear -c interpolation of boundary values in the computational space. -c -c--------------------------------------------------------------------- - - implicit none - - include 'applu.incl' - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j, k, m - integer iglob, jglob - double precision xi, eta, zeta - double precision pxi, peta, pzeta - double precision ue_1jk(5),ue_nx0jk(5),ue_i1k(5), - > ue_iny0k(5),ue_ij1(5),ue_ijnz(5) - - - do k = 2, nz - 1 - zeta = ( dble (k-1) ) / (nz-1) - do j = 1, ny - jglob = jpt + j - IF (jglob.ne.1.and.jglob.ne.ny0) then - eta = ( dble (jglob-1) ) / (ny0-1) - do i = 1, nx - iglob = ipt + i - IF (iglob.ne.1.and.iglob.ne.nx0) then - xi = ( dble (iglob-1) ) / (nx0-1) - call exact (1,jglob,k,ue_1jk) - call exact (nx0,jglob,k,ue_nx0jk) - call exact (iglob,1,k,ue_i1k) - call exact (iglob,ny0,k,ue_iny0k) - call exact (iglob,jglob,1,ue_ij1) - call exact (iglob,jglob,nz,ue_ijnz) - do m = 1, 5 - pxi = ( 1.0d+00 - xi ) * ue_1jk(m) - > + xi * ue_nx0jk(m) - peta = ( 1.0d+00 - eta ) * ue_i1k(m) - > + eta * ue_iny0k(m) - pzeta = ( 1.0d+00 - zeta ) * ue_ij1(m) - > + zeta * ue_ijnz(m) - - u( m, i, j, k ) = pxi + peta + pzeta - > - pxi * peta - peta * pzeta - pzeta * pxi - > + pxi * peta * pzeta - - end do - END IF - end do - END IF - end do - end do - - return - end diff --git a/examples/smpi/NAS/LU/ssor.f b/examples/smpi/NAS/LU/ssor.f deleted file mode 100644 index cf4eed0eb7..0000000000 --- a/examples/smpi/NAS/LU/ssor.f +++ /dev/null @@ -1,241 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine ssor(niter) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c to perform pseudo-time stepping SSOR iterations -c for five nonlinear pde's. -c--------------------------------------------------------------------- - - implicit none - integer niter - - include 'mpinpb.h' - include 'applu.incl' - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer i, j, k, m - integer istep - double precision tmp - double precision delunm(5), tv(5,isiz1,isiz2) - - external timer_read - double precision wtime, timer_read - - integer IERROR - - - ROOT = 0 - -c--------------------------------------------------------------------- -c begin pseudo-time stepping iterations -c--------------------------------------------------------------------- - tmp = 1.0d+00 / ( omega * ( 2.0d+00 - omega ) ) - -c--------------------------------------------------------------------- -c initialize a,b,c,d to zero (guarantees that page tables have been -c formed, if applicable on given architecture, before timestepping). -c--------------------------------------------------------------------- - do m=1,isiz2 - do k=1,isiz1 - do j=1,5 - do i=1,5 - a(i,j,k,m) = 0.d0 - b(i,j,k,m) = 0.d0 - c(i,j,k,m) = 0.d0 - d(i,j,k,m) = 0.d0 - enddo - enddo - enddo - enddo - -c--------------------------------------------------------------------- -c compute the steady-state residuals -c--------------------------------------------------------------------- - call rhs - -c--------------------------------------------------------------------- -c compute the L2 norms of newton iteration residuals -c--------------------------------------------------------------------- - call l2norm( isiz1, isiz2, isiz3, nx0, ny0, nz0, - > ist, iend, jst, jend, - > rsd, rsdnm ) - - call MPI_BARRIER( MPI_COMM_WORLD, IERROR ) - - call timer_clear(1) - call timer_start(1) - -c--------------------------------------------------------------------- -c the timestep loop -c--------------------------------------------------------------------- - do istep = 1, niter - - if (id .eq. 0) then - if (mod ( istep, 20) .eq. 0 .or. - > istep .eq. itmax .or. - > istep .eq. 1) then - if (niter .gt. 1) write( *, 200) istep - 200 format(' Time step ', i4) - endif - endif - -c--------------------------------------------------------------------- -c perform SSOR iteration -c--------------------------------------------------------------------- - do k = 2, nz - 1 - do j = jst, jend - do i = ist, iend - do m = 1, 5 - rsd(m,i,j,k) = dt * rsd(m,i,j,k) - end do - end do - end do - end do - - DO k = 2, nz -1 -c--------------------------------------------------------------------- -c form the lower triangular part of the jacobian matrix -c--------------------------------------------------------------------- - call jacld(k) - -c--------------------------------------------------------------------- -c perform the lower triangular solution -c--------------------------------------------------------------------- - call blts( isiz1, isiz2, isiz3, - > nx, ny, nz, k, - > omega, - > rsd, - > a, b, c, d, - > ist, iend, jst, jend, - > nx0, ny0, ipt, jpt) - END DO - - DO k = nz - 1, 2, -1 -c--------------------------------------------------------------------- -c form the strictly upper triangular part of the jacobian matrix -c--------------------------------------------------------------------- - call jacu(k) - -c--------------------------------------------------------------------- -c perform the upper triangular solution -c--------------------------------------------------------------------- - call buts( isiz1, isiz2, isiz3, - > nx, ny, nz, k, - > omega, - > rsd, tv, - > d, a, b, c, - > ist, iend, jst, jend, - > nx0, ny0, ipt, jpt) - END DO - -c--------------------------------------------------------------------- -c update the variables -c--------------------------------------------------------------------- - - do k = 2, nz-1 - do j = jst, jend - do i = ist, iend - do m = 1, 5 - u( m, i, j, k ) = u( m, i, j, k ) - > + tmp * rsd( m, i, j, k ) - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c compute the max-norms of newton iteration corrections -c--------------------------------------------------------------------- - if ( mod ( istep, inorm ) .eq. 0 ) then - call l2norm( isiz1, isiz2, isiz3, nx0, ny0, nz0, - > ist, iend, jst, jend, - > rsd, delunm ) -c if ( ipr .eq. 1 .and. id .eq. 0 ) then -c write (*,1006) ( delunm(m), m = 1, 5 ) -c else if ( ipr .eq. 2 .and. id .eq. 0 ) then -c write (*,'(i5,f15.6)') istep,delunm(5) -c end if - end if - -c--------------------------------------------------------------------- -c compute the steady-state residuals -c--------------------------------------------------------------------- - call rhs - -c--------------------------------------------------------------------- -c compute the max-norms of newton iteration residuals -c--------------------------------------------------------------------- - if ( ( mod ( istep, inorm ) .eq. 0 ) .or. - > ( istep .eq. itmax ) ) then - call l2norm( isiz1, isiz2, isiz3, nx0, ny0, nz0, - > ist, iend, jst, jend, - > rsd, rsdnm ) -c if ( ipr .eq. 1.and.id.eq.0 ) then -c write (*,1007) ( rsdnm(m), m = 1, 5 ) -c end if - end if - -c--------------------------------------------------------------------- -c check the newton-iteration residuals against the tolerance levels -c--------------------------------------------------------------------- - if ( ( rsdnm(1) .lt. tolrsd(1) ) .and. - > ( rsdnm(2) .lt. tolrsd(2) ) .and. - > ( rsdnm(3) .lt. tolrsd(3) ) .and. - > ( rsdnm(4) .lt. tolrsd(4) ) .and. - > ( rsdnm(5) .lt. tolrsd(5) ) ) then -c if (ipr .eq. 1 .and. id.eq.0) then -c write (*,1004) istep -c end if - return - end if - - end do - - call timer_stop(1) - wtime = timer_read(1) - - - call MPI_ALLREDUCE( wtime, - > maxtime, - > 1, - > MPI_DOUBLE_PRECISION, - > MPI_MAX, - > MPI_COMM_WORLD, - > IERROR ) - - - - return - - 1001 format (1x/5x,'pseudo-time SSOR iteration no.=',i4/) - 1004 format (1x/1x,'convergence was achieved after ',i4, - > ' pseudo-time steps' ) - 1006 format (1x/1x,'RMS-norm of SSOR-iteration correction ', - > 'for first pde = ',1pe12.5/, - > 1x,'RMS-norm of SSOR-iteration correction ', - > 'for second pde = ',1pe12.5/, - > 1x,'RMS-norm of SSOR-iteration correction ', - > 'for third pde = ',1pe12.5/, - > 1x,'RMS-norm of SSOR-iteration correction ', - > 'for fourth pde = ',1pe12.5/, - > 1x,'RMS-norm of SSOR-iteration correction ', - > 'for fifth pde = ',1pe12.5) - 1007 format (1x/1x,'RMS-norm of steady-state residual for ', - > 'first pde = ',1pe12.5/, - > 1x,'RMS-norm of steady-state residual for ', - > 'second pde = ',1pe12.5/, - > 1x,'RMS-norm of steady-state residual for ', - > 'third pde = ',1pe12.5/, - > 1x,'RMS-norm of steady-state residual for ', - > 'fourth pde = ',1pe12.5/, - > 1x,'RMS-norm of steady-state residual for ', - > 'fifth pde = ',1pe12.5) - - end diff --git a/examples/smpi/NAS/LU/subdomain.f b/examples/smpi/NAS/LU/subdomain.f deleted file mode 100644 index 388bbf4494..0000000000 --- a/examples/smpi/NAS/LU/subdomain.f +++ /dev/null @@ -1,103 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine subdomain - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - include 'applu.incl' - -c--------------------------------------------------------------------- -c local variables -c--------------------------------------------------------------------- - integer mm, ierror, errorcode - - -c--------------------------------------------------------------------- -c -c set up the sub-domain sizes -c -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c x dimension -c--------------------------------------------------------------------- - mm = mod(nx0,xdim) - if (row.le.mm) then - nx = nx0/xdim + 1 - ipt = (row-1)*nx - else - nx = nx0/xdim - ipt = (row-1)*nx + mm - end if - -c--------------------------------------------------------------------- -c y dimension -c--------------------------------------------------------------------- - mm = mod(ny0,ydim) - if (col.le.mm) then - ny = ny0/ydim + 1 - jpt = (col-1)*ny - else - ny = ny0/ydim - jpt = (col-1)*ny + mm - end if - -c--------------------------------------------------------------------- -c z dimension -c--------------------------------------------------------------------- - nz = nz0 - -c--------------------------------------------------------------------- -c check the sub-domain size -c--------------------------------------------------------------------- - if ( ( nx .lt. 4 ) .or. - > ( ny .lt. 4 ) .or. - > ( nz .lt. 4 ) ) then - write (*,2001) nx, ny, nz - 2001 format (5x,'SUBDOMAIN SIZE IS TOO SMALL - ', - > /5x,'ADJUST PROBLEM SIZE OR NUMBER OF PROCESSORS', - > /5x,'SO THAT NX, NY AND NZ ARE GREATER THAN OR EQUAL', - > /5x,'TO 4 THEY ARE CURRENTLY', 3I3) - CALL MPI_ABORT( MPI_COMM_WORLD, - > ERRORCODE, - > IERROR ) - end if - - if ( ( nx .gt. isiz1 ) .or. - > ( ny .gt. isiz2 ) .or. - > ( nz .gt. isiz3 ) ) then - write (*,2002) nx, ny, nz - 2002 format (5x,'SUBDOMAIN SIZE IS TOO LARGE - ', - > /5x,'ADJUST PROBLEM SIZE OR NUMBER OF PROCESSORS', - > /5x,'SO THAT NX, NY AND NZ ARE LESS THAN OR EQUAL TO ', - > /5x,'ISIZ1, ISIZ2 AND ISIZ3 RESPECTIVELY. THEY ARE', - > /5x,'CURRENTLY', 3I4) - CALL MPI_ABORT( MPI_COMM_WORLD, - > ERRORCODE, - > IERROR ) - end if - - -c--------------------------------------------------------------------- -c set up the start and end in i and j extents for all processors -c--------------------------------------------------------------------- - ist = 1 - iend = nx - if (north.eq.-1) ist = 2 - if (south.eq.-1) iend = nx - 1 - - jst = 1 - jend = ny - if (west.eq.-1) jst = 2 - if (east.eq.-1) jend = ny - 1 - - return - end - - diff --git a/examples/smpi/NAS/LU/verify.f b/examples/smpi/NAS/LU/verify.f deleted file mode 100644 index 2572441a44..0000000000 --- a/examples/smpi/NAS/LU/verify.f +++ /dev/null @@ -1,403 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine verify(xcr, xce, xci, class, verified) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c verification routine -c--------------------------------------------------------------------- - - implicit none - include 'mpinpb.h' - include 'applu.incl' - - double precision xcr(5), xce(5), xci - double precision xcrref(5),xceref(5),xciref, - > xcrdif(5),xcedif(5),xcidif, - > epsilon, dtref - integer m - character class - logical verified - -c--------------------------------------------------------------------- -c tolerance level -c--------------------------------------------------------------------- - epsilon = 1.0d-08 - - class = 'U' - verified = .true. - - do m = 1,5 - xcrref(m) = 1.0 - xceref(m) = 1.0 - end do - xciref = 1.0 - - if ( (nx0 .eq. 12 ) .and. - > (ny0 .eq. 12 ) .and. - > (nz0 .eq. 12 ) .and. - > (itmax .eq. 50 )) then - - class = 'S' - dtref = 5.0d-1 -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual, for the (12X12X12) grid, -c after 50 time steps, with DT = 5.0d-01 -c--------------------------------------------------------------------- - xcrref(1) = 1.6196343210976702d-02 - xcrref(2) = 2.1976745164821318d-03 - xcrref(3) = 1.5179927653399185d-03 - xcrref(4) = 1.5029584435994323d-03 - xcrref(5) = 3.4264073155896461d-02 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error, for the (12X12X12) grid, -c after 50 time steps, with DT = 5.0d-01 -c--------------------------------------------------------------------- - xceref(1) = 6.4223319957960924d-04 - xceref(2) = 8.4144342047347926d-05 - xceref(3) = 5.8588269616485186d-05 - xceref(4) = 5.8474222595157350d-05 - xceref(5) = 1.3103347914111294d-03 - -c--------------------------------------------------------------------- -c Reference value of surface integral, for the (12X12X12) grid, -c after 50 time steps, with DT = 5.0d-01 -c--------------------------------------------------------------------- - xciref = 7.8418928865937083d+00 - - - elseif ( (nx0 .eq. 33) .and. - > (ny0 .eq. 33) .and. - > (nz0 .eq. 33) .and. - > (itmax . eq. 300) ) then - - class = 'W' !SPEC95fp size - dtref = 1.5d-3 -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual, for the (33x33x33) grid, -c after 300 time steps, with DT = 1.5d-3 -c--------------------------------------------------------------------- - xcrref(1) = 0.1236511638192d+02 - xcrref(2) = 0.1317228477799d+01 - xcrref(3) = 0.2550120713095d+01 - xcrref(4) = 0.2326187750252d+01 - xcrref(5) = 0.2826799444189d+02 - - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error, for the (33X33X33) grid, -c--------------------------------------------------------------------- - xceref(1) = 0.4867877144216d+00 - xceref(2) = 0.5064652880982d-01 - xceref(3) = 0.9281818101960d-01 - xceref(4) = 0.8570126542733d-01 - xceref(5) = 0.1084277417792d+01 - - -c--------------------------------------------------------------------- -c Reference value of surface integral, for the (33X33X33) grid, -c after 300 time steps, with DT = 1.5d-3 -c--------------------------------------------------------------------- - xciref = 0.1161399311023d+02 - - elseif ( (nx0 .eq. 64) .and. - > (ny0 .eq. 64) .and. - > (nz0 .eq. 64) .and. - > (itmax . eq. 250) ) then - - class = 'A' - dtref = 2.0d+0 -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual, for the (64X64X64) grid, -c after 250 time steps, with DT = 2.0d+00 -c--------------------------------------------------------------------- - xcrref(1) = 7.7902107606689367d+02 - xcrref(2) = 6.3402765259692870d+01 - xcrref(3) = 1.9499249727292479d+02 - xcrref(4) = 1.7845301160418537d+02 - xcrref(5) = 1.8384760349464247d+03 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error, for the (64X64X64) grid, -c after 250 time steps, with DT = 2.0d+00 -c--------------------------------------------------------------------- - xceref(1) = 2.9964085685471943d+01 - xceref(2) = 2.8194576365003349d+00 - xceref(3) = 7.3473412698774742d+00 - xceref(4) = 6.7139225687777051d+00 - xceref(5) = 7.0715315688392578d+01 - -c--------------------------------------------------------------------- -c Reference value of surface integral, for the (64X64X64) grid, -c after 250 time steps, with DT = 2.0d+00 -c--------------------------------------------------------------------- - xciref = 2.6030925604886277d+01 - - - elseif ( (nx0 .eq. 102) .and. - > (ny0 .eq. 102) .and. - > (nz0 .eq. 102) .and. - > (itmax . eq. 250) ) then - - class = 'B' - dtref = 2.0d+0 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual, for the (102X102X102) grid, -c after 250 time steps, with DT = 2.0d+00 -c--------------------------------------------------------------------- - xcrref(1) = 3.5532672969982736d+03 - xcrref(2) = 2.6214750795310692d+02 - xcrref(3) = 8.8333721850952190d+02 - xcrref(4) = 7.7812774739425265d+02 - xcrref(5) = 7.3087969592545314d+03 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error, for the (102X102X102) -c grid, after 250 time steps, with DT = 2.0d+00 -c--------------------------------------------------------------------- - xceref(1) = 1.1401176380212709d+02 - xceref(2) = 8.1098963655421574d+00 - xceref(3) = 2.8480597317698308d+01 - xceref(4) = 2.5905394567832939d+01 - xceref(5) = 2.6054907504857413d+02 - -c--------------------------------------------------------------------- -c Reference value of surface integral, for the (102X102X102) grid, -c after 250 time steps, with DT = 2.0d+00 -c--------------------------------------------------------------------- - xciref = 4.7887162703308227d+01 - - elseif ( (nx0 .eq. 162) .and. - > (ny0 .eq. 162) .and. - > (nz0 .eq. 162) .and. - > (itmax . eq. 250) ) then - - class = 'C' - dtref = 2.0d+0 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual, for the (162X162X162) grid, -c after 250 time steps, with DT = 2.0d+00 -c--------------------------------------------------------------------- - xcrref(1) = 1.03766980323537846d+04 - xcrref(2) = 8.92212458801008552d+02 - xcrref(3) = 2.56238814582660871d+03 - xcrref(4) = 2.19194343857831427d+03 - xcrref(5) = 1.78078057261061185d+04 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error, for the (162X162X162) -c grid, after 250 time steps, with DT = 2.0d+00 -c--------------------------------------------------------------------- - xceref(1) = 2.15986399716949279d+02 - xceref(2) = 1.55789559239863600d+01 - xceref(3) = 5.41318863077207766d+01 - xceref(4) = 4.82262643154045421d+01 - xceref(5) = 4.55902910043250358d+02 - -c--------------------------------------------------------------------- -c Reference value of surface integral, for the (162X162X162) grid, -c after 250 time steps, with DT = 2.0d+00 -c--------------------------------------------------------------------- - xciref = 6.66404553572181300d+01 - - elseif ( (nx0 .eq. 408) .and. - > (ny0 .eq. 408) .and. - > (nz0 .eq. 408) .and. - > (itmax . eq. 300) ) then - - class = 'D' - dtref = 1.0d+0 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual, for the (408X408X408) grid, -c after 300 time steps, with DT = 1.0d+00 -c--------------------------------------------------------------------- - xcrref(1) = 0.4868417937025d+05 - xcrref(2) = 0.4696371050071d+04 - xcrref(3) = 0.1218114549776d+05 - xcrref(4) = 0.1033801493461d+05 - xcrref(5) = 0.7142398413817d+05 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error, for the (408X408X408) -c grid, after 300 time steps, with DT = 1.0d+00 -c--------------------------------------------------------------------- - xceref(1) = 0.3752393004482d+03 - xceref(2) = 0.3084128893659d+02 - xceref(3) = 0.9434276905469d+02 - xceref(4) = 0.8230686681928d+02 - xceref(5) = 0.7002620636210d+03 - -c--------------------------------------------------------------------- -c Reference value of surface integral, for the (408X408X408) grid, -c after 300 time steps, with DT = 1.0d+00 -c--------------------------------------------------------------------- - xciref = 0.8334101392503d+02 - - elseif ( (nx0 .eq. 1020) .and. - > (ny0 .eq. 1020) .and. - > (nz0 .eq. 1020) .and. - > (itmax . eq. 300) ) then - - class = 'E' - dtref = 0.5d+0 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual, for the (1020X1020X1020) grid, -c after 300 time steps, with DT = 0.5d+00 -c--------------------------------------------------------------------- - xcrref(1) = 0.2099641687874d+06 - xcrref(2) = 0.2130403143165d+05 - xcrref(3) = 0.5319228789371d+05 - xcrref(4) = 0.4509761639833d+05 - xcrref(5) = 0.2932360006590d+06 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error, for the (1020X1020X1020) -c grid, after 300 time steps, with DT = 0.5d+00 -c--------------------------------------------------------------------- - xceref(1) = 0.4800572578333d+03 - xceref(2) = 0.4221993400184d+02 - xceref(3) = 0.1210851906824d+03 - xceref(4) = 0.1047888986770d+03 - xceref(5) = 0.8363028257389d+03 - -c--------------------------------------------------------------------- -c Reference value of surface integral, for the (1020X1020X1020) grid, -c after 300 time steps, with DT = 0.5d+00 -c--------------------------------------------------------------------- - xciref = 0.9512163272273d+02 - - else - verified = .FALSE. - endif - -c--------------------------------------------------------------------- -c verification test for residuals if gridsize is one of -c the defined grid sizes above (class .ne. 'U') -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Compute the difference of solution values and the known reference values. -c--------------------------------------------------------------------- - do m = 1, 5 - - xcrdif(m) = dabs((xcr(m)-xcrref(m))/xcrref(m)) - xcedif(m) = dabs((xce(m)-xceref(m))/xceref(m)) - - enddo - xcidif = dabs((xci - xciref)/xciref) - - -c--------------------------------------------------------------------- -c Output the comparison of computed results to known cases. -c--------------------------------------------------------------------- - - if (class .ne. 'U') then - write(*, 1990) class - 1990 format(/, ' Verification being performed for class ', a) - write (*,2000) epsilon - 2000 format(' Accuracy setting for epsilon = ', E20.13) - verified = (dabs(dt-dtref) .le. epsilon) - if (.not.verified) then - class = 'U' - write (*,1000) dtref - 1000 format(' DT does not match the reference value of ', - > E15.8) - endif - else - write(*, 1995) - 1995 format(' Unknown class') - endif - - - if (class .ne. 'U') then - write (*,2001) - else - write (*, 2005) - endif - - 2001 format(' Comparison of RMS-norms of residual') - 2005 format(' RMS-norms of residual') - do m = 1, 5 - if (class .eq. 'U') then - write(*, 2015) m, xcr(m) - else if (xcrdif(m) .le. epsilon) then - write (*,2011) m,xcr(m),xcrref(m),xcrdif(m) - else - verified = .false. - write (*,2010) m,xcr(m),xcrref(m),xcrdif(m) - endif - enddo - - if (class .ne. 'U') then - write (*,2002) - else - write (*,2006) - endif - 2002 format(' Comparison of RMS-norms of solution error') - 2006 format(' RMS-norms of solution error') - - do m = 1, 5 - if (class .eq. 'U') then - write(*, 2015) m, xce(m) - else if (xcedif(m) .le. epsilon) then - write (*,2011) m,xce(m),xceref(m),xcedif(m) - else - verified = .false. - write (*,2010) m,xce(m),xceref(m),xcedif(m) - endif - enddo - - 2010 format(' FAILURE: ', i2, 2x, E20.13, E20.13, E20.13) - 2011 format(' ', i2, 2x, E20.13, E20.13, E20.13) - 2015 format(' ', i2, 2x, E20.13) - - if (class .ne. 'U') then - write (*,2025) - else - write (*,2026) - endif - 2025 format(' Comparison of surface integral') - 2026 format(' Surface integral') - - - if (class .eq. 'U') then - write(*, 2030) xci - else if (xcidif .le. epsilon) then - write(*, 2032) xci, xciref, xcidif - else - verified = .false. - write(*, 2031) xci, xciref, xcidif - endif - - 2030 format(' ', 4x, E20.13) - 2031 format(' FAILURE: ', 4x, E20.13, E20.13, E20.13) - 2032 format(' ', 4x, E20.13, E20.13, E20.13) - - - - if (class .eq. 'U') then - write(*, 2022) - write(*, 2023) - 2022 format(' No reference values provided') - 2023 format(' No verification performed') - else if (verified) then - write(*, 2020) - 2020 format(' Verification Successful') - else - write(*, 2021) - 2021 format(' Verification failed') - endif - - return - - - end diff --git a/examples/smpi/NAS/MG/Makefile b/examples/smpi/NAS/MG/Makefile deleted file mode 100644 index 1554bedeea..0000000000 --- a/examples/smpi/NAS/MG/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -SHELL=/bin/sh -BENCHMARK=mg -BENCHMARKU=MG - -include ../config/make.def - -OBJS = mg.o ${COMMON}/print_results.o \ - ${COMMON}/${RAND}.o ${COMMON}/timers.o - -include ../sys/make.common - -${PROGRAM}: config ${OBJS} - ${FLINK} ${FLINKFLAGS} -o ${PROGRAM} ${OBJS} ${FMPI_LIB} - -mg.o: mg.f globals.h mpinpb.h npbparams.h - ${FCOMPILE} mg.f - -clean: - - rm -f *.o *~ - - rm -f npbparams.h core - - - diff --git a/examples/smpi/NAS/MG/README b/examples/smpi/NAS/MG/README deleted file mode 100644 index 6c03f78527..0000000000 --- a/examples/smpi/NAS/MG/README +++ /dev/null @@ -1,138 +0,0 @@ -Some info about the MG benchmark -================================ - -'mg_demo' demonstrates the capabilities of a very simple multigrid -solver in computing a three dimensional potential field. This is -a simplified multigrid solver in two important respects: - - (1) it solves only a constant coefficient equation, - and that only on a uniform cubical grid, - - (2) it solves only a single equation, representing - a scalar field rather than a vector field. - -We chose it for its portability and simplicity, and expect that a -supercomputer which can run it effectively will also be able to -run more complex multigrid programs at least as well. - - Eric Barszcz Paul Frederickson - RIACS - NASA Ames Research Center NASA Ames Research Center - -======================================================================== -Running the program: (Note: also see parameter lm information in the - two sections immediately below this section) - -The program may be run with or without an input deck (called "mg.input"). -The following describes a few things about the input deck if you want to -use one. - -The four lines below are the "mg.input" file required to run a -problem of total size 256x256x256, for 4 iterations (Class "A"), -and presumes the use of 8 processors: - - 8 = top level - 256 256 256 = nx ny nz - 4 = nit - 0 0 0 0 0 0 0 0 = debug_vec - -The first line of input indicates how many levels of multi-grid -cycle will be applied to a particular subpartition. Presuming that -8 processors are solving this problem (recall that the number of -processors is specified to MPI as a run parameter, and MPI subsequently -determines this for the code via an MPI subroutine call), a 2x2x2 -processor grid is formed, and thus each partition on a processor is -of size 128x128x128. Therefore, a maximum of 8 multi-grid levels may -be used. These are of size 128,64,32,16,8,4,2,1, with the coarsest -level being a single point on a given processor. - - -Next, consider the same size problem but running on 1 processor. The -following "mg.input" file is appropriate: - - 9 = top level - 256 256 256 = nx ny nz - 4 = nit - 0 0 0 0 0 0 0 0 = debug_vec - -Since this processor must solve the full 256x256x256 problem, this -permits 9 multi-grid levels (256,128,64,32,16,8,4,2,1), resulting in -a coarsest multi-grid level of a single point on the processor - - -Next, consider the same size problem but running on 2 processors. The -following "mg.input" file is required: - - 8 = top level - 256 256 256 = nx ny nz - 4 = nit - 0 0 0 0 0 0 0 0 = debug_vec - -The algorithm for partitioning the full grid onto some power of 2 number -of processors is to start by splitting the last dimension of the grid -(z dimension) in 2: the problem is now partitioned onto 2 processors. -Next the middle dimension (y dimension) is split in 2: the problem is now -partitioned onto 4 processors. Next, first dimension (x dimension) is -split in 2: the problem is now partitioned onto 8 processors. Next, the -last dimension (z dimension) is split again in 2: the problem is now -partitioned onto 16 processors. This partitioning is repeated until all -of the power of 2 processors have been allocated. - -Thus to run the above problem on 2 processors, the grid partitioning -algorithm will allocate the two processors across the last dimension, -creating two partitions each of size 256x256x128. The coarsest level of -multi-grid must be a single point surrounded by a cubic number of grid -points. Therefore, each of the two processor partitions will contain 4 -coarsest multi-grid level points, each surrounded by a cube of grid points -of size 128x128x128, indicated by a top level of 8. - - -Next, consider the same size problem but running on 4 processors. The -following "mg.input" file is required: - - 8 = top level - 256 256 256 = nx ny nz - 4 = nit - 0 0 0 0 0 0 0 0 = debug_vec - -The partitioning algorithm will create 4 partitions, each of size -256x128x128. Each partition will contain 2 coarsest multi-grid level -points each surrounded by a cube of grid points of size 128x128x128, -indicated by a top level of 8. - - -Next, consider the same size problem but running on 16 processors. The -following "mg.input" file is required: - - 7 = top level - 256 256 256 = nx ny nz - 4 = nit - 0 0 0 0 0 0 0 0 = debug_vec - -On each node a partition of size 128x128x64 will be created. A maximum -of 7 multi-grid levels (64,32,16,8,4,2,1) may be used, resulting in each -partions containing 4 coarsest multi-grid level points, each surrounded -by a cube of grid points of size 64x64x64, indicated by a top level of 7. - - - - -Note that non-cubic problem sizes may also be considered: - -The four lines below are the "mg.input" file appropriate for running a -problem of total size 256x512x512, for 20 iterations and presumes the -use of 32 processors (note: this is NOT a class C problem): - - 8 = top level - 256 512 512 = nx ny nz - 20 = nit - 0 0 0 0 0 0 0 0 = debug_vec - -The first line of input indicates how many levels of multi-grid -cycle will be applied to a particular subpartition. Presuming that -32 processors are solving this problem, a 2x4x4 processor grid is -formed, and thus each partition on a processor is of size 128x128x128. -Therefore, a maximum of 8 multi-grid levels may be used. These are of -size 128,64,32,16,8,4,2,1, with the coarsest level being a single -point on a given processor. - diff --git a/examples/smpi/NAS/MG/globals.h b/examples/smpi/NAS/MG/globals.h deleted file mode 100644 index 99573e3c20..0000000000 --- a/examples/smpi/NAS/MG/globals.h +++ /dev/null @@ -1,55 +0,0 @@ -c--------------------------------------------------------------------- -c Parameter lm (declared and set in "npbparams.h") is the log-base2 of -c the edge size max for the partition on a given node, so must be changed -c either to save space (if running a small case) or made bigger for larger -c cases, for example, 512^3. Thus lm=7 means that the largest dimension -c of a partition that can be solved on a node is 2^7 = 128. lm is set -c automatically in npbparams.h -c Parameters ndim1, ndim2, ndim3 are the local problem dimensions. -c--------------------------------------------------------------------- - - include 'npbparams.h' - - integer nm ! actual dimension including ghost cells for communications - > , nv ! size of rhs array - > , nr ! size of residual array - > , nm2 ! size of communication buffer - > , maxlevel! maximum number of levels - - parameter( nm=2+2**lm, nv=(2+2**ndim1)*(2+2**ndim2)*(2+2**ndim3) ) - parameter( nm2=2*nm*nm, maxlevel=(lt_default+1) ) - parameter( nr = (8*(nv+nm**2+5*nm+14*lt_default-7*lm))/7 ) - integer maxprocs - parameter( maxprocs = 131072 ) ! this is the upper proc limit that - ! the current "nr" parameter can handle -c--------------------------------------------------------------------- - integer nbr(3,-1:1,maxlevel), msg_type(3,-1:1) - integer msg_id(3,-1:1,2),nx(maxlevel),ny(maxlevel),nz(maxlevel) - common /mg3/ nbr,msg_type,msg_id,nx,ny,nz - - character class - common /ClassType/class - - integer debug_vec(0:7) - common /my_debug/ debug_vec - - integer ir(maxlevel), m1(maxlevel), m2(maxlevel), m3(maxlevel) - integer lt, lb - common /fap/ ir,m1,m2,m3,lt,lb - - logical dead(maxlevel), give_ex(3,maxlevel), take_ex(3,maxlevel) - common /comm_ex/ dead, give_ex, take_ex - -c--------------------------------------------------------------------- -c Set at m=1024, can handle cases up to 1024^3 case -c--------------------------------------------------------------------- - integer m -c parameter( m=1037 ) - parameter( m=nm+1 ) - - double precision buff(nm2,4) - common /buffer/ buff - - - - diff --git a/examples/smpi/NAS/MG/mg.f b/examples/smpi/NAS/MG/mg.f deleted file mode 100644 index b0352ae2df..0000000000 --- a/examples/smpi/NAS/MG/mg.f +++ /dev/null @@ -1,2479 +0,0 @@ -!-------------------------------------------------------------------------! -! ! -! N A S P A R A L L E L B E N C H M A R K S 3.3 ! -! ! -! M G ! -! ! -!-------------------------------------------------------------------------! -! ! -! This benchmark is part of the NAS Parallel Benchmark 3.3 suite. ! -! It is described in NAS Technical Reports 95-020 and 02-007 ! -! ! -! Permission to use, copy, distribute and modify this software ! -! for any purpose with or without fee is hereby granted. We ! -! request, however, that all derived work reference the NAS ! -! Parallel Benchmarks 3.3. This software is provided "as is" ! -! without express or implied warranty. ! -! ! -! Information on NPB 3.3, including the technical report, the ! -! original specifications, source code, results and information ! -! on how to submit new results, is available at: ! -! ! -! http://www.nas.nasa.gov/Software/NPB/ ! -! ! -! Send comments or suggestions to npb@nas.nasa.gov ! -! ! -! NAS Parallel Benchmarks Group ! -! NASA Ames Research Center ! -! Mail Stop: T27A-1 ! -! Moffett Field, CA 94035-1000 ! -! ! -! E-mail: npb@nas.nasa.gov ! -! Fax: (650) 604-3957 ! -! ! -!-------------------------------------------------------------------------! - - -c--------------------------------------------------------------------- -c -c Authors: E. Barszcz -c P. Frederickson -c A. Woo -c M. Yarrow -c R. F. Van der Wijngaart -c -c--------------------------------------------------------------------- - - -c--------------------------------------------------------------------- - program mg_mpi -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - include 'globals.h' - -c---------------------------------------------------------------------------c -c k is the current level. It is passed down through subroutine args -c and is NOT global. it is the current iteration -c---------------------------------------------------------------------------c - - integer k, it - - external timer_read - double precision t, t0, tinit, mflops, timer_read - -c---------------------------------------------------------------------------c -c These arrays are in common because they are quite large -c and probably shouldn't be allocated on the stack. They -c are always passed as subroutine args. -c---------------------------------------------------------------------------c - - double precision u(nr),v(nv),r(nr),a(0:3),c(0:3) - common /noautom/ u,v,r - - double precision rnm2, rnmu, old2, oldu, epsilon - integer n1, n2, n3, nit - double precision nn, verify_value, err - logical verified - - integer ierr,i, fstatus - integer T_bench, T_init - parameter (T_bench=1, T_init=2) - - call mpi_init(ierr) - call mpi_comm_rank(mpi_comm_world, me, ierr) - call mpi_comm_size(mpi_comm_world, nprocs, ierr) - - root = 0 - if (nprocs_compiled .gt. maxprocs) then - if (me .eq. root) write(*,20) nprocs_compiled, maxprocs - 20 format(' ERROR: compiled for ',i8,' processes'// - & ' The maximum size allowed for this benchmark is ',i6) - call mpi_abort(MPI_COMM_WORLD, ierr) - stop - endif - - if (.not. convertdouble) then - dp_type = MPI_DOUBLE_PRECISION - else - dp_type = MPI_REAL - endif - - - call timer_clear(T_bench) - call timer_clear(T_init) - - call mpi_barrier(MPI_COMM_WORLD, ierr) - - call timer_start(T_init) - - -c--------------------------------------------------------------------- -c Read in and broadcast input data -c--------------------------------------------------------------------- - - if( me .eq. root )then - write (*, 1000) - - open(unit=7,file="mg.input", status="old", iostat=fstatus) - if (fstatus .eq. 0) then - write(*,50) - 50 format(' Reading from input file mg.input') - read(7,*) lt - read(7,*) nx(lt), ny(lt), nz(lt) - read(7,*) nit - read(7,*) (debug_vec(i),i=0,7) - else - write(*,51) - 51 format(' No input file. Using compiled defaults ') - lt = lt_default - nit = nit_default - nx(lt) = nx_default - ny(lt) = ny_default - nz(lt) = nz_default - do i = 0,7 - debug_vec(i) = debug_default - end do - endif - endif - - call mpi_bcast(lt, 1, MPI_INTEGER, 0, mpi_comm_world, ierr) - call mpi_bcast(nit, 1, MPI_INTEGER, 0, mpi_comm_world, ierr) - call mpi_bcast(nx(lt), 1, MPI_INTEGER, 0, mpi_comm_world, ierr) - call mpi_bcast(ny(lt), 1, MPI_INTEGER, 0, mpi_comm_world, ierr) - call mpi_bcast(nz(lt), 1, MPI_INTEGER, 0, mpi_comm_world, ierr) - call mpi_bcast(debug_vec(0), 8, MPI_INTEGER, 0, - > mpi_comm_world, ierr) - - if ( (nx(lt) .ne. ny(lt)) .or. (nx(lt) .ne. nz(lt)) ) then - Class = 'U' - else if( nx(lt) .eq. 32 .and. nit .eq. 4 ) then - Class = 'S' - else if( nx(lt) .eq. 128 .and. nit .eq. 4 ) then - Class = 'W' - else if( nx(lt) .eq. 256 .and. nit .eq. 4 ) then - Class = 'A' - else if( nx(lt) .eq. 256 .and. nit .eq. 20 ) then - Class = 'B' - else if( nx(lt) .eq. 512 .and. nit .eq. 20 ) then - Class = 'C' - else if( nx(lt) .eq. 1024 .and. nit .eq. 50 ) then - Class = 'D' - else if( nx(lt) .eq. 2048 .and. nit .eq. 50 ) then - Class = 'E' - else - Class = 'U' - endif - -c--------------------------------------------------------------------- -c Use these for debug info: -c--------------------------------------------------------------------- -c debug_vec(0) = 1 !=> report all norms -c debug_vec(1) = 1 !=> some setup information -c debug_vec(1) = 2 !=> more setup information -c debug_vec(2) = k => at level k or below, show result of resid -c debug_vec(3) = k => at level k or below, show result of psinv -c debug_vec(4) = k => at level k or below, show result of rprj -c debug_vec(5) = k => at level k or below, show result of interp -c debug_vec(6) = 1 => (unused) -c debug_vec(7) = 1 => (unused) -c--------------------------------------------------------------------- - a(0) = -8.0D0/3.0D0 - a(1) = 0.0D0 - a(2) = 1.0D0/6.0D0 - a(3) = 1.0D0/12.0D0 - - if(Class .eq. 'A' .or. Class .eq. 'S'.or. Class .eq.'W') then -c--------------------------------------------------------------------- -c Coefficients for the S(a) smoother -c--------------------------------------------------------------------- - c(0) = -3.0D0/8.0D0 - c(1) = +1.0D0/32.0D0 - c(2) = -1.0D0/64.0D0 - c(3) = 0.0D0 - else -c--------------------------------------------------------------------- -c Coefficients for the S(b) smoother -c--------------------------------------------------------------------- - c(0) = -3.0D0/17.0D0 - c(1) = +1.0D0/33.0D0 - c(2) = -1.0D0/61.0D0 - c(3) = 0.0D0 - endif - lb = 1 - k = lt - - call setup(n1,n2,n3,k) - call zero3(u,n1,n2,n3) - call zran3(v,n1,n2,n3,nx(lt),ny(lt),k) - - call norm2u3(v,n1,n2,n3,rnm2,rnmu,nx(lt),ny(lt),nz(lt)) - - if( me .eq. root )then - write (*, 1001) nx(lt),ny(lt),nz(lt), Class - write (*, 1002) nit - - 1000 format(//,' NAS Parallel Benchmarks 3.3 -- MG Benchmark', /) - 1001 format(' Size: ', i4, 'x', i4, 'x', i4, ' (class ', A, ')' ) - 1002 format(' Iterations: ', i4) - 1003 format(' Number of processes: ', i6) - if (nprocs .ne. nprocs_compiled) then - write (*, 1004) nprocs_compiled - write (*, 1005) nprocs - 1004 format(' WARNING: compiled for ', i6, ' processes ') - 1005 format(' Number of active processes: ', i6, /) - else - write (*, 1003) nprocs - endif - endif - - call resid(u,v,r,n1,n2,n3,a,k) - call norm2u3(r,n1,n2,n3,rnm2,rnmu,nx(lt),ny(lt),nz(lt)) - old2 = rnm2 - oldu = rnmu - -c--------------------------------------------------------------------- -c One iteration for startup -c--------------------------------------------------------------------- - call mg3P(u,v,r,a,c,n1,n2,n3,k) - call resid(u,v,r,n1,n2,n3,a,k) - call setup(n1,n2,n3,k) - call zero3(u,n1,n2,n3) - call zran3(v,n1,n2,n3,nx(lt),ny(lt),k) - - call timer_stop(T_init) - if( me .eq. root )then - tinit = timer_read(T_init) - write( *,'(/A,F15.3,A/)' ) - > ' Initialization time: ',tinit, ' seconds' - endif - - call mpi_barrier(mpi_comm_world,ierr) - - call timer_start(T_bench) - - call resid(u,v,r,n1,n2,n3,a,k) - call norm2u3(r,n1,n2,n3,rnm2,rnmu,nx(lt),ny(lt),nz(lt)) - old2 = rnm2 - oldu = rnmu - - do it=1,nit - if (it.eq.1 .or. it.eq.nit .or. mod(it,5).eq.0) then - if (me .eq. root) write(*,80) it - 80 format(' iter ',i4) - endif - call mg3P(u,v,r,a,c,n1,n2,n3,k) - call resid(u,v,r,n1,n2,n3,a,k) - enddo - - - call norm2u3(r,n1,n2,n3,rnm2,rnmu,nx(lt),ny(lt),nz(lt)) - - call timer_stop(T_bench) - - t0 = timer_read(T_bench) - - call mpi_reduce(t0,t,1,dp_type, - > mpi_max,root,mpi_comm_world,ierr) - verified = .FALSE. - verify_value = 0.0 - if( me .eq. root )then - write(*,100) - 100 format(/' Benchmark completed ') - - epsilon = 1.d-8 - if (Class .ne. 'U') then - if(Class.eq.'S') then - verify_value = 0.5307707005734d-04 - elseif(Class.eq.'W') then - verify_value = 0.6467329375339d-05 - elseif(Class.eq.'A') then - verify_value = 0.2433365309069d-05 - elseif(Class.eq.'B') then - verify_value = 0.1800564401355d-05 - elseif(Class.eq.'C') then - verify_value = 0.5706732285740d-06 - elseif(Class.eq.'D') then - verify_value = 0.1583275060440d-09 - elseif(Class.eq.'E') then - verify_value = 0.5630442584711d-10 - endif - - err = abs( rnm2 - verify_value ) / verify_value - if( err .le. epsilon ) then - verified = .TRUE. - write(*, 200) - write(*, 201) rnm2 - write(*, 202) err - 200 format(' VERIFICATION SUCCESSFUL ') - 201 format(' L2 Norm is ', E20.13) - 202 format(' Error is ', E20.13) - else - verified = .FALSE. - write(*, 300) - write(*, 301) rnm2 - write(*, 302) verify_value - 300 format(' VERIFICATION FAILED') - 301 format(' L2 Norm is ', E20.13) - 302 format(' The correct L2 Norm is ', E20.13) - endif - else - verified = .FALSE. - write (*, 400) - write (*, 401) - write (*, 201) rnm2 - 400 format(' Problem size unknown') - 401 format(' NO VERIFICATION PERFORMED') - endif - - nn = 1.0d0*nx(lt)*ny(lt)*nz(lt) - - if( t .ne. 0. ) then - mflops = 58.*1.0D-6*nit*nn / t - else - mflops = 0.0 - endif - - call print_results('MG', class, nx(lt), ny(lt), nz(lt), - > nit, nprocs_compiled, nprocs, t, - > mflops, ' floating point', - > verified, npbversion, compiletime, - > cs1, cs2, cs3, cs4, cs5, cs6, cs7) - - - endif - - - call mpi_finalize(ierr) - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine setup(n1,n2,n3,k) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - include 'globals.h' - - integer is1, is2, is3, ie1, ie2, ie3 - common /grid/ is1,is2,is3,ie1,ie2,ie3 - - integer n1,n2,n3,k - integer dx, dy, log_p, d, i, j - - integer ax, next(3),mi(3,maxlevel),mip(3,maxlevel) - integer ng(3,maxlevel) - integer idi(3), pi(3), idin(3,-1:1) - integer s, dir,ierr - - do j=-1,1,1 - do d=1,3 - msg_type(d,j) = 100*(j+2+10*d) - enddo - enddo - - ng(1,lt) = nx(lt) - ng(2,lt) = ny(lt) - ng(3,lt) = nz(lt) - do ax=1,3 - next(ax) = 1 - do k=lt-1,1,-1 - ng(ax,k) = ng(ax,k+1)/2 - enddo - enddo - 61 format(10i4) - do k=lt,1,-1 - nx(k) = ng(1,k) - ny(k) = ng(2,k) - nz(k) = ng(3,k) - enddo - - log_p = log(float(nprocs)+0.0001)/log(2.0) - dx = log_p/3 - pi(1) = 2**dx - idi(1) = mod(me,pi(1)) - - dy = (log_p-dx)/2 - pi(2) = 2**dy - idi(2) = mod((me/pi(1)),pi(2)) - - pi(3) = nprocs/(pi(1)*pi(2)) - idi(3) = me/(pi(1)*pi(2)) - - do k = lt,1,-1 - dead(k) = .false. - do ax = 1,3 - take_ex(ax,k) = .false. - give_ex(ax,k) = .false. - - mi(ax,k) = 2 + - > ((idi(ax)+1)*ng(ax,k))/pi(ax) - - > ((idi(ax)+0)*ng(ax,k))/pi(ax) - mip(ax,k) = 2 + - > ((next(ax)+idi(ax)+1)*ng(ax,k))/pi(ax) - - > ((next(ax)+idi(ax)+0)*ng(ax,k))/pi(ax) - - if(mip(ax,k).eq.2.or.mi(ax,k).eq.2)then - next(ax) = 2*next(ax) - endif - - if( k+1 .le. lt )then - if((mip(ax,k).eq.2).and.(mi(ax,k).eq.3))then - give_ex(ax,k+1) = .true. - endif - if((mip(ax,k).eq.3).and.(mi(ax,k).eq.2))then - take_ex(ax,k+1) = .true. - endif - endif - enddo - - if( mi(1,k).eq.2 .or. - > mi(2,k).eq.2 .or. - > mi(3,k).eq.2 )then - dead(k) = .true. - endif - m1(k) = mi(1,k) - m2(k) = mi(2,k) - m3(k) = mi(3,k) - - do ax=1,3 - idin(ax,+1) = mod( idi(ax) + next(ax) + pi(ax) , pi(ax) ) - idin(ax,-1) = mod( idi(ax) - next(ax) + pi(ax) , pi(ax) ) - enddo - do dir = 1,-1,-2 - nbr(1,dir,k) = idin(1,dir) + pi(1) - > *(idi(2) + pi(2) - > * idi(3)) - nbr(2,dir,k) = idi(1) + pi(1) - > *(idin(2,dir) + pi(2) - > * idi(3)) - nbr(3,dir,k) = idi(1) + pi(1) - > *(idi(2) + pi(2) - > * idin(3,dir)) - enddo - enddo - - k = lt - is1 = 2 + ng(1,k) - ((pi(1) -idi(1))*ng(1,lt))/pi(1) - ie1 = 1 + ng(1,k) - ((pi(1)-1-idi(1))*ng(1,lt))/pi(1) - n1 = 3 + ie1 - is1 - is2 = 2 + ng(2,k) - ((pi(2) -idi(2))*ng(2,lt))/pi(2) - ie2 = 1 + ng(2,k) - ((pi(2)-1-idi(2))*ng(2,lt))/pi(2) - n2 = 3 + ie2 - is2 - is3 = 2 + ng(3,k) - ((pi(3) -idi(3))*ng(3,lt))/pi(3) - ie3 = 1 + ng(3,k) - ((pi(3)-1-idi(3))*ng(3,lt))/pi(3) - n3 = 3 + ie3 - is3 - - - ir(lt)=1 - do j = lt-1, 1, -1 - ir(j)=ir(j+1)+m1(j+1)*m2(j+1)*m3(j+1) - enddo - - - if( debug_vec(1) .ge. 1 )then - if( me .eq. root )write(*,*)' in setup, ' - if( me .eq. root )write(*,*)' me k lt nx ny nz ', - > ' n1 n2 n3 is1 is2 is3 ie1 ie2 ie3' - do i=0,nprocs-1 - if( me .eq. i )then - write(*,9) me,k,lt,ng(1,k),ng(2,k),ng(3,k), - > n1,n2,n3,is1,is2,is3,ie1,ie2,ie3 - 9 format(15i4) - endif - call mpi_barrier(mpi_comm_world,ierr) - enddo - endif - if( debug_vec(1) .ge. 2 )then - do i=0,nprocs-1 - if( me .eq. i )then - write(*,*)' ' - write(*,*)' processor =',me - do k=lt,1,-1 - write(*,7)k,idi(1),idi(2),idi(3), - > ((nbr(d,j,k),j=-1,1,2),d=1,3), - > (mi(d,k),d=1,3) - enddo - 7 format(i4,'idi=',3i4,'nbr=',3(2i4,' '),'mi=',3i4,' ') - write(*,*)'idi(s) = ',(idi(s),s=1,3) - write(*,*)'dead(2), dead(1) = ',dead(2),dead(1) - do ax=1,3 - write(*,*)'give_ex(ax,2)= ',give_ex(ax,2) - write(*,*)'take_ex(ax,2)= ',take_ex(ax,2) - enddo - endif - call mpi_barrier(mpi_comm_world,ierr) - enddo - endif - - k = lt - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine mg3P(u,v,r,a,c,n1,n2,n3,k) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c multigrid V-cycle routine -c--------------------------------------------------------------------- - implicit none - - include 'mpinpb.h' - include 'globals.h' - - integer n1, n2, n3, k - double precision u(nr),v(nv),r(nr) - double precision a(0:3),c(0:3) - - integer j - -c--------------------------------------------------------------------- -c down cycle. -c restrict the residual from the find grid to the coarse -c--------------------------------------------------------------------- - - do k= lt, lb+1 , -1 - j = k-1 - call rprj3(r(ir(k)),m1(k),m2(k),m3(k), - > r(ir(j)),m1(j),m2(j),m3(j),k) - enddo - - k = lb -c--------------------------------------------------------------------- -c compute an approximate solution on the coarsest grid -c--------------------------------------------------------------------- - call zero3(u(ir(k)),m1(k),m2(k),m3(k)) - call psinv(r(ir(k)),u(ir(k)),m1(k),m2(k),m3(k),c,k) - - do k = lb+1, lt-1 - j = k-1 -c--------------------------------------------------------------------- -c prolongate from level k-1 to k -c--------------------------------------------------------------------- - call zero3(u(ir(k)),m1(k),m2(k),m3(k)) - call interp(u(ir(j)),m1(j),m2(j),m3(j), - > u(ir(k)),m1(k),m2(k),m3(k),k) -c--------------------------------------------------------------------- -c compute residual for level k -c--------------------------------------------------------------------- - call resid(u(ir(k)),r(ir(k)),r(ir(k)),m1(k),m2(k),m3(k),a,k) -c--------------------------------------------------------------------- -c apply smoother -c--------------------------------------------------------------------- - call psinv(r(ir(k)),u(ir(k)),m1(k),m2(k),m3(k),c,k) - enddo - 200 continue - j = lt - 1 - k = lt - call interp(u(ir(j)),m1(j),m2(j),m3(j),u,n1,n2,n3,k) - call resid(u,v,r,n1,n2,n3,a,k) - call psinv(r,u,n1,n2,n3,c,k) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine psinv( r,u,n1,n2,n3,c,k) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c psinv applies an approximate inverse as smoother: u = u + Cr -c -c This implementation costs 15A + 4M per result, where -c A and M denote the costs of Addition and Multiplication. -c Presuming coefficient c(3) is zero (the NPB assumes this, -c but it is thus not a general case), 2A + 1M may be eliminated, -c resulting in 13A + 3M. -c Note that this vectorizes, and is also fine for cache -c based machines. -c--------------------------------------------------------------------- - implicit none - - include 'globals.h' - - integer n1,n2,n3,k - double precision u(n1,n2,n3),r(n1,n2,n3),c(0:3) - integer i3, i2, i1 - - double precision r1(m), r2(m) - - do i3=2,n3-1 - do i2=2,n2-1 - do i1=1,n1 - r1(i1) = r(i1,i2-1,i3) + r(i1,i2+1,i3) - > + r(i1,i2,i3-1) + r(i1,i2,i3+1) - r2(i1) = r(i1,i2-1,i3-1) + r(i1,i2+1,i3-1) - > + r(i1,i2-1,i3+1) + r(i1,i2+1,i3+1) - enddo - do i1=2,n1-1 - u(i1,i2,i3) = u(i1,i2,i3) - > + c(0) * r(i1,i2,i3) - > + c(1) * ( r(i1-1,i2,i3) + r(i1+1,i2,i3) - > + r1(i1) ) - > + c(2) * ( r2(i1) + r1(i1-1) + r1(i1+1) ) -c--------------------------------------------------------------------- -c Assume c(3) = 0 (Enable line below if c(3) not= 0) -c--------------------------------------------------------------------- -c > + c(3) * ( r2(i1-1) + r2(i1+1) ) -c--------------------------------------------------------------------- - enddo - enddo - enddo - -c--------------------------------------------------------------------- -c exchange boundary points -c--------------------------------------------------------------------- - call comm3(u,n1,n2,n3,k) - - if( debug_vec(0) .ge. 1 )then - call rep_nrm(u,n1,n2,n3,' psinv',k) - endif - - if( debug_vec(3) .ge. k )then - call showall(u,n1,n2,n3) - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine resid( u,v,r,n1,n2,n3,a,k ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c resid computes the residual: r = v - Au -c -c This implementation costs 15A + 4M per result, where -c A and M denote the costs of Addition (or Subtraction) and -c Multiplication, respectively. -c Presuming coefficient a(1) is zero (the NPB assumes this, -c but it is thus not a general case), 3A + 1M may be eliminated, -c resulting in 12A + 3M. -c Note that this vectorizes, and is also fine for cache -c based machines. -c--------------------------------------------------------------------- - implicit none - - include 'globals.h' - - integer n1,n2,n3,k - double precision u(n1,n2,n3),v(n1,n2,n3),r(n1,n2,n3),a(0:3) - integer i3, i2, i1 - double precision u1(m), u2(m) - - do i3=2,n3-1 - do i2=2,n2-1 - do i1=1,n1 - u1(i1) = u(i1,i2-1,i3) + u(i1,i2+1,i3) - > + u(i1,i2,i3-1) + u(i1,i2,i3+1) - u2(i1) = u(i1,i2-1,i3-1) + u(i1,i2+1,i3-1) - > + u(i1,i2-1,i3+1) + u(i1,i2+1,i3+1) - enddo - do i1=2,n1-1 - r(i1,i2,i3) = v(i1,i2,i3) - > - a(0) * u(i1,i2,i3) -c--------------------------------------------------------------------- -c Assume a(1) = 0 (Enable 2 lines below if a(1) not= 0) -c--------------------------------------------------------------------- -c > - a(1) * ( u(i1-1,i2,i3) + u(i1+1,i2,i3) -c > + u1(i1) ) -c--------------------------------------------------------------------- - > - a(2) * ( u2(i1) + u1(i1-1) + u1(i1+1) ) - > - a(3) * ( u2(i1-1) + u2(i1+1) ) - enddo - enddo - enddo - -c--------------------------------------------------------------------- -c exchange boundary data -c--------------------------------------------------------------------- - call comm3(r,n1,n2,n3,k) - - if( debug_vec(0) .ge. 1 )then - call rep_nrm(r,n1,n2,n3,' resid',k) - endif - - if( debug_vec(2) .ge. k )then - call showall(r,n1,n2,n3) - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine rprj3( r,m1k,m2k,m3k,s,m1j,m2j,m3j,k ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c rprj3 projects onto the next coarser grid, -c using a trilinear Finite Element projection: s = r' = P r -c -c This implementation costs 20A + 4M per result, where -c A and M denote the costs of Addition and Multiplication. -c Note that this vectorizes, and is also fine for cache -c based machines. -c--------------------------------------------------------------------- - implicit none - - include 'mpinpb.h' - include 'globals.h' - - integer m1k, m2k, m3k, m1j, m2j, m3j,k - double precision r(m1k,m2k,m3k), s(m1j,m2j,m3j) - integer j3, j2, j1, i3, i2, i1, d1, d2, d3, j - - double precision x1(m), y1(m), x2,y2 - - - if(m1k.eq.3)then - d1 = 2 - else - d1 = 1 - endif - - if(m2k.eq.3)then - d2 = 2 - else - d2 = 1 - endif - - if(m3k.eq.3)then - d3 = 2 - else - d3 = 1 - endif - - do j3=2,m3j-1 - i3 = 2*j3-d3 -C i3 = 2*j3-1 - do j2=2,m2j-1 - i2 = 2*j2-d2 -C i2 = 2*j2-1 - - do j1=2,m1j - i1 = 2*j1-d1 -C i1 = 2*j1-1 - x1(i1-1) = r(i1-1,i2-1,i3 ) + r(i1-1,i2+1,i3 ) - > + r(i1-1,i2, i3-1) + r(i1-1,i2, i3+1) - y1(i1-1) = r(i1-1,i2-1,i3-1) + r(i1-1,i2-1,i3+1) - > + r(i1-1,i2+1,i3-1) + r(i1-1,i2+1,i3+1) - enddo - - do j1=2,m1j-1 - i1 = 2*j1-d1 -C i1 = 2*j1-1 - y2 = r(i1, i2-1,i3-1) + r(i1, i2-1,i3+1) - > + r(i1, i2+1,i3-1) + r(i1, i2+1,i3+1) - x2 = r(i1, i2-1,i3 ) + r(i1, i2+1,i3 ) - > + r(i1, i2, i3-1) + r(i1, i2, i3+1) - s(j1,j2,j3) = - > 0.5D0 * r(i1,i2,i3) - > + 0.25D0 * ( r(i1-1,i2,i3) + r(i1+1,i2,i3) + x2) - > + 0.125D0 * ( x1(i1-1) + x1(i1+1) + y2) - > + 0.0625D0 * ( y1(i1-1) + y1(i1+1) ) - enddo - - enddo - enddo - - - j = k-1 - call comm3(s,m1j,m2j,m3j,j) - - if( debug_vec(0) .ge. 1 )then - call rep_nrm(s,m1j,m2j,m3j,' rprj3',k-1) - endif - - if( debug_vec(4) .ge. k )then - call showall(s,m1j,m2j,m3j) - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine interp( z,mm1,mm2,mm3,u,n1,n2,n3,k ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c interp adds the trilinear interpolation of the correction -c from the coarser grid to the current approximation: u = u + Qu' -c -c Observe that this implementation costs 16A + 4M, where -c A and M denote the costs of Addition and Multiplication. -c Note that this vectorizes, and is also fine for cache -c based machines. Vector machines may get slightly better -c performance however, with 8 separate "do i1" loops, rather than 4. -c--------------------------------------------------------------------- - implicit none - - include 'mpinpb.h' - include 'globals.h' - - integer mm1, mm2, mm3, n1, n2, n3,k - double precision z(mm1,mm2,mm3),u(n1,n2,n3) - integer i3, i2, i1, d1, d2, d3, t1, t2, t3 - -c note that m = 1037 in globals.h but for this only need to be -c 535 to handle up to 1024^3 -c integer m -c parameter( m=535 ) - double precision z1(m),z2(m),z3(m) - - - if( n1 .ne. 3 .and. n2 .ne. 3 .and. n3 .ne. 3 ) then - - do i3=1,mm3-1 - do i2=1,mm2-1 - - do i1=1,mm1 - z1(i1) = z(i1,i2+1,i3) + z(i1,i2,i3) - z2(i1) = z(i1,i2,i3+1) + z(i1,i2,i3) - z3(i1) = z(i1,i2+1,i3+1) + z(i1,i2,i3+1) + z1(i1) - enddo - - do i1=1,mm1-1 - u(2*i1-1,2*i2-1,2*i3-1)=u(2*i1-1,2*i2-1,2*i3-1) - > +z(i1,i2,i3) - u(2*i1,2*i2-1,2*i3-1)=u(2*i1,2*i2-1,2*i3-1) - > +0.5d0*(z(i1+1,i2,i3)+z(i1,i2,i3)) - enddo - do i1=1,mm1-1 - u(2*i1-1,2*i2,2*i3-1)=u(2*i1-1,2*i2,2*i3-1) - > +0.5d0 * z1(i1) - u(2*i1,2*i2,2*i3-1)=u(2*i1,2*i2,2*i3-1) - > +0.25d0*( z1(i1) + z1(i1+1) ) - enddo - do i1=1,mm1-1 - u(2*i1-1,2*i2-1,2*i3)=u(2*i1-1,2*i2-1,2*i3) - > +0.5d0 * z2(i1) - u(2*i1,2*i2-1,2*i3)=u(2*i1,2*i2-1,2*i3) - > +0.25d0*( z2(i1) + z2(i1+1) ) - enddo - do i1=1,mm1-1 - u(2*i1-1,2*i2,2*i3)=u(2*i1-1,2*i2,2*i3) - > +0.25d0* z3(i1) - u(2*i1,2*i2,2*i3)=u(2*i1,2*i2,2*i3) - > +0.125d0*( z3(i1) + z3(i1+1) ) - enddo - enddo - enddo - - else - - if(n1.eq.3)then - d1 = 2 - t1 = 1 - else - d1 = 1 - t1 = 0 - endif - - if(n2.eq.3)then - d2 = 2 - t2 = 1 - else - d2 = 1 - t2 = 0 - endif - - if(n3.eq.3)then - d3 = 2 - t3 = 1 - else - d3 = 1 - t3 = 0 - endif - - do i3=d3,mm3-1 - do i2=d2,mm2-1 - do i1=d1,mm1-1 - u(2*i1-d1,2*i2-d2,2*i3-d3)=u(2*i1-d1,2*i2-d2,2*i3-d3) - > +z(i1,i2,i3) - enddo - do i1=1,mm1-1 - u(2*i1-t1,2*i2-d2,2*i3-d3)=u(2*i1-t1,2*i2-d2,2*i3-d3) - > +0.5D0*(z(i1+1,i2,i3)+z(i1,i2,i3)) - enddo - enddo - do i2=1,mm2-1 - do i1=d1,mm1-1 - u(2*i1-d1,2*i2-t2,2*i3-d3)=u(2*i1-d1,2*i2-t2,2*i3-d3) - > +0.5D0*(z(i1,i2+1,i3)+z(i1,i2,i3)) - enddo - do i1=1,mm1-1 - u(2*i1-t1,2*i2-t2,2*i3-d3)=u(2*i1-t1,2*i2-t2,2*i3-d3) - > +0.25D0*(z(i1+1,i2+1,i3)+z(i1+1,i2,i3) - > +z(i1, i2+1,i3)+z(i1, i2,i3)) - enddo - enddo - enddo - - do i3=1,mm3-1 - do i2=d2,mm2-1 - do i1=d1,mm1-1 - u(2*i1-d1,2*i2-d2,2*i3-t3)=u(2*i1-d1,2*i2-d2,2*i3-t3) - > +0.5D0*(z(i1,i2,i3+1)+z(i1,i2,i3)) - enddo - do i1=1,mm1-1 - u(2*i1-t1,2*i2-d2,2*i3-t3)=u(2*i1-t1,2*i2-d2,2*i3-t3) - > +0.25D0*(z(i1+1,i2,i3+1)+z(i1,i2,i3+1) - > +z(i1+1,i2,i3 )+z(i1,i2,i3 )) - enddo - enddo - do i2=1,mm2-1 - do i1=d1,mm1-1 - u(2*i1-d1,2*i2-t2,2*i3-t3)=u(2*i1-d1,2*i2-t2,2*i3-t3) - > +0.25D0*(z(i1,i2+1,i3+1)+z(i1,i2,i3+1) - > +z(i1,i2+1,i3 )+z(i1,i2,i3 )) - enddo - do i1=1,mm1-1 - u(2*i1-t1,2*i2-t2,2*i3-t3)=u(2*i1-t1,2*i2-t2,2*i3-t3) - > +0.125D0*(z(i1+1,i2+1,i3+1)+z(i1+1,i2,i3+1) - > +z(i1 ,i2+1,i3+1)+z(i1 ,i2,i3+1) - > +z(i1+1,i2+1,i3 )+z(i1+1,i2,i3 ) - > +z(i1 ,i2+1,i3 )+z(i1 ,i2,i3 )) - enddo - enddo - enddo - - endif - - call comm3_ex(u,n1,n2,n3,k) - - if( debug_vec(0) .ge. 1 )then - call rep_nrm(z,mm1,mm2,mm3,'z: inter',k-1) - call rep_nrm(u,n1,n2,n3,'u: inter',k) - endif - - if( debug_vec(5) .ge. k )then - call showall(z,mm1,mm2,mm3) - call showall(u,n1,n2,n3) - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine norm2u3(r,n1,n2,n3,rnm2,rnmu,nx,ny,nz) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c norm2u3 evaluates approximations to the L2 norm and the -c uniform (or L-infinity or Chebyshev) norm, under the -c assumption that the boundaries are periodic or zero. Add the -c boundaries in with half weight (quarter weight on the edges -c and eighth weight at the corners) for inhomogeneous boundaries. -c--------------------------------------------------------------------- - implicit none - - include 'mpinpb.h' - - integer n1, n2, n3, nx, ny, nz - double precision rnm2, rnmu, r(n1,n2,n3) - double precision s, a, ss - integer i3, i2, i1, ierr - - double precision dn - - dn = 1.0d0*nx*ny*nz - - s=0.0D0 - rnmu = 0.0D0 - do i3=2,n3-1 - do i2=2,n2-1 - do i1=2,n1-1 - s=s+r(i1,i2,i3)**2 - a=abs(r(i1,i2,i3)) - if(a.gt.rnmu)rnmu=a - enddo - enddo - enddo - - call mpi_allreduce(rnmu,ss,1,dp_type, - > mpi_max,mpi_comm_world,ierr) - rnmu = ss - call mpi_allreduce(s, ss, 1, dp_type, - > mpi_sum,mpi_comm_world,ierr) - s = ss - rnm2=sqrt( s / dn ) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine rep_nrm(u,n1,n2,n3,title,kk) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c report on norm -c--------------------------------------------------------------------- - implicit none - - include 'mpinpb.h' - include 'globals.h' - - integer n1, n2, n3, kk - double precision u(n1,n2,n3) - character*8 title - - double precision rnm2, rnmu - - - call norm2u3(u,n1,n2,n3,rnm2,rnmu,nx(kk),ny(kk),nz(kk)) - if( me .eq. root )then - write(*,7)kk,title,rnm2,rnmu - 7 format(' Level',i2,' in ',a8,': norms =',D21.14,D21.14) - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine comm3(u,n1,n2,n3,kk) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c comm3 organizes the communication on all borders -c--------------------------------------------------------------------- - implicit none - - include 'mpinpb.h' - include 'globals.h' - - integer n1, n2, n3, kk - double precision u(n1,n2,n3) - integer axis - - if( .not. dead(kk) )then - do axis = 1, 3 - if( nprocs .ne. 1) then - - call ready( axis, -1, kk ) - call ready( axis, +1, kk ) - - call give3( axis, +1, u, n1, n2, n3, kk ) - call give3( axis, -1, u, n1, n2, n3, kk ) - - call take3( axis, -1, u, n1, n2, n3 ) - call take3( axis, +1, u, n1, n2, n3 ) - - else - call comm1p( axis, u, n1, n2, n3, kk ) - endif - enddo - else - call zero3(u,n1,n2,n3) - endif - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine comm3_ex(u,n1,n2,n3,kk) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c comm3_ex communicates to expand the number of processors -c--------------------------------------------------------------------- - implicit none - - include 'mpinpb.h' - include 'globals.h' - - integer n1, n2, n3, kk - double precision u(n1,n2,n3) - integer axis - - do axis = 1, 3 - if( nprocs .ne. 1 ) then - if( take_ex( axis, kk ) )then - call ready( axis, -1, kk ) - call ready( axis, +1, kk ) - call take3_ex( axis, -1, u, n1, n2, n3 ) - call take3_ex( axis, +1, u, n1, n2, n3 ) - endif - - if( give_ex( axis, kk ) )then - call give3_ex( axis, +1, u, n1, n2, n3, kk ) - call give3_ex( axis, -1, u, n1, n2, n3, kk ) - endif - else - call comm1p_ex( axis, u, n1, n2, n3, kk ) - endif - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine ready( axis, dir, k ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c ready allocates a buffer to take in a message -c--------------------------------------------------------------------- - implicit none - - include 'mpinpb.h' - include 'globals.h' - - integer axis, dir, k - integer buff_id,buff_len,i,ierr - - buff_id = 3 + dir - buff_len = nm2 - - do i=1,nm2 - buff(i,buff_id) = 0.0D0 - enddo - - -c--------------------------------------------------------------------- -c fake message request type -c--------------------------------------------------------------------- - msg_id(axis,dir,1) = msg_type(axis,dir) +1000*me - - call mpi_irecv( buff(1,buff_id), buff_len, - > dp_type, nbr(axis,-dir,k), msg_type(axis,dir), - > mpi_comm_world, msg_id(axis,dir,1), ierr) - return - end - - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine give3( axis, dir, u, n1, n2, n3, k ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c give3 sends border data out in the requested direction -c--------------------------------------------------------------------- - implicit none - - include 'mpinpb.h' - include 'globals.h' - - integer axis, dir, n1, n2, n3, k, ierr - double precision u( n1, n2, n3 ) - - integer i3, i2, i1, buff_len,buff_id - - buff_id = 2 + dir - buff_len = 0 - - if( axis .eq. 1 )then - if( dir .eq. -1 )then - - do i3=2,n3-1 - do i2=2,n2-1 - buff_len = buff_len + 1 - buff(buff_len,buff_id ) = u( 2, i2,i3) - enddo - enddo - - call mpi_send( - > buff(1, buff_id ), buff_len,dp_type, - > nbr( axis, dir, k ), msg_type(axis,dir), - > mpi_comm_world, ierr) - - else if( dir .eq. +1 ) then - - do i3=2,n3-1 - do i2=2,n2-1 - buff_len = buff_len + 1 - buff(buff_len, buff_id ) = u( n1-1, i2,i3) - enddo - enddo - - call mpi_send( - > buff(1, buff_id ), buff_len,dp_type, - > nbr( axis, dir, k ), msg_type(axis,dir), - > mpi_comm_world, ierr) - - endif - endif - - if( axis .eq. 2 )then - if( dir .eq. -1 )then - - do i3=2,n3-1 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len, buff_id ) = u( i1, 2,i3) - enddo - enddo - - call mpi_send( - > buff(1, buff_id ), buff_len,dp_type, - > nbr( axis, dir, k ), msg_type(axis,dir), - > mpi_comm_world, ierr) - - else if( dir .eq. +1 ) then - - do i3=2,n3-1 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len, buff_id )= u( i1,n2-1,i3) - enddo - enddo - - call mpi_send( - > buff(1, buff_id ), buff_len,dp_type, - > nbr( axis, dir, k ), msg_type(axis,dir), - > mpi_comm_world, ierr) - - endif - endif - - if( axis .eq. 3 )then - if( dir .eq. -1 )then - - do i2=1,n2 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len, buff_id ) = u( i1,i2,2) - enddo - enddo - - call mpi_send( - > buff(1, buff_id ), buff_len,dp_type, - > nbr( axis, dir, k ), msg_type(axis,dir), - > mpi_comm_world, ierr) - - else if( dir .eq. +1 ) then - - do i2=1,n2 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len, buff_id ) = u( i1,i2,n3-1) - enddo - enddo - - call mpi_send( - > buff(1, buff_id ), buff_len,dp_type, - > nbr( axis, dir, k ), msg_type(axis,dir), - > mpi_comm_world, ierr) - - endif - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine take3( axis, dir, u, n1, n2, n3 ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c take3 copies in border data from the requested direction -c--------------------------------------------------------------------- - implicit none - - include 'mpinpb.h' - include 'globals.h' - - integer axis, dir, n1, n2, n3 - double precision u( n1, n2, n3 ) - - integer buff_id, indx - - integer status(mpi_status_size), ierr - - integer i3, i2, i1 - - call mpi_wait( msg_id( axis, dir, 1 ),status,ierr) - buff_id = 3 + dir - indx = 0 - - if( axis .eq. 1 )then - if( dir .eq. -1 )then - - do i3=2,n3-1 - do i2=2,n2-1 - indx = indx + 1 - u(n1,i2,i3) = buff(indx, buff_id ) - enddo - enddo - - else if( dir .eq. +1 ) then - - do i3=2,n3-1 - do i2=2,n2-1 - indx = indx + 1 - u(1,i2,i3) = buff(indx, buff_id ) - enddo - enddo - - endif - endif - - if( axis .eq. 2 )then - if( dir .eq. -1 )then - - do i3=2,n3-1 - do i1=1,n1 - indx = indx + 1 - u(i1,n2,i3) = buff(indx, buff_id ) - enddo - enddo - - else if( dir .eq. +1 ) then - - do i3=2,n3-1 - do i1=1,n1 - indx = indx + 1 - u(i1,1,i3) = buff(indx, buff_id ) - enddo - enddo - - endif - endif - - if( axis .eq. 3 )then - if( dir .eq. -1 )then - - do i2=1,n2 - do i1=1,n1 - indx = indx + 1 - u(i1,i2,n3) = buff(indx, buff_id ) - enddo - enddo - - else if( dir .eq. +1 ) then - - do i2=1,n2 - do i1=1,n1 - indx = indx + 1 - u(i1,i2,1) = buff(indx, buff_id ) - enddo - enddo - - endif - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine give3_ex( axis, dir, u, n1, n2, n3, k ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c give3_ex sends border data out to expand number of processors -c--------------------------------------------------------------------- - implicit none - - include 'mpinpb.h' - include 'globals.h' - - integer axis, dir, n1, n2, n3, k, ierr - double precision u( n1, n2, n3 ) - - integer i3, i2, i1, buff_len, buff_id - - buff_id = 2 + dir - buff_len = 0 - - if( axis .eq. 1 )then - if( dir .eq. -1 )then - - do i3=1,n3 - do i2=1,n2 - buff_len = buff_len + 1 - buff(buff_len,buff_id ) = u( 2, i2,i3) - enddo - enddo - - call mpi_send( - > buff(1, buff_id ), buff_len,dp_type, - > nbr( axis, dir, k ), msg_type(axis,dir), - > mpi_comm_world, ierr) - - else if( dir .eq. +1 ) then - - do i3=1,n3 - do i2=1,n2 - do i1=n1-1,n1 - buff_len = buff_len + 1 - buff(buff_len,buff_id)= u(i1,i2,i3) - enddo - enddo - enddo - - call mpi_send( - > buff(1, buff_id ), buff_len,dp_type, - > nbr( axis, dir, k ), msg_type(axis,dir), - > mpi_comm_world, ierr) - - endif - endif - - if( axis .eq. 2 )then - if( dir .eq. -1 )then - - do i3=1,n3 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len, buff_id ) = u( i1, 2,i3) - enddo - enddo - - call mpi_send( - > buff(1, buff_id ), buff_len,dp_type, - > nbr( axis, dir, k ), msg_type(axis,dir), - > mpi_comm_world, ierr) - - else if( dir .eq. +1 ) then - - do i3=1,n3 - do i2=n2-1,n2 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len,buff_id )= u(i1,i2,i3) - enddo - enddo - enddo - - call mpi_send( - > buff(1, buff_id ), buff_len,dp_type, - > nbr( axis, dir, k ), msg_type(axis,dir), - > mpi_comm_world, ierr) - - endif - endif - - if( axis .eq. 3 )then - if( dir .eq. -1 )then - - do i2=1,n2 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len, buff_id ) = u( i1,i2,2) - enddo - enddo - - call mpi_send( - > buff(1, buff_id ), buff_len,dp_type, - > nbr( axis, dir, k ), msg_type(axis,dir), - > mpi_comm_world, ierr) - - else if( dir .eq. +1 ) then - - do i3=n3-1,n3 - do i2=1,n2 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len, buff_id ) = u( i1,i2,i3) - enddo - enddo - enddo - - call mpi_send( - > buff(1, buff_id ), buff_len,dp_type, - > nbr( axis, dir, k ), msg_type(axis,dir), - > mpi_comm_world, ierr) - - endif - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine take3_ex( axis, dir, u, n1, n2, n3 ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c take3_ex copies in border data to expand number of processors -c--------------------------------------------------------------------- - implicit none - - include 'mpinpb.h' - include 'globals.h' - - integer axis, dir, n1, n2, n3 - double precision u( n1, n2, n3 ) - - integer buff_id, indx - - integer status(mpi_status_size) , ierr - - integer i3, i2, i1 - - call mpi_wait( msg_id( axis, dir, 1 ),status,ierr) - buff_id = 3 + dir - indx = 0 - - if( axis .eq. 1 )then - if( dir .eq. -1 )then - - do i3=1,n3 - do i2=1,n2 - indx = indx + 1 - u(n1,i2,i3) = buff(indx, buff_id ) - enddo - enddo - - else if( dir .eq. +1 ) then - - do i3=1,n3 - do i2=1,n2 - do i1=1,2 - indx = indx + 1 - u(i1,i2,i3) = buff(indx,buff_id) - enddo - enddo - enddo - - endif - endif - - if( axis .eq. 2 )then - if( dir .eq. -1 )then - - do i3=1,n3 - do i1=1,n1 - indx = indx + 1 - u(i1,n2,i3) = buff(indx, buff_id ) - enddo - enddo - - else if( dir .eq. +1 ) then - - do i3=1,n3 - do i2=1,2 - do i1=1,n1 - indx = indx + 1 - u(i1,i2,i3) = buff(indx,buff_id) - enddo - enddo - enddo - - endif - endif - - if( axis .eq. 3 )then - if( dir .eq. -1 )then - - do i2=1,n2 - do i1=1,n1 - indx = indx + 1 - u(i1,i2,n3) = buff(indx, buff_id ) - enddo - enddo - - else if( dir .eq. +1 ) then - - do i3=1,2 - do i2=1,n2 - do i1=1,n1 - indx = indx + 1 - u(i1,i2,i3) = buff(indx,buff_id) - enddo - enddo - enddo - - endif - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine comm1p( axis, u, n1, n2, n3, kk ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - include 'globals.h' - - integer axis, dir, n1, n2, n3 - double precision u( n1, n2, n3 ) - - integer i3, i2, i1, buff_len,buff_id - integer i, kk, indx - - dir = -1 - - buff_id = 3 + dir - buff_len = nm2 - - do i=1,nm2 - buff(i,buff_id) = 0.0D0 - enddo - - - dir = +1 - - buff_id = 3 + dir - buff_len = nm2 - - do i=1,nm2 - buff(i,buff_id) = 0.0D0 - enddo - - dir = +1 - - buff_id = 2 + dir - buff_len = 0 - - if( axis .eq. 1 )then - do i3=2,n3-1 - do i2=2,n2-1 - buff_len = buff_len + 1 - buff(buff_len, buff_id ) = u( n1-1, i2,i3) - enddo - enddo - endif - - if( axis .eq. 2 )then - do i3=2,n3-1 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len, buff_id )= u( i1,n2-1,i3) - enddo - enddo - endif - - if( axis .eq. 3 )then - do i2=1,n2 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len, buff_id ) = u( i1,i2,n3-1) - enddo - enddo - endif - - dir = -1 - - buff_id = 2 + dir - buff_len = 0 - - if( axis .eq. 1 )then - do i3=2,n3-1 - do i2=2,n2-1 - buff_len = buff_len + 1 - buff(buff_len,buff_id ) = u( 2, i2,i3) - enddo - enddo - endif - - if( axis .eq. 2 )then - do i3=2,n3-1 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len, buff_id ) = u( i1, 2,i3) - enddo - enddo - endif - - if( axis .eq. 3 )then - do i2=1,n2 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len, buff_id ) = u( i1,i2,2) - enddo - enddo - endif - - do i=1,nm2 - buff(i,4) = buff(i,3) - buff(i,2) = buff(i,1) - enddo - - dir = -1 - - buff_id = 3 + dir - indx = 0 - - if( axis .eq. 1 )then - do i3=2,n3-1 - do i2=2,n2-1 - indx = indx + 1 - u(n1,i2,i3) = buff(indx, buff_id ) - enddo - enddo - endif - - if( axis .eq. 2 )then - do i3=2,n3-1 - do i1=1,n1 - indx = indx + 1 - u(i1,n2,i3) = buff(indx, buff_id ) - enddo - enddo - endif - - if( axis .eq. 3 )then - do i2=1,n2 - do i1=1,n1 - indx = indx + 1 - u(i1,i2,n3) = buff(indx, buff_id ) - enddo - enddo - endif - - - dir = +1 - - buff_id = 3 + dir - indx = 0 - - if( axis .eq. 1 )then - do i3=2,n3-1 - do i2=2,n2-1 - indx = indx + 1 - u(1,i2,i3) = buff(indx, buff_id ) - enddo - enddo - endif - - if( axis .eq. 2 )then - do i3=2,n3-1 - do i1=1,n1 - indx = indx + 1 - u(i1,1,i3) = buff(indx, buff_id ) - enddo - enddo - endif - - if( axis .eq. 3 )then - do i2=1,n2 - do i1=1,n1 - indx = indx + 1 - u(i1,i2,1) = buff(indx, buff_id ) - enddo - enddo - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine comm1p_ex( axis, u, n1, n2, n3, kk ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - include 'globals.h' - - integer axis, dir, n1, n2, n3 - double precision u( n1, n2, n3 ) - - integer i3, i2, i1, buff_len,buff_id - integer i, kk, indx - - if( take_ex( axis, kk ) ) then - - dir = -1 - - buff_id = 3 + dir - buff_len = nm2 - - do i=1,nm2 - buff(i,buff_id) = 0.0D0 - enddo - - - dir = +1 - - buff_id = 3 + dir - buff_len = nm2 - - do i=1,nm2 - buff(i,buff_id) = 0.0D0 - enddo - - - dir = -1 - - buff_id = 3 + dir - indx = 0 - - if( axis .eq. 1 )then - do i3=1,n3 - do i2=1,n2 - indx = indx + 1 - u(n1,i2,i3) = buff(indx, buff_id ) - enddo - enddo - endif - - if( axis .eq. 2 )then - do i3=1,n3 - do i1=1,n1 - indx = indx + 1 - u(i1,n2,i3) = buff(indx, buff_id ) - enddo - enddo - endif - - if( axis .eq. 3 )then - do i2=1,n2 - do i1=1,n1 - indx = indx + 1 - u(i1,i2,n3) = buff(indx, buff_id ) - enddo - enddo - endif - - dir = +1 - - buff_id = 3 + dir - indx = 0 - - if( axis .eq. 1 )then - do i3=1,n3 - do i2=1,n2 - do i1=1,2 - indx = indx + 1 - u(i1,i2,i3) = buff(indx,buff_id) - enddo - enddo - enddo - endif - - if( axis .eq. 2 )then - do i3=1,n3 - do i2=1,2 - do i1=1,n1 - indx = indx + 1 - u(i1,i2,i3) = buff(indx,buff_id) - enddo - enddo - enddo - endif - - if( axis .eq. 3 )then - do i3=1,2 - do i2=1,n2 - do i1=1,n1 - indx = indx + 1 - u(i1,i2,i3) = buff(indx,buff_id) - enddo - enddo - enddo - endif - - endif - - if( give_ex( axis, kk ) )then - - dir = +1 - - buff_id = 2 + dir - buff_len = 0 - - if( axis .eq. 1 )then - do i3=1,n3 - do i2=1,n2 - do i1=n1-1,n1 - buff_len = buff_len + 1 - buff(buff_len,buff_id)= u(i1,i2,i3) - enddo - enddo - enddo - endif - - if( axis .eq. 2 )then - do i3=1,n3 - do i2=n2-1,n2 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len,buff_id )= u(i1,i2,i3) - enddo - enddo - enddo - endif - - if( axis .eq. 3 )then - do i3=n3-1,n3 - do i2=1,n2 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len, buff_id ) = u( i1,i2,i3) - enddo - enddo - enddo - endif - - dir = -1 - - buff_id = 2 + dir - buff_len = 0 - - if( axis .eq. 1 )then - do i3=1,n3 - do i2=1,n2 - buff_len = buff_len + 1 - buff(buff_len,buff_id ) = u( 2, i2,i3) - enddo - enddo - endif - - if( axis .eq. 2 )then - do i3=1,n3 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len, buff_id ) = u( i1, 2,i3) - enddo - enddo - endif - - if( axis .eq. 3 )then - do i2=1,n2 - do i1=1,n1 - buff_len = buff_len + 1 - buff(buff_len, buff_id ) = u( i1,i2,2) - enddo - enddo - endif - - endif - - do i=1,nm2 - buff(i,4) = buff(i,3) - buff(i,2) = buff(i,1) - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine zran3(z,n1,n2,n3,nx,ny,k) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c zran3 loads +1 at ten randomly chosen points, -c loads -1 at a different ten random points, -c and zero elsewhere. -c--------------------------------------------------------------------- - implicit none - - include 'mpinpb.h' - - integer is1, is2, is3, ie1, ie2, ie3 - common /grid/ is1,is2,is3,ie1,ie2,ie3 - - integer n1, n2, n3, k, nx, ny, ierr, i0, m0, m1 - double precision z(n1,n2,n3) - - integer mm, i1, i2, i3, d1, e1, e2, e3 - double precision x, a - double precision xx, x0, x1, a1, a2, ai, power - parameter( mm = 10, a = 5.D0 ** 13, x = 314159265.D0) - double precision ten( mm, 0:1 ), temp, best - integer i, j1( mm, 0:1 ), j2( mm, 0:1 ), j3( mm, 0:1 ) - integer jg( 0:3, mm, 0:1 ), jg_temp(4) - - external randlc - double precision randlc, rdummy - - a1 = power( a, nx, 1, 0 ) - a2 = power( a, nx, ny, 0 ) - - call zero3(z,n1,n2,n3) - -c i = is1-2+nx*(is2-2+ny*(is3-2)) - - ai = power( a, nx, is2-2+ny*(is3-2), is1-2 ) - d1 = ie1 - is1 + 1 - e1 = ie1 - is1 + 2 - e2 = ie2 - is2 + 2 - e3 = ie3 - is3 + 2 - x0 = x - rdummy = randlc( x0, ai ) - do i3 = 2, e3 - x1 = x0 - do i2 = 2, e2 - xx = x1 - call vranlc( d1, xx, a, z( 2, i2, i3 )) - rdummy = randlc( x1, a1 ) - enddo - rdummy = randlc( x0, a2 ) - enddo - -c--------------------------------------------------------------------- -c call comm3(z,n1,n2,n3) -c call showall(z,n1,n2,n3) -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c each processor looks for twenty candidates -c--------------------------------------------------------------------- - do i=1,mm - ten( i, 1 ) = 0.0D0 - j1( i, 1 ) = 0 - j2( i, 1 ) = 0 - j3( i, 1 ) = 0 - ten( i, 0 ) = 1.0D0 - j1( i, 0 ) = 0 - j2( i, 0 ) = 0 - j3( i, 0 ) = 0 - enddo - - do i3=2,n3-1 - do i2=2,n2-1 - do i1=2,n1-1 - if( z(i1,i2,i3) .gt. ten( 1, 1 ) )then - ten(1,1) = z(i1,i2,i3) - j1(1,1) = i1 - j2(1,1) = i2 - j3(1,1) = i3 - call bubble( ten, j1, j2, j3, mm, 1 ) - endif - if( z(i1,i2,i3) .lt. ten( 1, 0 ) )then - ten(1,0) = z(i1,i2,i3) - j1(1,0) = i1 - j2(1,0) = i2 - j3(1,0) = i3 - call bubble( ten, j1, j2, j3, mm, 0 ) - endif - enddo - enddo - enddo - - call mpi_barrier(mpi_comm_world,ierr) - -c--------------------------------------------------------------------- -c Now which of these are globally best? -c--------------------------------------------------------------------- - i1 = mm - i0 = mm - do i=mm,1,-1 - - best = z( j1(i1,1), j2(i1,1), j3(i1,1) ) - call mpi_allreduce(best,temp,1,dp_type, - > mpi_max,mpi_comm_world,ierr) - best = temp - if(best.eq.z(j1(i1,1),j2(i1,1),j3(i1,1)))then - jg( 0, i, 1) = me - jg( 1, i, 1) = is1 - 2 + j1( i1, 1 ) - jg( 2, i, 1) = is2 - 2 + j2( i1, 1 ) - jg( 3, i, 1) = is3 - 2 + j3( i1, 1 ) - i1 = i1-1 - else - jg( 0, i, 1) = 0 - jg( 1, i, 1) = 0 - jg( 2, i, 1) = 0 - jg( 3, i, 1) = 0 - endif - ten( i, 1 ) = best - call mpi_allreduce(jg(0,i,1), jg_temp,4,MPI_INTEGER, - > mpi_max,mpi_comm_world,ierr) - jg( 0, i, 1) = jg_temp(1) - jg( 1, i, 1) = jg_temp(2) - jg( 2, i, 1) = jg_temp(3) - jg( 3, i, 1) = jg_temp(4) - - best = z( j1(i0,0), j2(i0,0), j3(i0,0) ) - call mpi_allreduce(best,temp,1,dp_type, - > mpi_min,mpi_comm_world,ierr) - best = temp - if(best.eq.z(j1(i0,0),j2(i0,0),j3(i0,0)))then - jg( 0, i, 0) = me - jg( 1, i, 0) = is1 - 2 + j1( i0, 0 ) - jg( 2, i, 0) = is2 - 2 + j2( i0, 0 ) - jg( 3, i, 0) = is3 - 2 + j3( i0, 0 ) - i0 = i0-1 - else - jg( 0, i, 0) = 0 - jg( 1, i, 0) = 0 - jg( 2, i, 0) = 0 - jg( 3, i, 0) = 0 - endif - ten( i, 0 ) = best - call mpi_allreduce(jg(0,i,0), jg_temp,4,MPI_INTEGER, - > mpi_max,mpi_comm_world,ierr) - jg( 0, i, 0) = jg_temp(1) - jg( 1, i, 0) = jg_temp(2) - jg( 2, i, 0) = jg_temp(3) - jg( 3, i, 0) = jg_temp(4) - - enddo - m1 = i1+1 - m0 = i0+1 - -c if( me .eq. root) then -c write(*,*)' ' -c write(*,*)' negative charges at' -c write(*,9)(jg(1,i,0),jg(2,i,0),jg(3,i,0),i=1,mm) -c write(*,*)' positive charges at' -c write(*,9)(jg(1,i,1),jg(2,i,1),jg(3,i,1),i=1,mm) -c write(*,*)' small random numbers were' -c write(*,8)(ten( i,0),i=mm,1,-1) -c write(*,*)' and they were found on processor number' -c write(*,7)(jg(0,i,0),i=mm,1,-1) -c write(*,*)' large random numbers were' -c write(*,8)(ten( i,1),i=mm,1,-1) -c write(*,*)' and they were found on processor number' -c write(*,7)(jg(0,i,1),i=mm,1,-1) -c endif -c 9 format(5(' (',i3,2(',',i3),')')) -c 8 format(5D15.8) -c 7 format(10i4) - call mpi_barrier(mpi_comm_world,ierr) - do i3=1,n3 - do i2=1,n2 - do i1=1,n1 - z(i1,i2,i3) = 0.0D0 - enddo - enddo - enddo - do i=mm,m0,-1 - z( j1(i,0), j2(i,0), j3(i,0) ) = -1.0D0 - enddo - do i=mm,m1,-1 - z( j1(i,1), j2(i,1), j3(i,1) ) = +1.0D0 - enddo - call comm3(z,n1,n2,n3,k) - -c--------------------------------------------------------------------- -c call showall(z,n1,n2,n3) -c--------------------------------------------------------------------- - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine show_l(z,n1,n2,n3) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - - integer n1,n2,n3,i1,i2,i3,ierr - double precision z(n1,n2,n3) - integer m1, m2, m3,i - - m1 = min(n1,18) - m2 = min(n2,14) - m3 = min(n3,18) - - write(*,*)' ' - do i=0,nprocs-1 - if( me .eq. i )then - write(*,*)' id = ', me - do i3=1,m3 - do i1=1,m1 - write(*,6)(z(i1,i2,i3),i2=1,m2) - enddo - write(*,*)' - - - - - - - ' - enddo - write(*,*)' ' - 6 format(6f15.11) - endif - call mpi_barrier(mpi_comm_world,ierr) - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine showall(z,n1,n2,n3) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - - integer n1,n2,n3,i1,i2,i3,i,ierr - double precision z(n1,n2,n3) - integer m1, m2, m3 - - m1 = min(n1,18) - m2 = min(n2,14) - m3 = min(n3,18) - - write(*,*)' ' - do i=0,nprocs-1 - if( me .eq. i )then - write(*,*)' id = ', me - do i3=1,m3 - do i1=1,m1 - write(*,6)(z(i1,i2,i3),i2=1,m2) - enddo - write(*,*)' - - - - - - - ' - enddo - write(*,*)' ' - 6 format(15f6.3) - endif - call mpi_barrier(mpi_comm_world,ierr) - enddo - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine show(z,n1,n2,n3) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - integer n1,n2,n3,i1,i2,i3,ierr,i - double precision z(n1,n2,n3) - - write(*,*)' ' - do i=0,nprocs-1 - if( me .eq. i )then - write(*,*)' id = ', me - do i3=2,n3-1 - do i1=2,n1-1 - write(*,6)(z(i1,i2,i3),i2=2,n1-1) - enddo - write(*,*)' - - - - - - - ' - enddo - write(*,*)' ' - 6 format(8D10.3) - endif - call mpi_barrier(mpi_comm_world,ierr) - enddo - -c call comm3(z,n1,n2,n3) - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - double precision function power( a, n1, n2, n3 ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c power raises an integer, disguised as a double -c precision real, to an integer power. -c This version tries to avoid integer overflow by treating -c it as expressed in a form of "n1*n2+n3". -c--------------------------------------------------------------------- - implicit none - - double precision a, aj - integer n1, n2, n3 - - integer n1j, n2j, nj - external randlc - double precision randlc, rdummy - - power = 1.0d0 - aj = a - nj = n3 - n1j = n1 - n2j = n2 - 100 continue - - if( n2j .gt. 0 ) then - if( mod(n2j,2) .eq. 1 ) nj = nj + n1j - n2j = n2j/2 - else if( nj .eq. 0 ) then - go to 200 - endif - if( mod(nj,2) .eq. 1 ) rdummy = randlc( power, aj ) - rdummy = randlc( aj, aj ) - nj = nj/2 - go to 100 - - 200 continue - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine bubble( ten, j1, j2, j3, m, ind ) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c bubble does a bubble sort in direction dir -c--------------------------------------------------------------------- - implicit none - - include 'mpinpb.h' - - integer m, ind, j1( m, 0:1 ), j2( m, 0:1 ), j3( m, 0:1 ) - double precision ten( m, 0:1 ) - double precision temp - integer i, j_temp - - if( ind .eq. 1 )then - - do i=1,m-1 - if( ten(i,ind) .gt. ten(i+1,ind) )then - - temp = ten( i+1, ind ) - ten( i+1, ind ) = ten( i, ind ) - ten( i, ind ) = temp - - j_temp = j1( i+1, ind ) - j1( i+1, ind ) = j1( i, ind ) - j1( i, ind ) = j_temp - - j_temp = j2( i+1, ind ) - j2( i+1, ind ) = j2( i, ind ) - j2( i, ind ) = j_temp - - j_temp = j3( i+1, ind ) - j3( i+1, ind ) = j3( i, ind ) - j3( i, ind ) = j_temp - - else - return - endif - enddo - - else - - do i=1,m-1 - if( ten(i,ind) .lt. ten(i+1,ind) )then - - temp = ten( i+1, ind ) - ten( i+1, ind ) = ten( i, ind ) - ten( i, ind ) = temp - - j_temp = j1( i+1, ind ) - j1( i+1, ind ) = j1( i, ind ) - j1( i, ind ) = j_temp - - j_temp = j2( i+1, ind ) - j2( i+1, ind ) = j2( i, ind ) - j2( i, ind ) = j_temp - - j_temp = j3( i+1, ind ) - j3( i+1, ind ) = j3( i, ind ) - j3( i, ind ) = j_temp - - else - return - endif - enddo - - endif - - return - end - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine zero3(z,n1,n2,n3) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - - include 'mpinpb.h' - - integer n1, n2, n3 - double precision z(n1,n2,n3) - integer i1, i2, i3 - - do i3=1,n3 - do i2=1,n2 - do i1=1,n1 - z(i1,i2,i3)=0.0D0 - enddo - enddo - enddo - - return - end - - -c----- end of program ------------------------------------------------ diff --git a/examples/smpi/NAS/MG/mg.input.sample b/examples/smpi/NAS/MG/mg.input.sample deleted file mode 100644 index a4dcf81275..0000000000 --- a/examples/smpi/NAS/MG/mg.input.sample +++ /dev/null @@ -1,4 +0,0 @@ - 8 = top level - 256 256 256 = nx ny nz - 20 = nit - 0 0 0 0 0 0 0 0 = debug_vec diff --git a/examples/smpi/NAS/MG/mpinpb.h b/examples/smpi/NAS/MG/mpinpb.h deleted file mode 100644 index 1f0368c0b7..0000000000 --- a/examples/smpi/NAS/MG/mpinpb.h +++ /dev/null @@ -1,9 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'mpif.h' - - integer me, nprocs, root, dp_type - common /mpistuff/ me, nprocs, root, dp_type - diff --git a/examples/smpi/NAS/Makefile b/examples/smpi/NAS/Makefile index f40f6b1226..7f1bee88a4 100644 --- a/examples/smpi/NAS/Makefile +++ b/examples/smpi/NAS/Makefile @@ -8,26 +8,6 @@ SFILE=config/suite.def default: header @ sys/print_instructions -BT: bt -bt: header - cd BT; $(MAKE) NPROCS=$(NPROCS) CLASS=$(CLASS) SUBTYPE=$(SUBTYPE) VERSION=$(VERSION) - -SP: sp -sp: header - cd SP; $(MAKE) NPROCS=$(NPROCS) CLASS=$(CLASS) - -LU: lu -lu: header - cd LU; $(MAKE) NPROCS=$(NPROCS) CLASS=$(CLASS) VERSION=$(VERSION) - -MG: mg -mg: header - cd MG; $(MAKE) NPROCS=$(NPROCS) CLASS=$(CLASS) - -FT: ft -ft: header - cd FT; $(MAKE) NPROCS=$(NPROCS) CLASS=$(CLASS) - IS: is is: header cd IS; $(MAKE) NPROCS=$(NPROCS) CLASS=$(CLASS) @@ -36,10 +16,6 @@ IS-trace: is-trace is-trace: header cd IS-trace; $(MAKE) NPROCS=$(NPROCS) CLASS=$(CLASS) -CG: cg -cg: header - cd CG; $(MAKE) NPROCS=$(NPROCS) CLASS=$(CLASS) - EP: ep ep: header cd EP; $(MAKE) NPROCS=$(NPROCS) CLASS=$(CLASS) diff --git a/examples/smpi/NAS/SP/Makefile b/examples/smpi/NAS/SP/Makefile deleted file mode 100644 index 01508aa935..0000000000 --- a/examples/smpi/NAS/SP/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -SHELL=/bin/sh -BENCHMARK=sp -BENCHMARKU=SP - -include ../config/make.def - - -OBJS = sp.o make_set.o initialize.o exact_solution.o exact_rhs.o \ - set_constants.o adi.o define.o copy_faces.o rhs.o \ - lhsx.o lhsy.o lhsz.o x_solve.o ninvr.o y_solve.o pinvr.o \ - z_solve.o tzetar.o add.o txinvr.o error.o verify.o setup_mpi.o \ - ${COMMON}/print_results.o ${COMMON}/timers.o - -include ../sys/make.common - -# npbparams.h is included by header.h -# The following rule should do the trick but many make programs (not gmake) -# will do the wrong thing and rebuild the world every time (because the -# mod time on header.h is not changed. One solution would be to -# touch header.h but this might cause confusion if someone has -# accidentally deleted it. Instead, make the dependency on npbparams.h -# explicit in all the lines below (even though dependence is indirect). - -# header.h: npbparams.h - -${PROGRAM}: config ${OBJS} - ${FLINK} ${FLINKFLAGS} -o ${PROGRAM} ${OBJS} ${FMPI_LIB} - -.f.o: - ${FCOMPILE} $< - -sp.o: sp.f header.h npbparams.h mpinpb.h -make_set.o: make_set.f header.h npbparams.h mpinpb.h -initialize.o: initialize.f header.h npbparams.h -exact_solution.o: exact_solution.f header.h npbparams.h -exact_rhs.o: exact_rhs.f header.h npbparams.h -set_constants.o: set_constants.f header.h npbparams.h -adi.o: adi.f header.h npbparams.h -define.o: define.f header.h npbparams.h -copy_faces.o: copy_faces.f header.h npbparams.h mpinpb.h -rhs.o: rhs.f header.h npbparams.h -lhsx.o: lhsx.f header.h npbparams.h -lhsy.o: lhsy.f header.h npbparams.h -lhsz.o: lhsz.f header.h npbparams.h -x_solve.o: x_solve.f header.h npbparams.h mpinpb.h -ninvr.o: ninvr.f header.h npbparams.h -y_solve.o: y_solve.f header.h npbparams.h mpinpb.h -pinvr.o: pinvr.f header.h npbparams.h -z_solve.o: z_solve.f header.h npbparams.h mpinpb.h -tzetar.o: tzetar.f header.h npbparams.h -add.o: add.f header.h npbparams.h -txinvr.o: txinvr.f header.h npbparams.h -error.o: error.f header.h npbparams.h mpinpb.h -verify.o: verify.f header.h npbparams.h mpinpb.h -setup_mpi.o: setup_mpi.f mpinpb.h npbparams.h - - -clean: - - rm -f *.o *~ mputil* - - rm -f npbparams.h core diff --git a/examples/smpi/NAS/SP/README b/examples/smpi/NAS/SP/README deleted file mode 100644 index fe423db43f..0000000000 --- a/examples/smpi/NAS/SP/README +++ /dev/null @@ -1,17 +0,0 @@ - -This code implements a 3D Multi-partition algorithm for the solution -of the uncoupled systems of linear equations resulting from -Beam-Warming approximate factorization. Consequently, the program -must be run on a square number of processors. The included file -"npbparams.h" contains a parameter statement which sets "maxcells" -and "problem_size". The parameter maxcells must be set to the -square root of the number of processors. For example, if running -on 25 processors, then set max_cells=5. The standard problem sizes -are problem_size=64 for class A, 102 for class B, and 162 for class C. - -The number of time steps and the time step size dt are set in the -npbparams.h but may be overridden in the input deck "inputsp.data". -The number of time steps is 400 for all three -standard problems, and the appropriate time step sizes "dt" are -0.0015d0 for class A, 0.001d0 for class B, and 0.00067 for class C. - diff --git a/examples/smpi/NAS/SP/add.f b/examples/smpi/NAS/SP/add.f deleted file mode 100644 index cdc4765cbf..0000000000 --- a/examples/smpi/NAS/SP/add.f +++ /dev/null @@ -1,31 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine add - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c addition of update to the vector u -c--------------------------------------------------------------------- - - include 'header.h' - - integer c, i, j, k, m - - do c = 1, ncells - do m = 1, 5 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - u(i,j,k,m,c) = u(i,j,k,m,c) + rhs(i,j,k,m,c) - end do - end do - end do - end do - end do - - return - end diff --git a/examples/smpi/NAS/SP/adi.f b/examples/smpi/NAS/SP/adi.f deleted file mode 100644 index e55cfd60da..0000000000 --- a/examples/smpi/NAS/SP/adi.f +++ /dev/null @@ -1,24 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine adi - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - call copy_faces - - call txinvr - - call x_solve - - call y_solve - - call z_solve - - call add - - return - end - diff --git a/examples/smpi/NAS/SP/copy_faces.f b/examples/smpi/NAS/SP/copy_faces.f deleted file mode 100644 index 41824d2198..0000000000 --- a/examples/smpi/NAS/SP/copy_faces.f +++ /dev/null @@ -1,306 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine copy_faces - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c this function copies the face values of a variable defined on a set -c of cells to the overlap locations of the adjacent sets of cells. -c Because a set of cells interfaces in each direction with exactly one -c other set, we only need to fill six different buffers. We could try to -c overlap communication with computation, by computing -c some internal values while communicating boundary values, but this -c adds so much overhead that it's not clearly useful. -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer i, j, k, c, m, requests(0:11), p0, p1, - > p2, p3, p4, p5, b_size(0:5), ss(0:5), - > sr(0:5), error, statuses(MPI_STATUS_SIZE, 0:11) - -c--------------------------------------------------------------------- -c exit immediately if there are no faces to be copied -c--------------------------------------------------------------------- - if (no_nodes .eq. 1) then - call compute_rhs - return - endif - - - ss(0) = start_send_east - ss(1) = start_send_west - ss(2) = start_send_north - ss(3) = start_send_south - ss(4) = start_send_top - ss(5) = start_send_bottom - - sr(0) = start_recv_east - sr(1) = start_recv_west - sr(2) = start_recv_north - sr(3) = start_recv_south - sr(4) = start_recv_top - sr(5) = start_recv_bottom - - b_size(0) = east_size - b_size(1) = west_size - b_size(2) = north_size - b_size(3) = south_size - b_size(4) = top_size - b_size(5) = bottom_size - -c--------------------------------------------------------------------- -c because the difference stencil for the diagonalized scheme is -c orthogonal, we do not have to perform the staged copying of faces, -c but can send all face information simultaneously to the neighboring -c cells in all directions -c--------------------------------------------------------------------- - p0 = 0 - p1 = 0 - p2 = 0 - p3 = 0 - p4 = 0 - p5 = 0 - - do c = 1, ncells - do m = 1, 5 - -c--------------------------------------------------------------------- -c fill the buffer to be sent to eastern neighbors (i-dir) -c--------------------------------------------------------------------- - if (cell_coord(1,c) .ne. ncells) then - do k = 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = cell_size(1,c)-2, cell_size(1,c)-1 - out_buffer(ss(0)+p0) = u(i,j,k,m,c) - p0 = p0 + 1 - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c fill the buffer to be sent to western neighbors -c--------------------------------------------------------------------- - if (cell_coord(1,c) .ne. 1) then - do k = 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = 0, 1 - out_buffer(ss(1)+p1) = u(i,j,k,m,c) - p1 = p1 + 1 - end do - end do - end do - - - endif - -c--------------------------------------------------------------------- -c fill the buffer to be sent to northern neighbors (j_dir) -c--------------------------------------------------------------------- - if (cell_coord(2,c) .ne. ncells) then - do k = 0, cell_size(3,c)-1 - do j = cell_size(2,c)-2, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - out_buffer(ss(2)+p2) = u(i,j,k,m,c) - p2 = p2 + 1 - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c fill the buffer to be sent to southern neighbors -c--------------------------------------------------------------------- - if (cell_coord(2,c).ne. 1) then - do k = 0, cell_size(3,c)-1 - do j = 0, 1 - do i = 0, cell_size(1,c)-1 - out_buffer(ss(3)+p3) = u(i,j,k,m,c) - p3 = p3 + 1 - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c fill the buffer to be sent to top neighbors (k-dir) -c--------------------------------------------------------------------- - if (cell_coord(3,c) .ne. ncells) then - do k = cell_size(3,c)-2, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - out_buffer(ss(4)+p4) = u(i,j,k,m,c) - p4 = p4 + 1 - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c fill the buffer to be sent to bottom neighbors -c--------------------------------------------------------------------- - if (cell_coord(3,c).ne. 1) then - do k=0, 1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - out_buffer(ss(5)+p5) = u(i,j,k,m,c) - p5 = p5 + 1 - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c m loop -c--------------------------------------------------------------------- - end do - -c--------------------------------------------------------------------- -c cell loop -c--------------------------------------------------------------------- - end do - - call mpi_irecv(in_buffer(sr(0)), b_size(0), - > dp_type, successor(1), WEST, - > comm_rhs, requests(0), error) - call mpi_irecv(in_buffer(sr(1)), b_size(1), - > dp_type, predecessor(1), EAST, - > comm_rhs, requests(1), error) - call mpi_irecv(in_buffer(sr(2)), b_size(2), - > dp_type, successor(2), SOUTH, - > comm_rhs, requests(2), error) - call mpi_irecv(in_buffer(sr(3)), b_size(3), - > dp_type, predecessor(2), NORTH, - > comm_rhs, requests(3), error) - call mpi_irecv(in_buffer(sr(4)), b_size(4), - > dp_type, successor(3), BOTTOM, - > comm_rhs, requests(4), error) - call mpi_irecv(in_buffer(sr(5)), b_size(5), - > dp_type, predecessor(3), TOP, - > comm_rhs, requests(5), error) - - call mpi_isend(out_buffer(ss(0)), b_size(0), - > dp_type, successor(1), EAST, - > comm_rhs, requests(6), error) - call mpi_isend(out_buffer(ss(1)), b_size(1), - > dp_type, predecessor(1), WEST, - > comm_rhs, requests(7), error) - call mpi_isend(out_buffer(ss(2)), b_size(2), - > dp_type,successor(2), NORTH, - > comm_rhs, requests(8), error) - call mpi_isend(out_buffer(ss(3)), b_size(3), - > dp_type,predecessor(2), SOUTH, - > comm_rhs, requests(9), error) - call mpi_isend(out_buffer(ss(4)), b_size(4), - > dp_type,successor(3), TOP, - > comm_rhs, requests(10), error) - call mpi_isend(out_buffer(ss(5)), b_size(5), - > dp_type,predecessor(3), BOTTOM, - > comm_rhs,requests(11), error) - - - call mpi_waitall(12, requests, statuses, error) - -c--------------------------------------------------------------------- -c unpack the data that has just been received; -c--------------------------------------------------------------------- - p0 = 0 - p1 = 0 - p2 = 0 - p3 = 0 - p4 = 0 - p5 = 0 - - do c = 1, ncells - do m = 1, 5 - - if (cell_coord(1,c) .ne. 1) then - do k = 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = -2, -1 - u(i,j,k,m,c) = in_buffer(sr(1)+p0) - p0 = p0 + 1 - end do - end do - end do - endif - - if (cell_coord(1,c) .ne. ncells) then - do k = 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = cell_size(1,c), cell_size(1,c)+1 - u(i,j,k,m,c) = in_buffer(sr(0)+p1) - p1 = p1 + 1 - end do - end do - end do - end if - - if (cell_coord(2,c) .ne. 1) then - do k = 0, cell_size(3,c)-1 - do j = -2, -1 - do i = 0, cell_size(1,c)-1 - u(i,j,k,m,c) = in_buffer(sr(3)+p2) - p2 = p2 + 1 - end do - end do - end do - - endif - - if (cell_coord(2,c) .ne. ncells) then - do k = 0, cell_size(3,c)-1 - do j = cell_size(2,c), cell_size(2,c)+1 - do i = 0, cell_size(1,c)-1 - u(i,j,k,m,c) = in_buffer(sr(2)+p3) - p3 = p3 + 1 - end do - end do - end do - endif - - if (cell_coord(3,c) .ne. 1) then - do k = -2, -1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - u(i,j,k,m,c) = in_buffer(sr(5)+p4) - p4 = p4 + 1 - end do - end do - end do - endif - - if (cell_coord(3,c) .ne. ncells) then - do k = cell_size(3,c), cell_size(3,c)+1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - u(i,j,k,m,c) = in_buffer(sr(4)+p5) - p5 = p5 + 1 - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c m loop -c--------------------------------------------------------------------- - end do - -c--------------------------------------------------------------------- -c cells loop -c--------------------------------------------------------------------- - end do - -c--------------------------------------------------------------------- -c now that we have all the data, compute the rhs -c--------------------------------------------------------------------- - call compute_rhs - - return - end diff --git a/examples/smpi/NAS/SP/define.f b/examples/smpi/NAS/SP/define.f deleted file mode 100644 index c465533f9a..0000000000 --- a/examples/smpi/NAS/SP/define.f +++ /dev/null @@ -1,66 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine compute_buffer_size(dim) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - - integer c, dim, face_size - - if (ncells .eq. 1) return - -c--------------------------------------------------------------------- -c compute the actual sizes of the buffers; note that there is -c always one cell face that doesn't need buffer space, because it -c is at the boundary of the grid -c--------------------------------------------------------------------- - - west_size = 0 - east_size = 0 - - do c = 1, ncells - face_size = cell_size(2,c) * cell_size(3,c) * dim * 2 - if (cell_coord(1,c).ne.1) west_size = west_size + face_size - if (cell_coord(1,c).ne.ncells) east_size = east_size + - > face_size - end do - - north_size = 0 - south_size = 0 - do c = 1, ncells - face_size = cell_size(1,c)*cell_size(3,c) * dim * 2 - if (cell_coord(2,c).ne.1) south_size = south_size + face_size - if (cell_coord(2,c).ne.ncells) north_size = north_size + - > face_size - end do - - top_size = 0 - bottom_size = 0 - do c = 1, ncells - face_size = cell_size(1,c) * cell_size(2,c) * dim * 2 - if (cell_coord(3,c).ne.1) bottom_size = bottom_size + - > face_size - if (cell_coord(3,c).ne.ncells) top_size = top_size + - > face_size - end do - - start_send_west = 1 - start_send_east = start_send_west + west_size - start_send_south = start_send_east + east_size - start_send_north = start_send_south + south_size - start_send_bottom = start_send_north + north_size - start_send_top = start_send_bottom + bottom_size - start_recv_west = 1 - start_recv_east = start_recv_west + west_size - start_recv_south = start_recv_east + east_size - start_recv_north = start_recv_south + south_size - start_recv_bottom = start_recv_north + north_size - start_recv_top = start_recv_bottom + bottom_size - - return - end - diff --git a/examples/smpi/NAS/SP/error.f b/examples/smpi/NAS/SP/error.f deleted file mode 100644 index fd9aab37b3..0000000000 --- a/examples/smpi/NAS/SP/error.f +++ /dev/null @@ -1,105 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine error_norm(rms) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c this function computes the norm of the difference between the -c computed solution and the exact solution -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer c, i, j, k, m, ii, jj, kk, d, error - double precision xi, eta, zeta, u_exact(5), rms(5), rms_work(5), - > add - - do m = 1, 5 - rms_work(m) = 0.0d0 - end do - - do c = 1, ncells - kk = 0 - do k = cell_low(3,c), cell_high(3,c) - zeta = dble(k) * dnzm1 - jj = 0 - do j = cell_low(2,c), cell_high(2,c) - eta = dble(j) * dnym1 - ii = 0 - do i = cell_low(1,c), cell_high(1,c) - xi = dble(i) * dnxm1 - call exact_solution(xi, eta, zeta, u_exact) - - do m = 1, 5 - add = u(ii,jj,kk,m,c)-u_exact(m) - rms_work(m) = rms_work(m) + add*add - end do - ii = ii + 1 - end do - jj = jj + 1 - end do - kk = kk + 1 - end do - end do - - call mpi_allreduce(rms_work, rms, 5, dp_type, - > MPI_SUM, comm_setup, error) - - do m = 1, 5 - do d = 1, 3 - rms(m) = rms(m) / dble(grid_points(d)-2) - end do - rms(m) = dsqrt(rms(m)) - end do - - return - end - - - - subroutine rhs_norm(rms) - - include 'header.h' - include 'mpinpb.h' - - integer c, i, j, k, d, m, error - double precision rms(5), rms_work(5), add - - do m = 1, 5 - rms_work(m) = 0.0d0 - end do - - do c = 1, ncells - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - do m = 1, 5 - add = rhs(i,j,k,m,c) - rms_work(m) = rms_work(m) + add*add - end do - end do - end do - end do - end do - - - - call mpi_allreduce(rms_work, rms, 5, dp_type, - > MPI_SUM, comm_setup, error) - - do m = 1, 5 - do d = 1, 3 - rms(m) = rms(m) / dble(grid_points(d)-2) - end do - rms(m) = dsqrt(rms(m)) - end do - - return - end - - diff --git a/examples/smpi/NAS/SP/exact_rhs.f b/examples/smpi/NAS/SP/exact_rhs.f deleted file mode 100644 index b589668126..0000000000 --- a/examples/smpi/NAS/SP/exact_rhs.f +++ /dev/null @@ -1,363 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine exact_rhs - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c compute the right hand side based on exact solution -c--------------------------------------------------------------------- - - include 'header.h' - - double precision dtemp(5), xi, eta, zeta, dtpp - integer c, m, i, j, k, ip1, im1, jp1, - > jm1, km1, kp1 - -c--------------------------------------------------------------------- -c loop over all cells owned by this node -c--------------------------------------------------------------------- - do c = 1, ncells - -c--------------------------------------------------------------------- -c initialize -c--------------------------------------------------------------------- - do m = 1, 5 - do k= 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - forcing(i,j,k,m,c) = 0.0d0 - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c xi-direction flux differences -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - zeta = dble(k+cell_low(3,c)) * dnzm1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - eta = dble(j+cell_low(2,c)) * dnym1 - - do i=-2*(1-start(1,c)), cell_size(1,c)+1-2*end(1,c) - xi = dble(i+cell_low(1,c)) * dnxm1 - - call exact_solution(xi, eta, zeta, dtemp) - do m = 1, 5 - ue(i,m) = dtemp(m) - end do - - dtpp = 1.0d0 / dtemp(1) - - do m = 2, 5 - buf(i,m) = dtpp * dtemp(m) - end do - - cuf(i) = buf(i,2) * buf(i,2) - buf(i,1) = cuf(i) + buf(i,3) * buf(i,3) + - > buf(i,4) * buf(i,4) - q(i) = 0.5d0*(buf(i,2)*ue(i,2) + buf(i,3)*ue(i,3) + - > buf(i,4)*ue(i,4)) - - end do - - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - im1 = i-1 - ip1 = i+1 - - forcing(i,j,k,1,c) = forcing(i,j,k,1,c) - - > tx2*( ue(ip1,2)-ue(im1,2) )+ - > dx1tx1*(ue(ip1,1)-2.0d0*ue(i,1)+ue(im1,1)) - - forcing(i,j,k,2,c) = forcing(i,j,k,2,c) - tx2 * ( - > (ue(ip1,2)*buf(ip1,2)+c2*(ue(ip1,5)-q(ip1)))- - > (ue(im1,2)*buf(im1,2)+c2*(ue(im1,5)-q(im1))))+ - > xxcon1*(buf(ip1,2)-2.0d0*buf(i,2)+buf(im1,2))+ - > dx2tx1*( ue(ip1,2)-2.0d0* ue(i,2)+ue(im1,2)) - - forcing(i,j,k,3,c) = forcing(i,j,k,3,c) - tx2 * ( - > ue(ip1,3)*buf(ip1,2)-ue(im1,3)*buf(im1,2))+ - > xxcon2*(buf(ip1,3)-2.0d0*buf(i,3)+buf(im1,3))+ - > dx3tx1*( ue(ip1,3)-2.0d0*ue(i,3) +ue(im1,3)) - - forcing(i,j,k,4,c) = forcing(i,j,k,4,c) - tx2*( - > ue(ip1,4)*buf(ip1,2)-ue(im1,4)*buf(im1,2))+ - > xxcon2*(buf(ip1,4)-2.0d0*buf(i,4)+buf(im1,4))+ - > dx4tx1*( ue(ip1,4)-2.0d0* ue(i,4)+ ue(im1,4)) - - forcing(i,j,k,5,c) = forcing(i,j,k,5,c) - tx2*( - > buf(ip1,2)*(c1*ue(ip1,5)-c2*q(ip1))- - > buf(im1,2)*(c1*ue(im1,5)-c2*q(im1)))+ - > 0.5d0*xxcon3*(buf(ip1,1)-2.0d0*buf(i,1)+ - > buf(im1,1))+ - > xxcon4*(cuf(ip1)-2.0d0*cuf(i)+cuf(im1))+ - > xxcon5*(buf(ip1,5)-2.0d0*buf(i,5)+buf(im1,5))+ - > dx5tx1*( ue(ip1,5)-2.0d0* ue(i,5)+ ue(im1,5)) - end do - -c--------------------------------------------------------------------- -c Fourth-order dissipation -c--------------------------------------------------------------------- - if (start(1,c) .gt. 0) then - do m = 1, 5 - i = 1 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp * - > (5.0d0*ue(i,m) - 4.0d0*ue(i+1,m) +ue(i+2,m)) - i = 2 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp * - > (-4.0d0*ue(i-1,m) + 6.0d0*ue(i,m) - - > 4.0d0*ue(i+1,m) + ue(i+2,m)) - end do - endif - - do m = 1, 5 - do i = start(1,c)*3, cell_size(1,c)-3*end(1,c)-1 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp* - > (ue(i-2,m) - 4.0d0*ue(i-1,m) + - > 6.0d0*ue(i,m) - 4.0d0*ue(i+1,m) + ue(i+2,m)) - end do - end do - - if (end(1,c) .gt. 0) then - do m = 1, 5 - i = cell_size(1,c)-3 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp * - > (ue(i-2,m) - 4.0d0*ue(i-1,m) + - > 6.0d0*ue(i,m) - 4.0d0*ue(i+1,m)) - i = cell_size(1,c)-2 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp * - > (ue(i-2,m) - 4.0d0*ue(i-1,m) + 5.0d0*ue(i,m)) - end do - endif - - end do - end do -c--------------------------------------------------------------------- -c eta-direction flux differences -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - zeta = dble(k+cell_low(3,c)) * dnzm1 - do i=start(1,c), cell_size(1,c)-end(1,c)-1 - xi = dble(i+cell_low(1,c)) * dnxm1 - - do j=-2*(1-start(2,c)), cell_size(2,c)+1-2*end(2,c) - eta = dble(j+cell_low(2,c)) * dnym1 - - call exact_solution(xi, eta, zeta, dtemp) - do m = 1, 5 - ue(j,m) = dtemp(m) - end do - dtpp = 1.0d0/dtemp(1) - - do m = 2, 5 - buf(j,m) = dtpp * dtemp(m) - end do - - cuf(j) = buf(j,3) * buf(j,3) - buf(j,1) = cuf(j) + buf(j,2) * buf(j,2) + - > buf(j,4) * buf(j,4) - q(j) = 0.5d0*(buf(j,2)*ue(j,2) + buf(j,3)*ue(j,3) + - > buf(j,4)*ue(j,4)) - end do - - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - jm1 = j-1 - jp1 = j+1 - - forcing(i,j,k,1,c) = forcing(i,j,k,1,c) - - > ty2*( ue(jp1,3)-ue(jm1,3) )+ - > dy1ty1*(ue(jp1,1)-2.0d0*ue(j,1)+ue(jm1,1)) - - forcing(i,j,k,2,c) = forcing(i,j,k,2,c) - ty2*( - > ue(jp1,2)*buf(jp1,3)-ue(jm1,2)*buf(jm1,3))+ - > yycon2*(buf(jp1,2)-2.0d0*buf(j,2)+buf(jm1,2))+ - > dy2ty1*( ue(jp1,2)-2.0* ue(j,2)+ ue(jm1,2)) - - forcing(i,j,k,3,c) = forcing(i,j,k,3,c) - ty2*( - > (ue(jp1,3)*buf(jp1,3)+c2*(ue(jp1,5)-q(jp1)))- - > (ue(jm1,3)*buf(jm1,3)+c2*(ue(jm1,5)-q(jm1))))+ - > yycon1*(buf(jp1,3)-2.0d0*buf(j,3)+buf(jm1,3))+ - > dy3ty1*( ue(jp1,3)-2.0d0*ue(j,3) +ue(jm1,3)) - - forcing(i,j,k,4,c) = forcing(i,j,k,4,c) - ty2*( - > ue(jp1,4)*buf(jp1,3)-ue(jm1,4)*buf(jm1,3))+ - > yycon2*(buf(jp1,4)-2.0d0*buf(j,4)+buf(jm1,4))+ - > dy4ty1*( ue(jp1,4)-2.0d0*ue(j,4)+ ue(jm1,4)) - - forcing(i,j,k,5,c) = forcing(i,j,k,5,c) - ty2*( - > buf(jp1,3)*(c1*ue(jp1,5)-c2*q(jp1))- - > buf(jm1,3)*(c1*ue(jm1,5)-c2*q(jm1)))+ - > 0.5d0*yycon3*(buf(jp1,1)-2.0d0*buf(j,1)+ - > buf(jm1,1))+ - > yycon4*(cuf(jp1)-2.0d0*cuf(j)+cuf(jm1))+ - > yycon5*(buf(jp1,5)-2.0d0*buf(j,5)+buf(jm1,5))+ - > dy5ty1*(ue(jp1,5)-2.0d0*ue(j,5)+ue(jm1,5)) - end do - -c--------------------------------------------------------------------- -c Fourth-order dissipation -c--------------------------------------------------------------------- - if (start(2,c) .gt. 0) then - do m = 1, 5 - j = 1 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp * - > (5.0d0*ue(j,m) - 4.0d0*ue(j+1,m) +ue(j+2,m)) - j = 2 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp * - > (-4.0d0*ue(j-1,m) + 6.0d0*ue(j,m) - - > 4.0d0*ue(j+1,m) + ue(j+2,m)) - end do - endif - - do m = 1, 5 - do j = start(2,c)*3, cell_size(2,c)-3*end(2,c)-1 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp* - > (ue(j-2,m) - 4.0d0*ue(j-1,m) + - > 6.0d0*ue(j,m) - 4.0d0*ue(j+1,m) + ue(j+2,m)) - end do - end do - if (end(2,c) .gt. 0) then - do m = 1, 5 - j = cell_size(2,c)-3 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp * - > (ue(j-2,m) - 4.0d0*ue(j-1,m) + - > 6.0d0*ue(j,m) - 4.0d0*ue(j+1,m)) - j = cell_size(2,c)-2 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp * - > (ue(j-2,m) - 4.0d0*ue(j-1,m) + 5.0d0*ue(j,m)) - - end do - endif - - end do - end do - -c--------------------------------------------------------------------- -c zeta-direction flux differences -c--------------------------------------------------------------------- - do j=start(2,c), cell_size(2,c)-end(2,c)-1 - eta = dble(j+cell_low(2,c)) * dnym1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - xi = dble(i+cell_low(1,c)) * dnxm1 - - do k=-2*(1-start(3,c)), cell_size(3,c)+1-2*end(3,c) - zeta = dble(k+cell_low(3,c)) * dnzm1 - - call exact_solution(xi, eta, zeta, dtemp) - do m = 1, 5 - ue(k,m) = dtemp(m) - end do - - dtpp = 1.0d0/dtemp(1) - - do m = 2, 5 - buf(k,m) = dtpp * dtemp(m) - end do - - cuf(k) = buf(k,4) * buf(k,4) - buf(k,1) = cuf(k) + buf(k,2) * buf(k,2) + - > buf(k,3) * buf(k,3) - q(k) = 0.5d0*(buf(k,2)*ue(k,2) + buf(k,3)*ue(k,3) + - > buf(k,4)*ue(k,4)) - end do - - do k=start(3,c), cell_size(3,c)-end(3,c)-1 - km1 = k-1 - kp1 = k+1 - - forcing(i,j,k,1,c) = forcing(i,j,k,1,c) - - > tz2*( ue(kp1,4)-ue(km1,4) )+ - > dz1tz1*(ue(kp1,1)-2.0d0*ue(k,1)+ue(km1,1)) - - forcing(i,j,k,2,c) = forcing(i,j,k,2,c) - tz2 * ( - > ue(kp1,2)*buf(kp1,4)-ue(km1,2)*buf(km1,4))+ - > zzcon2*(buf(kp1,2)-2.0d0*buf(k,2)+buf(km1,2))+ - > dz2tz1*( ue(kp1,2)-2.0d0* ue(k,2)+ ue(km1,2)) - - forcing(i,j,k,3,c) = forcing(i,j,k,3,c) - tz2 * ( - > ue(kp1,3)*buf(kp1,4)-ue(km1,3)*buf(km1,4))+ - > zzcon2*(buf(kp1,3)-2.0d0*buf(k,3)+buf(km1,3))+ - > dz3tz1*(ue(kp1,3)-2.0d0*ue(k,3)+ue(km1,3)) - - forcing(i,j,k,4,c) = forcing(i,j,k,4,c) - tz2 * ( - > (ue(kp1,4)*buf(kp1,4)+c2*(ue(kp1,5)-q(kp1)))- - > (ue(km1,4)*buf(km1,4)+c2*(ue(km1,5)-q(km1))))+ - > zzcon1*(buf(kp1,4)-2.0d0*buf(k,4)+buf(km1,4))+ - > dz4tz1*( ue(kp1,4)-2.0d0*ue(k,4) +ue(km1,4)) - - forcing(i,j,k,5,c) = forcing(i,j,k,5,c) - tz2 * ( - > buf(kp1,4)*(c1*ue(kp1,5)-c2*q(kp1))- - > buf(km1,4)*(c1*ue(km1,5)-c2*q(km1)))+ - > 0.5d0*zzcon3*(buf(kp1,1)-2.0d0*buf(k,1) - > +buf(km1,1))+ - > zzcon4*(cuf(kp1)-2.0d0*cuf(k)+cuf(km1))+ - > zzcon5*(buf(kp1,5)-2.0d0*buf(k,5)+buf(km1,5))+ - > dz5tz1*( ue(kp1,5)-2.0d0*ue(k,5)+ ue(km1,5)) - end do - -c--------------------------------------------------------------------- -c Fourth-order dissipation -c--------------------------------------------------------------------- - if (start(3,c) .gt. 0) then - do m = 1, 5 - k = 1 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp * - > (5.0d0*ue(k,m) - 4.0d0*ue(k+1,m) +ue(k+2,m)) - k = 2 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp * - > (-4.0d0*ue(k-1,m) + 6.0d0*ue(k,m) - - > 4.0d0*ue(k+1,m) + ue(k+2,m)) - end do - endif - - do m = 1, 5 - do k = start(3,c)*3, cell_size(3,c)-3*end(3,c)-1 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp* - > (ue(k-2,m) - 4.0d0*ue(k-1,m) + - > 6.0d0*ue(k,m) - 4.0d0*ue(k+1,m) + ue(k+2,m)) - end do - end do - - if (end(3,c) .gt. 0) then - do m = 1, 5 - k = cell_size(3,c)-3 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp * - > (ue(k-2,m) - 4.0d0*ue(k-1,m) + - > 6.0d0*ue(k,m) - 4.0d0*ue(k+1,m)) - k = cell_size(3,c)-2 - forcing(i,j,k,m,c) = forcing(i,j,k,m,c) - dssp * - > (ue(k-2,m) - 4.0d0*ue(k-1,m) + 5.0d0*ue(k,m)) - end do - endif - - end do - end do -c--------------------------------------------------------------------- -c now change the sign of the forcing function, -c--------------------------------------------------------------------- - do m = 1, 5 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - forcing(i,j,k,m,c) = -1.d0 * forcing(i,j,k,m,c) - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c cell loop -c--------------------------------------------------------------------- - end do - - return - end - - - - - diff --git a/examples/smpi/NAS/SP/exact_solution.f b/examples/smpi/NAS/SP/exact_solution.f deleted file mode 100644 index 2644f0b8f9..0000000000 --- a/examples/smpi/NAS/SP/exact_solution.f +++ /dev/null @@ -1,30 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine exact_solution(xi,eta,zeta,dtemp) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c this function returns the exact solution at point xi, eta, zeta -c--------------------------------------------------------------------- - - include 'header.h' - - double precision xi, eta, zeta, dtemp(5) - integer m - - do m = 1, 5 - dtemp(m) = ce(m,1) + - > xi*(ce(m,2) + xi*(ce(m,5) + xi*(ce(m,8) + xi*ce(m,11)))) + - > eta*(ce(m,3) + eta*(ce(m,6) + eta*(ce(m,9) + eta*ce(m,12))))+ - > zeta*(ce(m,4) + zeta*(ce(m,7) + zeta*(ce(m,10) + - > zeta*ce(m,13)))) - end do - - return - end - - diff --git a/examples/smpi/NAS/SP/header.h b/examples/smpi/NAS/SP/header.h deleted file mode 100644 index 663515a104..0000000000 --- a/examples/smpi/NAS/SP/header.h +++ /dev/null @@ -1,113 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - implicit none - -c--------------------------------------------------------------------- -c The following include file is generated automatically by the -c "setparams" utility. It defines -c maxcells: the square root of the maximum number of processors -c problem_size: 12, 64, 102, 162 (for class T, A, B, C) -c dt_default: default time step for this problem size if no -c config file -c niter_default: default number of iterations for this problem size -c--------------------------------------------------------------------- - - include 'npbparams.h' - - integer ncells, grid_points(3) - common /global/ ncells, grid_points - - double precision tx1, tx2, tx3, ty1, ty2, ty3, tz1, tz2, tz3, - > dx1, dx2, dx3, dx4, dx5, dy1, dy2, dy3, dy4, - > dy5, dz1, dz2, dz3, dz4, dz5, dssp, dt, - > ce(5,13), dxmax, dymax, dzmax, xxcon1, xxcon2, - > xxcon3, xxcon4, xxcon5, dx1tx1, dx2tx1, dx3tx1, - > dx4tx1, dx5tx1, yycon1, yycon2, yycon3, yycon4, - > yycon5, dy1ty1, dy2ty1, dy3ty1, dy4ty1, dy5ty1, - > zzcon1, zzcon2, zzcon3, zzcon4, zzcon5, dz1tz1, - > dz2tz1, dz3tz1, dz4tz1, dz5tz1, dnxm1, dnym1, - > dnzm1, c1c2, c1c5, c3c4, c1345, conz1, c1, c2, - > c3, c4, c5, c4dssp, c5dssp, dtdssp, dttx1, bt, - > dttx2, dtty1, dtty2, dttz1, dttz2, c2dttx1, - > c2dtty1, c2dttz1, comz1, comz4, comz5, comz6, - > c3c4tx3, c3c4ty3, c3c4tz3, c2iv, con43, con16 - - common /constants/ tx1, tx2, tx3, ty1, ty2, ty3, tz1, tz2, tz3, - > dx1, dx2, dx3, dx4, dx5, dy1, dy2, dy3, dy4, - > dy5, dz1, dz2, dz3, dz4, dz5, dssp, dt, - > ce, dxmax, dymax, dzmax, xxcon1, xxcon2, - > xxcon3, xxcon4, xxcon5, dx1tx1, dx2tx1, dx3tx1, - > dx4tx1, dx5tx1, yycon1, yycon2, yycon3, yycon4, - > yycon5, dy1ty1, dy2ty1, dy3ty1, dy4ty1, dy5ty1, - > zzcon1, zzcon2, zzcon3, zzcon4, zzcon5, dz1tz1, - > dz2tz1, dz3tz1, dz4tz1, dz5tz1, dnxm1, dnym1, - > dnzm1, c1c2, c1c5, c3c4, c1345, conz1, c1, c2, - > c3, c4, c5, c4dssp, c5dssp, dtdssp, dttx1, bt, - > dttx2, dtty1, dtty2, dttz1, dttz2, c2dttx1, - > c2dtty1, c2dttz1, comz1, comz4, comz5, comz6, - > c3c4tx3, c3c4ty3, c3c4tz3, c2iv, con43, con16 - - integer EAST, WEST, NORTH, SOUTH, - > BOTTOM, TOP - - parameter (EAST=2000, WEST=3000, NORTH=4000, SOUTH=5000, - > BOTTOM=6000, TOP=7000) - - integer cell_coord (3,maxcells), cell_low (3,maxcells), - > cell_high (3,maxcells), cell_size(3,maxcells), - > predecessor(3), slice (3,maxcells), - > grid_size (3), successor(3), - > start (3,maxcells), end (3,maxcells) - common /partition/ cell_coord, cell_low, cell_high, cell_size, - > grid_size, successor, predecessor, slice, - > start, end - - integer IMAX, JMAX, KMAX, MAX_CELL_DIM, BUF_SIZE, IMAXP, JMAXP - - parameter (MAX_CELL_DIM = (problem_size/maxcells)+1) - - parameter (IMAX=MAX_CELL_DIM,JMAX=MAX_CELL_DIM,KMAX=MAX_CELL_DIM) - parameter (IMAXP=IMAX/2*2+1,JMAXP=JMAX/2*2+1) - -c--------------------------------------------------------------------- -c +1 at end to avoid zero length arrays for 1 node -c--------------------------------------------------------------------- - parameter (BUF_SIZE=MAX_CELL_DIM*MAX_CELL_DIM*(maxcells-1)*60*2+1) - - double precision - > u (-2:IMAXP+1,-2:JMAXP+1,-2:KMAX+1, 5,maxcells), - > us (-1:IMAX, -1:JMAX, -1:KMAX, maxcells), - > vs (-1:IMAX, -1:JMAX, -1:KMAX, maxcells), - > ws (-1:IMAX, -1:JMAX, -1:KMAX, maxcells), - > qs (-1:IMAX, -1:JMAX, -1:KMAX, maxcells), - > ainv (-1:IMAX, -1:JMAX, -1:KMAX, maxcells), - > rho_i (-1:IMAX, -1:JMAX, -1:KMAX, maxcells), - > speed (-1:IMAX, -1:JMAX, -1:KMAX, maxcells), - > square (-1:IMAX, -1:JMAX, -1:KMAX, maxcells), - > rhs ( 0:IMAXP-1, 0:JMAXP-1, 0:KMAX-1, 5,maxcells), - > forcing ( 0:IMAXP-1, 0:JMAXP-1, 0:KMAX-1, 5,maxcells), - > lhs ( 0:IMAXP-1, 0:JMAXP-1, 0:KMAX-1,15,maxcells), - > in_buffer(BUF_SIZE), out_buffer(BUF_SIZE) - common /fields/ u, us, vs, ws, qs, ainv, rho_i, speed, square, - > rhs, forcing, lhs, in_buffer, out_buffer - - double precision cv(-2:MAX_CELL_DIM+1), rhon(-2:MAX_CELL_DIM+1), - > rhos(-2:MAX_CELL_DIM+1), rhoq(-2:MAX_CELL_DIM+1), - > cuf(-2:MAX_CELL_DIM+1), q(-2:MAX_CELL_DIM+1), - > ue(-2:MAX_CELL_DIM+1,5), buf(-2:MAX_CELL_DIM+1,5) - common /work_1d/ cv, rhon, rhos, rhoq, cuf, q, ue, buf - - integer west_size, east_size, bottom_size, top_size, - > north_size, south_size, start_send_west, - > start_send_east, start_send_south, start_send_north, - > start_send_bottom, start_send_top, start_recv_west, - > start_recv_east, start_recv_south, start_recv_north, - > start_recv_bottom, start_recv_top - common /box/ west_size, east_size, bottom_size, - > top_size, north_size, south_size, - > start_send_west, start_send_east, start_send_south, - > start_send_north, start_send_bottom, start_send_top, - > start_recv_west, start_recv_east, start_recv_south, - > start_recv_north, start_recv_bottom, start_recv_top diff --git a/examples/smpi/NAS/SP/initialize.f b/examples/smpi/NAS/SP/initialize.f deleted file mode 100644 index 655c8d9369..0000000000 --- a/examples/smpi/NAS/SP/initialize.f +++ /dev/null @@ -1,286 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine initialize - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c This subroutine initializes the field variable u using -c tri-linear transfinite interpolation of the boundary values -c--------------------------------------------------------------------- - - include 'header.h' - - integer c, i, j, k, m, ii, jj, kk, ix, iy, iz - double precision xi, eta, zeta, Pface(5,3,2), Pxi, Peta, - > Pzeta, temp(5) - - -c--------------------------------------------------------------------- -c Later (in compute_rhs) we compute 1/u for every element. A few of -c the corner elements are not used, but it convenient (and faster) -c to compute the whole thing with a simple loop. Make sure those -c values are nonzero by initializing the whole thing here. -c--------------------------------------------------------------------- - do c = 1, ncells - do kk = -1, IMAX - do jj = -1, IMAX - do ii = -1, IMAX - u(ii, jj, kk, 1, c) = 1.0 - u(ii, jj, kk, 2, c) = 0.0 - u(ii, jj, kk, 3, c) = 0.0 - u(ii, jj, kk, 4, c) = 0.0 - u(ii, jj, kk, 5, c) = 1.0 - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c first store the "interpolated" values everywhere on the grid -c--------------------------------------------------------------------- - do c=1, ncells - kk = 0 - do k = cell_low(3,c), cell_high(3,c) - zeta = dble(k) * dnzm1 - jj = 0 - do j = cell_low(2,c), cell_high(2,c) - eta = dble(j) * dnym1 - ii = 0 - do i = cell_low(1,c), cell_high(1,c) - xi = dble(i) * dnxm1 - - do ix = 1, 2 - call exact_solution(dble(ix-1), eta, zeta, - > Pface(1,1,ix)) - end do - - do iy = 1, 2 - call exact_solution(xi, dble(iy-1) , zeta, - > Pface(1,2,iy)) - end do - - do iz = 1, 2 - call exact_solution(xi, eta, dble(iz-1), - > Pface(1,3,iz)) - end do - - do m = 1, 5 - Pxi = xi * Pface(m,1,2) + - > (1.0d0-xi) * Pface(m,1,1) - Peta = eta * Pface(m,2,2) + - > (1.0d0-eta) * Pface(m,2,1) - Pzeta = zeta * Pface(m,3,2) + - > (1.0d0-zeta) * Pface(m,3,1) - - u(ii,jj,kk,m,c) = Pxi + Peta + Pzeta - - > Pxi*Peta - Pxi*Pzeta - Peta*Pzeta + - > Pxi*Peta*Pzeta - - end do - ii = ii + 1 - end do - jj = jj + 1 - end do - kk = kk+1 - end do - end do - -c--------------------------------------------------------------------- -c now store the exact values on the boundaries -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c west face -c--------------------------------------------------------------------- - c = slice(1,1) - ii = 0 - xi = 0.0d0 - kk = 0 - do k = cell_low(3,c), cell_high(3,c) - zeta = dble(k) * dnzm1 - jj = 0 - do j = cell_low(2,c), cell_high(2,c) - eta = dble(j) * dnym1 - call exact_solution(xi, eta, zeta, temp) - do m = 1, 5 - u(ii,jj,kk,m,c) = temp(m) - end do - jj = jj + 1 - end do - kk = kk + 1 - end do - -c--------------------------------------------------------------------- -c east face -c--------------------------------------------------------------------- - c = slice(1,ncells) - ii = cell_size(1,c)-1 - xi = 1.0d0 - kk = 0 - do k = cell_low(3,c), cell_high(3,c) - zeta = dble(k) * dnzm1 - jj = 0 - do j = cell_low(2,c), cell_high(2,c) - eta = dble(j) * dnym1 - call exact_solution(xi, eta, zeta, temp) - do m = 1, 5 - u(ii,jj,kk,m,c) = temp(m) - end do - jj = jj + 1 - end do - kk = kk + 1 - end do - -c--------------------------------------------------------------------- -c south face -c--------------------------------------------------------------------- - c = slice(2,1) - jj = 0 - eta = 0.0d0 - kk = 0 - do k = cell_low(3,c), cell_high(3,c) - zeta = dble(k) * dnzm1 - ii = 0 - do i = cell_low(1,c), cell_high(1,c) - xi = dble(i) * dnxm1 - call exact_solution(xi, eta, zeta, temp) - do m = 1, 5 - u(ii,jj,kk,m,c) = temp(m) - end do - ii = ii + 1 - end do - kk = kk + 1 - end do - - -c--------------------------------------------------------------------- -c north face -c--------------------------------------------------------------------- - c = slice(2,ncells) - jj = cell_size(2,c)-1 - eta = 1.0d0 - kk = 0 - do k = cell_low(3,c), cell_high(3,c) - zeta = dble(k) * dnzm1 - ii = 0 - do i = cell_low(1,c), cell_high(1,c) - xi = dble(i) * dnxm1 - call exact_solution(xi, eta, zeta, temp) - do m = 1, 5 - u(ii,jj,kk,m,c) = temp(m) - end do - ii = ii + 1 - end do - kk = kk + 1 - end do - -c--------------------------------------------------------------------- -c bottom face -c--------------------------------------------------------------------- - c = slice(3,1) - kk = 0 - zeta = 0.0d0 - jj = 0 - do j = cell_low(2,c), cell_high(2,c) - eta = dble(j) * dnym1 - ii = 0 - do i =cell_low(1,c), cell_high(1,c) - xi = dble(i) *dnxm1 - call exact_solution(xi, eta, zeta, temp) - do m = 1, 5 - u(ii,jj,kk,m,c) = temp(m) - end do - ii = ii + 1 - end do - jj = jj + 1 - end do - -c--------------------------------------------------------------------- -c top face -c--------------------------------------------------------------------- - c = slice(3,ncells) - kk = cell_size(3,c)-1 - zeta = 1.0d0 - jj = 0 - do j = cell_low(2,c), cell_high(2,c) - eta = dble(j) * dnym1 - ii = 0 - do i =cell_low(1,c), cell_high(1,c) - xi = dble(i) * dnxm1 - call exact_solution(xi, eta, zeta, temp) - do m = 1, 5 - u(ii,jj,kk,m,c) = temp(m) - end do - ii = ii + 1 - end do - jj = jj + 1 - end do - - return - end - - - subroutine lhsinit - - include 'header.h' - - integer i, j, k, d, c, n - -c--------------------------------------------------------------------- -c loop over all cells -c--------------------------------------------------------------------- - do c = 1, ncells - -c--------------------------------------------------------------------- -c first, initialize the start and end arrays -c--------------------------------------------------------------------- - do d = 1, 3 - if (cell_coord(d,c) .eq. 1) then - start(d,c) = 1 - else - start(d,c) = 0 - endif - if (cell_coord(d,c) .eq. ncells) then - end(d,c) = 1 - else - end(d,c) = 0 - endif - end do - -c--------------------------------------------------------------------- -c zap the whole left hand side for starters -c--------------------------------------------------------------------- - do n = 1, 15 - do k = 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - lhs(i,j,k,n,c) = 0.0d0 - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c next, set all diagonal values to 1. This is overkill, but convenient -c--------------------------------------------------------------------- - do n = 1, 3 - do k = 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - lhs(i,j,k,5*n-2,c) = 1.0d0 - end do - end do - end do - end do - - end do - - return - end - - - diff --git a/examples/smpi/NAS/SP/inputsp.data.sample b/examples/smpi/NAS/SP/inputsp.data.sample deleted file mode 100644 index ae3801fdb7..0000000000 --- a/examples/smpi/NAS/SP/inputsp.data.sample +++ /dev/null @@ -1,3 +0,0 @@ -400 number of time steps -0.0015d0 dt for class A = 0.0015d0. class B = 0.001d0 class C = 0.00067d0 -64 64 64 diff --git a/examples/smpi/NAS/SP/lhsx.f b/examples/smpi/NAS/SP/lhsx.f deleted file mode 100644 index cae7779122..0000000000 --- a/examples/smpi/NAS/SP/lhsx.f +++ /dev/null @@ -1,124 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine lhsx(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c This function computes the left hand side for the three x-factors -c--------------------------------------------------------------------- - - include 'header.h' - - double precision ru1 - integer i, j, k, c - - -c--------------------------------------------------------------------- -c treat only cell c -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c first fill the lhs for the u-eigenvalue -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c)-1, cell_size(1,c)-end(1,c) - ru1 = c3c4*rho_i(i,j,k,c) - cv(i) = us(i,j,k,c) - rhon(i) = dmax1(dx2+con43*ru1, - > dx5+c1c5*ru1, - > dxmax+ru1, - > dx1) - end do - - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - lhs(i,j,k,1,c) = 0.0d0 - lhs(i,j,k,2,c) = - dttx2 * cv(i-1) - dttx1 * rhon(i-1) - lhs(i,j,k,3,c) = 1.0d0 + c2dttx1 * rhon(i) - lhs(i,j,k,4,c) = dttx2 * cv(i+1) - dttx1 * rhon(i+1) - lhs(i,j,k,5,c) = 0.0d0 - end do - end do - end do - -c--------------------------------------------------------------------- -c add fourth order dissipation -c--------------------------------------------------------------------- - if (start(1,c) .gt. 0) then - i = 1 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - lhs(i,j,k,3,c) = lhs(i,j,k,3,c) + comz5 - lhs(i,j,k,4,c) = lhs(i,j,k,4,c) - comz4 - lhs(i,j,k,5,c) = lhs(i,j,k,5,c) + comz1 - - lhs(i+1,j,k,2,c) = lhs(i+1,j,k,2,c) - comz4 - lhs(i+1,j,k,3,c) = lhs(i+1,j,k,3,c) + comz6 - lhs(i+1,j,k,4,c) = lhs(i+1,j,k,4,c) - comz4 - lhs(i+1,j,k,5,c) = lhs(i+1,j,k,5,c) + comz1 - end do - end do - endif - - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i=3*start(1,c), cell_size(1,c)-3*end(1,c)-1 - lhs(i,j,k,1,c) = lhs(i,j,k,1,c) + comz1 - lhs(i,j,k,2,c) = lhs(i,j,k,2,c) - comz4 - lhs(i,j,k,3,c) = lhs(i,j,k,3,c) + comz6 - lhs(i,j,k,4,c) = lhs(i,j,k,4,c) - comz4 - lhs(i,j,k,5,c) = lhs(i,j,k,5,c) + comz1 - end do - end do - end do - - if (end(1,c) .gt. 0) then - i = cell_size(1,c)-3 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - lhs(i,j,k,1,c) = lhs(i,j,k,1,c) + comz1 - lhs(i,j,k,2,c) = lhs(i,j,k,2,c) - comz4 - lhs(i,j,k,3,c) = lhs(i,j,k,3,c) + comz6 - lhs(i,j,k,4,c) = lhs(i,j,k,4,c) - comz4 - - lhs(i+1,j,k,1,c) = lhs(i+1,j,k,1,c) + comz1 - lhs(i+1,j,k,2,c) = lhs(i+1,j,k,2,c) - comz4 - lhs(i+1,j,k,3,c) = lhs(i+1,j,k,3,c) + comz5 - end do - end do - endif - -c--------------------------------------------------------------------- -c subsequently, fill the other factors (u+c), (u-c) by a4ing to -c the first -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - lhs(i,j,k,1+5,c) = lhs(i,j,k,1,c) - lhs(i,j,k,2+5,c) = lhs(i,j,k,2,c) - - > dttx2 * speed(i-1,j,k,c) - lhs(i,j,k,3+5,c) = lhs(i,j,k,3,c) - lhs(i,j,k,4+5,c) = lhs(i,j,k,4,c) + - > dttx2 * speed(i+1,j,k,c) - lhs(i,j,k,5+5,c) = lhs(i,j,k,5,c) - lhs(i,j,k,1+10,c) = lhs(i,j,k,1,c) - lhs(i,j,k,2+10,c) = lhs(i,j,k,2,c) + - > dttx2 * speed(i-1,j,k,c) - lhs(i,j,k,3+10,c) = lhs(i,j,k,3,c) - lhs(i,j,k,4+10,c) = lhs(i,j,k,4,c) - - > dttx2 * speed(i+1,j,k,c) - lhs(i,j,k,5+10,c) = lhs(i,j,k,5,c) - end do - end do - end do - - return - end - - - diff --git a/examples/smpi/NAS/SP/lhsy.f b/examples/smpi/NAS/SP/lhsy.f deleted file mode 100644 index 9c07a35538..0000000000 --- a/examples/smpi/NAS/SP/lhsy.f +++ /dev/null @@ -1,125 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine lhsy(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c This function computes the left hand side for the three y-factors -c--------------------------------------------------------------------- - - include 'header.h' - - double precision ru1 - integer i, j, k, c - -c--------------------------------------------------------------------- -c treat only cell c -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c first fill the lhs for the u-eigenvalue -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - - do j = start(2,c)-1, cell_size(2,c)-end(2,c) - ru1 = c3c4*rho_i(i,j,k,c) - cv(j) = vs(i,j,k,c) - rhoq(j) = dmax1( dy3 + con43 * ru1, - > dy5 + c1c5*ru1, - > dymax + ru1, - > dy1) - end do - - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - lhs(i,j,k,1,c) = 0.0d0 - lhs(i,j,k,2,c) = -dtty2 * cv(j-1) - dtty1 * rhoq(j-1) - lhs(i,j,k,3,c) = 1.0 + c2dtty1 * rhoq(j) - lhs(i,j,k,4,c) = dtty2 * cv(j+1) - dtty1 * rhoq(j+1) - lhs(i,j,k,5,c) = 0.0d0 - end do - end do - end do - -c--------------------------------------------------------------------- -c add fourth order dissipation -c--------------------------------------------------------------------- - if (start(2,c) .gt. 0) then - j = 1 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - - lhs(i,j,k,3,c) = lhs(i,j,k,3,c) + comz5 - lhs(i,j,k,4,c) = lhs(i,j,k,4,c) - comz4 - lhs(i,j,k,5,c) = lhs(i,j,k,5,c) + comz1 - - lhs(i,j+1,k,2,c) = lhs(i,j+1,k,2,c) - comz4 - lhs(i,j+1,k,3,c) = lhs(i,j+1,k,3,c) + comz6 - lhs(i,j+1,k,4,c) = lhs(i,j+1,k,4,c) - comz4 - lhs(i,j+1,k,5,c) = lhs(i,j+1,k,5,c) + comz1 - end do - end do - endif - - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j=3*start(2,c), cell_size(2,c)-3*end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - - lhs(i,j,k,1,c) = lhs(i,j,k,1,c) + comz1 - lhs(i,j,k,2,c) = lhs(i,j,k,2,c) - comz4 - lhs(i,j,k,3,c) = lhs(i,j,k,3,c) + comz6 - lhs(i,j,k,4,c) = lhs(i,j,k,4,c) - comz4 - lhs(i,j,k,5,c) = lhs(i,j,k,5,c) + comz1 - end do - end do - end do - - if (end(2,c) .gt. 0) then - j = cell_size(2,c)-3 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - lhs(i,j,k,1,c) = lhs(i,j,k,1,c) + comz1 - lhs(i,j,k,2,c) = lhs(i,j,k,2,c) - comz4 - lhs(i,j,k,3,c) = lhs(i,j,k,3,c) + comz6 - lhs(i,j,k,4,c) = lhs(i,j,k,4,c) - comz4 - - lhs(i,j+1,k,1,c) = lhs(i,j+1,k,1,c) + comz1 - lhs(i,j+1,k,2,c) = lhs(i,j+1,k,2,c) - comz4 - lhs(i,j+1,k,3,c) = lhs(i,j+1,k,3,c) + comz5 - end do - end do - endif - -c--------------------------------------------------------------------- -c subsequently, do the other two factors -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - lhs(i,j,k,1+5,c) = lhs(i,j,k,1,c) - lhs(i,j,k,2+5,c) = lhs(i,j,k,2,c) - - > dtty2 * speed(i,j-1,k,c) - lhs(i,j,k,3+5,c) = lhs(i,j,k,3,c) - lhs(i,j,k,4+5,c) = lhs(i,j,k,4,c) + - > dtty2 * speed(i,j+1,k,c) - lhs(i,j,k,5+5,c) = lhs(i,j,k,5,c) - lhs(i,j,k,1+10,c) = lhs(i,j,k,1,c) - lhs(i,j,k,2+10,c) = lhs(i,j,k,2,c) + - > dtty2 * speed(i,j-1,k,c) - lhs(i,j,k,3+10,c) = lhs(i,j,k,3,c) - lhs(i,j,k,4+10,c) = lhs(i,j,k,4,c) - - > dtty2 * speed(i,j+1,k,c) - lhs(i,j,k,5+10,c) = lhs(i,j,k,5,c) - end do - end do - end do - - return - end - - - diff --git a/examples/smpi/NAS/SP/lhsz.f b/examples/smpi/NAS/SP/lhsz.f deleted file mode 100644 index 08ea0bc24d..0000000000 --- a/examples/smpi/NAS/SP/lhsz.f +++ /dev/null @@ -1,123 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine lhsz(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c This function computes the left hand side for the three z-factors -c--------------------------------------------------------------------- - - include 'header.h' - - double precision ru1 - integer i, j, k, c - -c--------------------------------------------------------------------- -c treat only cell c -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c first fill the lhs for the u-eigenvalue -c--------------------------------------------------------------------- - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - - do k = start(3,c)-1, cell_size(3,c)-end(3,c) - ru1 = c3c4*rho_i(i,j,k,c) - cv(k) = ws(i,j,k,c) - rhos(k) = dmax1(dz4 + con43 * ru1, - > dz5 + c1c5 * ru1, - > dzmax + ru1, - > dz1) - end do - - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - lhs(i,j,k,1,c) = 0.0d0 - lhs(i,j,k,2,c) = -dttz2 * cv(k-1) - dttz1 * rhos(k-1) - lhs(i,j,k,3,c) = 1.0 + c2dttz1 * rhos(k) - lhs(i,j,k,4,c) = dttz2 * cv(k+1) - dttz1 * rhos(k+1) - lhs(i,j,k,5,c) = 0.0d0 - end do - end do - end do - -c--------------------------------------------------------------------- -c add fourth order dissipation -c--------------------------------------------------------------------- - if (start(3,c) .gt. 0) then - k = 1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - lhs(i,j,k,3,c) = lhs(i,j,k,3,c) + comz5 - lhs(i,j,k,4,c) = lhs(i,j,k,4,c) - comz4 - lhs(i,j,k,5,c) = lhs(i,j,k,5,c) + comz1 - - lhs(i,j,k+1,2,c) = lhs(i,j,k+1,2,c) - comz4 - lhs(i,j,k+1,3,c) = lhs(i,j,k+1,3,c) + comz6 - lhs(i,j,k+1,4,c) = lhs(i,j,k+1,4,c) - comz4 - lhs(i,j,k+1,5,c) = lhs(i,j,k+1,5,c) + comz1 - end do - end do - endif - - do k = 3*start(3,c), cell_size(3,c)-3*end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - lhs(i,j,k,1,c) = lhs(i,j,k,1,c) + comz1 - lhs(i,j,k,2,c) = lhs(i,j,k,2,c) - comz4 - lhs(i,j,k,3,c) = lhs(i,j,k,3,c) + comz6 - lhs(i,j,k,4,c) = lhs(i,j,k,4,c) - comz4 - lhs(i,j,k,5,c) = lhs(i,j,k,5,c) + comz1 - end do - end do - end do - - if (end(3,c) .gt. 0) then - k = cell_size(3,c)-3 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - lhs(i,j,k,1,c) = lhs(i,j,k,1,c) + comz1 - lhs(i,j,k,2,c) = lhs(i,j,k,2,c) - comz4 - lhs(i,j,k,3,c) = lhs(i,j,k,3,c) + comz6 - lhs(i,j,k,4,c) = lhs(i,j,k,4,c) - comz4 - - lhs(i,j,k+1,1,c) = lhs(i,j,k+1,1,c) + comz1 - lhs(i,j,k+1,2,c) = lhs(i,j,k+1,2,c) - comz4 - lhs(i,j,k+1,3,c) = lhs(i,j,k+1,3,c) + comz5 - end do - end do - endif - - -c--------------------------------------------------------------------- -c subsequently, fill the other factors (u+c), (u-c) -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - lhs(i,j,k,1+5,c) = lhs(i,j,k,1,c) - lhs(i,j,k,2+5,c) = lhs(i,j,k,2,c) - - > dttz2 * speed(i,j,k-1,c) - lhs(i,j,k,3+5,c) = lhs(i,j,k,3,c) - lhs(i,j,k,4+5,c) = lhs(i,j,k,4,c) + - > dttz2 * speed(i,j,k+1,c) - lhs(i,j,k,5+5,c) = lhs(i,j,k,5,c) - lhs(i,j,k,1+10,c) = lhs(i,j,k,1,c) - lhs(i,j,k,2+10,c) = lhs(i,j,k,2,c) + - > dttz2 * speed(i,j,k-1,c) - lhs(i,j,k,3+10,c) = lhs(i,j,k,3,c) - lhs(i,j,k,4+10,c) = lhs(i,j,k,4,c) - - > dttz2 * speed(i,j,k+1,c) - lhs(i,j,k,5+10,c) = lhs(i,j,k,5,c) - end do - end do - end do - - return - end - - diff --git a/examples/smpi/NAS/SP/make_set.f b/examples/smpi/NAS/SP/make_set.f deleted file mode 100644 index 7a84e93010..0000000000 --- a/examples/smpi/NAS/SP/make_set.f +++ /dev/null @@ -1,120 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine make_set - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c This function allocates space for a set of cells and fills the set -c such that communication between cells on different nodes is only -c nearest neighbor -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer p, i, j, c, dir, size, excess, ierr,ierrcode - -c--------------------------------------------------------------------- -c compute square root; add small number to allow for roundoff -c (note: this is computed in setup_mpi.f also, but prefer to do -c it twice because of some include file problems). -c--------------------------------------------------------------------- - ncells = dint(dsqrt(dble(no_nodes) + 0.00001d0)) - -c--------------------------------------------------------------------- -c this makes coding easier -c--------------------------------------------------------------------- - p = ncells - -c--------------------------------------------------------------------- -c determine the location of the cell at the bottom of the 3D -c array of cells -c--------------------------------------------------------------------- - cell_coord(1,1) = mod(node,p) - cell_coord(2,1) = node/p - cell_coord(3,1) = 0 - -c--------------------------------------------------------------------- -c set the cell_coords for cells in the rest of the z-layers; -c this comes down to a simple linear numbering in the z-direct- -c ion, and to the doubly-cyclic numbering in the other dirs -c--------------------------------------------------------------------- - do c=2, p - cell_coord(1,c) = mod(cell_coord(1,c-1)+1,p) - cell_coord(2,c) = mod(cell_coord(2,c-1)-1+p,p) - cell_coord(3,c) = c-1 - end do - -c--------------------------------------------------------------------- -c offset all the coordinates by 1 to adjust for Fortran arrays -c--------------------------------------------------------------------- - do dir = 1, 3 - do c = 1, p - cell_coord(dir,c) = cell_coord(dir,c) + 1 - end do - end do - -c--------------------------------------------------------------------- -c slice(dir,n) contains the sequence number of the cell that is in -c coordinate plane n in the dir direction -c--------------------------------------------------------------------- - do dir = 1, 3 - do c = 1, p - slice(dir,cell_coord(dir,c)) = c - end do - end do - - -c--------------------------------------------------------------------- -c fill the predecessor and successor entries, using the indices -c of the bottom cells (they are the same at each level of k -c anyway) acting as if full periodicity pertains; note that p is -c added to those arguments to the mod functions that might -c otherwise return wrong values when using the modulo function -c--------------------------------------------------------------------- - i = cell_coord(1,1)-1 - j = cell_coord(2,1)-1 - - predecessor(1) = mod(i-1+p,p) + p*j - predecessor(2) = i + p*mod(j-1+p,p) - predecessor(3) = mod(i+1,p) + p*mod(j-1+p,p) - successor(1) = mod(i+1,p) + p*j - successor(2) = i + p*mod(j+1,p) - successor(3) = mod(i-1+p,p) + p*mod(j+1,p) - -c--------------------------------------------------------------------- -c now compute the sizes of the cells -c--------------------------------------------------------------------- - do dir= 1, 3 -c--------------------------------------------------------------------- -c set cell_coord range for each direction -c--------------------------------------------------------------------- - size = grid_points(dir)/p - excess = mod(grid_points(dir),p) - do c=1, ncells - if (cell_coord(dir,c) .le. excess) then - cell_size(dir,c) = size+1 - cell_low(dir,c) = (cell_coord(dir,c)-1)*(size+1) - cell_high(dir,c) = cell_low(dir,c)+size - else - cell_size(dir,c) = size - cell_low(dir,c) = excess*(size+1)+ - > (cell_coord(dir,c)-excess-1)*size - cell_high(dir,c) = cell_low(dir,c)+size-1 - endif - if (cell_size(dir, c) .le. 2) then - write(*,50) - 50 format(' Error: Cell size too small. Min size is 3') - call MPI_Abort(mpi_comm_world,ierrcode,ierr) - stop - endif - end do - end do - - return - end - diff --git a/examples/smpi/NAS/SP/mpinpb.h b/examples/smpi/NAS/SP/mpinpb.h deleted file mode 100644 index 439db34f60..0000000000 --- a/examples/smpi/NAS/SP/mpinpb.h +++ /dev/null @@ -1,13 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'mpif.h' - - integer node, no_nodes, total_nodes, root, comm_setup, - > comm_solve, comm_rhs, dp_type - logical active - common /mpistuff/ node, no_nodes, total_nodes, root, comm_setup, - > comm_solve, comm_rhs, dp_type, active - integer DEFAULT_TAG - parameter (DEFAULT_TAG = 0) diff --git a/examples/smpi/NAS/SP/ninvr.f b/examples/smpi/NAS/SP/ninvr.f deleted file mode 100644 index 146d046e8b..0000000000 --- a/examples/smpi/NAS/SP/ninvr.f +++ /dev/null @@ -1,45 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine ninvr(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c block-diagonal matrix-vector multiplication -c--------------------------------------------------------------------- - - include 'header.h' - - integer c, i, j, k - double precision r1, r2, r3, r4, r5, t1, t2 - -c--------------------------------------------------------------------- -c treat only one cell -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - - r1 = rhs(i,j,k,1,c) - r2 = rhs(i,j,k,2,c) - r3 = rhs(i,j,k,3,c) - r4 = rhs(i,j,k,4,c) - r5 = rhs(i,j,k,5,c) - - t1 = bt * r3 - t2 = 0.5d0 * ( r4 + r5 ) - - rhs(i,j,k,1,c) = -r2 - rhs(i,j,k,2,c) = r1 - rhs(i,j,k,3,c) = bt * ( r4 - r5 ) - rhs(i,j,k,4,c) = -t1 + t2 - rhs(i,j,k,5,c) = t1 + t2 - enddo - enddo - enddo - - return - end diff --git a/examples/smpi/NAS/SP/pinvr.f b/examples/smpi/NAS/SP/pinvr.f deleted file mode 100644 index 060f0a57ef..0000000000 --- a/examples/smpi/NAS/SP/pinvr.f +++ /dev/null @@ -1,48 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine pinvr(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c block-diagonal matrix-vector multiplication -c--------------------------------------------------------------------- - - include 'header.h' - - integer i, j, k, c - double precision r1, r2, r3, r4, r5, t1, t2 - -c--------------------------------------------------------------------- -c treat only one cell -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - - r1 = rhs(i,j,k,1,c) - r2 = rhs(i,j,k,2,c) - r3 = rhs(i,j,k,3,c) - r4 = rhs(i,j,k,4,c) - r5 = rhs(i,j,k,5,c) - - t1 = bt * r1 - t2 = 0.5d0 * ( r4 + r5 ) - - rhs(i,j,k,1,c) = bt * ( r4 - r5 ) - rhs(i,j,k,2,c) = -r3 - rhs(i,j,k,3,c) = r2 - rhs(i,j,k,4,c) = -t1 + t2 - rhs(i,j,k,5,c) = t1 + t2 - end do - end do - end do - - return - end - - - diff --git a/examples/smpi/NAS/SP/rhs.f b/examples/smpi/NAS/SP/rhs.f deleted file mode 100644 index 34e562a4e3..0000000000 --- a/examples/smpi/NAS/SP/rhs.f +++ /dev/null @@ -1,446 +0,0 @@ -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine compute_rhs - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - - integer c, i, j, k, m - double precision aux, rho_inv, uijk, up1, um1, vijk, vp1, vm1, - > wijk, wp1, wm1 - - -c--------------------------------------------------------------------- -c loop over all cells owned by this node -c--------------------------------------------------------------------- - do c = 1, ncells - -c--------------------------------------------------------------------- -c compute the reciprocal of density, and the kinetic energy, -c and the speed of sound. -c--------------------------------------------------------------------- - - do k = -1, cell_size(3,c) - do j = -1, cell_size(2,c) - do i = -1, cell_size(1,c) - rho_inv = 1.0d0/u(i,j,k,1,c) - rho_i(i,j,k,c) = rho_inv - us(i,j,k,c) = u(i,j,k,2,c) * rho_inv - vs(i,j,k,c) = u(i,j,k,3,c) * rho_inv - ws(i,j,k,c) = u(i,j,k,4,c) * rho_inv - square(i,j,k,c) = 0.5d0* ( - > u(i,j,k,2,c)*u(i,j,k,2,c) + - > u(i,j,k,3,c)*u(i,j,k,3,c) + - > u(i,j,k,4,c)*u(i,j,k,4,c) ) * rho_inv - qs(i,j,k,c) = square(i,j,k,c) * rho_inv -c--------------------------------------------------------------------- -c (don't need speed and ainx until the lhs computation) -c--------------------------------------------------------------------- - aux = c1c2*rho_inv* (u(i,j,k,5,c) - square(i,j,k,c)) - aux = dsqrt(aux) - speed(i,j,k,c) = aux - ainv(i,j,k,c) = 1.0d0/aux - end do - end do - end do - -c--------------------------------------------------------------------- -c copy the exact forcing term to the right hand side; because -c this forcing term is known, we can store it on the whole of every -c cell, including the boundary -c--------------------------------------------------------------------- - - do m = 1, 5 - do k = 0, cell_size(3,c)-1 - do j = 0, cell_size(2,c)-1 - do i = 0, cell_size(1,c)-1 - rhs(i,j,k,m,c) = forcing(i,j,k,m,c) - end do - end do - end do - end do - - -c--------------------------------------------------------------------- -c compute xi-direction fluxes -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - uijk = us(i,j,k,c) - up1 = us(i+1,j,k,c) - um1 = us(i-1,j,k,c) - - rhs(i,j,k,1,c) = rhs(i,j,k,1,c) + dx1tx1 * - > (u(i+1,j,k,1,c) - 2.0d0*u(i,j,k,1,c) + - > u(i-1,j,k,1,c)) - - > tx2 * (u(i+1,j,k,2,c) - u(i-1,j,k,2,c)) - - rhs(i,j,k,2,c) = rhs(i,j,k,2,c) + dx2tx1 * - > (u(i+1,j,k,2,c) - 2.0d0*u(i,j,k,2,c) + - > u(i-1,j,k,2,c)) + - > xxcon2*con43 * (up1 - 2.0d0*uijk + um1) - - > tx2 * (u(i+1,j,k,2,c)*up1 - - > u(i-1,j,k,2,c)*um1 + - > (u(i+1,j,k,5,c)- square(i+1,j,k,c)- - > u(i-1,j,k,5,c)+ square(i-1,j,k,c))* - > c2) - - rhs(i,j,k,3,c) = rhs(i,j,k,3,c) + dx3tx1 * - > (u(i+1,j,k,3,c) - 2.0d0*u(i,j,k,3,c) + - > u(i-1,j,k,3,c)) + - > xxcon2 * (vs(i+1,j,k,c) - 2.0d0*vs(i,j,k,c) + - > vs(i-1,j,k,c)) - - > tx2 * (u(i+1,j,k,3,c)*up1 - - > u(i-1,j,k,3,c)*um1) - - rhs(i,j,k,4,c) = rhs(i,j,k,4,c) + dx4tx1 * - > (u(i+1,j,k,4,c) - 2.0d0*u(i,j,k,4,c) + - > u(i-1,j,k,4,c)) + - > xxcon2 * (ws(i+1,j,k,c) - 2.0d0*ws(i,j,k,c) + - > ws(i-1,j,k,c)) - - > tx2 * (u(i+1,j,k,4,c)*up1 - - > u(i-1,j,k,4,c)*um1) - - rhs(i,j,k,5,c) = rhs(i,j,k,5,c) + dx5tx1 * - > (u(i+1,j,k,5,c) - 2.0d0*u(i,j,k,5,c) + - > u(i-1,j,k,5,c)) + - > xxcon3 * (qs(i+1,j,k,c) - 2.0d0*qs(i,j,k,c) + - > qs(i-1,j,k,c)) + - > xxcon4 * (up1*up1 - 2.0d0*uijk*uijk + - > um1*um1) + - > xxcon5 * (u(i+1,j,k,5,c)*rho_i(i+1,j,k,c) - - > 2.0d0*u(i,j,k,5,c)*rho_i(i,j,k,c) + - > u(i-1,j,k,5,c)*rho_i(i-1,j,k,c)) - - > tx2 * ( (c1*u(i+1,j,k,5,c) - - > c2*square(i+1,j,k,c))*up1 - - > (c1*u(i-1,j,k,5,c) - - > c2*square(i-1,j,k,c))*um1 ) - end do - end do - end do - -c--------------------------------------------------------------------- -c add fourth order xi-direction dissipation -c--------------------------------------------------------------------- - if (start(1,c) .gt. 0) then - i = 1 - do m = 1, 5 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c)- dssp * - > ( 5.0d0*u(i,j,k,m,c) - 4.0d0*u(i+1,j,k,m,c) + - > u(i+2,j,k,m,c)) - end do - end do - end do - - i = 2 - do m = 1, 5 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - dssp * - > (-4.0d0*u(i-1,j,k,m,c) + 6.0d0*u(i,j,k,m,c) - - > 4.0d0*u(i+1,j,k,m,c) + u(i+2,j,k,m,c)) - end do - end do - end do - endif - - do m = 1, 5 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = 3*start(1,c),cell_size(1,c)-3*end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - dssp * - > ( u(i-2,j,k,m,c) - 4.0d0*u(i-1,j,k,m,c) + - > 6.0*u(i,j,k,m,c) - 4.0d0*u(i+1,j,k,m,c) + - > u(i+2,j,k,m,c) ) - end do - end do - end do - end do - - - if (end(1,c) .gt. 0) then - i = cell_size(1,c)-3 - do m = 1, 5 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - dssp * - > ( u(i-2,j,k,m,c) - 4.0d0*u(i-1,j,k,m,c) + - > 6.0d0*u(i,j,k,m,c) - 4.0d0*u(i+1,j,k,m,c) ) - end do - end do - end do - - i = cell_size(1,c)-2 - do m = 1, 5 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - dssp * - > ( u(i-2,j,k,m,c) - 4.d0*u(i-1,j,k,m,c) + - > 5.d0*u(i,j,k,m,c) ) - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c compute eta-direction fluxes -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - vijk = vs(i,j,k,c) - vp1 = vs(i,j+1,k,c) - vm1 = vs(i,j-1,k,c) - rhs(i,j,k,1,c) = rhs(i,j,k,1,c) + dy1ty1 * - > (u(i,j+1,k,1,c) - 2.0d0*u(i,j,k,1,c) + - > u(i,j-1,k,1,c)) - - > ty2 * (u(i,j+1,k,3,c) - u(i,j-1,k,3,c)) - rhs(i,j,k,2,c) = rhs(i,j,k,2,c) + dy2ty1 * - > (u(i,j+1,k,2,c) - 2.0d0*u(i,j,k,2,c) + - > u(i,j-1,k,2,c)) + - > yycon2 * (us(i,j+1,k,c) - 2.0d0*us(i,j,k,c) + - > us(i,j-1,k,c)) - - > ty2 * (u(i,j+1,k,2,c)*vp1 - - > u(i,j-1,k,2,c)*vm1) - rhs(i,j,k,3,c) = rhs(i,j,k,3,c) + dy3ty1 * - > (u(i,j+1,k,3,c) - 2.0d0*u(i,j,k,3,c) + - > u(i,j-1,k,3,c)) + - > yycon2*con43 * (vp1 - 2.0d0*vijk + vm1) - - > ty2 * (u(i,j+1,k,3,c)*vp1 - - > u(i,j-1,k,3,c)*vm1 + - > (u(i,j+1,k,5,c) - square(i,j+1,k,c) - - > u(i,j-1,k,5,c) + square(i,j-1,k,c)) - > *c2) - rhs(i,j,k,4,c) = rhs(i,j,k,4,c) + dy4ty1 * - > (u(i,j+1,k,4,c) - 2.0d0*u(i,j,k,4,c) + - > u(i,j-1,k,4,c)) + - > yycon2 * (ws(i,j+1,k,c) - 2.0d0*ws(i,j,k,c) + - > ws(i,j-1,k,c)) - - > ty2 * (u(i,j+1,k,4,c)*vp1 - - > u(i,j-1,k,4,c)*vm1) - rhs(i,j,k,5,c) = rhs(i,j,k,5,c) + dy5ty1 * - > (u(i,j+1,k,5,c) - 2.0d0*u(i,j,k,5,c) + - > u(i,j-1,k,5,c)) + - > yycon3 * (qs(i,j+1,k,c) - 2.0d0*qs(i,j,k,c) + - > qs(i,j-1,k,c)) + - > yycon4 * (vp1*vp1 - 2.0d0*vijk*vijk + - > vm1*vm1) + - > yycon5 * (u(i,j+1,k,5,c)*rho_i(i,j+1,k,c) - - > 2.0d0*u(i,j,k,5,c)*rho_i(i,j,k,c) + - > u(i,j-1,k,5,c)*rho_i(i,j-1,k,c)) - - > ty2 * ((c1*u(i,j+1,k,5,c) - - > c2*square(i,j+1,k,c)) * vp1 - - > (c1*u(i,j-1,k,5,c) - - > c2*square(i,j-1,k,c)) * vm1) - end do - end do - end do - -c--------------------------------------------------------------------- -c add fourth order eta-direction dissipation -c--------------------------------------------------------------------- - if (start(2,c) .gt. 0) then - j = 1 - do m = 1, 5 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c)- dssp * - > ( 5.0d0*u(i,j,k,m,c) - 4.0d0*u(i,j+1,k,m,c) + - > u(i,j+2,k,m,c)) - end do - end do - end do - - j = 2 - do m = 1, 5 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - dssp * - > (-4.0d0*u(i,j-1,k,m,c) + 6.0d0*u(i,j,k,m,c) - - > 4.0d0*u(i,j+1,k,m,c) + u(i,j+2,k,m,c)) - end do - end do - end do - endif - - do m = 1, 5 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = 3*start(2,c), cell_size(2,c)-3*end(2,c)-1 - do i = start(1,c),cell_size(1,c)-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - dssp * - > ( u(i,j-2,k,m,c) - 4.0d0*u(i,j-1,k,m,c) + - > 6.0*u(i,j,k,m,c) - 4.0d0*u(i,j+1,k,m,c) + - > u(i,j+2,k,m,c) ) - end do - end do - end do - end do - - if (end(2,c) .gt. 0) then - j = cell_size(2,c)-3 - do m = 1, 5 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - dssp * - > ( u(i,j-2,k,m,c) - 4.0d0*u(i,j-1,k,m,c) + - > 6.0d0*u(i,j,k,m,c) - 4.0d0*u(i,j+1,k,m,c) ) - end do - end do - end do - - j = cell_size(2,c)-2 - do m = 1, 5 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - dssp * - > ( u(i,j-2,k,m,c) - 4.d0*u(i,j-1,k,m,c) + - > 5.d0*u(i,j,k,m,c) ) - end do - end do - end do - endif - - -c--------------------------------------------------------------------- -c compute zeta-direction fluxes -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - wijk = ws(i,j,k,c) - wp1 = ws(i,j,k+1,c) - wm1 = ws(i,j,k-1,c) - - rhs(i,j,k,1,c) = rhs(i,j,k,1,c) + dz1tz1 * - > (u(i,j,k+1,1,c) - 2.0d0*u(i,j,k,1,c) + - > u(i,j,k-1,1,c)) - - > tz2 * (u(i,j,k+1,4,c) - u(i,j,k-1,4,c)) - rhs(i,j,k,2,c) = rhs(i,j,k,2,c) + dz2tz1 * - > (u(i,j,k+1,2,c) - 2.0d0*u(i,j,k,2,c) + - > u(i,j,k-1,2,c)) + - > zzcon2 * (us(i,j,k+1,c) - 2.0d0*us(i,j,k,c) + - > us(i,j,k-1,c)) - - > tz2 * (u(i,j,k+1,2,c)*wp1 - - > u(i,j,k-1,2,c)*wm1) - rhs(i,j,k,3,c) = rhs(i,j,k,3,c) + dz3tz1 * - > (u(i,j,k+1,3,c) - 2.0d0*u(i,j,k,3,c) + - > u(i,j,k-1,3,c)) + - > zzcon2 * (vs(i,j,k+1,c) - 2.0d0*vs(i,j,k,c) + - > vs(i,j,k-1,c)) - - > tz2 * (u(i,j,k+1,3,c)*wp1 - - > u(i,j,k-1,3,c)*wm1) - rhs(i,j,k,4,c) = rhs(i,j,k,4,c) + dz4tz1 * - > (u(i,j,k+1,4,c) - 2.0d0*u(i,j,k,4,c) + - > u(i,j,k-1,4,c)) + - > zzcon2*con43 * (wp1 - 2.0d0*wijk + wm1) - - > tz2 * (u(i,j,k+1,4,c)*wp1 - - > u(i,j,k-1,4,c)*wm1 + - > (u(i,j,k+1,5,c) - square(i,j,k+1,c) - - > u(i,j,k-1,5,c) + square(i,j,k-1,c)) - > *c2) - rhs(i,j,k,5,c) = rhs(i,j,k,5,c) + dz5tz1 * - > (u(i,j,k+1,5,c) - 2.0d0*u(i,j,k,5,c) + - > u(i,j,k-1,5,c)) + - > zzcon3 * (qs(i,j,k+1,c) - 2.0d0*qs(i,j,k,c) + - > qs(i,j,k-1,c)) + - > zzcon4 * (wp1*wp1 - 2.0d0*wijk*wijk + - > wm1*wm1) + - > zzcon5 * (u(i,j,k+1,5,c)*rho_i(i,j,k+1,c) - - > 2.0d0*u(i,j,k,5,c)*rho_i(i,j,k,c) + - > u(i,j,k-1,5,c)*rho_i(i,j,k-1,c)) - - > tz2 * ( (c1*u(i,j,k+1,5,c) - - > c2*square(i,j,k+1,c))*wp1 - - > (c1*u(i,j,k-1,5,c) - - > c2*square(i,j,k-1,c))*wm1) - end do - end do - end do - -c--------------------------------------------------------------------- -c add fourth order zeta-direction dissipation -c--------------------------------------------------------------------- - if (start(3,c) .gt. 0) then - k = 1 - do m = 1, 5 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c)- dssp * - > ( 5.0d0*u(i,j,k,m,c) - 4.0d0*u(i,j,k+1,m,c) + - > u(i,j,k+2,m,c)) - end do - end do - end do - - k = 2 - do m = 1, 5 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - dssp * - > (-4.0d0*u(i,j,k-1,m,c) + 6.0d0*u(i,j,k,m,c) - - > 4.0d0*u(i,j,k+1,m,c) + u(i,j,k+2,m,c)) - end do - end do - end do - endif - - do m = 1, 5 - do k = 3*start(3,c), cell_size(3,c)-3*end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c),cell_size(1,c)-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - dssp * - > ( u(i,j,k-2,m,c) - 4.0d0*u(i,j,k-1,m,c) + - > 6.0*u(i,j,k,m,c) - 4.0d0*u(i,j,k+1,m,c) + - > u(i,j,k+2,m,c) ) - end do - end do - end do - end do - - if (end(3,c) .gt. 0) then - k = cell_size(3,c)-3 - do m = 1, 5 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - dssp * - > ( u(i,j,k-2,m,c) - 4.0d0*u(i,j,k-1,m,c) + - > 6.0d0*u(i,j,k,m,c) - 4.0d0*u(i,j,k+1,m,c) ) - end do - end do - end do - - k = cell_size(3,c)-2 - do m = 1, 5 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - dssp * - > ( u(i,j,k-2,m,c) - 4.d0*u(i,j,k-1,m,c) + - > 5.d0*u(i,j,k,m,c) ) - end do - end do - end do - endif - - do m = 1, 5 - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) * dt - end do - end do - end do - end do - - end do - - return - end - - - - diff --git a/examples/smpi/NAS/SP/set_constants.f b/examples/smpi/NAS/SP/set_constants.f deleted file mode 100644 index 63ce72bb9b..0000000000 --- a/examples/smpi/NAS/SP/set_constants.f +++ /dev/null @@ -1,203 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine set_constants - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - include 'header.h' - - ce(1,1) = 2.0d0 - ce(1,2) = 0.0d0 - ce(1,3) = 0.0d0 - ce(1,4) = 4.0d0 - ce(1,5) = 5.0d0 - ce(1,6) = 3.0d0 - ce(1,7) = 0.5d0 - ce(1,8) = 0.02d0 - ce(1,9) = 0.01d0 - ce(1,10) = 0.03d0 - ce(1,11) = 0.5d0 - ce(1,12) = 0.4d0 - ce(1,13) = 0.3d0 - - ce(2,1) = 1.0d0 - ce(2,2) = 0.0d0 - ce(2,3) = 0.0d0 - ce(2,4) = 0.0d0 - ce(2,5) = 1.0d0 - ce(2,6) = 2.0d0 - ce(2,7) = 3.0d0 - ce(2,8) = 0.01d0 - ce(2,9) = 0.03d0 - ce(2,10) = 0.02d0 - ce(2,11) = 0.4d0 - ce(2,12) = 0.3d0 - ce(2,13) = 0.5d0 - - ce(3,1) = 2.0d0 - ce(3,2) = 2.0d0 - ce(3,3) = 0.0d0 - ce(3,4) = 0.0d0 - ce(3,5) = 0.0d0 - ce(3,6) = 2.0d0 - ce(3,7) = 3.0d0 - ce(3,8) = 0.04d0 - ce(3,9) = 0.03d0 - ce(3,10) = 0.05d0 - ce(3,11) = 0.3d0 - ce(3,12) = 0.5d0 - ce(3,13) = 0.4d0 - - ce(4,1) = 2.0d0 - ce(4,2) = 2.0d0 - ce(4,3) = 0.0d0 - ce(4,4) = 0.0d0 - ce(4,5) = 0.0d0 - ce(4,6) = 2.0d0 - ce(4,7) = 3.0d0 - ce(4,8) = 0.03d0 - ce(4,9) = 0.05d0 - ce(4,10) = 0.04d0 - ce(4,11) = 0.2d0 - ce(4,12) = 0.1d0 - ce(4,13) = 0.3d0 - - ce(5,1) = 5.0d0 - ce(5,2) = 4.0d0 - ce(5,3) = 3.0d0 - ce(5,4) = 2.0d0 - ce(5,5) = 0.1d0 - ce(5,6) = 0.4d0 - ce(5,7) = 0.3d0 - ce(5,8) = 0.05d0 - ce(5,9) = 0.04d0 - ce(5,10) = 0.03d0 - ce(5,11) = 0.1d0 - ce(5,12) = 0.3d0 - ce(5,13) = 0.2d0 - - c1 = 1.4d0 - c2 = 0.4d0 - c3 = 0.1d0 - c4 = 1.0d0 - c5 = 1.4d0 - - bt = dsqrt(0.5d0) - - dnxm1 = 1.0d0 / dble(grid_points(1)-1) - dnym1 = 1.0d0 / dble(grid_points(2)-1) - dnzm1 = 1.0d0 / dble(grid_points(3)-1) - - c1c2 = c1 * c2 - c1c5 = c1 * c5 - c3c4 = c3 * c4 - c1345 = c1c5 * c3c4 - - conz1 = (1.0d0-c1c5) - - tx1 = 1.0d0 / (dnxm1 * dnxm1) - tx2 = 1.0d0 / (2.0d0 * dnxm1) - tx3 = 1.0d0 / dnxm1 - - ty1 = 1.0d0 / (dnym1 * dnym1) - ty2 = 1.0d0 / (2.0d0 * dnym1) - ty3 = 1.0d0 / dnym1 - - tz1 = 1.0d0 / (dnzm1 * dnzm1) - tz2 = 1.0d0 / (2.0d0 * dnzm1) - tz3 = 1.0d0 / dnzm1 - - dx1 = 0.75d0 - dx2 = 0.75d0 - dx3 = 0.75d0 - dx4 = 0.75d0 - dx5 = 0.75d0 - - dy1 = 0.75d0 - dy2 = 0.75d0 - dy3 = 0.75d0 - dy4 = 0.75d0 - dy5 = 0.75d0 - - dz1 = 1.0d0 - dz2 = 1.0d0 - dz3 = 1.0d0 - dz4 = 1.0d0 - dz5 = 1.0d0 - - dxmax = dmax1(dx3, dx4) - dymax = dmax1(dy2, dy4) - dzmax = dmax1(dz2, dz3) - - dssp = 0.25d0 * dmax1(dx1, dmax1(dy1, dz1) ) - - c4dssp = 4.0d0 * dssp - c5dssp = 5.0d0 * dssp - - dttx1 = dt*tx1 - dttx2 = dt*tx2 - dtty1 = dt*ty1 - dtty2 = dt*ty2 - dttz1 = dt*tz1 - dttz2 = dt*tz2 - - c2dttx1 = 2.0d0*dttx1 - c2dtty1 = 2.0d0*dtty1 - c2dttz1 = 2.0d0*dttz1 - - dtdssp = dt*dssp - - comz1 = dtdssp - comz4 = 4.0d0*dtdssp - comz5 = 5.0d0*dtdssp - comz6 = 6.0d0*dtdssp - - c3c4tx3 = c3c4*tx3 - c3c4ty3 = c3c4*ty3 - c3c4tz3 = c3c4*tz3 - - dx1tx1 = dx1*tx1 - dx2tx1 = dx2*tx1 - dx3tx1 = dx3*tx1 - dx4tx1 = dx4*tx1 - dx5tx1 = dx5*tx1 - - dy1ty1 = dy1*ty1 - dy2ty1 = dy2*ty1 - dy3ty1 = dy3*ty1 - dy4ty1 = dy4*ty1 - dy5ty1 = dy5*ty1 - - dz1tz1 = dz1*tz1 - dz2tz1 = dz2*tz1 - dz3tz1 = dz3*tz1 - dz4tz1 = dz4*tz1 - dz5tz1 = dz5*tz1 - - c2iv = 2.5d0 - con43 = 4.0d0/3.0d0 - con16 = 1.0d0/6.0d0 - - xxcon1 = c3c4tx3*con43*tx3 - xxcon2 = c3c4tx3*tx3 - xxcon3 = c3c4tx3*conz1*tx3 - xxcon4 = c3c4tx3*con16*tx3 - xxcon5 = c3c4tx3*c1c5*tx3 - - yycon1 = c3c4ty3*con43*ty3 - yycon2 = c3c4ty3*ty3 - yycon3 = c3c4ty3*conz1*ty3 - yycon4 = c3c4ty3*con16*ty3 - yycon5 = c3c4ty3*c1c5*ty3 - - zzcon1 = c3c4tz3*con43*tz3 - zzcon2 = c3c4tz3*tz3 - zzcon3 = c3c4tz3*conz1*tz3 - zzcon4 = c3c4tz3*con16*tz3 - zzcon5 = c3c4tz3*c1c5*tz3 - - return - end diff --git a/examples/smpi/NAS/SP/setup_mpi.f b/examples/smpi/NAS/SP/setup_mpi.f deleted file mode 100644 index 2d98f7dd02..0000000000 --- a/examples/smpi/NAS/SP/setup_mpi.f +++ /dev/null @@ -1,65 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine setup_mpi - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c set up MPI stuff -c--------------------------------------------------------------------- - - implicit none - include 'mpinpb.h' - include 'npbparams.h' - integer error, nc, color - - call mpi_init(error) - - call mpi_comm_size(MPI_COMM_WORLD, total_nodes, error) - call mpi_comm_rank(MPI_COMM_WORLD, node, error) - - if (.not. convertdouble) then - dp_type = MPI_DOUBLE_PRECISION - else - dp_type = MPI_REAL - endif - -c--------------------------------------------------------------------- -c compute square root; add small number to allow for roundoff -c--------------------------------------------------------------------- - nc = dint(dsqrt(dble(total_nodes) + 0.00001d0)) - -c--------------------------------------------------------------------- -c We handle a non-square number of nodes by making the excess nodes -c inactive. However, we can never handle more cells than were compiled -c in. -c--------------------------------------------------------------------- - - if (nc .gt. maxcells) nc = maxcells - - if (node .ge. nc*nc) then - active = .false. - color = 1 - else - active = .true. - color = 0 - end if - - call mpi_comm_split(MPI_COMM_WORLD,color,node,comm_setup,error) - if (.not. active) return - - call mpi_comm_size(comm_setup, no_nodes, error) - call mpi_comm_dup(comm_setup, comm_solve, error) - call mpi_comm_dup(comm_setup, comm_rhs, error) - -c--------------------------------------------------------------------- -c let node 0 be the root for the group (there is only one) -c--------------------------------------------------------------------- - root = 0 - - return - end - diff --git a/examples/smpi/NAS/SP/sp.f b/examples/smpi/NAS/SP/sp.f deleted file mode 100644 index 740cadee46..0000000000 --- a/examples/smpi/NAS/SP/sp.f +++ /dev/null @@ -1,194 +0,0 @@ -!-------------------------------------------------------------------------! -! ! -! N A S P A R A L L E L B E N C H M A R K S 3.3 ! -! ! -! S P ! -! ! -!-------------------------------------------------------------------------! -! ! -! This benchmark is part of the NAS Parallel Benchmark 3.3 suite. ! -! It is described in NAS Technical Reports 95-020 and 02-007 ! -! ! -! Permission to use, copy, distribute and modify this software ! -! for any purpose with or without fee is hereby granted. We ! -! request, however, that all derived work reference the NAS ! -! Parallel Benchmarks 3.3. This software is provided "as is" ! -! without express or implied warranty. ! -! ! -! Information on NPB 3.3, including the technical report, the ! -! original specifications, source code, results and information ! -! on how to submit new results, is available at: ! -! ! -! http://www.nas.nasa.gov/Software/NPB/ ! -! ! -! Send comments or suggestions to npb@nas.nasa.gov ! -! ! -! NAS Parallel Benchmarks Group ! -! NASA Ames Research Center ! -! Mail Stop: T27A-1 ! -! Moffett Field, CA 94035-1000 ! -! ! -! E-mail: npb@nas.nasa.gov ! -! Fax: (650) 604-3957 ! -! ! -!-------------------------------------------------------------------------! - - -c--------------------------------------------------------------------- -c -c Authors: R. F. Van der Wijngaart -c W. Saphir -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- - program MPSP -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer i, niter, step, c, error, fstatus - external timer_read - double precision mflops, t, tmax, timer_read - logical verified - character class - - call setup_mpi - if (.not. active) goto 999 - -c--------------------------------------------------------------------- -c Root node reads input file (if it exists) else takes -c defaults from parameters -c--------------------------------------------------------------------- - if (node .eq. root) then - - write(*, 1000) - open (unit=2,file='inputsp.data',status='old', iostat=fstatus) -c - if (fstatus .eq. 0) then - write(*,233) - 233 format(' Reading from input file inputsp.data') - read (2,*) niter - read (2,*) dt - read (2,*) grid_points(1), grid_points(2), grid_points(3) - close(2) - else - write(*,234) - niter = niter_default - dt = dt_default - grid_points(1) = problem_size - grid_points(2) = problem_size - grid_points(3) = problem_size - endif - 234 format(' No input file inputsp.data. Using compiled defaults') - - write(*, 1001) grid_points(1), grid_points(2), grid_points(3) - write(*, 1002) niter, dt - if (no_nodes .ne. total_nodes) write(*, 1004) total_nodes - if (no_nodes .ne. maxcells*maxcells) - > write(*, 1005) maxcells*maxcells - write(*, 1003) no_nodes - - 1000 format(//,' NAS Parallel Benchmarks 3.3 -- SP Benchmark',/) - 1001 format(' Size: ', i4, 'x', i4, 'x', i4) - 1002 format(' Iterations: ', i4, ' dt: ', F11.7) - 1004 format(' Total number of processes: ', i5) - 1005 format(' WARNING: compiled for ', i5, ' processes ') - 1003 format(' Number of active processes: ', i5, /) - - endif - - call mpi_bcast(niter, 1, MPI_INTEGER, - > root, comm_setup, error) - - call mpi_bcast(dt, 1, dp_type, - > root, comm_setup, error) - - call mpi_bcast(grid_points(1), 3, MPI_INTEGER, - > root, comm_setup, error) - - - call make_set - - do c = 1, ncells - if ( (cell_size(1,c) .gt. IMAX) .or. - > (cell_size(2,c) .gt. JMAX) .or. - > (cell_size(3,c) .gt. KMAX) ) then - print *,node, c, (cell_size(i,c),i=1,3) - print *,' Problem size too big for compiled array sizes' - goto 999 - endif - end do - - call set_constants - - call initialize - -c call mpi_finalize(error) -c stop - - call lhsinit - - call exact_rhs - - call compute_buffer_size(5) - -c--------------------------------------------------------------------- -c do one time step to touch all code, and reinitialize -c--------------------------------------------------------------------- - call adi - call initialize - -c--------------------------------------------------------------------- -c Synchronize before placing time stamp -c--------------------------------------------------------------------- - call mpi_barrier(comm_setup, error) - - call timer_clear(1) - call timer_start(1) - - do step = 1, niter - - if (node .eq. root) then - if (mod(step, 20) .eq. 0 .or. - > step .eq. 1) then - write(*, 200) step - 200 format(' Time step ', i4) - endif - endif - - call adi - - end do - - call timer_stop(1) - t = timer_read(1) - - call verify(niter, class, verified) - - call mpi_reduce(t, tmax, 1, - > dp_type, MPI_MAX, - > root, comm_setup, error) - - if( node .eq. root ) then - if( tmax .ne. 0. ) then - mflops = (881.174*float( problem_size )**3 - > -4683.91*float( problem_size )**2 - > +11484.5*float( problem_size ) - > -19272.4) * float( niter ) / (tmax*1000000.0d0) - else - mflops = 0.0 - endif - - call print_results('SP', class, grid_points(1), - > grid_points(2), grid_points(3), niter, maxcells*maxcells, - > total_nodes, tmax, mflops, ' floating point', - > verified, npbversion,compiletime, cs1, cs2, cs3, cs4, cs5, - > cs6, '(none)') - endif - - 999 continue - call mpi_barrier(MPI_COMM_WORLD, error) - call mpi_finalize(error) - - end diff --git a/examples/smpi/NAS/SP/txinvr.f b/examples/smpi/NAS/SP/txinvr.f deleted file mode 100644 index b5ca4616f5..0000000000 --- a/examples/smpi/NAS/SP/txinvr.f +++ /dev/null @@ -1,59 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine txinvr - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c block-diagonal matrix-vector multiplication -c--------------------------------------------------------------------- - - include 'header.h' - - integer c, i, j, k - double precision t1, t2, t3, ac, ru1, uu, vv, ww, r1, r2, r3, - > r4, r5, ac2inv - -c--------------------------------------------------------------------- -c loop over all cells owned by this node -c--------------------------------------------------------------------- - do c = 1, ncells - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - - ru1 = rho_i(i,j,k,c) - uu = us(i,j,k,c) - vv = vs(i,j,k,c) - ww = ws(i,j,k,c) - ac = speed(i,j,k,c) - ac2inv = ainv(i,j,k,c)*ainv(i,j,k,c) - - r1 = rhs(i,j,k,1,c) - r2 = rhs(i,j,k,2,c) - r3 = rhs(i,j,k,3,c) - r4 = rhs(i,j,k,4,c) - r5 = rhs(i,j,k,5,c) - - t1 = c2 * ac2inv * ( qs(i,j,k,c)*r1 - uu*r2 - - > vv*r3 - ww*r4 + r5 ) - t2 = bt * ru1 * ( uu * r1 - r2 ) - t3 = ( bt * ru1 * ac ) * t1 - - rhs(i,j,k,1,c) = r1 - t1 - rhs(i,j,k,2,c) = - ru1 * ( ww*r1 - r4 ) - rhs(i,j,k,3,c) = ru1 * ( vv*r1 - r3 ) - rhs(i,j,k,4,c) = - t2 + t3 - rhs(i,j,k,5,c) = t2 + t3 - end do - end do - end do - end do - - return - end - - diff --git a/examples/smpi/NAS/SP/tzetar.f b/examples/smpi/NAS/SP/tzetar.f deleted file mode 100644 index 554066d6fc..0000000000 --- a/examples/smpi/NAS/SP/tzetar.f +++ /dev/null @@ -1,60 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine tzetar(c) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c block-diagonal matrix-vector multiplication -c--------------------------------------------------------------------- - - include 'header.h' - - integer i, j, k, c - double precision t1, t2, t3, ac, xvel, yvel, zvel, r1, r2, r3, - > r4, r5, btuz, acinv, ac2u, uzik1 - -c--------------------------------------------------------------------- -c treat only one cell -c--------------------------------------------------------------------- - do k = start(3,c), cell_size(3,c)-end(3,c)-1 - do j = start(2,c), cell_size(2,c)-end(2,c)-1 - do i = start(1,c), cell_size(1,c)-end(1,c)-1 - - xvel = us(i,j,k,c) - yvel = vs(i,j,k,c) - zvel = ws(i,j,k,c) - ac = speed(i,j,k,c) - acinv = ainv(i,j,k,c) - - ac2u = ac*ac - - r1 = rhs(i,j,k,1,c) - r2 = rhs(i,j,k,2,c) - r3 = rhs(i,j,k,3,c) - r4 = rhs(i,j,k,4,c) - r5 = rhs(i,j,k,5,c) - - uzik1 = u(i,j,k,1,c) - btuz = bt * uzik1 - - t1 = btuz*acinv * (r4 + r5) - t2 = r3 + t1 - t3 = btuz * (r4 - r5) - - rhs(i,j,k,1,c) = t2 - rhs(i,j,k,2,c) = -uzik1*r2 + xvel*t2 - rhs(i,j,k,3,c) = uzik1*r1 + yvel*t2 - rhs(i,j,k,4,c) = zvel*t2 + t3 - rhs(i,j,k,5,c) = uzik1*(-xvel*r2 + yvel*r1) + - > qs(i,j,k,c)*t2 + c2iv*ac2u*t1 + zvel*t3 - - end do - end do - end do - - return - end diff --git a/examples/smpi/NAS/SP/verify.f b/examples/smpi/NAS/SP/verify.f deleted file mode 100644 index 08be79c8a6..0000000000 --- a/examples/smpi/NAS/SP/verify.f +++ /dev/null @@ -1,358 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine verify(no_time_steps, class, verified) - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c verification routine -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - double precision xcrref(5),xceref(5),xcrdif(5),xcedif(5), - > epsilon, xce(5), xcr(5), dtref - integer m, no_time_steps - character class - logical verified - -c--------------------------------------------------------------------- -c tolerance level -c--------------------------------------------------------------------- - epsilon = 1.0d-08 - - -c--------------------------------------------------------------------- -c compute the error norm and the residual norm, and exit if not printing -c--------------------------------------------------------------------- - call error_norm(xce) - call copy_faces - - call rhs_norm(xcr) - - do m = 1, 5 - xcr(m) = xcr(m) / dt - enddo - - if (node .ne. 0) return - - class = 'U' - verified = .true. - - do m = 1,5 - xcrref(m) = 1.0 - xceref(m) = 1.0 - end do - -c--------------------------------------------------------------------- -c reference data for 12X12X12 grids after 100 time steps, with DT = 1.50d-02 -c--------------------------------------------------------------------- - if ( (grid_points(1) .eq. 12 ) .and. - > (grid_points(2) .eq. 12 ) .and. - > (grid_points(3) .eq. 12 ) .and. - > (no_time_steps .eq. 100 )) then - - class = 'S' - dtref = 1.5d-2 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual. -c--------------------------------------------------------------------- - xcrref(1) = 2.7470315451339479d-02 - xcrref(2) = 1.0360746705285417d-02 - xcrref(3) = 1.6235745065095532d-02 - xcrref(4) = 1.5840557224455615d-02 - xcrref(5) = 3.4849040609362460d-02 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error. -c--------------------------------------------------------------------- - xceref(1) = 2.7289258557377227d-05 - xceref(2) = 1.0364446640837285d-05 - xceref(3) = 1.6154798287166471d-05 - xceref(4) = 1.5750704994480102d-05 - xceref(5) = 3.4177666183390531d-05 - - -c--------------------------------------------------------------------- -c reference data for 36X36X36 grids after 400 time steps, with DT = 1.5d-03 -c--------------------------------------------------------------------- - elseif ( (grid_points(1) .eq. 36) .and. - > (grid_points(2) .eq. 36) .and. - > (grid_points(3) .eq. 36) .and. - > (no_time_steps . eq. 400) ) then - - class = 'W' - dtref = 1.5d-3 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual. -c--------------------------------------------------------------------- - xcrref(1) = 0.1893253733584d-02 - xcrref(2) = 0.1717075447775d-03 - xcrref(3) = 0.2778153350936d-03 - xcrref(4) = 0.2887475409984d-03 - xcrref(5) = 0.3143611161242d-02 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error. -c--------------------------------------------------------------------- - xceref(1) = 0.7542088599534d-04 - xceref(2) = 0.6512852253086d-05 - xceref(3) = 0.1049092285688d-04 - xceref(4) = 0.1128838671535d-04 - xceref(5) = 0.1212845639773d-03 - -c--------------------------------------------------------------------- -c reference data for 64X64X64 grids after 400 time steps, with DT = 1.5d-03 -c--------------------------------------------------------------------- - elseif ( (grid_points(1) .eq. 64) .and. - > (grid_points(2) .eq. 64) .and. - > (grid_points(3) .eq. 64) .and. - > (no_time_steps . eq. 400) ) then - - class = 'A' - dtref = 1.5d-3 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual. -c--------------------------------------------------------------------- - xcrref(1) = 2.4799822399300195d0 - xcrref(2) = 1.1276337964368832d0 - xcrref(3) = 1.5028977888770491d0 - xcrref(4) = 1.4217816211695179d0 - xcrref(5) = 2.1292113035138280d0 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error. -c--------------------------------------------------------------------- - xceref(1) = 1.0900140297820550d-04 - xceref(2) = 3.7343951769282091d-05 - xceref(3) = 5.0092785406541633d-05 - xceref(4) = 4.7671093939528255d-05 - xceref(5) = 1.3621613399213001d-04 - -c--------------------------------------------------------------------- -c reference data for 102X102X102 grids after 400 time steps, -c with DT = 1.0d-03 -c--------------------------------------------------------------------- - elseif ( (grid_points(1) .eq. 102) .and. - > (grid_points(2) .eq. 102) .and. - > (grid_points(3) .eq. 102) .and. - > (no_time_steps . eq. 400) ) then - - class = 'B' - dtref = 1.0d-3 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual. -c--------------------------------------------------------------------- - xcrref(1) = 0.6903293579998d+02 - xcrref(2) = 0.3095134488084d+02 - xcrref(3) = 0.4103336647017d+02 - xcrref(4) = 0.3864769009604d+02 - xcrref(5) = 0.5643482272596d+02 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error. -c--------------------------------------------------------------------- - xceref(1) = 0.9810006190188d-02 - xceref(2) = 0.1022827905670d-02 - xceref(3) = 0.1720597911692d-02 - xceref(4) = 0.1694479428231d-02 - xceref(5) = 0.1847456263981d-01 - -c--------------------------------------------------------------------- -c reference data for 162X162X162 grids after 400 time steps, -c with DT = 0.67d-03 -c--------------------------------------------------------------------- - elseif ( (grid_points(1) .eq. 162) .and. - > (grid_points(2) .eq. 162) .and. - > (grid_points(3) .eq. 162) .and. - > (no_time_steps . eq. 400) ) then - - class = 'C' - dtref = 0.67d-3 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual. -c--------------------------------------------------------------------- - xcrref(1) = 0.5881691581829d+03 - xcrref(2) = 0.2454417603569d+03 - xcrref(3) = 0.3293829191851d+03 - xcrref(4) = 0.3081924971891d+03 - xcrref(5) = 0.4597223799176d+03 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error. -c--------------------------------------------------------------------- - xceref(1) = 0.2598120500183d+00 - xceref(2) = 0.2590888922315d-01 - xceref(3) = 0.5132886416320d-01 - xceref(4) = 0.4806073419454d-01 - xceref(5) = 0.5483377491301d+00 - -c--------------------------------------------------------------------- -c reference data for 408X408X408 grids after 500 time steps, -c with DT = 0.3d-03 -c--------------------------------------------------------------------- - elseif ( (grid_points(1) .eq. 408) .and. - > (grid_points(2) .eq. 408) .and. - > (grid_points(3) .eq. 408) .and. - > (no_time_steps . eq. 500) ) then - - class = 'D' - dtref = 0.30d-3 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual. -c--------------------------------------------------------------------- - xcrref(1) = 0.1044696216887d+05 - xcrref(2) = 0.3204427762578d+04 - xcrref(3) = 0.4648680733032d+04 - xcrref(4) = 0.4238923283697d+04 - xcrref(5) = 0.7588412036136d+04 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error. -c--------------------------------------------------------------------- - xceref(1) = 0.5089471423669d+01 - xceref(2) = 0.5323514855894d+00 - xceref(3) = 0.1187051008971d+01 - xceref(4) = 0.1083734951938d+01 - xceref(5) = 0.1164108338568d+02 - -c--------------------------------------------------------------------- -c reference data for 1020X1020X1020 grids after 500 time steps, -c with DT = 0.1d-03 -c--------------------------------------------------------------------- - elseif ( (grid_points(1) .eq. 1020) .and. - > (grid_points(2) .eq. 1020) .and. - > (grid_points(3) .eq. 1020) .and. - > (no_time_steps . eq. 500) ) then - - class = 'E' - dtref = 0.10d-3 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of residual. -c--------------------------------------------------------------------- - xcrref(1) = 0.6255387422609d+05 - xcrref(2) = 0.1495317020012d+05 - xcrref(3) = 0.2347595750586d+05 - xcrref(4) = 0.2091099783534d+05 - xcrref(5) = 0.4770412841218d+05 - -c--------------------------------------------------------------------- -c Reference values of RMS-norms of solution error. -c--------------------------------------------------------------------- - xceref(1) = 0.6742735164909d+02 - xceref(2) = 0.5390656036938d+01 - xceref(3) = 0.1680647196477d+02 - xceref(4) = 0.1536963126457d+02 - xceref(5) = 0.1575330146156d+03 - - else - verified = .false. - endif - -c--------------------------------------------------------------------- -c verification test for residuals if gridsize is one of -c the defined grid sizes above (class .ne. 'U') -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c Compute the difference of solution values and the known reference values. -c--------------------------------------------------------------------- - do m = 1, 5 - - xcrdif(m) = dabs((xcr(m)-xcrref(m))/xcrref(m)) - xcedif(m) = dabs((xce(m)-xceref(m))/xceref(m)) - - enddo - -c--------------------------------------------------------------------- -c Output the comparison of computed results to known cases. -c--------------------------------------------------------------------- - - if (class .ne. 'U') then - write(*, 1990) class - 1990 format(' Verification being performed for class ', a) - write (*,2000) epsilon - 2000 format(' accuracy setting for epsilon = ', E20.13) - verified = (dabs(dt-dtref) .le. epsilon) - if (.not.verified) then - class = 'U' - write (*,1000) dtref - 1000 format(' DT does not match the reference value of ', - > E15.8) - endif - else - write(*, 1995) - 1995 format(' Unknown class') - endif - - - if (class .ne. 'U') then - write (*,2001) - else - write (*, 2005) - endif - - 2001 format(' Comparison of RMS-norms of residual') - 2005 format(' RMS-norms of residual') - do m = 1, 5 - if (class .eq. 'U') then - write(*, 2015) m, xcr(m) - else if (xcrdif(m) .le. epsilon) then - write (*,2011) m,xcr(m),xcrref(m),xcrdif(m) - else - verified = .false. - write (*,2010) m,xcr(m),xcrref(m),xcrdif(m) - endif - enddo - - if (class .ne. 'U') then - write (*,2002) - else - write (*,2006) - endif - 2002 format(' Comparison of RMS-norms of solution error') - 2006 format(' RMS-norms of solution error') - - do m = 1, 5 - if (class .eq. 'U') then - write(*, 2015) m, xce(m) - else if (xcedif(m) .le. epsilon) then - write (*,2011) m,xce(m),xceref(m),xcedif(m) - else - verified = .false. - write (*,2010) m,xce(m),xceref(m),xcedif(m) - endif - enddo - - 2010 format(' FAILURE: ', i2, E20.13, E20.13, E20.13) - 2011 format(' ', i2, E20.13, E20.13, E20.13) - 2015 format(' ', i2, E20.13) - - if (class .eq. 'U') then - write(*, 2022) - write(*, 2023) - 2022 format(' No reference values provided') - 2023 format(' No verification performed') - else if (verified) then - write(*, 2020) - 2020 format(' Verification Successful') - else - write(*, 2021) - 2021 format(' Verification failed') - endif - - return - - - end diff --git a/examples/smpi/NAS/SP/x_solve.f b/examples/smpi/NAS/SP/x_solve.f deleted file mode 100644 index cd40756ec3..0000000000 --- a/examples/smpi/NAS/SP/x_solve.f +++ /dev/null @@ -1,545 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine x_solve - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c this function performs the solution of the approximate factorization -c step in the x-direction for all five matrix components -c simultaneously. The Thomas algorithm is employed to solve the -c systems for the x-lines. Boundary conditions are non-periodic -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - - integer i, j, k, jp, kp, n, iend, jsize, ksize, i1, i2, - > buffer_size, c, m, p, istart, stage, error, - > requests(2), statuses(MPI_STATUS_SIZE, 2) - double precision r1, r2, d, e, s(5), sm1, sm2, - > fac1, fac2 - - - -c--------------------------------------------------------------------- -c OK, now we know that there are multiple processors -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c now do a sweep on a layer-by-layer basis, i.e. sweeping through cells -c on this node in the direction of increasing i for the forward sweep, -c and after that reversing the direction for the backsubstitution. -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c FORWARD ELIMINATION -c--------------------------------------------------------------------- - do stage = 1, ncells - c = slice(1,stage) - - istart = 0 - iend = cell_size(1,c)-1 - - jsize = cell_size(2,c) - ksize = cell_size(3,c) - jp = cell_coord(2,c)-1 - kp = cell_coord(3,c)-1 - - buffer_size = (jsize-start(2,c)-end(2,c)) * - > (ksize-start(3,c)-end(3,c)) - - if ( stage .ne. 1) then - -c--------------------------------------------------------------------- -c if this is not the first processor in this row of cells, -c receive data from predecessor containing the right hand -c sides and the upper diagonal elements of the previous two rows -c--------------------------------------------------------------------- - call mpi_irecv(in_buffer, 22*buffer_size, - > dp_type, predecessor(1), - > DEFAULT_TAG, comm_solve, - > requests(1), error) - - -c--------------------------------------------------------------------- -c communication has already been started. -c compute the left hand side while waiting for the msg -c--------------------------------------------------------------------- - call lhsx(c) - -c--------------------------------------------------------------------- -c wait for pending communication to complete -c This waits on the current receive and on the send -c from the previous stage. They always come in pairs. -c--------------------------------------------------------------------- - - call mpi_waitall(2, requests, statuses, error) - -c--------------------------------------------------------------------- -c unpack the buffer -c--------------------------------------------------------------------- - i = istart - i1 = istart + 1 - n = 0 - -c--------------------------------------------------------------------- -c create a running pointer -c--------------------------------------------------------------------- - p = 0 - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - lhs(i,j,k,n+2,c) = lhs(i,j,k,n+2,c) - - > in_buffer(p+1) * lhs(i,j,k,n+1,c) - lhs(i,j,k,n+3,c) = lhs(i,j,k,n+3,c) - - > in_buffer(p+2) * lhs(i,j,k,n+1,c) - do m = 1, 3 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > in_buffer(p+2+m) * lhs(i,j,k,n+1,c) - end do - d = in_buffer(p+6) - e = in_buffer(p+7) - do m = 1, 3 - s(m) = in_buffer(p+7+m) - end do - r1 = lhs(i,j,k,n+2,c) - lhs(i,j,k,n+3,c) = lhs(i,j,k,n+3,c) - d * r1 - lhs(i,j,k,n+4,c) = lhs(i,j,k,n+4,c) - e * r1 - do m = 1, 3 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - s(m) * r1 - end do - r2 = lhs(i1,j,k,n+1,c) - lhs(i1,j,k,n+2,c) = lhs(i1,j,k,n+2,c) - d * r2 - lhs(i1,j,k,n+3,c) = lhs(i1,j,k,n+3,c) - e * r2 - do m = 1, 3 - rhs(i1,j,k,m,c) = rhs(i1,j,k,m,c) - s(m) * r2 - end do - p = p + 10 - end do - end do - - do m = 4, 5 - n = (m-3)*5 - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - lhs(i,j,k,n+2,c) = lhs(i,j,k,n+2,c) - - > in_buffer(p+1) * lhs(i,j,k,n+1,c) - lhs(i,j,k,n+3,c) = lhs(i,j,k,n+3,c) - - > in_buffer(p+2) * lhs(i,j,k,n+1,c) - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > in_buffer(p+3) * lhs(i,j,k,n+1,c) - d = in_buffer(p+4) - e = in_buffer(p+5) - s(m) = in_buffer(p+6) - r1 = lhs(i,j,k,n+2,c) - lhs(i,j,k,n+3,c) = lhs(i,j,k,n+3,c) - d * r1 - lhs(i,j,k,n+4,c) = lhs(i,j,k,n+4,c) - e * r1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - s(m) * r1 - r2 = lhs(i1,j,k,n+1,c) - lhs(i1,j,k,n+2,c) = lhs(i1,j,k,n+2,c) - d * r2 - lhs(i1,j,k,n+3,c) = lhs(i1,j,k,n+3,c) - e * r2 - rhs(i1,j,k,m,c) = rhs(i1,j,k,m,c) - s(m) * r2 - p = p + 6 - end do - end do - end do - - else - -c--------------------------------------------------------------------- -c if this IS the first cell, we still compute the lhs -c--------------------------------------------------------------------- - call lhsx(c) - endif - -c--------------------------------------------------------------------- -c perform the Thomas algorithm; first, FORWARD ELIMINATION -c--------------------------------------------------------------------- - n = 0 - - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - do i = istart, iend-2 - i1 = i + 1 - i2 = i + 2 - fac1 = 1.d0/lhs(i,j,k,n+3,c) - lhs(i,j,k,n+4,c) = fac1*lhs(i,j,k,n+4,c) - lhs(i,j,k,n+5,c) = fac1*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i,j,k,m,c) = fac1*rhs(i,j,k,m,c) - end do - lhs(i1,j,k,n+3,c) = lhs(i1,j,k,n+3,c) - - > lhs(i1,j,k,n+2,c)*lhs(i,j,k,n+4,c) - lhs(i1,j,k,n+4,c) = lhs(i1,j,k,n+4,c) - - > lhs(i1,j,k,n+2,c)*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i1,j,k,m,c) = rhs(i1,j,k,m,c) - - > lhs(i1,j,k,n+2,c)*rhs(i,j,k,m,c) - end do - lhs(i2,j,k,n+2,c) = lhs(i2,j,k,n+2,c) - - > lhs(i2,j,k,n+1,c)*lhs(i,j,k,n+4,c) - lhs(i2,j,k,n+3,c) = lhs(i2,j,k,n+3,c) - - > lhs(i2,j,k,n+1,c)*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i2,j,k,m,c) = rhs(i2,j,k,m,c) - - > lhs(i2,j,k,n+1,c)*rhs(i,j,k,m,c) - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c The last two rows in this grid block are a bit different, -c since they do not have two more rows available for the -c elimination of off-diagonal entries -c--------------------------------------------------------------------- - - i = iend - 1 - i1 = iend - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - fac1 = 1.d0/lhs(i,j,k,n+3,c) - lhs(i,j,k,n+4,c) = fac1*lhs(i,j,k,n+4,c) - lhs(i,j,k,n+5,c) = fac1*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i,j,k,m,c) = fac1*rhs(i,j,k,m,c) - end do - lhs(i1,j,k,n+3,c) = lhs(i1,j,k,n+3,c) - - > lhs(i1,j,k,n+2,c)*lhs(i,j,k,n+4,c) - lhs(i1,j,k,n+4,c) = lhs(i1,j,k,n+4,c) - - > lhs(i1,j,k,n+2,c)*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i1,j,k,m,c) = rhs(i1,j,k,m,c) - - > lhs(i1,j,k,n+2,c)*rhs(i,j,k,m,c) - end do -c--------------------------------------------------------------------- -c scale the last row immediately (some of this is -c overkill in case this is the last cell) -c--------------------------------------------------------------------- - fac2 = 1.d0/lhs(i1,j,k,n+3,c) - lhs(i1,j,k,n+4,c) = fac2*lhs(i1,j,k,n+4,c) - lhs(i1,j,k,n+5,c) = fac2*lhs(i1,j,k,n+5,c) - do m = 1, 3 - rhs(i1,j,k,m,c) = fac2*rhs(i1,j,k,m,c) - end do - end do - end do - -c--------------------------------------------------------------------- -c do the u+c and the u-c factors -c--------------------------------------------------------------------- - - do m = 4, 5 - n = (m-3)*5 - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - do i = istart, iend-2 - i1 = i + 1 - i2 = i + 2 - fac1 = 1.d0/lhs(i,j,k,n+3,c) - lhs(i,j,k,n+4,c) = fac1*lhs(i,j,k,n+4,c) - lhs(i,j,k,n+5,c) = fac1*lhs(i,j,k,n+5,c) - rhs(i,j,k,m,c) = fac1*rhs(i,j,k,m,c) - lhs(i1,j,k,n+3,c) = lhs(i1,j,k,n+3,c) - - > lhs(i1,j,k,n+2,c)*lhs(i,j,k,n+4,c) - lhs(i1,j,k,n+4,c) = lhs(i1,j,k,n+4,c) - - > lhs(i1,j,k,n+2,c)*lhs(i,j,k,n+5,c) - rhs(i1,j,k,m,c) = rhs(i1,j,k,m,c) - - > lhs(i1,j,k,n+2,c)*rhs(i,j,k,m,c) - lhs(i2,j,k,n+2,c) = lhs(i2,j,k,n+2,c) - - > lhs(i2,j,k,n+1,c)*lhs(i,j,k,n+4,c) - lhs(i2,j,k,n+3,c) = lhs(i2,j,k,n+3,c) - - > lhs(i2,j,k,n+1,c)*lhs(i,j,k,n+5,c) - rhs(i2,j,k,m,c) = rhs(i2,j,k,m,c) - - > lhs(i2,j,k,n+1,c)*rhs(i,j,k,m,c) - end do - end do - end do - -c--------------------------------------------------------------------- -c And again the last two rows separately -c--------------------------------------------------------------------- - i = iend - 1 - i1 = iend - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - fac1 = 1.d0/lhs(i,j,k,n+3,c) - lhs(i,j,k,n+4,c) = fac1*lhs(i,j,k,n+4,c) - lhs(i,j,k,n+5,c) = fac1*lhs(i,j,k,n+5,c) - rhs(i,j,k,m,c) = fac1*rhs(i,j,k,m,c) - lhs(i1,j,k,n+3,c) = lhs(i1,j,k,n+3,c) - - > lhs(i1,j,k,n+2,c)*lhs(i,j,k,n+4,c) - lhs(i1,j,k,n+4,c) = lhs(i1,j,k,n+4,c) - - > lhs(i1,j,k,n+2,c)*lhs(i,j,k,n+5,c) - rhs(i1,j,k,m,c) = rhs(i1,j,k,m,c) - - > lhs(i1,j,k,n+2,c)*rhs(i,j,k,m,c) -c--------------------------------------------------------------------- -c Scale the last row immediately (some of this is overkill -c if this is the last cell) -c--------------------------------------------------------------------- - fac2 = 1.d0/lhs(i1,j,k,n+3,c) - lhs(i1,j,k,n+4,c) = fac2*lhs(i1,j,k,n+4,c) - lhs(i1,j,k,n+5,c) = fac2*lhs(i1,j,k,n+5,c) - rhs(i1,j,k,m,c) = fac2*rhs(i1,j,k,m,c) - - end do - end do - end do - -c--------------------------------------------------------------------- -c send information to the next processor, except when this -c is the last grid block -c--------------------------------------------------------------------- - if (stage .ne. ncells) then - -c--------------------------------------------------------------------- -c create a running pointer for the send buffer -c--------------------------------------------------------------------- - p = 0 - n = 0 - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - do i = iend-1, iend - out_buffer(p+1) = lhs(i,j,k,n+4,c) - out_buffer(p+2) = lhs(i,j,k,n+5,c) - do m = 1, 3 - out_buffer(p+2+m) = rhs(i,j,k,m,c) - end do - p = p+5 - end do - end do - end do - - do m = 4, 5 - n = (m-3)*5 - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - do i = iend-1, iend - out_buffer(p+1) = lhs(i,j,k,n+4,c) - out_buffer(p+2) = lhs(i,j,k,n+5,c) - out_buffer(p+3) = rhs(i,j,k,m,c) - p = p + 3 - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c send data to next phase -c can't receive data yet because buffer size will be wrong -c--------------------------------------------------------------------- - call mpi_isend(out_buffer, 22*buffer_size, - > dp_type, successor(1), - > DEFAULT_TAG, comm_solve, - > requests(2), error) - - endif - end do - -c--------------------------------------------------------------------- -c now go in the reverse direction -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c BACKSUBSTITUTION -c--------------------------------------------------------------------- - do stage = ncells, 1, -1 - c = slice(1,stage) - - istart = 0 - iend = cell_size(1,c)-1 - - jsize = cell_size(2,c) - ksize = cell_size(3,c) - jp = cell_coord(2,c)-1 - kp = cell_coord(3,c)-1 - - buffer_size = (jsize-start(2,c)-end(2,c)) * - > (ksize-start(3,c)-end(3,c)) - - if (stage .ne. ncells) then - -c--------------------------------------------------------------------- -c if this is not the starting cell in this row of cells, -c wait for a message to be received, containing the -c solution of the previous two stations -c--------------------------------------------------------------------- - call mpi_irecv(in_buffer, 10*buffer_size, - > dp_type, successor(1), - > DEFAULT_TAG, comm_solve, - > requests(1), error) - - -c--------------------------------------------------------------------- -c communication has already been started -c while waiting, do the block-diagonal inversion for the -c cell that was just finished -c--------------------------------------------------------------------- - - call ninvr(slice(1,stage+1)) - -c--------------------------------------------------------------------- -c wait for pending communication to complete -c--------------------------------------------------------------------- - call mpi_waitall(2, requests, statuses, error) - -c--------------------------------------------------------------------- -c unpack the buffer for the first three factors -c--------------------------------------------------------------------- - n = 0 - p = 0 - i = iend - i1 = i - 1 - do m = 1, 3 - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - sm1 = in_buffer(p+1) - sm2 = in_buffer(p+2) - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*sm1 - - > lhs(i,j,k,n+5,c)*sm2 - rhs(i1,j,k,m,c) = rhs(i1,j,k,m,c) - - > lhs(i1,j,k,n+4,c) * rhs(i,j,k,m,c) - - > lhs(i1,j,k,n+5,c) * sm1 - p = p + 2 - end do - end do - end do - -c--------------------------------------------------------------------- -c now unpack the buffer for the remaining two factors -c--------------------------------------------------------------------- - do m = 4, 5 - n = (m-3)*5 - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - sm1 = in_buffer(p+1) - sm2 = in_buffer(p+2) - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*sm1 - - > lhs(i,j,k,n+5,c)*sm2 - rhs(i1,j,k,m,c) = rhs(i1,j,k,m,c) - - > lhs(i1,j,k,n+4,c) * rhs(i,j,k,m,c) - - > lhs(i1,j,k,n+5,c) * sm1 - p = p + 2 - end do - end do - end do - - else - -c--------------------------------------------------------------------- -c now we know this is the first grid block on the back sweep, -c so we don't need a message to start the substitution. -c--------------------------------------------------------------------- - i = iend-1 - i1 = iend - n = 0 - do m = 1, 3 - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*rhs(i1,j,k,m,c) - end do - end do - end do - - do m = 4, 5 - n = (m-3)*5 - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*rhs(i1,j,k,m,c) - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c Whether or not this is the last processor, we always have -c to complete the back-substitution -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c The first three factors -c--------------------------------------------------------------------- - n = 0 - do m = 1, 3 - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - do i = iend-2, istart, -1 - i1 = i + 1 - i2 = i + 2 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*rhs(i1,j,k,m,c) - - > lhs(i,j,k,n+5,c)*rhs(i2,j,k,m,c) - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c And the remaining two -c--------------------------------------------------------------------- - do m = 4, 5 - n = (m-3)*5 - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - do i = iend-2, istart, -1 - i1 = i + 1 - i2 = i + 2 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*rhs(i1,j,k,m,c) - - > lhs(i,j,k,n+5,c)*rhs(i2,j,k,m,c) - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c send on information to the previous processor, if needed -c--------------------------------------------------------------------- - if (stage .ne. 1) then - i = istart - i1 = istart+1 - p = 0 - do m = 1, 5 - do k = start(3,c), ksize-end(3,c)-1 - do j = start(2,c), jsize-end(2,c)-1 - out_buffer(p+1) = rhs(i,j,k,m,c) - out_buffer(p+2) = rhs(i1,j,k,m,c) - p = p + 2 - end do - end do - end do - -c--------------------------------------------------------------------- -c pack and send the buffer -c--------------------------------------------------------------------- - call mpi_isend(out_buffer, 10*buffer_size, - > dp_type, predecessor(1), - > DEFAULT_TAG, comm_solve, - > requests(2), error) - - endif - -c--------------------------------------------------------------------- -c If this was the last stage, do the block-diagonal inversion -c--------------------------------------------------------------------- - if (stage .eq. 1) call ninvr(c) - - end do - - return - end - - - - - - - diff --git a/examples/smpi/NAS/SP/y_solve.f b/examples/smpi/NAS/SP/y_solve.f deleted file mode 100644 index fdcbb4d03f..0000000000 --- a/examples/smpi/NAS/SP/y_solve.f +++ /dev/null @@ -1,538 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine y_solve - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c this function performs the solution of the approximate factorization -c step in the y-direction for all five matrix components -c simultaneously. The Thomas algorithm is employed to solve the -c systems for the y-lines. Boundary conditions are non-periodic -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer i, j, k, stage, ip, kp, n, isize, jend, ksize, j1, j2, - > buffer_size, c, m, p, jstart, error, - > requests(2), statuses(MPI_STATUS_SIZE, 2) - double precision r1, r2, d, e, s(5), sm1, sm2, - > fac1, fac2 - - -c--------------------------------------------------------------------- -c now do a sweep on a layer-by-layer basis, i.e. sweeping through cells -c on this node in the direction of increasing i for the forward sweep, -c and after that reversing the direction for the backsubstitution -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c FORWARD ELIMINATION -c--------------------------------------------------------------------- - do stage = 1, ncells - c = slice(2,stage) - - jstart = 0 - jend = cell_size(2,c)-1 - - isize = cell_size(1,c) - ksize = cell_size(3,c) - ip = cell_coord(1,c)-1 - kp = cell_coord(3,c)-1 - - buffer_size = (isize-start(1,c)-end(1,c)) * - > (ksize-start(3,c)-end(3,c)) - - if ( stage .ne. 1) then - -c--------------------------------------------------------------------- -c if this is not the first processor in this row of cells, -c receive data from predecessor containing the right hand -c sides and the upper diagonal elements of the previous two rows -c--------------------------------------------------------------------- - - call mpi_irecv(in_buffer, 22*buffer_size, - > dp_type, predecessor(2), - > DEFAULT_TAG, comm_solve, - > requests(1), error) - -c--------------------------------------------------------------------- -c communication has already been started. -c compute the left hand side while waiting for the msg -c--------------------------------------------------------------------- - call lhsy(c) - -c--------------------------------------------------------------------- -c wait for pending communication to complete -c This waits on the current receive and on the send -c from the previous stage. They always come in pairs. -c--------------------------------------------------------------------- - call mpi_waitall(2, requests, statuses, error) - -c--------------------------------------------------------------------- -c unpack the buffer -c--------------------------------------------------------------------- - j = jstart - j1 = jstart + 1 - n = 0 -c--------------------------------------------------------------------- -c create a running pointer -c--------------------------------------------------------------------- - p = 0 - do k = start(3,c), ksize-end(3,c)-1 - do i = start(1,c), isize-end(1,c)-1 - lhs(i,j,k,n+2,c) = lhs(i,j,k,n+2,c) - - > in_buffer(p+1) * lhs(i,j,k,n+1,c) - lhs(i,j,k,n+3,c) = lhs(i,j,k,n+3,c) - - > in_buffer(p+2) * lhs(i,j,k,n+1,c) - do m = 1, 3 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > in_buffer(p+2+m) * lhs(i,j,k,n+1,c) - end do - d = in_buffer(p+6) - e = in_buffer(p+7) - do m = 1, 3 - s(m) = in_buffer(p+7+m) - end do - r1 = lhs(i,j,k,n+2,c) - lhs(i,j,k,n+3,c) = lhs(i,j,k,n+3,c) - d * r1 - lhs(i,j,k,n+4,c) = lhs(i,j,k,n+4,c) - e * r1 - do m = 1, 3 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - s(m) * r1 - end do - r2 = lhs(i,j1,k,n+1,c) - lhs(i,j1,k,n+2,c) = lhs(i,j1,k,n+2,c) - d * r2 - lhs(i,j1,k,n+3,c) = lhs(i,j1,k,n+3,c) - e * r2 - do m = 1, 3 - rhs(i,j1,k,m,c) = rhs(i,j1,k,m,c) - s(m) * r2 - end do - p = p + 10 - end do - end do - - do m = 4, 5 - n = (m-3)*5 - do k = start(3,c), ksize-end(3,c)-1 - do i = start(1,c), isize-end(1,c)-1 - lhs(i,j,k,n+2,c) = lhs(i,j,k,n+2,c) - - > in_buffer(p+1) * lhs(i,j,k,n+1,c) - lhs(i,j,k,n+3,c) = lhs(i,j,k,n+3,c) - - > in_buffer(p+2) * lhs(i,j,k,n+1,c) - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > in_buffer(p+3) * lhs(i,j,k,n+1,c) - d = in_buffer(p+4) - e = in_buffer(p+5) - s(m) = in_buffer(p+6) - r1 = lhs(i,j,k,n+2,c) - lhs(i,j,k,n+3,c) = lhs(i,j,k,n+3,c) - d * r1 - lhs(i,j,k,n+4,c) = lhs(i,j,k,n+4,c) - e * r1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - s(m) * r1 - r2 = lhs(i,j1,k,n+1,c) - lhs(i,j1,k,n+2,c) = lhs(i,j1,k,n+2,c) - d * r2 - lhs(i,j1,k,n+3,c) = lhs(i,j1,k,n+3,c) - e * r2 - rhs(i,j1,k,m,c) = rhs(i,j1,k,m,c) - s(m) * r2 - p = p + 6 - end do - end do - end do - - else - -c--------------------------------------------------------------------- -c if this IS the first cell, we still compute the lhs -c--------------------------------------------------------------------- - call lhsy(c) - endif - -c--------------------------------------------------------------------- -c perform the Thomas algorithm; first, FORWARD ELIMINATION -c--------------------------------------------------------------------- - n = 0 - - do k = start(3,c), ksize-end(3,c)-1 - do j = jstart, jend-2 - do i = start(1,c), isize-end(1,c)-1 - j1 = j + 1 - j2 = j + 2 - fac1 = 1.d0/lhs(i,j,k,n+3,c) - lhs(i,j,k,n+4,c) = fac1*lhs(i,j,k,n+4,c) - lhs(i,j,k,n+5,c) = fac1*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i,j,k,m,c) = fac1*rhs(i,j,k,m,c) - end do - lhs(i,j1,k,n+3,c) = lhs(i,j1,k,n+3,c) - - > lhs(i,j1,k,n+2,c)*lhs(i,j,k,n+4,c) - lhs(i,j1,k,n+4,c) = lhs(i,j1,k,n+4,c) - - > lhs(i,j1,k,n+2,c)*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i,j1,k,m,c) = rhs(i,j1,k,m,c) - - > lhs(i,j1,k,n+2,c)*rhs(i,j,k,m,c) - end do - lhs(i,j2,k,n+2,c) = lhs(i,j2,k,n+2,c) - - > lhs(i,j2,k,n+1,c)*lhs(i,j,k,n+4,c) - lhs(i,j2,k,n+3,c) = lhs(i,j2,k,n+3,c) - - > lhs(i,j2,k,n+1,c)*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i,j2,k,m,c) = rhs(i,j2,k,m,c) - - > lhs(i,j2,k,n+1,c)*rhs(i,j,k,m,c) - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c The last two rows in this grid block are a bit different, -c since they do not have two more rows available for the -c elimination of off-diagonal entries -c--------------------------------------------------------------------- - - j = jend - 1 - j1 = jend - do k = start(3,c), ksize-end(3,c)-1 - do i = start(1,c), isize-end(1,c)-1 - fac1 = 1.d0/lhs(i,j,k,n+3,c) - lhs(i,j,k,n+4,c) = fac1*lhs(i,j,k,n+4,c) - lhs(i,j,k,n+5,c) = fac1*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i,j,k,m,c) = fac1*rhs(i,j,k,m,c) - end do - lhs(i,j1,k,n+3,c) = lhs(i,j1,k,n+3,c) - - > lhs(i,j1,k,n+2,c)*lhs(i,j,k,n+4,c) - lhs(i,j1,k,n+4,c) = lhs(i,j1,k,n+4,c) - - > lhs(i,j1,k,n+2,c)*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i,j1,k,m,c) = rhs(i,j1,k,m,c) - - > lhs(i,j1,k,n+2,c)*rhs(i,j,k,m,c) - end do -c--------------------------------------------------------------------- -c scale the last row immediately (some of this is -c overkill in case this is the last cell) -c--------------------------------------------------------------------- - fac2 = 1.d0/lhs(i,j1,k,n+3,c) - lhs(i,j1,k,n+4,c) = fac2*lhs(i,j1,k,n+4,c) - lhs(i,j1,k,n+5,c) = fac2*lhs(i,j1,k,n+5,c) - do m = 1, 3 - rhs(i,j1,k,m,c) = fac2*rhs(i,j1,k,m,c) - end do - end do - end do - -c--------------------------------------------------------------------- -c do the u+c and the u-c factors -c--------------------------------------------------------------------- - do m = 4, 5 - n = (m-3)*5 - do k = start(3,c), ksize-end(3,c)-1 - do j = jstart, jend-2 - do i = start(1,c), isize-end(1,c)-1 - j1 = j + 1 - j2 = j + 2 - fac1 = 1.d0/lhs(i,j,k,n+3,c) - lhs(i,j,k,n+4,c) = fac1*lhs(i,j,k,n+4,c) - lhs(i,j,k,n+5,c) = fac1*lhs(i,j,k,n+5,c) - rhs(i,j,k,m,c) = fac1*rhs(i,j,k,m,c) - lhs(i,j1,k,n+3,c) = lhs(i,j1,k,n+3,c) - - > lhs(i,j1,k,n+2,c)*lhs(i,j,k,n+4,c) - lhs(i,j1,k,n+4,c) = lhs(i,j1,k,n+4,c) - - > lhs(i,j1,k,n+2,c)*lhs(i,j,k,n+5,c) - rhs(i,j1,k,m,c) = rhs(i,j1,k,m,c) - - > lhs(i,j1,k,n+2,c)*rhs(i,j,k,m,c) - lhs(i,j2,k,n+2,c) = lhs(i,j2,k,n+2,c) - - > lhs(i,j2,k,n+1,c)*lhs(i,j,k,n+4,c) - lhs(i,j2,k,n+3,c) = lhs(i,j2,k,n+3,c) - - > lhs(i,j2,k,n+1,c)*lhs(i,j,k,n+5,c) - rhs(i,j2,k,m,c) = rhs(i,j2,k,m,c) - - > lhs(i,j2,k,n+1,c)*rhs(i,j,k,m,c) - end do - end do - end do - -c--------------------------------------------------------------------- -c And again the last two rows separately -c--------------------------------------------------------------------- - j = jend - 1 - j1 = jend - do k = start(3,c), ksize-end(3,c)-1 - do i = start(1,c), isize-end(1,c)-1 - fac1 = 1.d0/lhs(i,j,k,n+3,c) - lhs(i,j,k,n+4,c) = fac1*lhs(i,j,k,n+4,c) - lhs(i,j,k,n+5,c) = fac1*lhs(i,j,k,n+5,c) - rhs(i,j,k,m,c) = fac1*rhs(i,j,k,m,c) - lhs(i,j1,k,n+3,c) = lhs(i,j1,k,n+3,c) - - > lhs(i,j1,k,n+2,c)*lhs(i,j,k,n+4,c) - lhs(i,j1,k,n+4,c) = lhs(i,j1,k,n+4,c) - - > lhs(i,j1,k,n+2,c)*lhs(i,j,k,n+5,c) - rhs(i,j1,k,m,c) = rhs(i,j1,k,m,c) - - > lhs(i,j1,k,n+2,c)*rhs(i,j,k,m,c) -c--------------------------------------------------------------------- -c Scale the last row immediately (some of this is overkill -c if this is the last cell) -c--------------------------------------------------------------------- - fac2 = 1.d0/lhs(i,j1,k,n+3,c) - lhs(i,j1,k,n+4,c) = fac2*lhs(i,j1,k,n+4,c) - lhs(i,j1,k,n+5,c) = fac2*lhs(i,j1,k,n+5,c) - rhs(i,j1,k,m,c) = fac2*rhs(i,j1,k,m,c) - - end do - end do - end do - -c--------------------------------------------------------------------- -c send information to the next processor, except when this -c is the last grid block; -c--------------------------------------------------------------------- - - if (stage .ne. ncells) then - -c--------------------------------------------------------------------- -c create a running pointer for the send buffer -c--------------------------------------------------------------------- - p = 0 - n = 0 - do k = start(3,c), ksize-end(3,c)-1 - do i = start(1,c), isize-end(1,c)-1 - do j = jend-1, jend - out_buffer(p+1) = lhs(i,j,k,n+4,c) - out_buffer(p+2) = lhs(i,j,k,n+5,c) - do m = 1, 3 - out_buffer(p+2+m) = rhs(i,j,k,m,c) - end do - p = p+5 - end do - end do - end do - - do m = 4, 5 - n = (m-3)*5 - do k = start(3,c), ksize-end(3,c)-1 - do i = start(1,c), isize-end(1,c)-1 - do j = jend-1, jend - out_buffer(p+1) = lhs(i,j,k,n+4,c) - out_buffer(p+2) = lhs(i,j,k,n+5,c) - out_buffer(p+3) = rhs(i,j,k,m,c) - p = p + 3 - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c pack and send the buffer -c--------------------------------------------------------------------- - call mpi_isend(out_buffer, 22*buffer_size, - > dp_type, successor(2), - > DEFAULT_TAG, comm_solve, - > requests(2), error) - - endif - end do - -c--------------------------------------------------------------------- -c now go in the reverse direction -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c BACKSUBSTITUTION -c--------------------------------------------------------------------- - do stage = ncells, 1, -1 - c = slice(2,stage) - - jstart = 0 - jend = cell_size(2,c)-1 - - isize = cell_size(1,c) - ksize = cell_size(3,c) - ip = cell_coord(1,c)-1 - kp = cell_coord(3,c)-1 - - buffer_size = (isize-start(1,c)-end(1,c)) * - > (ksize-start(3,c)-end(3,c)) - - if (stage .ne. ncells) then - -c--------------------------------------------------------------------- -c if this is not the starting cell in this row of cells, -c wait for a message to be received, containing the -c solution of the previous two stations -c--------------------------------------------------------------------- - - call mpi_irecv(in_buffer, 10*buffer_size, - > dp_type, successor(2), - > DEFAULT_TAG, comm_solve, - > requests(1), error) - - -c--------------------------------------------------------------------- -c communication has already been started -c while waiting, do the block-diagonal inversion for the -c cell that was just finished -c--------------------------------------------------------------------- - - call pinvr(slice(2,stage+1)) - -c--------------------------------------------------------------------- -c wait for pending communication to complete -c--------------------------------------------------------------------- - call mpi_waitall(2, requests, statuses, error) - -c--------------------------------------------------------------------- -c unpack the buffer for the first three factors -c--------------------------------------------------------------------- - n = 0 - p = 0 - j = jend - j1 = j - 1 - do m = 1, 3 - do k = start(3,c), ksize-end(3,c)-1 - do i = start(1,c), isize-end(1,c)-1 - sm1 = in_buffer(p+1) - sm2 = in_buffer(p+2) - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*sm1 - - > lhs(i,j,k,n+5,c)*sm2 - rhs(i,j1,k,m,c) = rhs(i,j1,k,m,c) - - > lhs(i,j1,k,n+4,c) * rhs(i,j,k,m,c) - - > lhs(i,j1,k,n+5,c) * sm1 - p = p + 2 - end do - end do - end do - -c--------------------------------------------------------------------- -c now unpack the buffer for the remaining two factors -c--------------------------------------------------------------------- - do m = 4, 5 - n = (m-3)*5 - do k = start(3,c), ksize-end(3,c)-1 - do i = start(1,c), isize-end(1,c)-1 - sm1 = in_buffer(p+1) - sm2 = in_buffer(p+2) - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*sm1 - - > lhs(i,j,k,n+5,c)*sm2 - rhs(i,j1,k,m,c) = rhs(i,j1,k,m,c) - - > lhs(i,j1,k,n+4,c) * rhs(i,j,k,m,c) - - > lhs(i,j1,k,n+5,c) * sm1 - p = p + 2 - end do - end do - end do - - else -c--------------------------------------------------------------------- -c now we know this is the first grid block on the back sweep, -c so we don't need a message to start the substitution. -c--------------------------------------------------------------------- - - j = jend - 1 - j1 = jend - n = 0 - do m = 1, 3 - do k = start(3,c), ksize-end(3,c)-1 - do i = start(1,c), isize-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*rhs(i,j1,k,m,c) - end do - end do - end do - - do m = 4, 5 - n = (m-3)*5 - do k = start(3,c), ksize-end(3,c)-1 - do i = start(1,c), isize-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*rhs(i,j1,k,m,c) - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c Whether or not this is the last processor, we always have -c to complete the back-substitution -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c The first three factors -c--------------------------------------------------------------------- - n = 0 - do m = 1, 3 - do k = start(3,c), ksize-end(3,c)-1 - do j = jend-2, jstart, -1 - do i = start(1,c), isize-end(1,c)-1 - j1 = j + 1 - j2 = j + 2 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*rhs(i,j1,k,m,c) - - > lhs(i,j,k,n+5,c)*rhs(i,j2,k,m,c) - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c And the remaining two -c--------------------------------------------------------------------- - do m = 4, 5 - n = (m-3)*5 - do k = start(3,c), ksize-end(3,c)-1 - do j = jend-2, jstart, -1 - do i = start(1,c), isize-end(1,c)-1 - j1 = j + 1 - j2 = j1 + 1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*rhs(i,j1,k,m,c) - - > lhs(i,j,k,n+5,c)*rhs(i,j2,k,m,c) - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c send on information to the previous processor, if needed -c--------------------------------------------------------------------- - if (stage .ne. 1) then - j = jstart - j1 = jstart + 1 - p = 0 - do m = 1, 5 - do k = start(3,c), ksize-end(3,c)-1 - do i = start(1,c), isize-end(1,c)-1 - out_buffer(p+1) = rhs(i,j,k,m,c) - out_buffer(p+2) = rhs(i,j1,k,m,c) - p = p + 2 - end do - end do - end do - -c--------------------------------------------------------------------- -c pack and send the buffer -c--------------------------------------------------------------------- - - call mpi_isend(out_buffer, 10*buffer_size, - > dp_type, predecessor(2), - > DEFAULT_TAG, comm_solve, - > requests(2), error) - - endif - -c--------------------------------------------------------------------- -c If this was the last stage, do the block-diagonal inversion -c--------------------------------------------------------------------- - if (stage .eq. 1) call pinvr(c) - - end do - - return - end - - - - - - - diff --git a/examples/smpi/NAS/SP/z_solve.f b/examples/smpi/NAS/SP/z_solve.f deleted file mode 100644 index ad0dc7e727..0000000000 --- a/examples/smpi/NAS/SP/z_solve.f +++ /dev/null @@ -1,532 +0,0 @@ - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - - subroutine z_solve - -c--------------------------------------------------------------------- -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c this function performs the solution of the approximate factorization -c step in the z-direction for all five matrix components -c simultaneously. The Thomas algorithm is employed to solve the -c systems for the z-lines. Boundary conditions are non-periodic -c--------------------------------------------------------------------- - - include 'header.h' - include 'mpinpb.h' - - integer i, j, k, stage, ip, jp, n, isize, jsize, kend, k1, k2, - > buffer_size, c, m, p, kstart, error, - > requests(2), statuses(MPI_STATUS_SIZE, 2) - double precision r1, r2, d, e, s(5), sm1, sm2, - > fac1, fac2 - -c--------------------------------------------------------------------- -c now do a sweep on a layer-by-layer basis, i.e. sweeping through cells -c on this node in the direction of increasing i for the forward sweep, -c and after that reversing the direction for the backsubstitution -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c FORWARD ELIMINATION -c--------------------------------------------------------------------- - do stage = 1, ncells - c = slice(3,stage) - - kstart = 0 - kend = cell_size(3,c)-1 - - isize = cell_size(1,c) - jsize = cell_size(2,c) - ip = cell_coord(1,c)-1 - jp = cell_coord(2,c)-1 - - buffer_size = (isize-start(1,c)-end(1,c)) * - > (jsize-start(2,c)-end(2,c)) - - if (stage .ne. 1) then - - -c--------------------------------------------------------------------- -c if this is not the first processor in this row of cells, -c receive data from predecessor containing the right hand -c sides and the upper diagonal elements of the previous two rows -c--------------------------------------------------------------------- - - call mpi_irecv(in_buffer, 22*buffer_size, - > dp_type, predecessor(3), - > DEFAULT_TAG, comm_solve, - > requests(1), error) - - -c--------------------------------------------------------------------- -c communication has already been started. -c compute the left hand side while waiting for the msg -c--------------------------------------------------------------------- - call lhsz(c) - -c--------------------------------------------------------------------- -c wait for pending communication to complete -c--------------------------------------------------------------------- - call mpi_waitall(2, requests, statuses, error) - -c--------------------------------------------------------------------- -c unpack the buffer -c--------------------------------------------------------------------- - k = kstart - k1 = kstart + 1 - n = 0 - -c--------------------------------------------------------------------- -c create a running pointer -c--------------------------------------------------------------------- - p = 0 - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - lhs(i,j,k,n+2,c) = lhs(i,j,k,n+2,c) - - > in_buffer(p+1) * lhs(i,j,k,n+1,c) - lhs(i,j,k,n+3,c) = lhs(i,j,k,n+3,c) - - > in_buffer(p+2) * lhs(i,j,k,n+1,c) - do m = 1, 3 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > in_buffer(p+2+m) * lhs(i,j,k,n+1,c) - end do - d = in_buffer(p+6) - e = in_buffer(p+7) - do m = 1, 3 - s(m) = in_buffer(p+7+m) - end do - r1 = lhs(i,j,k,n+2,c) - lhs(i,j,k,n+3,c) = lhs(i,j,k,n+3,c) - d * r1 - lhs(i,j,k,n+4,c) = lhs(i,j,k,n+4,c) - e * r1 - do m = 1, 3 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - s(m) * r1 - end do - r2 = lhs(i,j,k1,n+1,c) - lhs(i,j,k1,n+2,c) = lhs(i,j,k1,n+2,c) - d * r2 - lhs(i,j,k1,n+3,c) = lhs(i,j,k1,n+3,c) - e * r2 - do m = 1, 3 - rhs(i,j,k1,m,c) = rhs(i,j,k1,m,c) - s(m) * r2 - end do - p = p + 10 - end do - end do - - do m = 4, 5 - n = (m-3)*5 - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - lhs(i,j,k,n+2,c) = lhs(i,j,k,n+2,c) - - > in_buffer(p+1) * lhs(i,j,k,n+1,c) - lhs(i,j,k,n+3,c) = lhs(i,j,k,n+3,c) - - > in_buffer(p+2) * lhs(i,j,k,n+1,c) - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > in_buffer(p+3) * lhs(i,j,k,n+1,c) - d = in_buffer(p+4) - e = in_buffer(p+5) - s(m) = in_buffer(p+6) - r1 = lhs(i,j,k,n+2,c) - lhs(i,j,k,n+3,c) = lhs(i,j,k,n+3,c) - d * r1 - lhs(i,j,k,n+4,c) = lhs(i,j,k,n+4,c) - e * r1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - s(m) * r1 - r2 = lhs(i,j,k1,n+1,c) - lhs(i,j,k1,n+2,c) = lhs(i,j,k1,n+2,c) - d * r2 - lhs(i,j,k1,n+3,c) = lhs(i,j,k1,n+3,c) - e * r2 - rhs(i,j,k1,m,c) = rhs(i,j,k1,m,c) - s(m) * r2 - p = p + 6 - end do - end do - end do - - else - -c--------------------------------------------------------------------- -c if this IS the first cell, we still compute the lhs -c--------------------------------------------------------------------- - call lhsz(c) - endif - -c--------------------------------------------------------------------- -c perform the Thomas algorithm; first, FORWARD ELIMINATION -c--------------------------------------------------------------------- - n = 0 - - do k = kstart, kend-2 - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - k1 = k + 1 - k2 = k + 2 - fac1 = 1.d0/lhs(i,j,k,n+3,c) - lhs(i,j,k,n+4,c) = fac1*lhs(i,j,k,n+4,c) - lhs(i,j,k,n+5,c) = fac1*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i,j,k,m,c) = fac1*rhs(i,j,k,m,c) - end do - lhs(i,j,k1,n+3,c) = lhs(i,j,k1,n+3,c) - - > lhs(i,j,k1,n+2,c)*lhs(i,j,k,n+4,c) - lhs(i,j,k1,n+4,c) = lhs(i,j,k1,n+4,c) - - > lhs(i,j,k1,n+2,c)*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i,j,k1,m,c) = rhs(i,j,k1,m,c) - - > lhs(i,j,k1,n+2,c)*rhs(i,j,k,m,c) - end do - lhs(i,j,k2,n+2,c) = lhs(i,j,k2,n+2,c) - - > lhs(i,j,k2,n+1,c)*lhs(i,j,k,n+4,c) - lhs(i,j,k2,n+3,c) = lhs(i,j,k2,n+3,c) - - > lhs(i,j,k2,n+1,c)*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i,j,k2,m,c) = rhs(i,j,k2,m,c) - - > lhs(i,j,k2,n+1,c)*rhs(i,j,k,m,c) - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c The last two rows in this grid block are a bit different, -c since they do not have two more rows available for the -c elimination of off-diagonal entries -c--------------------------------------------------------------------- - k = kend - 1 - k1 = kend - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - fac1 = 1.d0/lhs(i,j,k,n+3,c) - lhs(i,j,k,n+4,c) = fac1*lhs(i,j,k,n+4,c) - lhs(i,j,k,n+5,c) = fac1*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i,j,k,m,c) = fac1*rhs(i,j,k,m,c) - end do - lhs(i,j,k1,n+3,c) = lhs(i,j,k1,n+3,c) - - > lhs(i,j,k1,n+2,c)*lhs(i,j,k,n+4,c) - lhs(i,j,k1,n+4,c) = lhs(i,j,k1,n+4,c) - - > lhs(i,j,k1,n+2,c)*lhs(i,j,k,n+5,c) - do m = 1, 3 - rhs(i,j,k1,m,c) = rhs(i,j,k1,m,c) - - > lhs(i,j,k1,n+2,c)*rhs(i,j,k,m,c) - end do -c--------------------------------------------------------------------- -c scale the last row immediately (some of this is -c overkill in case this is the last cell) -c--------------------------------------------------------------------- - fac2 = 1.d0/lhs(i,j,k1,n+3,c) - lhs(i,j,k1,n+4,c) = fac2*lhs(i,j,k1,n+4,c) - lhs(i,j,k1,n+5,c) = fac2*lhs(i,j,k1,n+5,c) - do m = 1, 3 - rhs(i,j,k1,m,c) = fac2*rhs(i,j,k1,m,c) - end do - end do - end do - -c--------------------------------------------------------------------- -c do the u+c and the u-c factors -c--------------------------------------------------------------------- - do m = 4, 5 - n = (m-3)*5 - do k = kstart, kend-2 - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - k1 = k + 1 - k2 = k + 2 - fac1 = 1.d0/lhs(i,j,k,n+3,c) - lhs(i,j,k,n+4,c) = fac1*lhs(i,j,k,n+4,c) - lhs(i,j,k,n+5,c) = fac1*lhs(i,j,k,n+5,c) - rhs(i,j,k,m,c) = fac1*rhs(i,j,k,m,c) - lhs(i,j,k1,n+3,c) = lhs(i,j,k1,n+3,c) - - > lhs(i,j,k1,n+2,c)*lhs(i,j,k,n+4,c) - lhs(i,j,k1,n+4,c) = lhs(i,j,k1,n+4,c) - - > lhs(i,j,k1,n+2,c)*lhs(i,j,k,n+5,c) - rhs(i,j,k1,m,c) = rhs(i,j,k1,m,c) - - > lhs(i,j,k1,n+2,c)*rhs(i,j,k,m,c) - lhs(i,j,k2,n+2,c) = lhs(i,j,k2,n+2,c) - - > lhs(i,j,k2,n+1,c)*lhs(i,j,k,n+4,c) - lhs(i,j,k2,n+3,c) = lhs(i,j,k2,n+3,c) - - > lhs(i,j,k2,n+1,c)*lhs(i,j,k,n+5,c) - rhs(i,j,k2,m,c) = rhs(i,j,k2,m,c) - - > lhs(i,j,k2,n+1,c)*rhs(i,j,k,m,c) - end do - end do - end do - -c--------------------------------------------------------------------- -c And again the last two rows separately -c--------------------------------------------------------------------- - k = kend - 1 - k1 = kend - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - fac1 = 1.d0/lhs(i,j,k,n+3,c) - lhs(i,j,k,n+4,c) = fac1*lhs(i,j,k,n+4,c) - lhs(i,j,k,n+5,c) = fac1*lhs(i,j,k,n+5,c) - rhs(i,j,k,m,c) = fac1*rhs(i,j,k,m,c) - lhs(i,j,k1,n+3,c) = lhs(i,j,k1,n+3,c) - - > lhs(i,j,k1,n+2,c)*lhs(i,j,k,n+4,c) - lhs(i,j,k1,n+4,c) = lhs(i,j,k1,n+4,c) - - > lhs(i,j,k1,n+2,c)*lhs(i,j,k,n+5,c) - rhs(i,j,k1,m,c) = rhs(i,j,k1,m,c) - - > lhs(i,j,k1,n+2,c)*rhs(i,j,k,m,c) -c--------------------------------------------------------------------- -c Scale the last row immediately (some of this is overkill -c if this is the last cell) -c--------------------------------------------------------------------- - fac2 = 1.d0/lhs(i,j,k1,n+3,c) - lhs(i,j,k1,n+4,c) = fac2*lhs(i,j,k1,n+4,c) - lhs(i,j,k1,n+5,c) = fac2*lhs(i,j,k1,n+5,c) - rhs(i,j,k1,m,c) = fac2*rhs(i,j,k1,m,c) - - end do - end do - end do - -c--------------------------------------------------------------------- -c send information to the next processor, except when this -c is the last grid block, -c--------------------------------------------------------------------- - - if (stage .ne. ncells) then - -c--------------------------------------------------------------------- -c create a running pointer for the send buffer -c--------------------------------------------------------------------- - p = 0 - n = 0 - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - do k = kend-1, kend - out_buffer(p+1) = lhs(i,j,k,n+4,c) - out_buffer(p+2) = lhs(i,j,k,n+5,c) - do m = 1, 3 - out_buffer(p+2+m) = rhs(i,j,k,m,c) - end do - p = p+5 - end do - end do - end do - - do m = 4, 5 - n = (m-3)*5 - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - do k = kend-1, kend - out_buffer(p+1) = lhs(i,j,k,n+4,c) - out_buffer(p+2) = lhs(i,j,k,n+5,c) - out_buffer(p+3) = rhs(i,j,k,m,c) - p = p + 3 - end do - end do - end do - end do - - - call mpi_isend(out_buffer, 22*buffer_size, - > dp_type, successor(3), - > DEFAULT_TAG, comm_solve, - > requests(2), error) - - endif - end do - -c--------------------------------------------------------------------- -c now go in the reverse direction -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c BACKSUBSTITUTION -c--------------------------------------------------------------------- - do stage = ncells, 1, -1 - c = slice(3,stage) - - kstart = 0 - kend = cell_size(3,c)-1 - - isize = cell_size(1,c) - jsize = cell_size(2,c) - ip = cell_coord(1,c)-1 - jp = cell_coord(2,c)-1 - - buffer_size = (isize-start(1,c)-end(1,c)) * - > (jsize-start(2,c)-end(2,c)) - - if (stage .ne. ncells) then - -c--------------------------------------------------------------------- -c if this is not the starting cell in this row of cells, -c wait for a message to be received, containing the -c solution of the previous two stations -c--------------------------------------------------------------------- - - call mpi_irecv(in_buffer, 10*buffer_size, - > dp_type, successor(3), - > DEFAULT_TAG, comm_solve, - > requests(1), error) - - -c--------------------------------------------------------------------- -c communication has already been started -c while waiting, do the block-diagonal inversion for the -c cell that was just finished -c--------------------------------------------------------------------- - - call tzetar(slice(3,stage+1)) - -c--------------------------------------------------------------------- -c wait for pending communication to complete -c--------------------------------------------------------------------- - call mpi_waitall(2, requests, statuses, error) - -c--------------------------------------------------------------------- -c unpack the buffer for the first three factors -c--------------------------------------------------------------------- - n = 0 - p = 0 - k = kend - k1 = k - 1 - do m = 1, 3 - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - sm1 = in_buffer(p+1) - sm2 = in_buffer(p+2) - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*sm1 - - > lhs(i,j,k,n+5,c)*sm2 - rhs(i,j,k1,m,c) = rhs(i,j,k1,m,c) - - > lhs(i,j,k1,n+4,c) * rhs(i,j,k,m,c) - - > lhs(i,j,k1,n+5,c) * sm1 - p = p + 2 - end do - end do - end do - -c--------------------------------------------------------------------- -c now unpack the buffer for the remaining two factors -c--------------------------------------------------------------------- - do m = 4, 5 - n = (m-3)*5 - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - sm1 = in_buffer(p+1) - sm2 = in_buffer(p+2) - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*sm1 - - > lhs(i,j,k,n+5,c)*sm2 - rhs(i,j,k1,m,c) = rhs(i,j,k1,m,c) - - > lhs(i,j,k1,n+4,c) * rhs(i,j,k,m,c) - - > lhs(i,j,k1,n+5,c) * sm1 - p = p + 2 - end do - end do - end do - - else - -c--------------------------------------------------------------------- -c now we know this is the first grid block on the back sweep, -c so we don't need a message to start the substitution. -c--------------------------------------------------------------------- - - k = kend - 1 - k1 = kend - n = 0 - do m = 1, 3 - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*rhs(i,j,k1,m,c) - end do - end do - end do - - do m = 4, 5 - n = (m-3)*5 - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*rhs(i,j,k1,m,c) - end do - end do - end do - endif - -c--------------------------------------------------------------------- -c Whether or not this is the last processor, we always have -c to complete the back-substitution -c--------------------------------------------------------------------- - -c--------------------------------------------------------------------- -c The first three factors -c--------------------------------------------------------------------- - n = 0 - do m = 1, 3 - do k = kend-2, kstart, -1 - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - k1 = k + 1 - k2 = k + 2 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*rhs(i,j,k1,m,c) - - > lhs(i,j,k,n+5,c)*rhs(i,j,k2,m,c) - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c And the remaining two -c--------------------------------------------------------------------- - do m = 4, 5 - n = (m-3)*5 - do k = kend-2, kstart, -1 - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - k1 = k + 1 - k2 = k + 2 - rhs(i,j,k,m,c) = rhs(i,j,k,m,c) - - > lhs(i,j,k,n+4,c)*rhs(i,j,k1,m,c) - - > lhs(i,j,k,n+5,c)*rhs(i,j,k2,m,c) - end do - end do - end do - end do - -c--------------------------------------------------------------------- -c send on information to the previous processor, if needed -c--------------------------------------------------------------------- - if (stage .ne. 1) then - k = kstart - k1 = kstart + 1 - p = 0 - do m = 1, 5 - do j = start(2,c), jsize-end(2,c)-1 - do i = start(1,c), isize-end(1,c)-1 - out_buffer(p+1) = rhs(i,j,k,m,c) - out_buffer(p+2) = rhs(i,j,k1,m,c) - p = p + 2 - end do - end do - end do - - call mpi_isend(out_buffer, 10*buffer_size, - > dp_type, predecessor(3), - > DEFAULT_TAG, comm_solve, - > requests(2), error) - - endif - -c--------------------------------------------------------------------- -c If this was the last stage, do the block-diagonal inversion -c--------------------------------------------------------------------- - if (stage .eq. 1) call tzetar(c) - - end do - - return - end - - - - - - - diff --git a/examples/smpi/energy/CMakeLists.txt b/examples/smpi/energy/CMakeLists.txt index d4372a9876..c6efd6e00d 100644 --- a/examples/smpi/energy/CMakeLists.txt +++ b/examples/smpi/energy/CMakeLists.txt @@ -8,7 +8,7 @@ if(enable_smpi) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(se se.c) target_link_libraries(se simgrid) diff --git a/examples/smpi/energy/energy.tesh b/examples/smpi/energy/energy.tesh index 0520bc2118..2f2126694a 100644 --- a/examples/smpi/energy/energy.tesh +++ b/examples/smpi/energy/energy.tesh @@ -16,5 +16,5 @@ $ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile -platf > [30.000000] [rank 0] Energy consumed: 5400 Joules. > [30.000000] [rank 0] Current pstate: 2; Current power: 20000000 > [80.000000] [rank 0] Energy consumed: 12900 Joules. -> [80.000000] [surf_energy/INFO] Total energy (Joules) of host MyHost1: 12900.000000 -> [80.000000] [surf_energy/INFO] Total energy (Joules) of host MyHost2: 2000.000000 +> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 12900.000000 Joules +> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 9000.000000 Joules diff --git a/examples/smpi/energy/f77/energy.tesh b/examples/smpi/energy/f77/energy.tesh index 82fa1fc764..825c29c9c1 100644 --- a/examples/smpi/energy/f77/energy.tesh +++ b/examples/smpi/energy/f77/energy.tesh @@ -7,8 +7,8 @@ $ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile -platf > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'smpi/cpu_threshold' to '-1' > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'plugin' to 'Energy' > [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s) -> [80.000000] [surf_energy/INFO] Total energy (Joules) of host MyHost1: 12900.000000 -> [80.000000] [surf_energy/INFO] Total energy (Joules) of host MyHost2: 2000.000000 +> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 12900.000000 Joules +> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 9000.000000 Joules > [ 0.0000000000000000 ] [rank 0 ] 3 pstates available > [ 0.0000000000000000 ] [rank 1 ] 1 pstates available > [ 0.0000000000000000 ] [rank 0 ] Power: 100000000.00000000 diff --git a/examples/smpi/energy/f90/energy.tesh b/examples/smpi/energy/f90/energy.tesh index 7b750ef509..da687b9f6f 100644 --- a/examples/smpi/energy/f90/energy.tesh +++ b/examples/smpi/energy/f90/energy.tesh @@ -7,8 +7,8 @@ $ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile -platf > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'smpi/cpu_threshold' to '-1' > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'plugin' to 'Energy' > [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s) -> [80.000000] [surf_energy/INFO] Total energy (Joules) of host MyHost1: 12900.000000 -> [80.000000] [surf_energy/INFO] Total energy (Joules) of host MyHost2: 2000.000000 +> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 12900.000000 Joules +> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 9000.000000 Joules > [ 0.0000000000000000 ] [rank 0 ] 3 pstates available > [ 0.0000000000000000 ] [rank 1 ] 1 pstates available > [ 0.0000000000000000 ] [rank 0 ] Power: 100000000.00000000 diff --git a/examples/smpi/replay/smpi_replay.tesh b/examples/smpi/replay/smpi_replay.tesh index 1f5bc8065a..bb086c016c 100644 --- a/examples/smpi/replay/smpi_replay.tesh +++ b/examples/smpi/replay/smpi_replay.tesh @@ -209,17 +209,18 @@ $ tail -n +3 ./simgrid.trace > 12 13.138198 2 3 7 > 5 8 2 smpi_replay_finalize "0 1 0" > 13 14.286929 2 2 +> 12 14.286929 2 2 8 > 13 18.250974 2 1 +> 12 18.250974 2 1 8 > 13 19.691622 2 3 -> 12 19.695603 2 1 8 -> 12 19.698548 2 2 8 -> 12 19.699584 2 3 8 -> 13 19.699584 2 3 -> 7 19.699584 1 3 -> 13 19.699584 2 1 -> 7 19.699584 1 1 -> 13 19.699584 2 2 -> 7 19.699584 1 2 +> 12 19.691622 2 3 8 +> 13 19.691622 2 3 +> 7 19.691622 1 3 +> 13 19.691622 2 2 +> 7 19.691622 1 2 +> 13 19.691622 2 1 +> 7 19.691622 1 1 + diff --git a/examples/smpi/replay_multiple/CMakeLists.txt b/examples/smpi/replay_multiple/CMakeLists.txt index 493df3d6a8..2f9afa5dcd 100644 --- a/examples/smpi/replay_multiple/CMakeLists.txt +++ b/examples/smpi/replay_multiple/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.6) if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(replay_multiple replay_multiple.c) target_link_libraries(replay_multiple simgrid) diff --git a/examples/smpi/replay_multiple/replay_multiple.tesh b/examples/smpi/replay_multiple/replay_multiple.tesh index 0d68e08742..0b1a1dfd39 100644 --- a/examples/smpi/replay_multiple/replay_multiple.tesh +++ b/examples/smpi/replay_multiple/replay_multiple.tesh @@ -1,13 +1,13 @@ p Test the replay with multiple instances p first generate the deployment file -$ ./generate_multiple_deployment.sh -platform ${srcdir:=.}/../../platforms/small_platform_with_routers.xml -hostfile ${srcdir:=.}/../hostfile ${srcdir:=.}/description_file deployment.xml +$ ${srcdir:=.}/generate_multiple_deployment.sh -platform ${srcdir:=.}/../../platforms/small_platform_with_routers.xml -hostfile ${srcdir:=.}/../hostfile ${srcdir:=.}/description_file deployment.xml $ ./replay_multiple description_file ${srcdir:=.}/../../platforms/small_platform_with_routers.xml deployment.xml --log=smpi.:info > [0.000000] [msg_test/INFO] Initializing instance 1 of size 32 > [0.000000] [msg_test/INFO] Initializing instance 2 of size 32 > [0.000000] [smpi_kernel/INFO] You did not set the power of the host running the simulation. The timings will certainly not be accurate. Use the option "--cfg=smpi/running_power:" to set its value.Check http://simgrid.org/simgrid/latest/doc/options.html#options_smpi_bench for more information. -> [Fafard:2:(53) 1140967.830052] [smpi_replay/INFO] Simulation time 1123895.291050 -> [1140967.964219] [msg_test/INFO] Simulation time 1.14097e+06 +> [Fafard:2:(53) 1140967.830052] [smpi_replay/INFO] Simulation time 1123895.291051 +> [1140967.830052] [msg_test/INFO] Simulation time 1.14097e+06 $ rm -f deployment.xml diff --git a/examples/smpi/smpi_msg_masterslave/CMakeLists.txt b/examples/smpi/smpi_msg_masterslave/CMakeLists.txt index 5d03cf60a9..0c42986f03 100644 --- a/examples/smpi/smpi_msg_masterslave/CMakeLists.txt +++ b/examples/smpi/smpi_msg_masterslave/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.6) if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(masterslave_mailbox_smpi masterslave_mailbox_smpi.c) target_link_libraries(masterslave_mailbox_smpi simgrid) diff --git a/include/msg/msg.h b/include/msg/msg.h index 5fceca3e31..32a2de4507 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -136,11 +136,11 @@ XBT_PUBLIC(int) MSG_host_is_off(msg_host_t h); XBT_PUBLIC(void) __MSG_host_priv_free(msg_host_priv_t priv); XBT_PUBLIC(void) __MSG_host_destroy(msg_host_t host); -XBT_PUBLIC(double) MSG_get_host_power_peak_at(msg_host_t h, int pstate_index); -XBT_PUBLIC(double) MSG_get_host_current_power_peak(msg_host_t h); -XBT_PUBLIC(int) MSG_get_host_nb_pstates(msg_host_t h); -XBT_PUBLIC(void) MSG_set_host_power_peak_at(msg_host_t h, int pstate); -XBT_PUBLIC(double) MSG_get_host_consumed_energy(msg_host_t h); +XBT_PUBLIC(double) MSG_host_get_power_peak_at(msg_host_t h, int pstate); +XBT_PUBLIC(double) MSG_host_get_current_power_peak(msg_host_t h); +XBT_PUBLIC(int) MSG_host_get_pstate_number(msg_host_t h); +XBT_PUBLIC(void) MSG_host_set_pstate(msg_host_t h, int pstate); +XBT_PUBLIC(double) MSG_host_get_consumed_energy(msg_host_t h); /*property handlers*/ XBT_PUBLIC(xbt_dict_t) MSG_host_get_properties(msg_host_t host); @@ -297,7 +297,7 @@ XBT_PUBLIC(msg_comm_t) MSG_task_isend(msg_task_t task, const char *alias); XBT_PUBLIC(msg_comm_t) MSG_task_isend_bounded(msg_task_t task, const char *alias, double maxrate); XBT_PUBLIC(msg_comm_t) MSG_task_isend_with_matching(msg_task_t task, const char *alias, - int (*match_fun)(void*,void*, smx_action_t), + int (*match_fun)(void*,void*, smx_synchro_t), void *match_data); XBT_PUBLIC(void) MSG_task_dsend(msg_task_t task, const char *alias, void_f_pvoid_t cleanup); @@ -509,11 +509,5 @@ xbt_dynar_t MSG_vm_get_list_from_hosts(msg_dynar_t) /* Used only by the bindings -- unclean pimple, please ignore if you're not writing a binding */ XBT_PUBLIC(smx_context_t) MSG_process_get_smx_ctx(msg_process_t process); -/* ****************************************************************************************** */ -/* TUTORIAL: New API */ -/* Declare all functions for the API */ -/* ****************************************************************************************** */ -XBT_PUBLIC(int) MSG_new_API_fct(const char* param1, double param2); - SG_END_DECL() #endif diff --git a/include/simgrid/datatypes.h b/include/simgrid/datatypes.h index 006da0af5c..e46e72b00b 100644 --- a/include/simgrid/datatypes.h +++ b/include/simgrid/datatypes.h @@ -22,9 +22,6 @@ typedef struct ws_params { double dp_rate; double dp_cap; /* bytes per 1 flop execution */ - double xfer_cpu_overhead; - double dpt_cpu_overhead; - /* set migration speed */ double mig_speed; } s_ws_params_t, *ws_params_t; diff --git a/include/simgrid/modelchecker.h b/include/simgrid/modelchecker.h index 34d9124df0..0d41344468 100644 --- a/include/simgrid/modelchecker.h +++ b/include/simgrid/modelchecker.h @@ -6,6 +6,8 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include + #include /* HAVE_MC ? */ #include #include "xbt/automaton.h" @@ -15,6 +17,8 @@ SG_BEGIN_DECL() +XBT_PUBLIC(int) MC_random(int min, int max); + #ifdef HAVE_MC extern int _sg_do_model_check; /* please don't use directly: we inline MC_is_active, but that's what you should use */ @@ -24,7 +28,6 @@ extern int _sg_mc_visited; #define MC_visited_reduction() _sg_mc_visited XBT_PUBLIC(void) MC_assert(int); -XBT_PUBLIC(int) MC_random(int min, int max); XBT_PUBLIC(void) MC_automaton_new_propositional_symbol(const char* id, void* fct); XBT_PUBLIC(void *) MC_snapshot(void); XBT_PUBLIC(int) MC_compare_snapshots(void *s1, void *s2); @@ -37,7 +40,6 @@ XBT_PUBLIC(void) MC_ignore(void *addr, size_t size); #define MC_visited_reduction() 0 #define MC_assert(a) xbt_assert(a) -#define MC_random(a, b) 0 #define MC_automaton_new_propositional_symbol(a, b) ((void)0) #define MC_snapshot() ((void*)0) #define MC_compare_snapshots(a, b) 0 @@ -46,6 +48,17 @@ XBT_PUBLIC(void) MC_ignore(void *addr, size_t size); #endif +/** Replay path (if any) in string representation + * + * This is a path as generated by `MC_record_stack_to_string()`. + */ +XBT_PUBLIC_DATA(char*) MC_record_path; + +/** Whether the replay mode is enabled */ +static inline bool MC_record_replay_is_active(void) { + return MC_record_path; +} + SG_END_DECL() #endif /* SIMGRID_MODELCHECKER_H */ diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 42b50d413f..0fac060d55 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -75,8 +75,8 @@ typedef struct s_smx_file *smx_file_t; typedef xbt_dictelm_t smx_storage_t; typedef struct s_smx_storage_priv *smx_storage_priv_t; -/********************************** Action *************************************/ -typedef struct s_smx_action *smx_action_t; /* FIXME: replace by specialized action handlers */ +/********************************** Synchro *************************************/ +typedef struct s_smx_synchro *smx_synchro_t; /* FIXME: replace by specialized synchro handlers */ /* ****************************** Process *********************************** */ /** @brief Process datatype @@ -124,8 +124,8 @@ typedef void (*smx_creation_func_t) ( /* process */ smx_process_t*, */ typedef struct s_smx_rvpoint *smx_rdv_t; -XBT_PUBLIC(void*) SIMIX_comm_get_src_data(smx_action_t action); -XBT_PUBLIC(void*) SIMIX_comm_get_dst_data(smx_action_t action); +XBT_PUBLIC(void*) SIMIX_comm_get_src_data(smx_synchro_t synchro); +XBT_PUBLIC(void*) SIMIX_comm_get_dst_data(smx_synchro_t synchro); /******************************** Context *************************************/ typedef struct s_smx_context *smx_context_t; @@ -281,14 +281,14 @@ XBT_PUBLIC(void) SIMIX_process_on_exit_runall(smx_process_t process); XBT_PUBLIC(void) SIMIX_process_on_exit(smx_process_t process, int_f_pvoid_pvoid_t fun, void *data); /****************************** Communication *********************************/ -XBT_PUBLIC(void) SIMIX_comm_set_copy_data_callback(void (*callback) (smx_action_t, void*, size_t)); -XBT_PUBLIC(void) SIMIX_comm_copy_pointer_callback(smx_action_t comm, void* buff, size_t buff_size); -XBT_PUBLIC(void) SIMIX_comm_copy_buffer_callback(smx_action_t comm, void* buff, size_t buff_size); +XBT_PUBLIC(void) SIMIX_comm_set_copy_data_callback(void (*callback) (smx_synchro_t, void*, size_t)); +XBT_PUBLIC(void) SIMIX_comm_copy_pointer_callback(smx_synchro_t comm, void* buff, size_t buff_size); +XBT_PUBLIC(void) SIMIX_comm_copy_buffer_callback(smx_synchro_t comm, void* buff, size_t buff_size); -XBT_PUBLIC(smx_action_t) SIMIX_comm_get_send_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data); +XBT_PUBLIC(smx_synchro_t) SIMIX_comm_get_send_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data); XBT_PUBLIC(int) SIMIX_comm_has_send_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data); XBT_PUBLIC(int) SIMIX_comm_has_recv_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data); -XBT_PUBLIC(void) SIMIX_comm_finish(smx_action_t action); +XBT_PUBLIC(void) SIMIX_comm_finish(smx_synchro_t synchro); /******************************************************************************/ /* SIMIX simcalls */ @@ -320,24 +320,24 @@ XBT_PUBLIC(int) simcall_host_get_nb_pstates(smx_host_t host); XBT_PUBLIC(void) simcall_host_set_power_peak_at(smx_host_t host, int pstate_index); XBT_PUBLIC(double) simcall_host_get_consumed_energy(smx_host_t host); -XBT_PUBLIC(smx_action_t) simcall_host_execute(const char *name, smx_host_t host, +XBT_PUBLIC(smx_synchro_t) simcall_host_execute(const char *name, smx_host_t host, double computation_amount, double priority, double bound, unsigned long affinity_mask); -XBT_PUBLIC(smx_action_t) simcall_host_parallel_execute(const char *name, +XBT_PUBLIC(smx_synchro_t) simcall_host_parallel_execute(const char *name, int host_nb, smx_host_t *host_list, double *computation_amount, double *communication_amount, double amount, double rate); -XBT_PUBLIC(void) simcall_host_execution_destroy(smx_action_t execution); -XBT_PUBLIC(void) simcall_host_execution_cancel(smx_action_t execution); -XBT_PUBLIC(double) simcall_host_execution_get_remains(smx_action_t execution); -XBT_PUBLIC(e_smx_state_t) simcall_host_execution_get_state(smx_action_t execution); -XBT_PUBLIC(void) simcall_host_execution_set_priority(smx_action_t execution, double priority); -XBT_PUBLIC(void) simcall_host_execution_set_bound(smx_action_t execution, double bound); -XBT_PUBLIC(void) simcall_host_execution_set_affinity(smx_action_t execution, smx_host_t host, unsigned long mask); -XBT_PUBLIC(e_smx_state_t) simcall_host_execution_wait(smx_action_t execution); +XBT_PUBLIC(void) simcall_host_execution_destroy(smx_synchro_t execution); +XBT_PUBLIC(void) simcall_host_execution_cancel(smx_synchro_t execution); +XBT_PUBLIC(double) simcall_host_execution_get_remains(smx_synchro_t execution); +XBT_PUBLIC(e_smx_state_t) simcall_host_execution_get_state(smx_synchro_t execution); +XBT_PUBLIC(void) simcall_host_execution_set_priority(smx_synchro_t execution, double priority); +XBT_PUBLIC(void) simcall_host_execution_set_bound(smx_synchro_t execution, double bound); +XBT_PUBLIC(void) simcall_host_execution_set_affinity(smx_synchro_t execution, smx_host_t host, unsigned long mask); +XBT_PUBLIC(e_smx_state_t) simcall_host_execution_wait(smx_synchro_t execution); XBT_PUBLIC(xbt_dict_t) simcall_host_get_mounted_storage_list(smx_host_t host); XBT_PUBLIC(xbt_dynar_t) simcall_host_get_attached_storage_list(smx_host_t host); XBT_PUBLIC(void) simcall_host_get_params(smx_host_t vm, ws_params_t param); @@ -408,7 +408,7 @@ XBT_PUBLIC(smx_rdv_t) simcall_rdv_create(const char *name); XBT_PUBLIC(void) simcall_rdv_destroy(smx_rdv_t rvp); XBT_PUBLIC(smx_rdv_t) simcall_rdv_get_by_name(const char *name); XBT_PUBLIC(int) simcall_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host); -XBT_PUBLIC(smx_action_t) simcall_rdv_get_head(smx_rdv_t rdv); +XBT_PUBLIC(smx_synchro_t) simcall_rdv_get_head(smx_rdv_t rdv); XBT_PUBLIC(smx_process_t) simcall_rdv_get_receiver(smx_rdv_t rdv); XBT_PUBLIC(void) simcall_rdv_set_receiver(smx_rdv_t rdv , smx_process_t process); @@ -419,56 +419,56 @@ XBT_PUBLIC(xbt_dict_t) SIMIX_get_rdv_points(void); XBT_PUBLIC(void) simcall_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void *src_buff, size_t src_buff_size, - int (*match_fun)(void *, void *, smx_action_t), - void (*copy_data_fun)(smx_action_t, void*, size_t), + int (*match_fun)(void *, void *, smx_synchro_t), + void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double timeout); -XBT_PUBLIC(smx_action_t) simcall_comm_isend(smx_process_t src, smx_rdv_t rdv, +XBT_PUBLIC(smx_synchro_t) simcall_comm_isend(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void *src_buff, size_t src_buff_size, - int (*match_fun)(void *, void *, smx_action_t), + int (*match_fun)(void *, void *, smx_synchro_t), void (*clean_fun)(void *), - void (*copy_data_fun)(smx_action_t, void*, size_t), + void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, int detached); XBT_PUBLIC(void) simcall_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, - int (*match_fun)(void *, void *, smx_action_t), - void (*copy_data_fun)(smx_action_t, void*, size_t), + int (*match_fun)(void *, void *, smx_synchro_t), + void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double timeout, double rate); -XBT_PUBLIC(smx_action_t) simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, +XBT_PUBLIC(smx_synchro_t) simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, - int (*match_fun)(void *, void *, smx_action_t), - void (*copy_data_fun)(smx_action_t, void*, size_t), + int (*match_fun)(void *, void *, smx_synchro_t), + void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double rate); -XBT_PUBLIC(smx_action_t) simcall_comm_iprobe(smx_rdv_t rdv, int type, int src, int tag, - int (*match_fun)(void *, void *, smx_action_t), void *data); -XBT_PUBLIC(void) simcall_comm_cancel(smx_action_t comm); +XBT_PUBLIC(smx_synchro_t) simcall_comm_iprobe(smx_rdv_t rdv, int type, int src, int tag, + int (*match_fun)(void *, void *, smx_synchro_t), void *data); +XBT_PUBLIC(void) simcall_comm_cancel(smx_synchro_t comm); /* FIXME: waitany is going to be a vararg function, and should take a timeout */ XBT_PUBLIC(unsigned int) simcall_comm_waitany(xbt_dynar_t comms); -XBT_PUBLIC(void) simcall_comm_wait(smx_action_t comm, double timeout); -XBT_PUBLIC(int) simcall_comm_test(smx_action_t comm); +XBT_PUBLIC(void) simcall_comm_wait(smx_synchro_t comm, double timeout); +XBT_PUBLIC(int) simcall_comm_test(smx_synchro_t comm); XBT_PUBLIC(int) simcall_comm_testany(xbt_dynar_t comms); /* Getters and setters */ -XBT_PUBLIC(double) simcall_comm_get_remains(smx_action_t comm); -XBT_PUBLIC(e_smx_state_t) simcall_comm_get_state(smx_action_t comm); -XBT_PUBLIC(void *) simcall_comm_get_src_data(smx_action_t comm); -XBT_PUBLIC(void *) simcall_comm_get_dst_data(smx_action_t comm); -XBT_PUBLIC(smx_process_t) simcall_comm_get_src_proc(smx_action_t comm); -XBT_PUBLIC(smx_process_t) simcall_comm_get_dst_proc(smx_action_t comm); +XBT_PUBLIC(double) simcall_comm_get_remains(smx_synchro_t comm); +XBT_PUBLIC(e_smx_state_t) simcall_comm_get_state(smx_synchro_t comm); +XBT_PUBLIC(void *) simcall_comm_get_src_data(smx_synchro_t comm); +XBT_PUBLIC(void *) simcall_comm_get_dst_data(smx_synchro_t comm); +XBT_PUBLIC(smx_process_t) simcall_comm_get_src_proc(smx_synchro_t comm); +XBT_PUBLIC(smx_process_t) simcall_comm_get_dst_proc(smx_synchro_t comm); #ifdef HAVE_LATENCY_BOUND_TRACKING -XBT_PUBLIC(int) simcall_comm_is_latency_bounded(smx_action_t comm); +XBT_PUBLIC(int) simcall_comm_is_latency_bounded(smx_synchro_t comm); #endif #ifdef HAVE_TRACING /************************** Tracing handling **********************************/ -XBT_PUBLIC(void) simcall_set_category(smx_action_t action, const char *category); +XBT_PUBLIC(void) simcall_set_category(smx_synchro_t synchro, const char *category); #endif /************************** Synchro simcalls **********************************/ @@ -531,10 +531,5 @@ XBT_PUBLIC(void *) simcall_mc_snapshot(void); XBT_PUBLIC(int) simcall_mc_compare_snapshots(void *s1, void *s2); XBT_PUBLIC(int) simcall_mc_random(int min, int max); -/************************** New API simcalls **********************************/ -/* TUTORIAL: New API */ -/******************************************************************************/ -XBT_PUBLIC(int) simcall_new_api_fct(const char* param1, double param2); - SG_END_DECL() #endif /* _SIMIX_SIMIX_H */ diff --git a/include/smpi/mpif.h.in b/include/smpi/mpif.h.in index 573221714d..0c07bbb188 100644 --- a/include/smpi/mpif.h.in +++ b/include/smpi/mpif.h.in @@ -91,7 +91,7 @@ parameter(MPI_IO=0) integer MPI_ROOT, MPI_INFO_NULL,MPI_COMM_TYPE_SHARED parameter(MPI_ROOT=0) - parameter(MPI_INFO_NULL=-1) + parameter(MPI_INFO_NULL=0) parameter(MPI_COMM_TYPE_SHARED=1) ! These should be ordered as in smpi_f77.c @@ -137,6 +137,7 @@ integer MPI_LOGICAL8, MPI_2REAL, MPI_2DOUBLE_PRECISION integer MPI_AINT, MPI_OFFSET, MPI_COUNT integer MPI_REAL16, MPI_COMPLEX8,MPI_COMPLEX16,MPI_COMPLEX32 + integer MPI_PACKED parameter(MPI_DATATYPE_NULL=-1) parameter(MPI_BYTE=0) parameter(MPI_CHARACTER=1) @@ -166,6 +167,7 @@ parameter(MPI_COMPLEX8=24) parameter(MPI_COMPLEX16=25) parameter(MPI_COMPLEX32=26) + parameter(MPI_PACKED=27) diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index 4b96b5279f..0b8a267e64 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -69,6 +69,9 @@ SG_BEGIN_DECL() #define MPI_ERR_TOPOLOGY 18 #define MPI_ERR_NO_MEM 19 #define MPI_ERR_WIN 20 +#define MPI_ERR_INFO_VALUE 21 +#define MPI_ERR_INFO_KEY 22 +#define MPI_ERR_INFO_NOKEY 23 #define MPI_ERRCODES_IGNORE (int *)0 #define MPI_IDENT 0 #define MPI_SIMILAR 1 @@ -111,7 +114,7 @@ SG_BEGIN_DECL() #define MPI_TYPECLASS_INTEGER 1 #define MPI_TYPECLASS_COMPLEX 2 #define MPI_ROOT 0 -#define MPI_INFO_NULL -1 +#define MPI_INFO_NULL NULL #define MPI_COMM_TYPE_SHARED 1 #define MPI_WIN_NULL NULL @@ -170,7 +173,8 @@ typedef struct { struct s_smpi_mpi_win; typedef struct s_smpi_mpi_win* MPI_Win; -typedef int MPI_Info; +struct s_smpi_mpi_info; +typedef struct s_smpi_mpi_info *MPI_Info; #define MPI_STATUS_IGNORE ((MPI_Status*)NULL) #define MPI_STATUSES_IGNORE ((MPI_Status*)NULL) @@ -221,6 +225,7 @@ XBT_PUBLIC_DATA(MPI_Datatype) MPI_2FLOAT; XBT_PUBLIC_DATA(MPI_Datatype) MPI_2DOUBLE; XBT_PUBLIC_DATA(MPI_Datatype) MPI_2LONG;//only for compatibility with Fortran +XBT_PUBLIC_DATA(MPI_Datatype) MPI_REAL; XBT_PUBLIC_DATA(MPI_Datatype) MPI_REAL4; XBT_PUBLIC_DATA(MPI_Datatype) MPI_REAL8; XBT_PUBLIC_DATA(MPI_Datatype) MPI_REAL16; diff --git a/include/surf/simgrid_dtd.h b/include/surf/simgrid_dtd.h index b5b18e4881..ff38c621a5 100644 --- a/include/surf/simgrid_dtd.h +++ b/include/surf/simgrid_dtd.h @@ -108,598 +108,598 @@ XBT_PUBLIC(void) STag_surfxml_model___prop(void); XBT_PUBLIC(void) ETag_surfxml_model___prop(void); /* XML application data. */ -typedef int AT_surfxml_storage_id; -#define AU_surfxml_storage_id NULL -typedef enum { AU_surfxml_link_sharing___policy, A_surfxml_link_sharing___policy_SHARED,A_surfxml_link_sharing___policy_FATPIPE,A_surfxml_link_sharing___policy_FULLDUPLEX } AT_surfxml_link_sharing___policy; -typedef int AT_surfxml_trace___connect_element; -#define AU_surfxml_trace___connect_element NULL -typedef int AT_surfxml_ASroute_dst; -#define AU_surfxml_ASroute_dst NULL -typedef int AT_surfxml_cluster_lat; -#define AU_surfxml_cluster_lat NULL -typedef int AT_surfxml_random_min; -#define AU_surfxml_random_min NULL -typedef int AT_surfxml_storage___type_id; -#define AU_surfxml_storage___type_id NULL -typedef int AT_surfxml_host___link_up; -#define AU_surfxml_host___link_up NULL -typedef int AT_surfxml_random_seed; -#define AU_surfxml_random_seed NULL -typedef int AT_surfxml_cluster_suffix; -#define AU_surfxml_cluster_suffix NULL -typedef enum { AU_surfxml_link___ctn_direction, A_surfxml_link___ctn_direction_UP,A_surfxml_link___ctn_direction_DOWN,A_surfxml_link___ctn_direction_NONE } AT_surfxml_link___ctn_direction; -typedef int AT_surfxml_storage___type_content; -#define AU_surfxml_storage___type_content NULL -typedef int AT_surfxml_peer_bw___out; -#define AU_surfxml_peer_bw___out NULL -typedef int AT_surfxml_ASroute_gw___src; -#define AU_surfxml_ASroute_gw___src NULL -typedef int AT_surfxml_bypassASroute_gw___dst; -#define AU_surfxml_bypassASroute_gw___dst NULL -typedef int AT_surfxml_process_kill___time; -#define AU_surfxml_process_kill___time NULL -typedef int AT_surfxml_route_src; -#define AU_surfxml_route_src NULL -typedef int AT_surfxml_argument_value; -#define AU_surfxml_argument_value NULL -typedef int AT_surfxml_peer_availability___file; -#define AU_surfxml_peer_availability___file NULL -typedef int AT_surfxml_cabinet_radical; -#define AU_surfxml_cabinet_radical NULL -typedef int AT_surfxml_trace___connect_trace; -#define AU_surfxml_trace___connect_trace NULL -typedef int AT_surfxml_mount_name; -#define AU_surfxml_mount_name NULL -typedef int AT_surfxml_host_core; -#define AU_surfxml_host_core NULL -typedef int AT_surfxml_route_dst; -#define AU_surfxml_route_dst NULL +typedef int AT_surfxml_mstorage_typeId; +#define AU_surfxml_mstorage_typeId NULL +typedef int AT_surfxml_peer_state___file; +#define AU_surfxml_peer_state___file NULL typedef int AT_surfxml_cluster_limiter___link; #define AU_surfxml_cluster_limiter___link NULL -typedef int AT_surfxml_host_pstate; -#define AU_surfxml_host_pstate NULL -typedef int AT_surfxml_cluster_availability___file; -#define AU_surfxml_cluster_availability___file NULL +typedef int AT_surfxml_storage___type_content; +#define AU_surfxml_storage___type_content NULL +typedef enum { AU_surfxml_ASroute_symmetrical, A_surfxml_ASroute_symmetrical_YES,A_surfxml_ASroute_symmetrical_NO } AT_surfxml_ASroute_symmetrical; +typedef int AT_surfxml_storage_content___type; +#define AU_surfxml_storage_content___type NULL +typedef int AT_surfxml_cluster_power; +#define AU_surfxml_cluster_power NULL +typedef enum { AU_surfxml_route_symmetrical, A_surfxml_route_symmetrical_YES,A_surfxml_route_symmetrical_NO } AT_surfxml_route_symmetrical; +typedef int AT_surfxml_cabinet_id; +#define AU_surfxml_cabinet_id NULL +typedef enum { AU_surfxml_cluster_topology, A_surfxml_cluster_topology_FLAT,A_surfxml_cluster_topology_TORUS,A_surfxml_cluster_topology_FAT___TREE } AT_surfxml_cluster_topology; +typedef int AT_surfxml_storage_content; +#define AU_surfxml_storage_content NULL +typedef int AT_surfxml_cluster_bw; +#define AU_surfxml_cluster_bw NULL +typedef int AT_surfxml_host_coordinates; +#define AU_surfxml_host_coordinates NULL +typedef int AT_surfxml_mount_storageId; +#define AU_surfxml_mount_storageId NULL typedef int AT_surfxml_random_id; #define AU_surfxml_random_id NULL -typedef int AT_surfxml_random_radical; -#define AU_surfxml_random_radical NULL -typedef int AT_surfxml_router_coordinates; -#define AU_surfxml_router_coordinates NULL -typedef enum { AU_surfxml_ASroute_symmetrical, A_surfxml_ASroute_symmetrical_YES,A_surfxml_ASroute_symmetrical_NO } AT_surfxml_ASroute_symmetrical; +typedef int AT_surfxml_mount_name; +#define AU_surfxml_mount_name NULL +typedef int AT_surfxml_bypassASroute_dst; +#define AU_surfxml_bypassASroute_dst NULL +typedef int AT_surfxml_config_id; +#define AU_surfxml_config_id NULL +typedef int AT_surfxml_bypassASroute_gw___src; +#define AU_surfxml_bypassASroute_gw___src NULL +typedef int AT_surfxml_link___ctn_id; +#define AU_surfxml_link___ctn_id NULL +typedef int AT_surfxml_mstorage_name; +#define AU_surfxml_mstorage_name NULL +typedef int AT_surfxml_random_std___deviation; +#define AU_surfxml_random_std___deviation NULL +typedef int AT_surfxml_cluster_bb___bw; +#define AU_surfxml_cluster_bb___bw NULL typedef int AT_surfxml_gpu_name; #define AU_surfxml_gpu_name NULL -typedef enum { AU_surfxml_link_state, A_surfxml_link_state_ON,A_surfxml_link_state_OFF } AT_surfxml_link_state; -typedef int AT_surfxml_bypassRoute_src; -#define AU_surfxml_bypassRoute_src NULL -typedef enum { AU_surfxml_AS_routing, A_surfxml_AS_routing_Full,A_surfxml_AS_routing_Floyd,A_surfxml_AS_routing_Dijkstra,A_surfxml_AS_routing_DijkstraCache,A_surfxml_AS_routing_None,A_surfxml_AS_routing_Vivaldi,A_surfxml_AS_routing_Cluster,A_surfxml_AS_routing_Cluster___torus,A_surfxml_AS_routing_Cluster___fat___tree } AT_surfxml_AS_routing; +typedef int AT_surfxml_cluster_loopback___bw; +#define AU_surfxml_cluster_loopback___bw NULL +typedef int AT_surfxml_model___prop_value; +#define AU_surfxml_model___prop_value NULL typedef int AT_surfxml_cluster_radical; #define AU_surfxml_cluster_radical NULL -typedef int AT_surfxml_link_id; -#define AU_surfxml_link_id NULL -typedef enum { AU_surfxml_process_on___failure, A_surfxml_process_on___failure_DIE,A_surfxml_process_on___failure_RESTART } AT_surfxml_process_on___failure; -typedef int AT_surfxml_backbone_bandwidth; -#define AU_surfxml_backbone_bandwidth NULL -typedef int AT_surfxml_mstorage_name; -#define AU_surfxml_mstorage_name NULL typedef int AT_surfxml_cabinet_bw; #define AU_surfxml_cabinet_bw NULL -typedef int AT_surfxml_bypassASroute_gw___src; -#define AU_surfxml_bypassASroute_gw___src NULL -typedef int AT_surfxml_cluster_id; -#define AU_surfxml_cluster_id NULL -typedef int AT_surfxml_host_availability; -#define AU_surfxml_host_availability NULL -typedef int AT_surfxml_peer_id; -#define AU_surfxml_peer_id NULL +typedef int AT_surfxml_host_availability___file; +#define AU_surfxml_host_availability___file NULL +typedef int AT_surfxml_process_function; +#define AU_surfxml_process_function NULL +typedef int AT_surfxml_cabinet_suffix; +#define AU_surfxml_cabinet_suffix NULL +typedef int AT_surfxml_ASroute_gw___dst; +#define AU_surfxml_ASroute_gw___dst NULL +typedef int AT_surfxml_bypassRoute_src; +#define AU_surfxml_bypassRoute_src NULL +typedef int AT_surfxml_trace_id; +#define AU_surfxml_trace_id NULL +typedef int AT_surfxml_link_latency___file; +#define AU_surfxml_link_latency___file NULL +typedef int AT_surfxml_link_id; +#define AU_surfxml_link_id NULL +typedef int AT_surfxml_process_start___time; +#define AU_surfxml_process_start___time NULL +typedef enum { AU_surfxml_host_state, A_surfxml_host_state_ON,A_surfxml_host_state_OFF } AT_surfxml_host_state; typedef int AT_surfxml_link_bandwidth___file; #define AU_surfxml_link_bandwidth___file NULL +typedef enum { AU_surfxml_cluster_sharing___policy, A_surfxml_cluster_sharing___policy_SHARED,A_surfxml_cluster_sharing___policy_FULLDUPLEX,A_surfxml_cluster_sharing___policy_FATPIPE } AT_surfxml_cluster_sharing___policy; +typedef int AT_surfxml_host_state___file; +#define AU_surfxml_host_state___file NULL +typedef int AT_surfxml_AS_id; +#define AU_surfxml_AS_id NULL +typedef int AT_surfxml_cluster_suffix; +#define AU_surfxml_cluster_suffix NULL +typedef int AT_surfxml_peer_availability___file; +#define AU_surfxml_peer_availability___file NULL +typedef int AT_surfxml_peer_bw___out; +#define AU_surfxml_peer_bw___out NULL +typedef int AT_surfxml_cluster_id; +#define AU_surfxml_cluster_id NULL +typedef int AT_surfxml_bypassRoute_dst; +#define AU_surfxml_bypassRoute_dst NULL +typedef int AT_surfxml_cabinet_prefix; +#define AU_surfxml_cabinet_prefix NULL +typedef int AT_surfxml_route_src; +#define AU_surfxml_route_src NULL +typedef int AT_surfxml_host___link_id; +#define AU_surfxml_host___link_id NULL typedef int AT_surfxml_peer_coordinates; #define AU_surfxml_peer_coordinates NULL -typedef int AT_surfxml_bypassASroute_src; -#define AU_surfxml_bypassASroute_src NULL -typedef enum { AU_surfxml_cluster_bb___sharing___policy, A_surfxml_cluster_bb___sharing___policy_SHARED,A_surfxml_cluster_bb___sharing___policy_FATPIPE } AT_surfxml_cluster_bb___sharing___policy; -typedef int AT_surfxml_ASroute_gw___dst; -#define AU_surfxml_ASroute_gw___dst NULL -typedef int AT_surfxml_peer_bw___in; -#define AU_surfxml_peer_bw___in NULL -typedef int AT_surfxml_storage_typeId; -#define AU_surfxml_storage_typeId NULL +typedef enum { AU_surfxml_AS_routing, A_surfxml_AS_routing_Full,A_surfxml_AS_routing_Floyd,A_surfxml_AS_routing_Dijkstra,A_surfxml_AS_routing_DijkstraCache,A_surfxml_AS_routing_None,A_surfxml_AS_routing_Vivaldi,A_surfxml_AS_routing_Cluster,A_surfxml_AS_routing_Cluster___torus,A_surfxml_AS_routing_Cluster___fat___tree } AT_surfxml_AS_routing; +typedef int AT_surfxml_host_power; +#define AU_surfxml_host_power NULL +typedef int AT_surfxml_storage_id; +#define AU_surfxml_storage_id NULL +typedef int AT_surfxml_cluster_state___file; +#define AU_surfxml_cluster_state___file NULL +typedef int AT_surfxml_peer_id; +#define AU_surfxml_peer_id NULL +typedef int AT_surfxml_cluster_availability___file; +#define AU_surfxml_cluster_availability___file NULL +typedef int AT_surfxml_storage___type_content___type; +#define AU_surfxml_storage___type_content___type NULL +typedef enum { AU_surfxml_link_state, A_surfxml_link_state_ON,A_surfxml_link_state_OFF } AT_surfxml_link_state; +typedef int AT_surfxml_route_dst; +#define AU_surfxml_route_dst NULL typedef int AT_surfxml_storage___type_model; #define AU_surfxml_storage___type_model NULL +typedef int AT_surfxml_peer_bw___in; +#define AU_surfxml_peer_bw___in NULL +typedef int AT_surfxml_backbone_id; +#define AU_surfxml_backbone_id NULL +typedef enum { AU_surfxml_link___ctn_direction, A_surfxml_link___ctn_direction_UP,A_surfxml_link___ctn_direction_DOWN,A_surfxml_link___ctn_direction_NONE } AT_surfxml_link___ctn_direction; +typedef int AT_surfxml_bypassASroute_gw___dst; +#define AU_surfxml_bypassASroute_gw___dst NULL +typedef int AT_surfxml_bypassASroute_src; +#define AU_surfxml_bypassASroute_src NULL +typedef int AT_surfxml_trace_file; +#define AU_surfxml_trace_file NULL +typedef int AT_surfxml_router_coordinates; +#define AU_surfxml_router_coordinates NULL +typedef int AT_surfxml_router_id; +#define AU_surfxml_router_id NULL typedef int AT_surfxml_link_bandwidth; #define AU_surfxml_link_bandwidth NULL -typedef int AT_surfxml_cluster_router___id; -#define AU_surfxml_cluster_router___id NULL -typedef int AT_surfxml_link___ctn_id; -#define AU_surfxml_link___ctn_id NULL -typedef int AT_surfxml_prop_value; -#define AU_surfxml_prop_value NULL -typedef int AT_surfxml_host___link_id; -#define AU_surfxml_host___link_id NULL -typedef int AT_surfxml_cluster_power; -#define AU_surfxml_cluster_power NULL -typedef int AT_surfxml_mount_storageId; -#define AU_surfxml_mount_storageId NULL -typedef int AT_surfxml_host_power; -#define AU_surfxml_host_power NULL -typedef int AT_surfxml_model___prop_id; -#define AU_surfxml_model___prop_id NULL -typedef int AT_surfxml_AS_id; -#define AU_surfxml_AS_id NULL -typedef int AT_surfxml_mstorage_typeId; -#define AU_surfxml_mstorage_typeId NULL -typedef enum { AU_surfxml_route_symmetrical, A_surfxml_route_symmetrical_YES,A_surfxml_route_symmetrical_NO } AT_surfxml_route_symmetrical; -typedef enum { AU_surfxml_random_generator, A_surfxml_random_generator_DRAND48,A_surfxml_random_generator_RAND,A_surfxml_random_generator_RNGSTREAM,A_surfxml_random_generator_NONE } AT_surfxml_random_generator; -typedef int AT_surfxml_include_file; -#define AU_surfxml_include_file NULL -typedef int AT_surfxml_bypassASroute_dst; -#define AU_surfxml_bypassASroute_dst NULL -typedef int AT_surfxml_host_id; -#define AU_surfxml_host_id NULL -typedef enum { AU_surfxml_trace___connect_kind, A_surfxml_trace___connect_kind_HOST___AVAIL,A_surfxml_trace___connect_kind_POWER,A_surfxml_trace___connect_kind_LINK___AVAIL,A_surfxml_trace___connect_kind_BANDWIDTH,A_surfxml_trace___connect_kind_LATENCY } AT_surfxml_trace___connect_kind; typedef int AT_surfxml_process_host; #define AU_surfxml_process_host NULL -typedef int AT_surfxml_cabinet_id; -#define AU_surfxml_cabinet_id NULL -typedef int AT_surfxml_config_id; -#define AU_surfxml_config_id NULL +typedef int AT_surfxml_trace_periodicity; +#define AU_surfxml_trace_periodicity NULL +typedef int AT_surfxml_storage___type_id; +#define AU_surfxml_storage___type_id NULL +typedef int AT_surfxml_cluster_bb___lat; +#define AU_surfxml_cluster_bb___lat NULL +typedef int AT_surfxml_trace___connect_trace; +#define AU_surfxml_trace___connect_trace NULL +typedef int AT_surfxml_random_radical; +#define AU_surfxml_random_radical NULL +typedef enum { AU_surfxml_trace___connect_kind, A_surfxml_trace___connect_kind_HOST___AVAIL,A_surfxml_trace___connect_kind_POWER,A_surfxml_trace___connect_kind_LINK___AVAIL,A_surfxml_trace___connect_kind_BANDWIDTH,A_surfxml_trace___connect_kind_LATENCY } AT_surfxml_trace___connect_kind; typedef int AT_surfxml_peer_lat; #define AU_surfxml_peer_lat NULL -typedef int AT_surfxml_storage_content; -#define AU_surfxml_storage_content NULL -typedef int AT_surfxml_bypassRoute_dst; -#define AU_surfxml_bypassRoute_dst NULL typedef int AT_surfxml_storage_attach; #define AU_surfxml_storage_attach NULL -typedef int AT_surfxml_cluster_state___file; -#define AU_surfxml_cluster_state___file NULL -typedef int AT_surfxml_cluster_topo___parameters; -#define AU_surfxml_cluster_topo___parameters NULL -typedef int AT_surfxml_cluster_core; -#define AU_surfxml_cluster_core NULL -typedef int AT_surfxml_peer_state___file; -#define AU_surfxml_peer_state___file NULL -typedef int AT_surfxml_cabinet_prefix; -#define AU_surfxml_cabinet_prefix NULL -typedef int AT_surfxml_platform_version; -#define AU_surfxml_platform_version NULL -typedef int AT_surfxml_ASroute_src; -#define AU_surfxml_ASroute_src NULL +typedef int AT_surfxml_host_core; +#define AU_surfxml_host_core NULL +typedef int AT_surfxml_model___prop_id; +#define AU_surfxml_model___prop_id NULL +typedef int AT_surfxml_cabinet_radical; +#define AU_surfxml_cabinet_radical NULL +typedef int AT_surfxml_backbone_bandwidth; +#define AU_surfxml_backbone_bandwidth NULL +typedef int AT_surfxml_cluster_lat; +#define AU_surfxml_cluster_lat NULL typedef int AT_surfxml_link_state___file; #define AU_surfxml_link_state___file NULL -typedef enum { AU_surfxml_cluster_topology, A_surfxml_cluster_topology_FLAT,A_surfxml_cluster_topology_TORUS,A_surfxml_cluster_topology_FAT___TREE } AT_surfxml_cluster_topology; -typedef enum { AU_surfxml_host_state, A_surfxml_host_state_ON,A_surfxml_host_state_OFF } AT_surfxml_host_state; -typedef int AT_surfxml_trace_file; -#define AU_surfxml_trace_file NULL -typedef int AT_surfxml_random_mean; -#define AU_surfxml_random_mean NULL -typedef int AT_surfxml_peer_power; -#define AU_surfxml_peer_power NULL -typedef int AT_surfxml_cabinet_lat; -#define AU_surfxml_cabinet_lat NULL -typedef int AT_surfxml_trace_id; -#define AU_surfxml_trace_id NULL -typedef int AT_surfxml_cluster_bb___bw; -#define AU_surfxml_cluster_bb___bw NULL -typedef int AT_surfxml_host_coordinates; -#define AU_surfxml_host_coordinates NULL -typedef int AT_surfxml_cabinet_power; -#define AU_surfxml_cabinet_power NULL -typedef int AT_surfxml_storage_content___type; -#define AU_surfxml_storage_content___type NULL -typedef int AT_surfxml_cluster_loopback___bw; -#define AU_surfxml_cluster_loopback___bw NULL -typedef int AT_surfxml_link_latency___file; -#define AU_surfxml_link_latency___file NULL -typedef int AT_surfxml_process_start___time; -#define AU_surfxml_process_start___time NULL +typedef int AT_surfxml_storage_typeId; +#define AU_surfxml_storage_typeId NULL +typedef int AT_surfxml_host_pstate; +#define AU_surfxml_host_pstate NULL typedef int AT_surfxml_prop_id; #define AU_surfxml_prop_id NULL -typedef enum { AU_surfxml_cluster_sharing___policy, A_surfxml_cluster_sharing___policy_SHARED,A_surfxml_cluster_sharing___policy_FULLDUPLEX,A_surfxml_cluster_sharing___policy_FATPIPE } AT_surfxml_cluster_sharing___policy; -typedef int AT_surfxml_random_max; -#define AU_surfxml_random_max NULL -typedef int AT_surfxml_router_id; -#define AU_surfxml_router_id NULL -typedef int AT_surfxml_backbone_latency; -#define AU_surfxml_backbone_latency NULL +typedef int AT_surfxml_process_kill___time; +#define AU_surfxml_process_kill___time NULL +typedef int AT_surfxml_host_id; +#define AU_surfxml_host_id NULL +typedef int AT_surfxml_trace___connect_element; +#define AU_surfxml_trace___connect_element NULL +typedef int AT_surfxml_random_min; +#define AU_surfxml_random_min NULL +typedef int AT_surfxml_peer_power; +#define AU_surfxml_peer_power NULL +typedef int AT_surfxml_cluster_loopback___lat; +#define AU_surfxml_cluster_loopback___lat NULL +typedef int AT_surfxml_random_mean; +#define AU_surfxml_random_mean NULL +typedef enum { AU_surfxml_cluster_bb___sharing___policy, A_surfxml_cluster_bb___sharing___policy_SHARED,A_surfxml_cluster_bb___sharing___policy_FATPIPE } AT_surfxml_cluster_bb___sharing___policy; typedef int AT_surfxml_cluster_prefix; #define AU_surfxml_cluster_prefix NULL -typedef int AT_surfxml_cluster_bw; -#define AU_surfxml_cluster_bw NULL -typedef int AT_surfxml_link_latency; -#define AU_surfxml_link_latency NULL -typedef int AT_surfxml_cabinet_suffix; -#define AU_surfxml_cabinet_suffix NULL +typedef enum { AU_surfxml_process_on___failure, A_surfxml_process_on___failure_DIE,A_surfxml_process_on___failure_RESTART } AT_surfxml_process_on___failure; +typedef int AT_surfxml_backbone_latency; +#define AU_surfxml_backbone_latency NULL +typedef int AT_surfxml_argument_value; +#define AU_surfxml_argument_value NULL +typedef enum { AU_surfxml_link_sharing___policy, A_surfxml_link_sharing___policy_SHARED,A_surfxml_link_sharing___policy_FATPIPE,A_surfxml_link_sharing___policy_FULLDUPLEX } AT_surfxml_link_sharing___policy; +typedef int AT_surfxml_platform_version; +#define AU_surfxml_platform_version NULL +typedef int AT_surfxml_ASroute_dst; +#define AU_surfxml_ASroute_dst NULL +typedef int AT_surfxml_prop_value; +#define AU_surfxml_prop_value NULL +typedef int AT_surfxml_ASroute_src; +#define AU_surfxml_ASroute_src NULL +typedef int AT_surfxml_host___link_up; +#define AU_surfxml_host___link_up NULL +typedef int AT_surfxml_cabinet_power; +#define AU_surfxml_cabinet_power NULL +typedef int AT_surfxml_cluster_core; +#define AU_surfxml_cluster_core NULL +typedef int AT_surfxml_include_file; +#define AU_surfxml_include_file NULL +typedef int AT_surfxml_ASroute_gw___src; +#define AU_surfxml_ASroute_gw___src NULL +typedef enum { AU_surfxml_random_generator, A_surfxml_random_generator_DRAND48,A_surfxml_random_generator_RAND,A_surfxml_random_generator_RNGSTREAM,A_surfxml_random_generator_NONE } AT_surfxml_random_generator; +typedef int AT_surfxml_cabinet_lat; +#define AU_surfxml_cabinet_lat NULL +typedef int AT_surfxml_random_seed; +#define AU_surfxml_random_seed NULL +typedef int AT_surfxml_cluster_router___id; +#define AU_surfxml_cluster_router___id NULL typedef int AT_surfxml_host___link_down; #define AU_surfxml_host___link_down NULL -typedef int AT_surfxml_cluster_loopback___lat; -#define AU_surfxml_cluster_loopback___lat NULL -typedef int AT_surfxml_host_state___file; -#define AU_surfxml_host_state___file NULL -typedef int AT_surfxml_model___prop_value; -#define AU_surfxml_model___prop_value NULL -typedef int AT_surfxml_random_std___deviation; -#define AU_surfxml_random_std___deviation NULL -typedef int AT_surfxml_process_function; -#define AU_surfxml_process_function NULL +typedef int AT_surfxml_link_latency; +#define AU_surfxml_link_latency NULL +typedef int AT_surfxml_random_max; +#define AU_surfxml_random_max NULL +typedef int AT_surfxml_host_availability; +#define AU_surfxml_host_availability NULL typedef int AT_surfxml_storage___type_size; #define AU_surfxml_storage___type_size NULL -typedef int AT_surfxml_host_availability___file; -#define AU_surfxml_host_availability___file NULL -typedef int AT_surfxml_backbone_id; -#define AU_surfxml_backbone_id NULL -typedef int AT_surfxml_trace_periodicity; -#define AU_surfxml_trace_periodicity NULL -typedef int AT_surfxml_cluster_bb___lat; -#define AU_surfxml_cluster_bb___lat NULL -typedef int AT_surfxml_storage___type_content___type; -#define AU_surfxml_storage___type_content___type NULL +typedef int AT_surfxml_cluster_topo___parameters; +#define AU_surfxml_cluster_topo___parameters NULL /* FleXML-provided data. */ XBT_PUBLIC_DATA(int) surfxml_pcdata_ix; XBT_PUBLIC_DATA(char *) surfxml_bufferstack; #define surfxml_pcdata (surfxml_bufferstack + surfxml_pcdata_ix) -XBT_PUBLIC_DATA(AT_surfxml_storage_id) AX_surfxml_storage_id; -#define A_surfxml_storage_id (surfxml_bufferstack + AX_surfxml_storage_id) -XBT_PUBLIC_DATA(short int) surfxml_storage_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_link_sharing___policy) AX_surfxml_link_sharing___policy; -#define A_surfxml_link_sharing___policy AX_surfxml_link_sharing___policy -XBT_PUBLIC_DATA(short int) surfxml_link_sharing___policy_isset; -XBT_PUBLIC_DATA(AT_surfxml_trace___connect_element) AX_surfxml_trace___connect_element; -#define A_surfxml_trace___connect_element (surfxml_bufferstack + AX_surfxml_trace___connect_element) -XBT_PUBLIC_DATA(short int) surfxml_trace___connect_element_isset; -XBT_PUBLIC_DATA(AT_surfxml_ASroute_dst) AX_surfxml_ASroute_dst; -#define A_surfxml_ASroute_dst (surfxml_bufferstack + AX_surfxml_ASroute_dst) -XBT_PUBLIC_DATA(short int) surfxml_ASroute_dst_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_lat) AX_surfxml_cluster_lat; -#define A_surfxml_cluster_lat (surfxml_bufferstack + AX_surfxml_cluster_lat) -XBT_PUBLIC_DATA(short int) surfxml_cluster_lat_isset; -XBT_PUBLIC_DATA(AT_surfxml_random_min) AX_surfxml_random_min; -#define A_surfxml_random_min (surfxml_bufferstack + AX_surfxml_random_min) -XBT_PUBLIC_DATA(short int) surfxml_random_min_isset; -XBT_PUBLIC_DATA(AT_surfxml_storage___type_id) AX_surfxml_storage___type_id; -#define A_surfxml_storage___type_id (surfxml_bufferstack + AX_surfxml_storage___type_id) -XBT_PUBLIC_DATA(short int) surfxml_storage___type_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_host___link_up) AX_surfxml_host___link_up; -#define A_surfxml_host___link_up (surfxml_bufferstack + AX_surfxml_host___link_up) -XBT_PUBLIC_DATA(short int) surfxml_host___link_up_isset; -XBT_PUBLIC_DATA(AT_surfxml_random_seed) AX_surfxml_random_seed; -#define A_surfxml_random_seed (surfxml_bufferstack + AX_surfxml_random_seed) -XBT_PUBLIC_DATA(short int) surfxml_random_seed_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_suffix) AX_surfxml_cluster_suffix; -#define A_surfxml_cluster_suffix (surfxml_bufferstack + AX_surfxml_cluster_suffix) -XBT_PUBLIC_DATA(short int) surfxml_cluster_suffix_isset; -XBT_PUBLIC_DATA(AT_surfxml_link___ctn_direction) AX_surfxml_link___ctn_direction; -#define A_surfxml_link___ctn_direction AX_surfxml_link___ctn_direction -XBT_PUBLIC_DATA(short int) surfxml_link___ctn_direction_isset; -XBT_PUBLIC_DATA(AT_surfxml_storage___type_content) AX_surfxml_storage___type_content; -#define A_surfxml_storage___type_content (surfxml_bufferstack + AX_surfxml_storage___type_content) -XBT_PUBLIC_DATA(short int) surfxml_storage___type_content_isset; -XBT_PUBLIC_DATA(AT_surfxml_peer_bw___out) AX_surfxml_peer_bw___out; -#define A_surfxml_peer_bw___out (surfxml_bufferstack + AX_surfxml_peer_bw___out) -XBT_PUBLIC_DATA(short int) surfxml_peer_bw___out_isset; -XBT_PUBLIC_DATA(AT_surfxml_ASroute_gw___src) AX_surfxml_ASroute_gw___src; -#define A_surfxml_ASroute_gw___src (surfxml_bufferstack + AX_surfxml_ASroute_gw___src) -XBT_PUBLIC_DATA(short int) surfxml_ASroute_gw___src_isset; -XBT_PUBLIC_DATA(AT_surfxml_bypassASroute_gw___dst) AX_surfxml_bypassASroute_gw___dst; -#define A_surfxml_bypassASroute_gw___dst (surfxml_bufferstack + AX_surfxml_bypassASroute_gw___dst) -XBT_PUBLIC_DATA(short int) surfxml_bypassASroute_gw___dst_isset; -XBT_PUBLIC_DATA(AT_surfxml_process_kill___time) AX_surfxml_process_kill___time; -#define A_surfxml_process_kill___time (surfxml_bufferstack + AX_surfxml_process_kill___time) -XBT_PUBLIC_DATA(short int) surfxml_process_kill___time_isset; -XBT_PUBLIC_DATA(AT_surfxml_route_src) AX_surfxml_route_src; -#define A_surfxml_route_src (surfxml_bufferstack + AX_surfxml_route_src) -XBT_PUBLIC_DATA(short int) surfxml_route_src_isset; -XBT_PUBLIC_DATA(AT_surfxml_argument_value) AX_surfxml_argument_value; -#define A_surfxml_argument_value (surfxml_bufferstack + AX_surfxml_argument_value) -XBT_PUBLIC_DATA(short int) surfxml_argument_value_isset; -XBT_PUBLIC_DATA(AT_surfxml_peer_availability___file) AX_surfxml_peer_availability___file; -#define A_surfxml_peer_availability___file (surfxml_bufferstack + AX_surfxml_peer_availability___file) -XBT_PUBLIC_DATA(short int) surfxml_peer_availability___file_isset; -XBT_PUBLIC_DATA(AT_surfxml_cabinet_radical) AX_surfxml_cabinet_radical; -#define A_surfxml_cabinet_radical (surfxml_bufferstack + AX_surfxml_cabinet_radical) -XBT_PUBLIC_DATA(short int) surfxml_cabinet_radical_isset; -XBT_PUBLIC_DATA(AT_surfxml_trace___connect_trace) AX_surfxml_trace___connect_trace; -#define A_surfxml_trace___connect_trace (surfxml_bufferstack + AX_surfxml_trace___connect_trace) -XBT_PUBLIC_DATA(short int) surfxml_trace___connect_trace_isset; -XBT_PUBLIC_DATA(AT_surfxml_mount_name) AX_surfxml_mount_name; -#define A_surfxml_mount_name (surfxml_bufferstack + AX_surfxml_mount_name) -XBT_PUBLIC_DATA(short int) surfxml_mount_name_isset; -XBT_PUBLIC_DATA(AT_surfxml_host_core) AX_surfxml_host_core; -#define A_surfxml_host_core (surfxml_bufferstack + AX_surfxml_host_core) -XBT_PUBLIC_DATA(short int) surfxml_host_core_isset; -XBT_PUBLIC_DATA(AT_surfxml_route_dst) AX_surfxml_route_dst; -#define A_surfxml_route_dst (surfxml_bufferstack + AX_surfxml_route_dst) -XBT_PUBLIC_DATA(short int) surfxml_route_dst_isset; +XBT_PUBLIC_DATA(AT_surfxml_mstorage_typeId) AX_surfxml_mstorage_typeId; +#define A_surfxml_mstorage_typeId (surfxml_bufferstack + AX_surfxml_mstorage_typeId) +XBT_PUBLIC_DATA(short int) surfxml_mstorage_typeId_isset; +XBT_PUBLIC_DATA(AT_surfxml_peer_state___file) AX_surfxml_peer_state___file; +#define A_surfxml_peer_state___file (surfxml_bufferstack + AX_surfxml_peer_state___file) +XBT_PUBLIC_DATA(short int) surfxml_peer_state___file_isset; XBT_PUBLIC_DATA(AT_surfxml_cluster_limiter___link) AX_surfxml_cluster_limiter___link; #define A_surfxml_cluster_limiter___link (surfxml_bufferstack + AX_surfxml_cluster_limiter___link) XBT_PUBLIC_DATA(short int) surfxml_cluster_limiter___link_isset; -XBT_PUBLIC_DATA(AT_surfxml_host_pstate) AX_surfxml_host_pstate; -#define A_surfxml_host_pstate (surfxml_bufferstack + AX_surfxml_host_pstate) -XBT_PUBLIC_DATA(short int) surfxml_host_pstate_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_availability___file) AX_surfxml_cluster_availability___file; -#define A_surfxml_cluster_availability___file (surfxml_bufferstack + AX_surfxml_cluster_availability___file) -XBT_PUBLIC_DATA(short int) surfxml_cluster_availability___file_isset; -XBT_PUBLIC_DATA(AT_surfxml_random_id) AX_surfxml_random_id; -#define A_surfxml_random_id (surfxml_bufferstack + AX_surfxml_random_id) -XBT_PUBLIC_DATA(short int) surfxml_random_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_random_radical) AX_surfxml_random_radical; -#define A_surfxml_random_radical (surfxml_bufferstack + AX_surfxml_random_radical) -XBT_PUBLIC_DATA(short int) surfxml_random_radical_isset; -XBT_PUBLIC_DATA(AT_surfxml_router_coordinates) AX_surfxml_router_coordinates; -#define A_surfxml_router_coordinates (surfxml_bufferstack + AX_surfxml_router_coordinates) -XBT_PUBLIC_DATA(short int) surfxml_router_coordinates_isset; +XBT_PUBLIC_DATA(AT_surfxml_storage___type_content) AX_surfxml_storage___type_content; +#define A_surfxml_storage___type_content (surfxml_bufferstack + AX_surfxml_storage___type_content) +XBT_PUBLIC_DATA(short int) surfxml_storage___type_content_isset; XBT_PUBLIC_DATA(AT_surfxml_ASroute_symmetrical) AX_surfxml_ASroute_symmetrical; #define A_surfxml_ASroute_symmetrical AX_surfxml_ASroute_symmetrical XBT_PUBLIC_DATA(short int) surfxml_ASroute_symmetrical_isset; +XBT_PUBLIC_DATA(AT_surfxml_storage_content___type) AX_surfxml_storage_content___type; +#define A_surfxml_storage_content___type (surfxml_bufferstack + AX_surfxml_storage_content___type) +XBT_PUBLIC_DATA(short int) surfxml_storage_content___type_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_power) AX_surfxml_cluster_power; +#define A_surfxml_cluster_power (surfxml_bufferstack + AX_surfxml_cluster_power) +XBT_PUBLIC_DATA(short int) surfxml_cluster_power_isset; +XBT_PUBLIC_DATA(AT_surfxml_route_symmetrical) AX_surfxml_route_symmetrical; +#define A_surfxml_route_symmetrical AX_surfxml_route_symmetrical +XBT_PUBLIC_DATA(short int) surfxml_route_symmetrical_isset; +XBT_PUBLIC_DATA(AT_surfxml_cabinet_id) AX_surfxml_cabinet_id; +#define A_surfxml_cabinet_id (surfxml_bufferstack + AX_surfxml_cabinet_id) +XBT_PUBLIC_DATA(short int) surfxml_cabinet_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_topology) AX_surfxml_cluster_topology; +#define A_surfxml_cluster_topology AX_surfxml_cluster_topology +XBT_PUBLIC_DATA(short int) surfxml_cluster_topology_isset; +XBT_PUBLIC_DATA(AT_surfxml_storage_content) AX_surfxml_storage_content; +#define A_surfxml_storage_content (surfxml_bufferstack + AX_surfxml_storage_content) +XBT_PUBLIC_DATA(short int) surfxml_storage_content_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_bw) AX_surfxml_cluster_bw; +#define A_surfxml_cluster_bw (surfxml_bufferstack + AX_surfxml_cluster_bw) +XBT_PUBLIC_DATA(short int) surfxml_cluster_bw_isset; +XBT_PUBLIC_DATA(AT_surfxml_host_coordinates) AX_surfxml_host_coordinates; +#define A_surfxml_host_coordinates (surfxml_bufferstack + AX_surfxml_host_coordinates) +XBT_PUBLIC_DATA(short int) surfxml_host_coordinates_isset; +XBT_PUBLIC_DATA(AT_surfxml_mount_storageId) AX_surfxml_mount_storageId; +#define A_surfxml_mount_storageId (surfxml_bufferstack + AX_surfxml_mount_storageId) +XBT_PUBLIC_DATA(short int) surfxml_mount_storageId_isset; +XBT_PUBLIC_DATA(AT_surfxml_random_id) AX_surfxml_random_id; +#define A_surfxml_random_id (surfxml_bufferstack + AX_surfxml_random_id) +XBT_PUBLIC_DATA(short int) surfxml_random_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_mount_name) AX_surfxml_mount_name; +#define A_surfxml_mount_name (surfxml_bufferstack + AX_surfxml_mount_name) +XBT_PUBLIC_DATA(short int) surfxml_mount_name_isset; +XBT_PUBLIC_DATA(AT_surfxml_bypassASroute_dst) AX_surfxml_bypassASroute_dst; +#define A_surfxml_bypassASroute_dst (surfxml_bufferstack + AX_surfxml_bypassASroute_dst) +XBT_PUBLIC_DATA(short int) surfxml_bypassASroute_dst_isset; +XBT_PUBLIC_DATA(AT_surfxml_config_id) AX_surfxml_config_id; +#define A_surfxml_config_id (surfxml_bufferstack + AX_surfxml_config_id) +XBT_PUBLIC_DATA(short int) surfxml_config_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_bypassASroute_gw___src) AX_surfxml_bypassASroute_gw___src; +#define A_surfxml_bypassASroute_gw___src (surfxml_bufferstack + AX_surfxml_bypassASroute_gw___src) +XBT_PUBLIC_DATA(short int) surfxml_bypassASroute_gw___src_isset; +XBT_PUBLIC_DATA(AT_surfxml_link___ctn_id) AX_surfxml_link___ctn_id; +#define A_surfxml_link___ctn_id (surfxml_bufferstack + AX_surfxml_link___ctn_id) +XBT_PUBLIC_DATA(short int) surfxml_link___ctn_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_mstorage_name) AX_surfxml_mstorage_name; +#define A_surfxml_mstorage_name (surfxml_bufferstack + AX_surfxml_mstorage_name) +XBT_PUBLIC_DATA(short int) surfxml_mstorage_name_isset; +XBT_PUBLIC_DATA(AT_surfxml_random_std___deviation) AX_surfxml_random_std___deviation; +#define A_surfxml_random_std___deviation (surfxml_bufferstack + AX_surfxml_random_std___deviation) +XBT_PUBLIC_DATA(short int) surfxml_random_std___deviation_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_bb___bw) AX_surfxml_cluster_bb___bw; +#define A_surfxml_cluster_bb___bw (surfxml_bufferstack + AX_surfxml_cluster_bb___bw) +XBT_PUBLIC_DATA(short int) surfxml_cluster_bb___bw_isset; XBT_PUBLIC_DATA(AT_surfxml_gpu_name) AX_surfxml_gpu_name; #define A_surfxml_gpu_name (surfxml_bufferstack + AX_surfxml_gpu_name) XBT_PUBLIC_DATA(short int) surfxml_gpu_name_isset; -XBT_PUBLIC_DATA(AT_surfxml_link_state) AX_surfxml_link_state; -#define A_surfxml_link_state AX_surfxml_link_state -XBT_PUBLIC_DATA(short int) surfxml_link_state_isset; -XBT_PUBLIC_DATA(AT_surfxml_bypassRoute_src) AX_surfxml_bypassRoute_src; -#define A_surfxml_bypassRoute_src (surfxml_bufferstack + AX_surfxml_bypassRoute_src) -XBT_PUBLIC_DATA(short int) surfxml_bypassRoute_src_isset; -XBT_PUBLIC_DATA(AT_surfxml_AS_routing) AX_surfxml_AS_routing; -#define A_surfxml_AS_routing AX_surfxml_AS_routing -XBT_PUBLIC_DATA(short int) surfxml_AS_routing_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_loopback___bw) AX_surfxml_cluster_loopback___bw; +#define A_surfxml_cluster_loopback___bw (surfxml_bufferstack + AX_surfxml_cluster_loopback___bw) +XBT_PUBLIC_DATA(short int) surfxml_cluster_loopback___bw_isset; +XBT_PUBLIC_DATA(AT_surfxml_model___prop_value) AX_surfxml_model___prop_value; +#define A_surfxml_model___prop_value (surfxml_bufferstack + AX_surfxml_model___prop_value) +XBT_PUBLIC_DATA(short int) surfxml_model___prop_value_isset; XBT_PUBLIC_DATA(AT_surfxml_cluster_radical) AX_surfxml_cluster_radical; #define A_surfxml_cluster_radical (surfxml_bufferstack + AX_surfxml_cluster_radical) XBT_PUBLIC_DATA(short int) surfxml_cluster_radical_isset; -XBT_PUBLIC_DATA(AT_surfxml_link_id) AX_surfxml_link_id; -#define A_surfxml_link_id (surfxml_bufferstack + AX_surfxml_link_id) -XBT_PUBLIC_DATA(short int) surfxml_link_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_process_on___failure) AX_surfxml_process_on___failure; -#define A_surfxml_process_on___failure AX_surfxml_process_on___failure -XBT_PUBLIC_DATA(short int) surfxml_process_on___failure_isset; -XBT_PUBLIC_DATA(AT_surfxml_backbone_bandwidth) AX_surfxml_backbone_bandwidth; -#define A_surfxml_backbone_bandwidth (surfxml_bufferstack + AX_surfxml_backbone_bandwidth) -XBT_PUBLIC_DATA(short int) surfxml_backbone_bandwidth_isset; -XBT_PUBLIC_DATA(AT_surfxml_mstorage_name) AX_surfxml_mstorage_name; -#define A_surfxml_mstorage_name (surfxml_bufferstack + AX_surfxml_mstorage_name) -XBT_PUBLIC_DATA(short int) surfxml_mstorage_name_isset; XBT_PUBLIC_DATA(AT_surfxml_cabinet_bw) AX_surfxml_cabinet_bw; #define A_surfxml_cabinet_bw (surfxml_bufferstack + AX_surfxml_cabinet_bw) XBT_PUBLIC_DATA(short int) surfxml_cabinet_bw_isset; -XBT_PUBLIC_DATA(AT_surfxml_bypassASroute_gw___src) AX_surfxml_bypassASroute_gw___src; -#define A_surfxml_bypassASroute_gw___src (surfxml_bufferstack + AX_surfxml_bypassASroute_gw___src) -XBT_PUBLIC_DATA(short int) surfxml_bypassASroute_gw___src_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_id) AX_surfxml_cluster_id; -#define A_surfxml_cluster_id (surfxml_bufferstack + AX_surfxml_cluster_id) -XBT_PUBLIC_DATA(short int) surfxml_cluster_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_host_availability) AX_surfxml_host_availability; -#define A_surfxml_host_availability (surfxml_bufferstack + AX_surfxml_host_availability) -XBT_PUBLIC_DATA(short int) surfxml_host_availability_isset; -XBT_PUBLIC_DATA(AT_surfxml_peer_id) AX_surfxml_peer_id; -#define A_surfxml_peer_id (surfxml_bufferstack + AX_surfxml_peer_id) -XBT_PUBLIC_DATA(short int) surfxml_peer_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_link_bandwidth___file) AX_surfxml_link_bandwidth___file; -#define A_surfxml_link_bandwidth___file (surfxml_bufferstack + AX_surfxml_link_bandwidth___file) -XBT_PUBLIC_DATA(short int) surfxml_link_bandwidth___file_isset; -XBT_PUBLIC_DATA(AT_surfxml_peer_coordinates) AX_surfxml_peer_coordinates; -#define A_surfxml_peer_coordinates (surfxml_bufferstack + AX_surfxml_peer_coordinates) -XBT_PUBLIC_DATA(short int) surfxml_peer_coordinates_isset; -XBT_PUBLIC_DATA(AT_surfxml_bypassASroute_src) AX_surfxml_bypassASroute_src; -#define A_surfxml_bypassASroute_src (surfxml_bufferstack + AX_surfxml_bypassASroute_src) -XBT_PUBLIC_DATA(short int) surfxml_bypassASroute_src_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_bb___sharing___policy) AX_surfxml_cluster_bb___sharing___policy; -#define A_surfxml_cluster_bb___sharing___policy AX_surfxml_cluster_bb___sharing___policy -XBT_PUBLIC_DATA(short int) surfxml_cluster_bb___sharing___policy_isset; +XBT_PUBLIC_DATA(AT_surfxml_host_availability___file) AX_surfxml_host_availability___file; +#define A_surfxml_host_availability___file (surfxml_bufferstack + AX_surfxml_host_availability___file) +XBT_PUBLIC_DATA(short int) surfxml_host_availability___file_isset; +XBT_PUBLIC_DATA(AT_surfxml_process_function) AX_surfxml_process_function; +#define A_surfxml_process_function (surfxml_bufferstack + AX_surfxml_process_function) +XBT_PUBLIC_DATA(short int) surfxml_process_function_isset; +XBT_PUBLIC_DATA(AT_surfxml_cabinet_suffix) AX_surfxml_cabinet_suffix; +#define A_surfxml_cabinet_suffix (surfxml_bufferstack + AX_surfxml_cabinet_suffix) +XBT_PUBLIC_DATA(short int) surfxml_cabinet_suffix_isset; XBT_PUBLIC_DATA(AT_surfxml_ASroute_gw___dst) AX_surfxml_ASroute_gw___dst; #define A_surfxml_ASroute_gw___dst (surfxml_bufferstack + AX_surfxml_ASroute_gw___dst) XBT_PUBLIC_DATA(short int) surfxml_ASroute_gw___dst_isset; -XBT_PUBLIC_DATA(AT_surfxml_peer_bw___in) AX_surfxml_peer_bw___in; -#define A_surfxml_peer_bw___in (surfxml_bufferstack + AX_surfxml_peer_bw___in) -XBT_PUBLIC_DATA(short int) surfxml_peer_bw___in_isset; -XBT_PUBLIC_DATA(AT_surfxml_storage_typeId) AX_surfxml_storage_typeId; -#define A_surfxml_storage_typeId (surfxml_bufferstack + AX_surfxml_storage_typeId) -XBT_PUBLIC_DATA(short int) surfxml_storage_typeId_isset; -XBT_PUBLIC_DATA(AT_surfxml_storage___type_model) AX_surfxml_storage___type_model; -#define A_surfxml_storage___type_model (surfxml_bufferstack + AX_surfxml_storage___type_model) -XBT_PUBLIC_DATA(short int) surfxml_storage___type_model_isset; -XBT_PUBLIC_DATA(AT_surfxml_link_bandwidth) AX_surfxml_link_bandwidth; -#define A_surfxml_link_bandwidth (surfxml_bufferstack + AX_surfxml_link_bandwidth) -XBT_PUBLIC_DATA(short int) surfxml_link_bandwidth_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_router___id) AX_surfxml_cluster_router___id; -#define A_surfxml_cluster_router___id (surfxml_bufferstack + AX_surfxml_cluster_router___id) -XBT_PUBLIC_DATA(short int) surfxml_cluster_router___id_isset; -XBT_PUBLIC_DATA(AT_surfxml_link___ctn_id) AX_surfxml_link___ctn_id; -#define A_surfxml_link___ctn_id (surfxml_bufferstack + AX_surfxml_link___ctn_id) -XBT_PUBLIC_DATA(short int) surfxml_link___ctn_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_prop_value) AX_surfxml_prop_value; -#define A_surfxml_prop_value (surfxml_bufferstack + AX_surfxml_prop_value) -XBT_PUBLIC_DATA(short int) surfxml_prop_value_isset; +XBT_PUBLIC_DATA(AT_surfxml_bypassRoute_src) AX_surfxml_bypassRoute_src; +#define A_surfxml_bypassRoute_src (surfxml_bufferstack + AX_surfxml_bypassRoute_src) +XBT_PUBLIC_DATA(short int) surfxml_bypassRoute_src_isset; +XBT_PUBLIC_DATA(AT_surfxml_trace_id) AX_surfxml_trace_id; +#define A_surfxml_trace_id (surfxml_bufferstack + AX_surfxml_trace_id) +XBT_PUBLIC_DATA(short int) surfxml_trace_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_link_latency___file) AX_surfxml_link_latency___file; +#define A_surfxml_link_latency___file (surfxml_bufferstack + AX_surfxml_link_latency___file) +XBT_PUBLIC_DATA(short int) surfxml_link_latency___file_isset; +XBT_PUBLIC_DATA(AT_surfxml_link_id) AX_surfxml_link_id; +#define A_surfxml_link_id (surfxml_bufferstack + AX_surfxml_link_id) +XBT_PUBLIC_DATA(short int) surfxml_link_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_process_start___time) AX_surfxml_process_start___time; +#define A_surfxml_process_start___time (surfxml_bufferstack + AX_surfxml_process_start___time) +XBT_PUBLIC_DATA(short int) surfxml_process_start___time_isset; +XBT_PUBLIC_DATA(AT_surfxml_host_state) AX_surfxml_host_state; +#define A_surfxml_host_state AX_surfxml_host_state +XBT_PUBLIC_DATA(short int) surfxml_host_state_isset; +XBT_PUBLIC_DATA(AT_surfxml_link_bandwidth___file) AX_surfxml_link_bandwidth___file; +#define A_surfxml_link_bandwidth___file (surfxml_bufferstack + AX_surfxml_link_bandwidth___file) +XBT_PUBLIC_DATA(short int) surfxml_link_bandwidth___file_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_sharing___policy) AX_surfxml_cluster_sharing___policy; +#define A_surfxml_cluster_sharing___policy AX_surfxml_cluster_sharing___policy +XBT_PUBLIC_DATA(short int) surfxml_cluster_sharing___policy_isset; +XBT_PUBLIC_DATA(AT_surfxml_host_state___file) AX_surfxml_host_state___file; +#define A_surfxml_host_state___file (surfxml_bufferstack + AX_surfxml_host_state___file) +XBT_PUBLIC_DATA(short int) surfxml_host_state___file_isset; +XBT_PUBLIC_DATA(AT_surfxml_AS_id) AX_surfxml_AS_id; +#define A_surfxml_AS_id (surfxml_bufferstack + AX_surfxml_AS_id) +XBT_PUBLIC_DATA(short int) surfxml_AS_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_suffix) AX_surfxml_cluster_suffix; +#define A_surfxml_cluster_suffix (surfxml_bufferstack + AX_surfxml_cluster_suffix) +XBT_PUBLIC_DATA(short int) surfxml_cluster_suffix_isset; +XBT_PUBLIC_DATA(AT_surfxml_peer_availability___file) AX_surfxml_peer_availability___file; +#define A_surfxml_peer_availability___file (surfxml_bufferstack + AX_surfxml_peer_availability___file) +XBT_PUBLIC_DATA(short int) surfxml_peer_availability___file_isset; +XBT_PUBLIC_DATA(AT_surfxml_peer_bw___out) AX_surfxml_peer_bw___out; +#define A_surfxml_peer_bw___out (surfxml_bufferstack + AX_surfxml_peer_bw___out) +XBT_PUBLIC_DATA(short int) surfxml_peer_bw___out_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_id) AX_surfxml_cluster_id; +#define A_surfxml_cluster_id (surfxml_bufferstack + AX_surfxml_cluster_id) +XBT_PUBLIC_DATA(short int) surfxml_cluster_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_bypassRoute_dst) AX_surfxml_bypassRoute_dst; +#define A_surfxml_bypassRoute_dst (surfxml_bufferstack + AX_surfxml_bypassRoute_dst) +XBT_PUBLIC_DATA(short int) surfxml_bypassRoute_dst_isset; +XBT_PUBLIC_DATA(AT_surfxml_cabinet_prefix) AX_surfxml_cabinet_prefix; +#define A_surfxml_cabinet_prefix (surfxml_bufferstack + AX_surfxml_cabinet_prefix) +XBT_PUBLIC_DATA(short int) surfxml_cabinet_prefix_isset; +XBT_PUBLIC_DATA(AT_surfxml_route_src) AX_surfxml_route_src; +#define A_surfxml_route_src (surfxml_bufferstack + AX_surfxml_route_src) +XBT_PUBLIC_DATA(short int) surfxml_route_src_isset; XBT_PUBLIC_DATA(AT_surfxml_host___link_id) AX_surfxml_host___link_id; #define A_surfxml_host___link_id (surfxml_bufferstack + AX_surfxml_host___link_id) XBT_PUBLIC_DATA(short int) surfxml_host___link_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_power) AX_surfxml_cluster_power; -#define A_surfxml_cluster_power (surfxml_bufferstack + AX_surfxml_cluster_power) -XBT_PUBLIC_DATA(short int) surfxml_cluster_power_isset; -XBT_PUBLIC_DATA(AT_surfxml_mount_storageId) AX_surfxml_mount_storageId; -#define A_surfxml_mount_storageId (surfxml_bufferstack + AX_surfxml_mount_storageId) -XBT_PUBLIC_DATA(short int) surfxml_mount_storageId_isset; +XBT_PUBLIC_DATA(AT_surfxml_peer_coordinates) AX_surfxml_peer_coordinates; +#define A_surfxml_peer_coordinates (surfxml_bufferstack + AX_surfxml_peer_coordinates) +XBT_PUBLIC_DATA(short int) surfxml_peer_coordinates_isset; +XBT_PUBLIC_DATA(AT_surfxml_AS_routing) AX_surfxml_AS_routing; +#define A_surfxml_AS_routing AX_surfxml_AS_routing +XBT_PUBLIC_DATA(short int) surfxml_AS_routing_isset; XBT_PUBLIC_DATA(AT_surfxml_host_power) AX_surfxml_host_power; #define A_surfxml_host_power (surfxml_bufferstack + AX_surfxml_host_power) XBT_PUBLIC_DATA(short int) surfxml_host_power_isset; -XBT_PUBLIC_DATA(AT_surfxml_model___prop_id) AX_surfxml_model___prop_id; -#define A_surfxml_model___prop_id (surfxml_bufferstack + AX_surfxml_model___prop_id) -XBT_PUBLIC_DATA(short int) surfxml_model___prop_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_AS_id) AX_surfxml_AS_id; -#define A_surfxml_AS_id (surfxml_bufferstack + AX_surfxml_AS_id) -XBT_PUBLIC_DATA(short int) surfxml_AS_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_mstorage_typeId) AX_surfxml_mstorage_typeId; -#define A_surfxml_mstorage_typeId (surfxml_bufferstack + AX_surfxml_mstorage_typeId) -XBT_PUBLIC_DATA(short int) surfxml_mstorage_typeId_isset; -XBT_PUBLIC_DATA(AT_surfxml_route_symmetrical) AX_surfxml_route_symmetrical; -#define A_surfxml_route_symmetrical AX_surfxml_route_symmetrical -XBT_PUBLIC_DATA(short int) surfxml_route_symmetrical_isset; -XBT_PUBLIC_DATA(AT_surfxml_random_generator) AX_surfxml_random_generator; -#define A_surfxml_random_generator AX_surfxml_random_generator -XBT_PUBLIC_DATA(short int) surfxml_random_generator_isset; -XBT_PUBLIC_DATA(AT_surfxml_include_file) AX_surfxml_include_file; -#define A_surfxml_include_file (surfxml_bufferstack + AX_surfxml_include_file) -XBT_PUBLIC_DATA(short int) surfxml_include_file_isset; -XBT_PUBLIC_DATA(AT_surfxml_bypassASroute_dst) AX_surfxml_bypassASroute_dst; -#define A_surfxml_bypassASroute_dst (surfxml_bufferstack + AX_surfxml_bypassASroute_dst) -XBT_PUBLIC_DATA(short int) surfxml_bypassASroute_dst_isset; -XBT_PUBLIC_DATA(AT_surfxml_host_id) AX_surfxml_host_id; -#define A_surfxml_host_id (surfxml_bufferstack + AX_surfxml_host_id) -XBT_PUBLIC_DATA(short int) surfxml_host_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_trace___connect_kind) AX_surfxml_trace___connect_kind; -#define A_surfxml_trace___connect_kind AX_surfxml_trace___connect_kind -XBT_PUBLIC_DATA(short int) surfxml_trace___connect_kind_isset; +XBT_PUBLIC_DATA(AT_surfxml_storage_id) AX_surfxml_storage_id; +#define A_surfxml_storage_id (surfxml_bufferstack + AX_surfxml_storage_id) +XBT_PUBLIC_DATA(short int) surfxml_storage_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_state___file) AX_surfxml_cluster_state___file; +#define A_surfxml_cluster_state___file (surfxml_bufferstack + AX_surfxml_cluster_state___file) +XBT_PUBLIC_DATA(short int) surfxml_cluster_state___file_isset; +XBT_PUBLIC_DATA(AT_surfxml_peer_id) AX_surfxml_peer_id; +#define A_surfxml_peer_id (surfxml_bufferstack + AX_surfxml_peer_id) +XBT_PUBLIC_DATA(short int) surfxml_peer_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_availability___file) AX_surfxml_cluster_availability___file; +#define A_surfxml_cluster_availability___file (surfxml_bufferstack + AX_surfxml_cluster_availability___file) +XBT_PUBLIC_DATA(short int) surfxml_cluster_availability___file_isset; +XBT_PUBLIC_DATA(AT_surfxml_storage___type_content___type) AX_surfxml_storage___type_content___type; +#define A_surfxml_storage___type_content___type (surfxml_bufferstack + AX_surfxml_storage___type_content___type) +XBT_PUBLIC_DATA(short int) surfxml_storage___type_content___type_isset; +XBT_PUBLIC_DATA(AT_surfxml_link_state) AX_surfxml_link_state; +#define A_surfxml_link_state AX_surfxml_link_state +XBT_PUBLIC_DATA(short int) surfxml_link_state_isset; +XBT_PUBLIC_DATA(AT_surfxml_route_dst) AX_surfxml_route_dst; +#define A_surfxml_route_dst (surfxml_bufferstack + AX_surfxml_route_dst) +XBT_PUBLIC_DATA(short int) surfxml_route_dst_isset; +XBT_PUBLIC_DATA(AT_surfxml_storage___type_model) AX_surfxml_storage___type_model; +#define A_surfxml_storage___type_model (surfxml_bufferstack + AX_surfxml_storage___type_model) +XBT_PUBLIC_DATA(short int) surfxml_storage___type_model_isset; +XBT_PUBLIC_DATA(AT_surfxml_peer_bw___in) AX_surfxml_peer_bw___in; +#define A_surfxml_peer_bw___in (surfxml_bufferstack + AX_surfxml_peer_bw___in) +XBT_PUBLIC_DATA(short int) surfxml_peer_bw___in_isset; +XBT_PUBLIC_DATA(AT_surfxml_backbone_id) AX_surfxml_backbone_id; +#define A_surfxml_backbone_id (surfxml_bufferstack + AX_surfxml_backbone_id) +XBT_PUBLIC_DATA(short int) surfxml_backbone_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_link___ctn_direction) AX_surfxml_link___ctn_direction; +#define A_surfxml_link___ctn_direction AX_surfxml_link___ctn_direction +XBT_PUBLIC_DATA(short int) surfxml_link___ctn_direction_isset; +XBT_PUBLIC_DATA(AT_surfxml_bypassASroute_gw___dst) AX_surfxml_bypassASroute_gw___dst; +#define A_surfxml_bypassASroute_gw___dst (surfxml_bufferstack + AX_surfxml_bypassASroute_gw___dst) +XBT_PUBLIC_DATA(short int) surfxml_bypassASroute_gw___dst_isset; +XBT_PUBLIC_DATA(AT_surfxml_bypassASroute_src) AX_surfxml_bypassASroute_src; +#define A_surfxml_bypassASroute_src (surfxml_bufferstack + AX_surfxml_bypassASroute_src) +XBT_PUBLIC_DATA(short int) surfxml_bypassASroute_src_isset; +XBT_PUBLIC_DATA(AT_surfxml_trace_file) AX_surfxml_trace_file; +#define A_surfxml_trace_file (surfxml_bufferstack + AX_surfxml_trace_file) +XBT_PUBLIC_DATA(short int) surfxml_trace_file_isset; +XBT_PUBLIC_DATA(AT_surfxml_router_coordinates) AX_surfxml_router_coordinates; +#define A_surfxml_router_coordinates (surfxml_bufferstack + AX_surfxml_router_coordinates) +XBT_PUBLIC_DATA(short int) surfxml_router_coordinates_isset; +XBT_PUBLIC_DATA(AT_surfxml_router_id) AX_surfxml_router_id; +#define A_surfxml_router_id (surfxml_bufferstack + AX_surfxml_router_id) +XBT_PUBLIC_DATA(short int) surfxml_router_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_link_bandwidth) AX_surfxml_link_bandwidth; +#define A_surfxml_link_bandwidth (surfxml_bufferstack + AX_surfxml_link_bandwidth) +XBT_PUBLIC_DATA(short int) surfxml_link_bandwidth_isset; XBT_PUBLIC_DATA(AT_surfxml_process_host) AX_surfxml_process_host; #define A_surfxml_process_host (surfxml_bufferstack + AX_surfxml_process_host) XBT_PUBLIC_DATA(short int) surfxml_process_host_isset; -XBT_PUBLIC_DATA(AT_surfxml_cabinet_id) AX_surfxml_cabinet_id; -#define A_surfxml_cabinet_id (surfxml_bufferstack + AX_surfxml_cabinet_id) -XBT_PUBLIC_DATA(short int) surfxml_cabinet_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_config_id) AX_surfxml_config_id; -#define A_surfxml_config_id (surfxml_bufferstack + AX_surfxml_config_id) -XBT_PUBLIC_DATA(short int) surfxml_config_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_trace_periodicity) AX_surfxml_trace_periodicity; +#define A_surfxml_trace_periodicity (surfxml_bufferstack + AX_surfxml_trace_periodicity) +XBT_PUBLIC_DATA(short int) surfxml_trace_periodicity_isset; +XBT_PUBLIC_DATA(AT_surfxml_storage___type_id) AX_surfxml_storage___type_id; +#define A_surfxml_storage___type_id (surfxml_bufferstack + AX_surfxml_storage___type_id) +XBT_PUBLIC_DATA(short int) surfxml_storage___type_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_bb___lat) AX_surfxml_cluster_bb___lat; +#define A_surfxml_cluster_bb___lat (surfxml_bufferstack + AX_surfxml_cluster_bb___lat) +XBT_PUBLIC_DATA(short int) surfxml_cluster_bb___lat_isset; +XBT_PUBLIC_DATA(AT_surfxml_trace___connect_trace) AX_surfxml_trace___connect_trace; +#define A_surfxml_trace___connect_trace (surfxml_bufferstack + AX_surfxml_trace___connect_trace) +XBT_PUBLIC_DATA(short int) surfxml_trace___connect_trace_isset; +XBT_PUBLIC_DATA(AT_surfxml_random_radical) AX_surfxml_random_radical; +#define A_surfxml_random_radical (surfxml_bufferstack + AX_surfxml_random_radical) +XBT_PUBLIC_DATA(short int) surfxml_random_radical_isset; +XBT_PUBLIC_DATA(AT_surfxml_trace___connect_kind) AX_surfxml_trace___connect_kind; +#define A_surfxml_trace___connect_kind AX_surfxml_trace___connect_kind +XBT_PUBLIC_DATA(short int) surfxml_trace___connect_kind_isset; XBT_PUBLIC_DATA(AT_surfxml_peer_lat) AX_surfxml_peer_lat; #define A_surfxml_peer_lat (surfxml_bufferstack + AX_surfxml_peer_lat) XBT_PUBLIC_DATA(short int) surfxml_peer_lat_isset; -XBT_PUBLIC_DATA(AT_surfxml_storage_content) AX_surfxml_storage_content; -#define A_surfxml_storage_content (surfxml_bufferstack + AX_surfxml_storage_content) -XBT_PUBLIC_DATA(short int) surfxml_storage_content_isset; -XBT_PUBLIC_DATA(AT_surfxml_bypassRoute_dst) AX_surfxml_bypassRoute_dst; -#define A_surfxml_bypassRoute_dst (surfxml_bufferstack + AX_surfxml_bypassRoute_dst) -XBT_PUBLIC_DATA(short int) surfxml_bypassRoute_dst_isset; XBT_PUBLIC_DATA(AT_surfxml_storage_attach) AX_surfxml_storage_attach; #define A_surfxml_storage_attach (surfxml_bufferstack + AX_surfxml_storage_attach) XBT_PUBLIC_DATA(short int) surfxml_storage_attach_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_state___file) AX_surfxml_cluster_state___file; -#define A_surfxml_cluster_state___file (surfxml_bufferstack + AX_surfxml_cluster_state___file) -XBT_PUBLIC_DATA(short int) surfxml_cluster_state___file_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_topo___parameters) AX_surfxml_cluster_topo___parameters; -#define A_surfxml_cluster_topo___parameters (surfxml_bufferstack + AX_surfxml_cluster_topo___parameters) -XBT_PUBLIC_DATA(short int) surfxml_cluster_topo___parameters_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_core) AX_surfxml_cluster_core; -#define A_surfxml_cluster_core (surfxml_bufferstack + AX_surfxml_cluster_core) -XBT_PUBLIC_DATA(short int) surfxml_cluster_core_isset; -XBT_PUBLIC_DATA(AT_surfxml_peer_state___file) AX_surfxml_peer_state___file; -#define A_surfxml_peer_state___file (surfxml_bufferstack + AX_surfxml_peer_state___file) -XBT_PUBLIC_DATA(short int) surfxml_peer_state___file_isset; -XBT_PUBLIC_DATA(AT_surfxml_cabinet_prefix) AX_surfxml_cabinet_prefix; -#define A_surfxml_cabinet_prefix (surfxml_bufferstack + AX_surfxml_cabinet_prefix) -XBT_PUBLIC_DATA(short int) surfxml_cabinet_prefix_isset; -XBT_PUBLIC_DATA(AT_surfxml_platform_version) AX_surfxml_platform_version; -#define A_surfxml_platform_version (surfxml_bufferstack + AX_surfxml_platform_version) -XBT_PUBLIC_DATA(short int) surfxml_platform_version_isset; -XBT_PUBLIC_DATA(AT_surfxml_ASroute_src) AX_surfxml_ASroute_src; -#define A_surfxml_ASroute_src (surfxml_bufferstack + AX_surfxml_ASroute_src) -XBT_PUBLIC_DATA(short int) surfxml_ASroute_src_isset; +XBT_PUBLIC_DATA(AT_surfxml_host_core) AX_surfxml_host_core; +#define A_surfxml_host_core (surfxml_bufferstack + AX_surfxml_host_core) +XBT_PUBLIC_DATA(short int) surfxml_host_core_isset; +XBT_PUBLIC_DATA(AT_surfxml_model___prop_id) AX_surfxml_model___prop_id; +#define A_surfxml_model___prop_id (surfxml_bufferstack + AX_surfxml_model___prop_id) +XBT_PUBLIC_DATA(short int) surfxml_model___prop_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_cabinet_radical) AX_surfxml_cabinet_radical; +#define A_surfxml_cabinet_radical (surfxml_bufferstack + AX_surfxml_cabinet_radical) +XBT_PUBLIC_DATA(short int) surfxml_cabinet_radical_isset; +XBT_PUBLIC_DATA(AT_surfxml_backbone_bandwidth) AX_surfxml_backbone_bandwidth; +#define A_surfxml_backbone_bandwidth (surfxml_bufferstack + AX_surfxml_backbone_bandwidth) +XBT_PUBLIC_DATA(short int) surfxml_backbone_bandwidth_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_lat) AX_surfxml_cluster_lat; +#define A_surfxml_cluster_lat (surfxml_bufferstack + AX_surfxml_cluster_lat) +XBT_PUBLIC_DATA(short int) surfxml_cluster_lat_isset; XBT_PUBLIC_DATA(AT_surfxml_link_state___file) AX_surfxml_link_state___file; #define A_surfxml_link_state___file (surfxml_bufferstack + AX_surfxml_link_state___file) XBT_PUBLIC_DATA(short int) surfxml_link_state___file_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_topology) AX_surfxml_cluster_topology; -#define A_surfxml_cluster_topology AX_surfxml_cluster_topology -XBT_PUBLIC_DATA(short int) surfxml_cluster_topology_isset; -XBT_PUBLIC_DATA(AT_surfxml_host_state) AX_surfxml_host_state; -#define A_surfxml_host_state AX_surfxml_host_state -XBT_PUBLIC_DATA(short int) surfxml_host_state_isset; -XBT_PUBLIC_DATA(AT_surfxml_trace_file) AX_surfxml_trace_file; -#define A_surfxml_trace_file (surfxml_bufferstack + AX_surfxml_trace_file) -XBT_PUBLIC_DATA(short int) surfxml_trace_file_isset; -XBT_PUBLIC_DATA(AT_surfxml_random_mean) AX_surfxml_random_mean; -#define A_surfxml_random_mean (surfxml_bufferstack + AX_surfxml_random_mean) -XBT_PUBLIC_DATA(short int) surfxml_random_mean_isset; -XBT_PUBLIC_DATA(AT_surfxml_peer_power) AX_surfxml_peer_power; -#define A_surfxml_peer_power (surfxml_bufferstack + AX_surfxml_peer_power) -XBT_PUBLIC_DATA(short int) surfxml_peer_power_isset; -XBT_PUBLIC_DATA(AT_surfxml_cabinet_lat) AX_surfxml_cabinet_lat; -#define A_surfxml_cabinet_lat (surfxml_bufferstack + AX_surfxml_cabinet_lat) -XBT_PUBLIC_DATA(short int) surfxml_cabinet_lat_isset; -XBT_PUBLIC_DATA(AT_surfxml_trace_id) AX_surfxml_trace_id; -#define A_surfxml_trace_id (surfxml_bufferstack + AX_surfxml_trace_id) -XBT_PUBLIC_DATA(short int) surfxml_trace_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_bb___bw) AX_surfxml_cluster_bb___bw; -#define A_surfxml_cluster_bb___bw (surfxml_bufferstack + AX_surfxml_cluster_bb___bw) -XBT_PUBLIC_DATA(short int) surfxml_cluster_bb___bw_isset; -XBT_PUBLIC_DATA(AT_surfxml_host_coordinates) AX_surfxml_host_coordinates; -#define A_surfxml_host_coordinates (surfxml_bufferstack + AX_surfxml_host_coordinates) -XBT_PUBLIC_DATA(short int) surfxml_host_coordinates_isset; -XBT_PUBLIC_DATA(AT_surfxml_cabinet_power) AX_surfxml_cabinet_power; -#define A_surfxml_cabinet_power (surfxml_bufferstack + AX_surfxml_cabinet_power) -XBT_PUBLIC_DATA(short int) surfxml_cabinet_power_isset; -XBT_PUBLIC_DATA(AT_surfxml_storage_content___type) AX_surfxml_storage_content___type; -#define A_surfxml_storage_content___type (surfxml_bufferstack + AX_surfxml_storage_content___type) -XBT_PUBLIC_DATA(short int) surfxml_storage_content___type_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_loopback___bw) AX_surfxml_cluster_loopback___bw; -#define A_surfxml_cluster_loopback___bw (surfxml_bufferstack + AX_surfxml_cluster_loopback___bw) -XBT_PUBLIC_DATA(short int) surfxml_cluster_loopback___bw_isset; -XBT_PUBLIC_DATA(AT_surfxml_link_latency___file) AX_surfxml_link_latency___file; -#define A_surfxml_link_latency___file (surfxml_bufferstack + AX_surfxml_link_latency___file) -XBT_PUBLIC_DATA(short int) surfxml_link_latency___file_isset; -XBT_PUBLIC_DATA(AT_surfxml_process_start___time) AX_surfxml_process_start___time; -#define A_surfxml_process_start___time (surfxml_bufferstack + AX_surfxml_process_start___time) -XBT_PUBLIC_DATA(short int) surfxml_process_start___time_isset; +XBT_PUBLIC_DATA(AT_surfxml_storage_typeId) AX_surfxml_storage_typeId; +#define A_surfxml_storage_typeId (surfxml_bufferstack + AX_surfxml_storage_typeId) +XBT_PUBLIC_DATA(short int) surfxml_storage_typeId_isset; +XBT_PUBLIC_DATA(AT_surfxml_host_pstate) AX_surfxml_host_pstate; +#define A_surfxml_host_pstate (surfxml_bufferstack + AX_surfxml_host_pstate) +XBT_PUBLIC_DATA(short int) surfxml_host_pstate_isset; XBT_PUBLIC_DATA(AT_surfxml_prop_id) AX_surfxml_prop_id; #define A_surfxml_prop_id (surfxml_bufferstack + AX_surfxml_prop_id) XBT_PUBLIC_DATA(short int) surfxml_prop_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_sharing___policy) AX_surfxml_cluster_sharing___policy; -#define A_surfxml_cluster_sharing___policy AX_surfxml_cluster_sharing___policy -XBT_PUBLIC_DATA(short int) surfxml_cluster_sharing___policy_isset; -XBT_PUBLIC_DATA(AT_surfxml_random_max) AX_surfxml_random_max; -#define A_surfxml_random_max (surfxml_bufferstack + AX_surfxml_random_max) -XBT_PUBLIC_DATA(short int) surfxml_random_max_isset; -XBT_PUBLIC_DATA(AT_surfxml_router_id) AX_surfxml_router_id; -#define A_surfxml_router_id (surfxml_bufferstack + AX_surfxml_router_id) -XBT_PUBLIC_DATA(short int) surfxml_router_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_backbone_latency) AX_surfxml_backbone_latency; -#define A_surfxml_backbone_latency (surfxml_bufferstack + AX_surfxml_backbone_latency) -XBT_PUBLIC_DATA(short int) surfxml_backbone_latency_isset; +XBT_PUBLIC_DATA(AT_surfxml_process_kill___time) AX_surfxml_process_kill___time; +#define A_surfxml_process_kill___time (surfxml_bufferstack + AX_surfxml_process_kill___time) +XBT_PUBLIC_DATA(short int) surfxml_process_kill___time_isset; +XBT_PUBLIC_DATA(AT_surfxml_host_id) AX_surfxml_host_id; +#define A_surfxml_host_id (surfxml_bufferstack + AX_surfxml_host_id) +XBT_PUBLIC_DATA(short int) surfxml_host_id_isset; +XBT_PUBLIC_DATA(AT_surfxml_trace___connect_element) AX_surfxml_trace___connect_element; +#define A_surfxml_trace___connect_element (surfxml_bufferstack + AX_surfxml_trace___connect_element) +XBT_PUBLIC_DATA(short int) surfxml_trace___connect_element_isset; +XBT_PUBLIC_DATA(AT_surfxml_random_min) AX_surfxml_random_min; +#define A_surfxml_random_min (surfxml_bufferstack + AX_surfxml_random_min) +XBT_PUBLIC_DATA(short int) surfxml_random_min_isset; +XBT_PUBLIC_DATA(AT_surfxml_peer_power) AX_surfxml_peer_power; +#define A_surfxml_peer_power (surfxml_bufferstack + AX_surfxml_peer_power) +XBT_PUBLIC_DATA(short int) surfxml_peer_power_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_loopback___lat) AX_surfxml_cluster_loopback___lat; +#define A_surfxml_cluster_loopback___lat (surfxml_bufferstack + AX_surfxml_cluster_loopback___lat) +XBT_PUBLIC_DATA(short int) surfxml_cluster_loopback___lat_isset; +XBT_PUBLIC_DATA(AT_surfxml_random_mean) AX_surfxml_random_mean; +#define A_surfxml_random_mean (surfxml_bufferstack + AX_surfxml_random_mean) +XBT_PUBLIC_DATA(short int) surfxml_random_mean_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_bb___sharing___policy) AX_surfxml_cluster_bb___sharing___policy; +#define A_surfxml_cluster_bb___sharing___policy AX_surfxml_cluster_bb___sharing___policy +XBT_PUBLIC_DATA(short int) surfxml_cluster_bb___sharing___policy_isset; XBT_PUBLIC_DATA(AT_surfxml_cluster_prefix) AX_surfxml_cluster_prefix; #define A_surfxml_cluster_prefix (surfxml_bufferstack + AX_surfxml_cluster_prefix) XBT_PUBLIC_DATA(short int) surfxml_cluster_prefix_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_bw) AX_surfxml_cluster_bw; -#define A_surfxml_cluster_bw (surfxml_bufferstack + AX_surfxml_cluster_bw) -XBT_PUBLIC_DATA(short int) surfxml_cluster_bw_isset; -XBT_PUBLIC_DATA(AT_surfxml_link_latency) AX_surfxml_link_latency; -#define A_surfxml_link_latency (surfxml_bufferstack + AX_surfxml_link_latency) -XBT_PUBLIC_DATA(short int) surfxml_link_latency_isset; -XBT_PUBLIC_DATA(AT_surfxml_cabinet_suffix) AX_surfxml_cabinet_suffix; -#define A_surfxml_cabinet_suffix (surfxml_bufferstack + AX_surfxml_cabinet_suffix) -XBT_PUBLIC_DATA(short int) surfxml_cabinet_suffix_isset; +XBT_PUBLIC_DATA(AT_surfxml_process_on___failure) AX_surfxml_process_on___failure; +#define A_surfxml_process_on___failure AX_surfxml_process_on___failure +XBT_PUBLIC_DATA(short int) surfxml_process_on___failure_isset; +XBT_PUBLIC_DATA(AT_surfxml_backbone_latency) AX_surfxml_backbone_latency; +#define A_surfxml_backbone_latency (surfxml_bufferstack + AX_surfxml_backbone_latency) +XBT_PUBLIC_DATA(short int) surfxml_backbone_latency_isset; +XBT_PUBLIC_DATA(AT_surfxml_argument_value) AX_surfxml_argument_value; +#define A_surfxml_argument_value (surfxml_bufferstack + AX_surfxml_argument_value) +XBT_PUBLIC_DATA(short int) surfxml_argument_value_isset; +XBT_PUBLIC_DATA(AT_surfxml_link_sharing___policy) AX_surfxml_link_sharing___policy; +#define A_surfxml_link_sharing___policy AX_surfxml_link_sharing___policy +XBT_PUBLIC_DATA(short int) surfxml_link_sharing___policy_isset; +XBT_PUBLIC_DATA(AT_surfxml_platform_version) AX_surfxml_platform_version; +#define A_surfxml_platform_version (surfxml_bufferstack + AX_surfxml_platform_version) +XBT_PUBLIC_DATA(short int) surfxml_platform_version_isset; +XBT_PUBLIC_DATA(AT_surfxml_ASroute_dst) AX_surfxml_ASroute_dst; +#define A_surfxml_ASroute_dst (surfxml_bufferstack + AX_surfxml_ASroute_dst) +XBT_PUBLIC_DATA(short int) surfxml_ASroute_dst_isset; +XBT_PUBLIC_DATA(AT_surfxml_prop_value) AX_surfxml_prop_value; +#define A_surfxml_prop_value (surfxml_bufferstack + AX_surfxml_prop_value) +XBT_PUBLIC_DATA(short int) surfxml_prop_value_isset; +XBT_PUBLIC_DATA(AT_surfxml_ASroute_src) AX_surfxml_ASroute_src; +#define A_surfxml_ASroute_src (surfxml_bufferstack + AX_surfxml_ASroute_src) +XBT_PUBLIC_DATA(short int) surfxml_ASroute_src_isset; +XBT_PUBLIC_DATA(AT_surfxml_host___link_up) AX_surfxml_host___link_up; +#define A_surfxml_host___link_up (surfxml_bufferstack + AX_surfxml_host___link_up) +XBT_PUBLIC_DATA(short int) surfxml_host___link_up_isset; +XBT_PUBLIC_DATA(AT_surfxml_cabinet_power) AX_surfxml_cabinet_power; +#define A_surfxml_cabinet_power (surfxml_bufferstack + AX_surfxml_cabinet_power) +XBT_PUBLIC_DATA(short int) surfxml_cabinet_power_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_core) AX_surfxml_cluster_core; +#define A_surfxml_cluster_core (surfxml_bufferstack + AX_surfxml_cluster_core) +XBT_PUBLIC_DATA(short int) surfxml_cluster_core_isset; +XBT_PUBLIC_DATA(AT_surfxml_include_file) AX_surfxml_include_file; +#define A_surfxml_include_file (surfxml_bufferstack + AX_surfxml_include_file) +XBT_PUBLIC_DATA(short int) surfxml_include_file_isset; +XBT_PUBLIC_DATA(AT_surfxml_ASroute_gw___src) AX_surfxml_ASroute_gw___src; +#define A_surfxml_ASroute_gw___src (surfxml_bufferstack + AX_surfxml_ASroute_gw___src) +XBT_PUBLIC_DATA(short int) surfxml_ASroute_gw___src_isset; +XBT_PUBLIC_DATA(AT_surfxml_random_generator) AX_surfxml_random_generator; +#define A_surfxml_random_generator AX_surfxml_random_generator +XBT_PUBLIC_DATA(short int) surfxml_random_generator_isset; +XBT_PUBLIC_DATA(AT_surfxml_cabinet_lat) AX_surfxml_cabinet_lat; +#define A_surfxml_cabinet_lat (surfxml_bufferstack + AX_surfxml_cabinet_lat) +XBT_PUBLIC_DATA(short int) surfxml_cabinet_lat_isset; +XBT_PUBLIC_DATA(AT_surfxml_random_seed) AX_surfxml_random_seed; +#define A_surfxml_random_seed (surfxml_bufferstack + AX_surfxml_random_seed) +XBT_PUBLIC_DATA(short int) surfxml_random_seed_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_router___id) AX_surfxml_cluster_router___id; +#define A_surfxml_cluster_router___id (surfxml_bufferstack + AX_surfxml_cluster_router___id) +XBT_PUBLIC_DATA(short int) surfxml_cluster_router___id_isset; XBT_PUBLIC_DATA(AT_surfxml_host___link_down) AX_surfxml_host___link_down; #define A_surfxml_host___link_down (surfxml_bufferstack + AX_surfxml_host___link_down) XBT_PUBLIC_DATA(short int) surfxml_host___link_down_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_loopback___lat) AX_surfxml_cluster_loopback___lat; -#define A_surfxml_cluster_loopback___lat (surfxml_bufferstack + AX_surfxml_cluster_loopback___lat) -XBT_PUBLIC_DATA(short int) surfxml_cluster_loopback___lat_isset; -XBT_PUBLIC_DATA(AT_surfxml_host_state___file) AX_surfxml_host_state___file; -#define A_surfxml_host_state___file (surfxml_bufferstack + AX_surfxml_host_state___file) -XBT_PUBLIC_DATA(short int) surfxml_host_state___file_isset; -XBT_PUBLIC_DATA(AT_surfxml_model___prop_value) AX_surfxml_model___prop_value; -#define A_surfxml_model___prop_value (surfxml_bufferstack + AX_surfxml_model___prop_value) -XBT_PUBLIC_DATA(short int) surfxml_model___prop_value_isset; -XBT_PUBLIC_DATA(AT_surfxml_random_std___deviation) AX_surfxml_random_std___deviation; -#define A_surfxml_random_std___deviation (surfxml_bufferstack + AX_surfxml_random_std___deviation) -XBT_PUBLIC_DATA(short int) surfxml_random_std___deviation_isset; -XBT_PUBLIC_DATA(AT_surfxml_process_function) AX_surfxml_process_function; -#define A_surfxml_process_function (surfxml_bufferstack + AX_surfxml_process_function) -XBT_PUBLIC_DATA(short int) surfxml_process_function_isset; +XBT_PUBLIC_DATA(AT_surfxml_link_latency) AX_surfxml_link_latency; +#define A_surfxml_link_latency (surfxml_bufferstack + AX_surfxml_link_latency) +XBT_PUBLIC_DATA(short int) surfxml_link_latency_isset; +XBT_PUBLIC_DATA(AT_surfxml_random_max) AX_surfxml_random_max; +#define A_surfxml_random_max (surfxml_bufferstack + AX_surfxml_random_max) +XBT_PUBLIC_DATA(short int) surfxml_random_max_isset; +XBT_PUBLIC_DATA(AT_surfxml_host_availability) AX_surfxml_host_availability; +#define A_surfxml_host_availability (surfxml_bufferstack + AX_surfxml_host_availability) +XBT_PUBLIC_DATA(short int) surfxml_host_availability_isset; XBT_PUBLIC_DATA(AT_surfxml_storage___type_size) AX_surfxml_storage___type_size; #define A_surfxml_storage___type_size (surfxml_bufferstack + AX_surfxml_storage___type_size) XBT_PUBLIC_DATA(short int) surfxml_storage___type_size_isset; -XBT_PUBLIC_DATA(AT_surfxml_host_availability___file) AX_surfxml_host_availability___file; -#define A_surfxml_host_availability___file (surfxml_bufferstack + AX_surfxml_host_availability___file) -XBT_PUBLIC_DATA(short int) surfxml_host_availability___file_isset; -XBT_PUBLIC_DATA(AT_surfxml_backbone_id) AX_surfxml_backbone_id; -#define A_surfxml_backbone_id (surfxml_bufferstack + AX_surfxml_backbone_id) -XBT_PUBLIC_DATA(short int) surfxml_backbone_id_isset; -XBT_PUBLIC_DATA(AT_surfxml_trace_periodicity) AX_surfxml_trace_periodicity; -#define A_surfxml_trace_periodicity (surfxml_bufferstack + AX_surfxml_trace_periodicity) -XBT_PUBLIC_DATA(short int) surfxml_trace_periodicity_isset; -XBT_PUBLIC_DATA(AT_surfxml_cluster_bb___lat) AX_surfxml_cluster_bb___lat; -#define A_surfxml_cluster_bb___lat (surfxml_bufferstack + AX_surfxml_cluster_bb___lat) -XBT_PUBLIC_DATA(short int) surfxml_cluster_bb___lat_isset; -XBT_PUBLIC_DATA(AT_surfxml_storage___type_content___type) AX_surfxml_storage___type_content___type; -#define A_surfxml_storage___type_content___type (surfxml_bufferstack + AX_surfxml_storage___type_content___type) -XBT_PUBLIC_DATA(short int) surfxml_storage___type_content___type_isset; +XBT_PUBLIC_DATA(AT_surfxml_cluster_topo___parameters) AX_surfxml_cluster_topo___parameters; +#define A_surfxml_cluster_topo___parameters (surfxml_bufferstack + AX_surfxml_cluster_topo___parameters) +XBT_PUBLIC_DATA(short int) surfxml_cluster_topo___parameters_isset; /* XML application utilities. */ XBT_PUBLIC(int) surfxml_element_context(int); diff --git a/include/xbt/graphxml.h b/include/xbt/graphxml.h index 5f89b84181..1f1382a7f7 100644 --- a/include/xbt/graphxml.h +++ b/include/xbt/graphxml.h @@ -56,70 +56,70 @@ XBT_PUBLIC(void) STag_graphxml_edge(void); XBT_PUBLIC(void) ETag_graphxml_edge(void); /* XML application data. */ -typedef int AT_graphxml_node_position___y; -#define AU_graphxml_node_position___y NULL -typedef int AT_graphxml_node_position___x; -#define AU_graphxml_node_position___x NULL -typedef int AT_graphxml_edge_source; -#define AU_graphxml_edge_source NULL -typedef enum { AU_graphxml_graph_isDirected, A_graphxml_graph_isDirected_true,A_graphxml_graph_isDirected_false } AT_graphxml_graph_isDirected; -typedef int AT_graphxml_node_data; -#define AU_graphxml_node_data NULL typedef int AT_graphxml_edge_name; #define AU_graphxml_edge_name NULL -typedef int AT_graphxml_edge_data; -#define AU_graphxml_edge_data NULL -typedef int AT_graphxml_edge_length; -#define AU_graphxml_edge_length NULL typedef int AT_graphxml_node_name; #define AU_graphxml_node_name NULL -typedef int AT_graphxml_edge_label; -#define AU_graphxml_edge_label NULL typedef int AT_graphxml_edge_target; #define AU_graphxml_edge_target NULL +typedef int AT_graphxml_edge_data; +#define AU_graphxml_edge_data NULL +typedef int AT_graphxml_node_data; +#define AU_graphxml_node_data NULL +typedef int AT_graphxml_edge_source; +#define AU_graphxml_edge_source NULL +typedef enum { AU_graphxml_graph_isDirected, A_graphxml_graph_isDirected_true,A_graphxml_graph_isDirected_false } AT_graphxml_graph_isDirected; typedef int AT_graphxml_node_label; #define AU_graphxml_node_label NULL +typedef int AT_graphxml_node_position___x; +#define AU_graphxml_node_position___x NULL +typedef int AT_graphxml_edge_label; +#define AU_graphxml_edge_label NULL +typedef int AT_graphxml_edge_length; +#define AU_graphxml_edge_length NULL +typedef int AT_graphxml_node_position___y; +#define AU_graphxml_node_position___y NULL /* FleXML-provided data. */ XBT_PUBLIC_DATA(int) graphxml_pcdata_ix; XBT_PUBLIC_DATA(char *) graphxml_bufferstack; #define graphxml_pcdata (graphxml_bufferstack + graphxml_pcdata_ix) -XBT_PUBLIC_DATA(AT_graphxml_node_position___y) AX_graphxml_node_position___y; -#define A_graphxml_node_position___y (graphxml_bufferstack + AX_graphxml_node_position___y) -XBT_PUBLIC_DATA(short int) graphxml_node_position___y_isset; -XBT_PUBLIC_DATA(AT_graphxml_node_position___x) AX_graphxml_node_position___x; -#define A_graphxml_node_position___x (graphxml_bufferstack + AX_graphxml_node_position___x) -XBT_PUBLIC_DATA(short int) graphxml_node_position___x_isset; -XBT_PUBLIC_DATA(AT_graphxml_edge_source) AX_graphxml_edge_source; -#define A_graphxml_edge_source (graphxml_bufferstack + AX_graphxml_edge_source) -XBT_PUBLIC_DATA(short int) graphxml_edge_source_isset; -XBT_PUBLIC_DATA(AT_graphxml_graph_isDirected) AX_graphxml_graph_isDirected; -#define A_graphxml_graph_isDirected AX_graphxml_graph_isDirected -XBT_PUBLIC_DATA(short int) graphxml_graph_isDirected_isset; -XBT_PUBLIC_DATA(AT_graphxml_node_data) AX_graphxml_node_data; -#define A_graphxml_node_data (graphxml_bufferstack + AX_graphxml_node_data) -XBT_PUBLIC_DATA(short int) graphxml_node_data_isset; XBT_PUBLIC_DATA(AT_graphxml_edge_name) AX_graphxml_edge_name; #define A_graphxml_edge_name (graphxml_bufferstack + AX_graphxml_edge_name) XBT_PUBLIC_DATA(short int) graphxml_edge_name_isset; -XBT_PUBLIC_DATA(AT_graphxml_edge_data) AX_graphxml_edge_data; -#define A_graphxml_edge_data (graphxml_bufferstack + AX_graphxml_edge_data) -XBT_PUBLIC_DATA(short int) graphxml_edge_data_isset; -XBT_PUBLIC_DATA(AT_graphxml_edge_length) AX_graphxml_edge_length; -#define A_graphxml_edge_length (graphxml_bufferstack + AX_graphxml_edge_length) -XBT_PUBLIC_DATA(short int) graphxml_edge_length_isset; XBT_PUBLIC_DATA(AT_graphxml_node_name) AX_graphxml_node_name; #define A_graphxml_node_name (graphxml_bufferstack + AX_graphxml_node_name) XBT_PUBLIC_DATA(short int) graphxml_node_name_isset; -XBT_PUBLIC_DATA(AT_graphxml_edge_label) AX_graphxml_edge_label; -#define A_graphxml_edge_label (graphxml_bufferstack + AX_graphxml_edge_label) -XBT_PUBLIC_DATA(short int) graphxml_edge_label_isset; XBT_PUBLIC_DATA(AT_graphxml_edge_target) AX_graphxml_edge_target; #define A_graphxml_edge_target (graphxml_bufferstack + AX_graphxml_edge_target) XBT_PUBLIC_DATA(short int) graphxml_edge_target_isset; +XBT_PUBLIC_DATA(AT_graphxml_edge_data) AX_graphxml_edge_data; +#define A_graphxml_edge_data (graphxml_bufferstack + AX_graphxml_edge_data) +XBT_PUBLIC_DATA(short int) graphxml_edge_data_isset; +XBT_PUBLIC_DATA(AT_graphxml_node_data) AX_graphxml_node_data; +#define A_graphxml_node_data (graphxml_bufferstack + AX_graphxml_node_data) +XBT_PUBLIC_DATA(short int) graphxml_node_data_isset; +XBT_PUBLIC_DATA(AT_graphxml_edge_source) AX_graphxml_edge_source; +#define A_graphxml_edge_source (graphxml_bufferstack + AX_graphxml_edge_source) +XBT_PUBLIC_DATA(short int) graphxml_edge_source_isset; +XBT_PUBLIC_DATA(AT_graphxml_graph_isDirected) AX_graphxml_graph_isDirected; +#define A_graphxml_graph_isDirected AX_graphxml_graph_isDirected +XBT_PUBLIC_DATA(short int) graphxml_graph_isDirected_isset; XBT_PUBLIC_DATA(AT_graphxml_node_label) AX_graphxml_node_label; #define A_graphxml_node_label (graphxml_bufferstack + AX_graphxml_node_label) XBT_PUBLIC_DATA(short int) graphxml_node_label_isset; +XBT_PUBLIC_DATA(AT_graphxml_node_position___x) AX_graphxml_node_position___x; +#define A_graphxml_node_position___x (graphxml_bufferstack + AX_graphxml_node_position___x) +XBT_PUBLIC_DATA(short int) graphxml_node_position___x_isset; +XBT_PUBLIC_DATA(AT_graphxml_edge_label) AX_graphxml_edge_label; +#define A_graphxml_edge_label (graphxml_bufferstack + AX_graphxml_edge_label) +XBT_PUBLIC_DATA(short int) graphxml_edge_label_isset; +XBT_PUBLIC_DATA(AT_graphxml_edge_length) AX_graphxml_edge_length; +#define A_graphxml_edge_length (graphxml_bufferstack + AX_graphxml_edge_length) +XBT_PUBLIC_DATA(short int) graphxml_edge_length_isset; +XBT_PUBLIC_DATA(AT_graphxml_node_position___y) AX_graphxml_node_position___y; +#define A_graphxml_node_position___y (graphxml_bufferstack + AX_graphxml_node_position___y) +XBT_PUBLIC_DATA(short int) graphxml_node_position___y_isset; /* XML application utilities. */ XBT_PUBLIC(int) graphxml_element_context(int); diff --git a/include/xbt/log.h b/include/xbt/log.h index 073bc8ddbb..a4c4d8ac06 100644 --- a/include/xbt/log.h +++ b/include/xbt/log.h @@ -340,6 +340,7 @@ XBT_PUBLIC(void) xbt_log_additivity_set(xbt_log_category_t cat, XBT_PUBLIC(xbt_log_layout_t) xbt_log_layout_simple_new(char *arg); XBT_PUBLIC(xbt_log_layout_t) xbt_log_layout_format_new(char *arg); XBT_PUBLIC(xbt_log_appender_t) xbt_log_appender_file_new(char *arg); +XBT_PUBLIC(xbt_log_appender_t) xbt_log_appender2_file_new(char *arg,int roll); /* ********************************** */ diff --git a/include/xbt/synchro_core.h b/include/xbt/synchro_core.h index 2c8e641a1b..a260c0d97b 100644 --- a/include/xbt/synchro_core.h +++ b/include/xbt/synchro_core.h @@ -83,7 +83,6 @@ XBT_PUBLIC(void) xbt_mutex_acquire(xbt_mutex_t mutex); * Tries to lock a mutex, return 1 if the mutex is unlocked, else 0. * This function does not block and wait for the mutex to be unlocked. * \param mutex The mutex - * \param issuer The process that tries to acquire the mutex * \return 1 - mutex free, 0 - mutex used */ XBT_PUBLIC(int) xbt_mutex_try_acquire(xbt_mutex_t mutex); diff --git a/src/bindings/java/jmsg_vm.c b/src/bindings/java/jmsg_vm.c index d03010e705..a86efdacef 100644 --- a/src/bindings/java/jmsg_vm.c +++ b/src/bindings/java/jmsg_vm.c @@ -128,6 +128,7 @@ Java_org_simgrid_msg_VM_internalmig(JNIEnv *env, jobject jvm, jobject jhost) { TRY{ MSG_vm_migrate(vm,host); } CATCH_ANONYMOUS{ + XBT_INFO("CATCH EXCEPTION MIGRATION"); jxbt_throw_host_failure(env, (char*)"during migration"); } } diff --git a/src/bindings/java/org/simgrid/NativeLib.java b/src/bindings/java/org/simgrid/NativeLib.java index 18e593a14d..d253847398 100644 --- a/src/bindings/java/org/simgrid/NativeLib.java +++ b/src/bindings/java/org/simgrid/NativeLib.java @@ -13,107 +13,111 @@ import java.io.File; public final class NativeLib { - public static String getPath() { - String prefix = "NATIVE"; - String os = System.getProperty("os.name"); - String arch = System.getProperty("os.arch"); - - if (arch.matches("^i[3-6]86$")) - arch = "x86"; - else if (arch.equalsIgnoreCase("amd64")) - arch = "x86_64"; - - if (os.toLowerCase().startsWith("win")){ - os = "Windows"; - arch = "x86"; - }else if (os.contains("OS X")) - os = "Darwin"; - - os = os.replace(' ', '_'); - arch = arch.replace(' ', '_'); - - return prefix + "/" + os + "/" + arch + "/"; - } - public static void nativeInit(String name) { - try { - /* prefer the version on disk, if existing */ - System.loadLibrary(name); - } catch (UnsatisfiedLinkError e) { - /* If not found, unpack the one bundled into the jar file and use it */ - loadLib(name); - } - } - - private static void loadLib (String name) { - String Path = NativeLib.getPath(); - - String filename=name; - InputStream in = NativeLib.class.getClassLoader().getResourceAsStream(Path+filename); - - if (in == null) { - filename = "lib"+name+".so"; - in = NativeLib.class.getClassLoader().getResourceAsStream(Path+filename); - } - if (in == null) { - filename = name+".dll"; - in = NativeLib.class.getClassLoader().getResourceAsStream(Path+filename); - } - if (in == null) { - filename = "lib"+name+".dll"; - in = NativeLib.class.getClassLoader().getResourceAsStream(Path+filename); - } - if (in == null) { - filename = "lib"+name+".dylib"; - in = NativeLib.class.getClassLoader().getResourceAsStream(Path+filename); - } - if (in == null) { - throw new RuntimeException("Cannot find library "+name+" in path "+Path+". Sorry, but this jar does not seem to be usable on your machine."); + public static String getPath() { + String prefix = "NATIVE"; + String os = System.getProperty("os.name"); + String arch = System.getProperty("os.arch"); + + if (arch.matches("^i[3-6]86$")) + arch = "x86"; + else if (arch.equalsIgnoreCase("amd64")) + arch = "x86_64"; + + if (os.toLowerCase().startsWith("win")){ + os = "Windows"; + arch = "x86"; + }else if (os.contains("OS X")) + os = "Darwin"; + + os = os.replace(' ', '_'); + arch = arch.replace(' ', '_'); + + return prefix + "/" + os + "/" + arch + "/"; } - try { - // We must write the lib onto the disk before loading it -- stupid operating systems - File fileOut = new File(filename); - fileOut = File.createTempFile(name+"-", ".tmp"); - // don't leak the file on disk, but remove it on JVM shutdown - Runtime.getRuntime().addShutdownHook(new Thread(new FileCleaner(fileOut.getAbsolutePath()))); - OutputStream out = new FileOutputStream(fileOut); - - /* copy the library in position */ - byte[] buffer = new byte[4096]; - int bytes_read; - while ((bytes_read = in.read(buffer)) != -1) // Read until EOF - out.write(buffer, 0, bytes_read); - - /* close all file descriptors, and load that shit */ - in.close(); - out.close(); - System.load(fileOut.getAbsolutePath()); - - } catch (Exception e) { - System.err.println("Cannot load the bindings to the "+name+" library: "); - e.printStackTrace(); - System.err.println("This jar file does not seem to fit your system, sorry"); - System.exit(1); + public static void nativeInit(String name) { + try { + /* prefer the version on disk, if existing */ + System.loadLibrary(name); + } catch (UnsatisfiedLinkError e) { + /* If not found, unpack the one bundled into the jar file and use it */ + loadLib(name); + } + } + + private static void loadLib (String name) { + String Path = NativeLib.getPath(); + + String filename=name; + InputStream in = NativeLib.class.getClassLoader().getResourceAsStream(Path+filename); + + if (in == null) { + filename = "lib"+name+".so"; + in = NativeLib.class.getClassLoader().getResourceAsStream(Path+filename); + } + if (in == null) { + filename = name+".dll"; + in = NativeLib.class.getClassLoader().getResourceAsStream(Path+filename); + } + if (in == null) { + filename = "lib"+name+".dll"; + in = NativeLib.class.getClassLoader().getResourceAsStream(Path+filename); + } + if (in == null) { + filename = "lib"+name+".dylib"; + in = NativeLib.class.getClassLoader().getResourceAsStream(Path+filename); + } + if (in == null) { + throw new RuntimeException("Cannot find library "+name+" in path "+Path+". Sorry, but this jar does not seem to be usable on your machine."); + } + try { + // We must write the lib onto the disk before loading it -- stupid operating systems + File fileOut = new File(filename); + fileOut = File.createTempFile(name+"-", ".tmp"); + // don't leak the file on disk, but remove it on JVM shutdown + Runtime.getRuntime().addShutdownHook(new Thread(new FileCleaner(fileOut.getAbsolutePath()))); + OutputStream out = new FileOutputStream(fileOut); + + /* copy the library in position */ + byte[] buffer = new byte[4096]; + int bytes_read; + while ((bytes_read = in.read(buffer)) != -1) // Read until EOF + out.write(buffer, 0, bytes_read); + + /* close all file descriptors, and load that shit */ + in.close(); + out.close(); + System.load(fileOut.getAbsolutePath()); + + } catch (Exception e) { + System.err.println("Cannot load the bindings to the "+name+" library in path "+getPath()); + e.printStackTrace(); + System.err.println("This jar file does not seem to fit your system, sorry"); + System.exit(1); + } } - } - + /* A hackish mechanism used to remove the file containing our library when the JVM shuts down */ private static class FileCleaner implements Runnable { private String target; public FileCleaner(String name) { target = name; } - public void run() { - try { - new File(target).delete(); - } catch(Exception e) { - System.out.println("Unable to clean temporary file "+target+" during shutdown."); - e.printStackTrace(); - } - } + public void run() { + try { + new File(target).delete(); + } catch(Exception e) { + System.out.println("Unable to clean temporary file "+target+" during shutdown."); + e.printStackTrace(); + } + } } - public static void main(String[] args) { - System.out.println(getPath()); - } + public static void main(String[] args) { + if (args.length >= 1 && args[0].equals("--quiet")) + /* be careful, this execution path is used in buildtools/Cmake/Scripts/java_bundle.sh to determine where to put the libs */ + System.out.println(getPath()); + else + System.out.println("This java library will try to load the native code under the following name:\n" +getPath()); + } } diff --git a/src/bindings/java/org/simgrid/msg/File.java b/src/bindings/java/org/simgrid/msg/File.java index ed657705ff..f0c78eb5e4 100644 --- a/src/bindings/java/org/simgrid/msg/File.java +++ b/src/bindings/java/org/simgrid/msg/File.java @@ -15,7 +15,6 @@ public class File { private long bind = 0; /** * Constructor, opens the file. - * @param storage is the name where you can find the file descriptor * @param path is the file location on the storage */ public File(String path) { diff --git a/src/bindings/java/org/simgrid/msg/Msg.java b/src/bindings/java/org/simgrid/msg/Msg.java index ec212a7d8e..6cdc8944e1 100644 --- a/src/bindings/java/org/simgrid/msg/Msg.java +++ b/src/bindings/java/org/simgrid/msg/Msg.java @@ -18,22 +18,21 @@ import java.io.File; public final class Msg { /* Statically load the library which contains all native functions used in here */ static private boolean isNativeInited = false; - public static void nativeInit() { - if (isNativeInited) - return; - NativeLib.nativeInit("simgrid"); - NativeLib.nativeInit("simgrid-java"); + public static void nativeInit() { + if (isNativeInited) + return; + NativeLib.nativeInit("simgrid"); + NativeLib.nativeInit("simgrid-java"); isNativeInited = true; - } static { - nativeInit(); + nativeInit(); } - - /** Retrieve the simulation time - * @return The simulation time. - */ + + /** Retrieve the simulation time + * @return The simulation time. + */ public final static native double getClock(); /** * Issue a debug logging message. @@ -47,8 +46,8 @@ public final class Msg { public final static native void verb(String s); /** Issue an information logging message - * @param s - */ + * @param s + */ public final static native void info(String s); /** * Issue an warning logging message. @@ -86,7 +85,7 @@ public final class Msg { * of a process or the current date is perfectly ok. */ public final static native void run() ; - + /** This function is useless nowadays, just stop calling it. */ @Deprecated public final static void clean(){} @@ -104,15 +103,15 @@ public final class Msg { /** * The method to deploy the simulation. * - * - * @param deploymentFile - */ + * + * @param deploymentFile + */ public final static native void deployApplication(String deploymentFile); - /** Example launcher. You can use it or provide your own launcher, as you wish - * @param args - * @throws MsgException - */ + /** Example launcher. You can use it or provide your own launcher, as you wish + * @param args + * @throws MsgException + */ static public void main(String[]args) throws MsgException { /* initialize the MSG simulation. Must be done before anything else (even logging). */ Msg.init(args); diff --git a/src/bindings/java/org/simgrid/msg/VM.java b/src/bindings/java/org/simgrid/msg/VM.java index 4454960a85..b858c49694 100644 --- a/src/bindings/java/org/simgrid/msg/VM.java +++ b/src/bindings/java/org/simgrid/msg/VM.java @@ -147,16 +147,21 @@ public class VM extends Host{ /** * Invoke native migration routine */ - public native void internalmig(Host destination); + public native void internalmig(Host destination) throws Exception; // TODO add throws DoubleMigrationException (i.e. when you call migrate on a VM that is already migrating); + /** Change the host on which all processes are running * (pre-copy is implemented) */ - public void migrate(Host destination){ - this.internalmig(destination); - // TODO we should test whether the migration has been correctly finalized. - // If and only if it is ok, then we should change the currentHost value. + public void migrate(Host destination) throws HostFailureException{ + try { + this.internalmig(destination); + } catch (Exception e){ + Msg.info("an exception occurs during the migration of VM "+this.getName()); + throw new HostFailureException(); + } + // If the migration correcly returned, then we should change the currentHost value. this.currentHost = destination; } diff --git a/src/bindings/java/org/simgrid/surf/NetworkLink.java b/src/bindings/java/org/simgrid/surf/NetworkLink.java index 5e61e7f7de..7bef76901d 100644 --- a/src/bindings/java/org/simgrid/surf/NetworkLink.java +++ b/src/bindings/java/org/simgrid/surf/NetworkLink.java @@ -63,7 +63,6 @@ public class NetworkLink extends Resource { /** * @param value The new bandwidth - * @param date When to change the bandwidth */ public void updateBandwidth(double value, double date) { SurfJNI.NetworkLink_updateBandwidth__SWIG_0(swigCPtr, this, value, date); @@ -72,7 +71,6 @@ public class NetworkLink extends Resource { /** * @param value The new bandwidth - * @param date When to change the bandwidth */ public void updateBandwidth(double value) { SurfJNI.NetworkLink_updateBandwidth__SWIG_1(swigCPtr, this, value); @@ -89,7 +87,6 @@ public class NetworkLink extends Resource { /** * @param value The new latency - * @param date When to change the latency */ public void updateLatency(double value, double date) { SurfJNI.NetworkLink_updateLatency__SWIG_0(swigCPtr, this, value, date); @@ -98,7 +95,6 @@ public class NetworkLink extends Resource { /** * @param value The new latency - * @param date When to change the latency */ public void updateLatency(double value) { SurfJNI.NetworkLink_updateLatency__SWIG_1(swigCPtr, this, value); diff --git a/src/bindings/java/smx_context_cojava.c b/src/bindings/java/smx_context_cojava.c index 3503536084..bfafcb4f6a 100644 --- a/src/bindings/java/smx_context_cojava.c +++ b/src/bindings/java/smx_context_cojava.c @@ -180,7 +180,8 @@ void smx_ctx_cojava_stop(smx_context_t context) if (context->iwannadie) { context->iwannadie = 0; JNIEnv *env = get_current_thread_env(); - jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", xbt_strdup("Process killed :)")); + // TODO it will be nice to have the name of the process to help the end-user to know which Process has been killed + jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", xbt_strdup("Process killed :) (file smx_context_cojava.c)")); THROWF(cancel_error, 0, "process cancelled"); } else { diff --git a/src/bindings/java/smx_context_java.c b/src/bindings/java/smx_context_java.c index b8dbfbb91a..29489d1bbf 100644 --- a/src/bindings/java/smx_context_java.c +++ b/src/bindings/java/smx_context_java.c @@ -12,6 +12,7 @@ #include "smx_context_java.h" #include "jxbt_utilities.h" #include "xbt/dynar.h" +#include "../../simix/smx_private.h" extern JavaVM *__java_vm; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(jmsg, bindings, "MSG for Java(TM)"); @@ -153,8 +154,13 @@ void smx_ctx_java_stop(smx_context_t context) if (context->iwannadie) { context->iwannadie = 0; JNIEnv *env = get_current_thread_env(); - XBT_DEBUG("Gonnal launch Killed Error"); - jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", xbt_strdup("Process killed :)")); + XBT_DEBUG("Gonna launch Killed Error"); + // TODO Adrien, if the process has not been created at the java layer, why should we raise the exception/error at the java level (this happens + // for instance during the migration process that creates at the C level two processes: one on the SRC node and one on the DST node, if the DST process is killed. + // it is not required to raise an exception at the JAVA level, the low level should be able to manage such an issue correctly but this is not the case right now unfortunately ... + // TODO it will be nice to have the name of the process to help the end-user to know which Process has been killed + // jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", bprintf("Process %s killed :) (file smx_context_java.c)", MSG_process_get_name( (msg_process_t)context) )); + jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", bprintf("Process %s killed :) (file smx_context_java.c)", simcall_process_get_name((smx_process_t) SIMIX_context_get_process(context))) ); XBT_DEBUG("Trigger a cancel error at the C level"); THROWF(cancel_error, 0, "process cancelled"); } else { diff --git a/src/bindings/java/surfdoc.i b/src/bindings/java/surfdoc.i index bea7464112..24eb9a9ce5 100644 --- a/src/bindings/java/surfdoc.i +++ b/src/bindings/java/surfdoc.i @@ -261,7 +261,6 @@ %javamethodmodifiers NetworkLink::updateBandwidth(double value, double date=surf_get_clock()) " /** * @param value The new bandwidth - * @param date When to change the bandwidth */ public"; @@ -274,7 +273,6 @@ %javamethodmodifiers NetworkLink::updateLatency(double value, double date=surf_get_clock()) " /** * @param value The new latency - * @param date When to change the latency */ public"; diff --git a/src/include/mc/datatypes.h b/src/include/mc/datatypes.h index ffc5d6f5bc..20805a8549 100644 --- a/src/include/mc/datatypes.h +++ b/src/include/mc/datatypes.h @@ -22,7 +22,6 @@ SG_BEGIN_DECL() typedef struct s_mc_transition *mc_transition_t; - /*********** Structures for snapshot comparison **************************/ typedef struct s_mc_heap_ignore_region{ @@ -44,17 +43,8 @@ typedef struct s_stack_region{ void heap_ignore_region_free(mc_heap_ignore_region_t r); void heap_ignore_region_free_voidp(void *r); -/************ Object info *************/ - -typedef struct s_mc_object_info s_mc_object_info_t, *mc_object_info_t; /************ DWARF structures *************/ -typedef int e_dw_type_type; - -typedef struct s_dw_type s_dw_type_t, *dw_type_t; - -char* get_type_description(mc_object_info_t info, char *type_name); - SG_END_DECL() #endif /* _MC_MC_H */ diff --git a/src/include/mc/mc.h b/src/include/mc/mc.h index 1368b59bbf..2bfe7ad44b 100644 --- a/src/include/mc/mc.h +++ b/src/include/mc/mc.h @@ -37,6 +37,7 @@ SG_BEGIN_DECL() /********************************** Configuration of MC **************************************/ extern int _sg_do_model_check; +extern int _sg_do_model_check_record; extern int _sg_mc_checkpoint; extern int _sg_mc_sparse_checkpoint; extern int _sg_mc_soft_dirty; diff --git a/src/include/surf/maxmin.h b/src/include/surf/maxmin.h index cf32554faa..2a5dc0aad2 100644 --- a/src/include/surf/maxmin.h +++ b/src/include/surf/maxmin.h @@ -284,6 +284,24 @@ XBT_PUBLIC(lmm_variable_t) lmm_get_var_from_cnst(lmm_system_t sys, lmm_constraint_t cnst, lmm_element_t * elem); +/** + * @brief Get a var associated to a constraint + * @details Get the first variable of the next variable of elem if elem is not NULL + * + * @param sys The system associated to the variable (not used) + * @param cnst A constraint + * @param elem A element of constraint of the constraint or NULL + * @param nextelem A element of constraint of the constraint or NULL, the one after elem + * @param numelem parameter representing the number of elements to go + * + * @return A variable associated to a constraint + */ +XBT_PUBLIC(lmm_variable_t) lmm_get_var_from_cnst_safe(lmm_system_t /*sys*/, + lmm_constraint_t cnst, + lmm_element_t * elem, + lmm_element_t * nextelem, + int * numelem); + /** * @brief Get the first active constraint of a system * diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 1a9d56edea..c9f19e8186 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -1008,6 +1008,16 @@ XBT_PUBLIC_DATA(surf_network_model_t) surf_network_model; */ XBT_PUBLIC(void) surf_network_model_init_SMPI(void); +/** \ingroup SURF_models + * \brief Same as network model 'LagrangeVelho', only with different correction factors. + * + * This model impelments a variant of the contention model on Infinband networks based on + * the works of Jérôme Vienne : http://mescal.imag.fr/membres/jean-marc.vincent/index.html/PhD/Vienne.pdf + * + * \see surf_workstation_model_init_IB() + */ +XBT_PUBLIC(void) surf_network_model_init_IB(void); + /** \ingroup SURF_models * \brief Initializes the platform with the network model 'LegrandVelho' * diff --git a/src/mc/mc_base.c b/src/mc/mc_base.c new file mode 100644 index 0000000000..82ca8c6a4f --- /dev/null +++ b/src/mc/mc_base.c @@ -0,0 +1,120 @@ +/* Copyright (c) 2008-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include + +#include "mc_base.h" +#include "../simix/smx_private.h" +#include "mc_record.h" + +XBT_LOG_NEW_CATEGORY(mc, "All MC categories"); + +/** + * \brief Schedules all the process that are ready to run + */ +void MC_wait_for_requests(void) +{ + smx_process_t process; + smx_simcall_t req; + unsigned int iter; + + while (!xbt_dynar_is_empty(simix_global->process_to_run)) { + SIMIX_process_runall(); + xbt_dynar_foreach(simix_global->process_that_ran, iter, process) { + req = &process->simcall; + if (req->call != SIMCALL_NONE && !MC_request_is_visible(req)) + SIMIX_simcall_handle(req, 0); + } + } +} + +int MC_request_is_enabled(smx_simcall_t req) +{ + unsigned int index = 0; + smx_synchro_t act = 0; + + switch (req->call) { + case SIMCALL_NONE: + return FALSE; + + case SIMCALL_COMM_WAIT: + /* FIXME: check also that src and dst processes are not suspended */ + act = simcall_comm_wait__get__comm(req); + if (simcall_comm_wait__get__timeout(req) >= 0) { + /* If it has a timeout it will be always be enabled, because even if the + * communication is not ready, it can timeout and won't block. */ + if (_sg_mc_timeout == 1) + return TRUE; + } else { + /* On the other hand if it hasn't a timeout, check if the comm is ready.*/ + if (act->comm.detached && act->comm.src_proc == NULL + && act->comm.type == SIMIX_COMM_READY) + return (act->comm.dst_proc != NULL); + } + return (act->comm.src_proc && act->comm.dst_proc); + + case SIMCALL_COMM_WAITANY: + /* Check if it has at least one communication ready */ + xbt_dynar_foreach(simcall_comm_waitany__get__comms(req), index, act) + if (act->comm.src_proc && act->comm.dst_proc) + return TRUE; + return FALSE; + + default: + /* The rest of the requests are always enabled */ + return TRUE; + } +} + +int MC_request_is_visible(smx_simcall_t req) +{ + return req->call == SIMCALL_COMM_ISEND + || req->call == SIMCALL_COMM_IRECV + || req->call == SIMCALL_COMM_WAIT + || req->call == SIMCALL_COMM_WAITANY + || req->call == SIMCALL_COMM_TEST + || req->call == SIMCALL_COMM_TESTANY + || req->call == SIMCALL_MC_RANDOM +#ifdef HAVE_MC + || req->call == SIMCALL_MC_SNAPSHOT + || req->call == SIMCALL_MC_COMPARE_SNAPSHOTS +#endif + ; +} + +int MC_random(int min, int max) +{ + /*FIXME: return mc_current_state->executed_transition->random.value; */ + return simcall_mc_random(min, max); +} + +static int prng_random(int min, int max) +{ + unsigned long output_size = ((unsigned long) max - (unsigned long) min) + 1; + unsigned long input_size = (unsigned long) RAND_MAX + 1; + unsigned long reject_size = input_size % output_size; + unsigned long accept_size = input_size - reject_size; // module*accept_size + + // Use rejection in order to avoid skew + long x; + do { +#ifndef _XBT_WIN32 + x = random(); +#else + x = rand(); +#endif + } while( x >= accept_size ); + return min + (x % output_size); +} + +int simcall_HANDLER_mc_random(smx_simcall_t simcall, int min, int max) +{ + if (!MC_is_active() && !MC_record_path){ + return prng_random(min, max); + } + + return simcall->mc_value; +} diff --git a/src/mc/mc_base.h b/src/mc/mc_base.h new file mode 100644 index 0000000000..c46241459f --- /dev/null +++ b/src/mc/mc_base.h @@ -0,0 +1,25 @@ +/* Copyright (c) 2008-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef MC_BASE_H +#define MC_BASE_H + +#include +#include "simgrid_config.h" +#include "internal_config.h" +#include "../simix/smx_private.h" + +SG_BEGIN_DECL() + +int MC_request_is_enabled(smx_simcall_t req); +int MC_request_is_visible(smx_simcall_t req); +void MC_wait_for_requests(void); + +extern double *mc_time; + +SG_END_DECL() + +#endif diff --git a/src/mc/mc_checkpoint.c b/src/mc/mc_checkpoint.c index 244982166c..38f64893db 100644 --- a/src/mc/mc_checkpoint.c +++ b/src/mc/mc_checkpoint.c @@ -7,11 +7,14 @@ #define _GNU_SOURCE #define UNW_LOCAL_ONLY +#include #include #include +#include #include "internal_config.h" +#include "mc_memory_map.h" #include "mc_private.h" #include "xbt/module.h" #include @@ -22,12 +25,15 @@ #include "../simix/smx_private.h" +#define UNW_LOCAL_ONLY #include #include #include "mc_private.h" #include +#include "mc_snapshot.h" +#include "mc_object_info.h" #include "mc_mmu.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_checkpoint, mc, @@ -102,7 +108,7 @@ void MC_free_snapshot(mc_snapshot_t snapshot) /******************************* Snapshot regions ********************************/ /*********************************************************************************/ - static mc_mem_region_t mc_region_new_dense(int type, void *start_addr, void* permanent_addr, size_t size, mc_mem_region_t ref_reg) +static mc_mem_region_t mc_region_new_dense(int type, void *start_addr, void* permanent_addr, size_t size, mc_mem_region_t ref_reg) { mc_mem_region_t new_reg = xbt_new(s_mc_mem_region_t, 1); new_reg->start_addr = start_addr; @@ -171,8 +177,8 @@ static void MC_snapshot_add_region(mc_snapshot_t snapshot, int type, static void MC_get_memory_regions(mc_snapshot_t snapshot) { - void *start_heap = ((xbt_mheap_t) std_heap)->base; - void *end_heap = ((xbt_mheap_t) std_heap)->breakval; + void *start_heap = std_heap->base; + void *end_heap = std_heap->breakval; MC_snapshot_add_region(snapshot, 0, start_heap, start_heap, (char *) end_heap - (char *) start_heap); snapshot->heap_bytes_used = mmalloc_get_bytes_used(std_heap); @@ -245,50 +251,6 @@ void MC_init_memory_map_info() } -/** \brief Fill/lookup the "subtype" field. - */ -static void MC_resolve_subtype(mc_object_info_t info, dw_type_t type) -{ - - if (type->dw_type_id == NULL) - return; - type->subtype = xbt_dict_get_or_null(info->types, type->dw_type_id); - if (type->subtype == NULL) - return; - if (type->subtype->byte_size != 0) - return; - if (type->subtype->name == NULL) - return; - // Try to find a more complete description of the type: - // We need to fix in order to support C++. - - dw_type_t subtype = - xbt_dict_get_or_null(info->full_types_by_name, type->subtype->name); - if (subtype != NULL) { - type->subtype = subtype; - } - -} - -void MC_post_process_types(mc_object_info_t info) -{ - xbt_dict_cursor_t cursor = NULL; - char *origin; - dw_type_t type; - - // Lookup "subtype" field: - xbt_dict_foreach(info->types, cursor, origin, type) { - MC_resolve_subtype(info, type); - - dw_type_t member; - unsigned int i = 0; - if (type->members != NULL) - xbt_dynar_foreach(type->members, i, member) { - MC_resolve_subtype(info, member); - } - } -} - /** \brief Fills the position of the segments (executable, read-only, read/write). * * TODO, use dl_iterate_phdr to be more robust @@ -389,12 +351,22 @@ static void mc_fill_local_variables_values(mc_stack_frame_t stack_frame, if (current_variable->address != NULL) { new_var->address = current_variable->address; } else if (current_variable->locations.size != 0) { - new_var->address = - (void *) mc_dwarf_resolve_locations(¤t_variable->locations, + s_mc_location_t location; + mc_dwarf_resolve_locations(&location, ¤t_variable->locations, current_variable->object_info, &(stack_frame->unw_cursor), (void *) stack_frame->frame_base, NULL, process_index); + + switch(mc_get_location_type(&location)) { + case MC_LOCATION_TYPE_ADDRESS: + new_var->address = location.memory_location; + break; + case MC_LOCATION_TYPE_REGISTER: + default: + xbt_die("Cannot handle non-address variable"); + } + } else { xbt_die("No address"); } @@ -599,13 +571,90 @@ static void MC_snapshot_ignore_restore(mc_snapshot_t snapshot) int mc_important_snapshot(mc_snapshot_t snapshot) { // We need this snapshot in order to know which - // pages needs to be stored in the next snapshot: + // pages needs to be stored in the next snapshot. + // This field is only non-NULL when using soft-dirty + // page tracking. if (snapshot == mc_model_checker->parent_snapshot) return true; return false; } +static void MC_get_current_fd(mc_snapshot_t snapshot){ + + snapshot->total_fd = 0; + + const size_t fd_dir_path_size = 20; + char fd_dir_path[fd_dir_path_size]; + if (snprintf(fd_dir_path, fd_dir_path_size, + "/proc/%lli/fd", (long long int) getpid()) > fd_dir_path_size) + xbt_die("Unexpected buffer is too small for fd_dir_path"); + + DIR* fd_dir = opendir (fd_dir_path); + if (fd_dir == NULL) + xbt_die("Cannot open directory '/proc/self/fd'\n"); + + size_t total_fd = 0; + struct dirent* fd_number; + while ((fd_number = readdir(fd_dir))) { + + int fd_value = atoi(fd_number->d_name); + + if(fd_value < 3) + continue; + + const size_t source_size = 25; + char source[25]; + if (snprintf(source, source_size, "/proc/self/fd/%s", fd_number->d_name) > source_size) + xbt_die("Unexpected buffer is too small for fd %s", fd_number->d_name); + + const size_t link_size = 200; + char link[200]; + int res = readlink(source, link, link_size); + if (res<0) { + xbt_die("Could not read link for %s", source); + } + if (res==200) { + xbt_die("Buffer to small for link of %s", source); + } + link[res] = '\0'; + + if(smpi_is_privatisation_file(link)) + continue; + + // This is (probably) the DIR* we are reading: + // TODO, read all the file entries at once and close the DIR.* + if(strcmp(fd_dir_path, link) == 0) + continue; + + // We don't handle them. + // It does not mean we should silently ignore them however. + if (strncmp(link, "pipe:", 5) == 0 || strncmp(link, "socket:", 7) == 0) + continue; + + // If dot_output enabled, do not handle the corresponding file + if (dot_output != NULL && strcmp(basename(link), _sg_mc_dot_output_file) == 0) + continue; + + // This is probably a shared memory used by lttng-ust: + if(strncmp("/dev/shm/ust-shm-tmp-", link, 21)==0) + continue; + + // Add an entry for this FD in the snapshot: + fd_infos_t fd = xbt_new0(s_fd_infos_t, 1); + fd->filename = strdup(link); + fd->number = fd_value; + fd->flags = fcntl(fd_value, F_GETFL) | fcntl(fd_value, F_GETFD) ; + fd->current_position = lseek(fd_value, 0, SEEK_CUR); + snapshot->current_fd = xbt_realloc(snapshot->current_fd, (total_fd + 1) * sizeof(fd_infos_t)); + snapshot->current_fd[total_fd] = fd; + total_fd++; + } + + snapshot->total_fd = total_fd; + closedir (fd_dir); +} + mc_snapshot_t MC_take_snapshot(int num_state) { @@ -618,6 +667,8 @@ mc_snapshot_t MC_take_snapshot(int num_state) MC_snapshot_handle_ignore(snapshot); + MC_get_current_fd(snapshot); + /* Save the std heap and the writable mapped pages of libsimgrid and binary */ MC_get_memory_regions(snapshot); if (_sg_mc_sparse_checkpoint && _sg_mc_soft_dirty) { @@ -649,6 +700,7 @@ void MC_restore_snapshot(mc_snapshot_t snapshot) { mc_snapshot_t parent_snapshot = mc_model_checker->parent_snapshot; + int new_fd; unsigned int i; for (i = 0; i < NB_REGIONS; i++) { // For privatized, variables we decided it was not necessary to take the snapshot: @@ -669,10 +721,31 @@ void MC_restore_snapshot(mc_snapshot_t snapshot) } } if(snapshot->privatization_index >= 0) { - smpi_switch_data_segment(snapshot->privatization_index); + // We just rewrote the global variables. + // The privatisation segment SMPI thinks + // is mapped might be inconsistent with the segment which + // is really mapped in memory (kernel state). + // We ask politely SMPI to map the segment anyway, + // even if it thinks it is the current one: + smpi_really_switch_data_segment(snapshot->privatization_index); } #endif + for(i=0; i < snapshot->total_fd; i++){ + + new_fd = open(snapshot->current_fd[i]->filename, snapshot->current_fd[i]->flags); + if (new_fd <0) { + xbt_die("Could not reopen the file %s fo restoring the file descriptor", + snapshot->current_fd[i]->filename); + } + if(new_fd != -1 && new_fd != snapshot->current_fd[i]->number){ + dup2(new_fd, snapshot->current_fd[i]->number); + //fprintf(stderr, "%p\n", fdopen(snapshot->current_fd[i]->number, "rw")); + close(new_fd); + }; + lseek(snapshot->current_fd[i]->number, snapshot->current_fd[i]->current_position, SEEK_SET); + } + if (_sg_mc_sparse_checkpoint && _sg_mc_soft_dirty) { mc_softdirty_reset(); } @@ -681,9 +754,10 @@ void MC_restore_snapshot(mc_snapshot_t snapshot) if (_sg_mc_sparse_checkpoint && _sg_mc_soft_dirty) { mc_model_checker->parent_snapshot = snapshot; } + } -mc_snapshot_t SIMIX_pre_mc_snapshot(smx_simcall_t simcall) +mc_snapshot_t simcall_HANDLER_mc_snapshot(smx_simcall_t simcall) { return MC_take_snapshot(1); } diff --git a/src/mc/mc_comm_determinism.c b/src/mc/mc_comm_determinism.c index 89379e4f53..1b11b1830b 100644 --- a/src/mc/mc_comm_determinism.c +++ b/src/mc/mc_comm_determinism.c @@ -4,7 +4,12 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "mc_state.h" +#include "mc_comm_pattern.h" +#include "mc_request.h" +#include "mc_safety.h" #include "mc_private.h" +#include "mc_record.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_comm_determinism, mc, "Logging specific to MC communication determinism detection"); @@ -13,8 +18,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_comm_determinism, mc, xbt_dynar_t initial_communications_pattern; xbt_dynar_t incomplete_communications_pattern; -xbt_dynar_t communications_pattern; -int nb_comm_pattern; /********** Static functions ***********/ @@ -26,225 +29,259 @@ static void comm_pattern_free(mc_comm_pattern_t p) p = NULL; } -static void comm_pattern_free_voidp(void *p) +static void list_comm_pattern_free(mc_list_comm_pattern_t l) { - comm_pattern_free((mc_comm_pattern_t) * (void **) p); -} - -static mc_comm_pattern_t get_comm_pattern_from_idx(xbt_dynar_t pattern, - unsigned int *idx, - e_smx_comm_type_t type, - unsigned long proc) -{ - mc_comm_pattern_t current_comm; - while (*idx < xbt_dynar_length(pattern)) { - current_comm = - (mc_comm_pattern_t) xbt_dynar_get_as(pattern, *idx, mc_comm_pattern_t); - if (current_comm->type == type && type == SIMIX_COMM_SEND) { - if (current_comm->src_proc == proc) - return current_comm; - } else if (current_comm->type == type && type == SIMIX_COMM_RECEIVE) { - if (current_comm->dst_proc == proc) - return current_comm; - } - (*idx)++; - } - return NULL; + xbt_dynar_free(&(l->list)); + xbt_free(l); + l = NULL; } -static int compare_comm_pattern(mc_comm_pattern_t comm1, - mc_comm_pattern_t comm2) -{ +static e_mc_comm_pattern_difference_t compare_comm_pattern(mc_comm_pattern_t comm1, mc_comm_pattern_t comm2) { + if(comm1->type != comm2->type) + return TYPE_DIFF; if (strcmp(comm1->rdv, comm2->rdv) != 0) - return 1; + return RDV_DIFF; if (comm1->src_proc != comm2->src_proc) - return 1; + return SRC_PROC_DIFF; if (comm1->dst_proc != comm2->dst_proc) - return 1; - if (comm1->data_size != comm2->data_size) - return 1; - if (memcmp(comm1->data, comm2->data, comm1->data_size) != 0) - return 1; + return DST_PROC_DIFF; + if (comm1->tag != comm2->tag) + return TAG_DIFF; + /*if (comm1->data_size != comm2->data_size) + return DATA_SIZE_DIFF; + if(comm1->data == NULL && comm2->data == NULL) + return 0; + if(comm1->data != NULL && comm2->data !=NULL) { + if (!memcmp(comm1->data, comm2->data, comm1->data_size)) + return 0; + return DATA_DIFF; + }else{ + return DATA_DIFF; + }*/ return 0; } -static void deterministic_pattern(xbt_dynar_t pattern, int partial) -{ - - unsigned int cursor = 0, send_index = 0, recv_index = 0; - mc_comm_pattern_t comm1, comm2; - unsigned int current_process = 1; /* Process 0 corresponds to maestro */ - unsigned int nb_comms1, nb_comms2; - xbt_dynar_t process_comms_pattern1, process_comms_pattern2; - - while (current_process < simix_process_maxpid) { - process_comms_pattern1 = (xbt_dynar_t)xbt_dynar_get_as(initial_communications_pattern, current_process, xbt_dynar_t); - process_comms_pattern2 = (xbt_dynar_t)xbt_dynar_get_as(pattern, current_process, xbt_dynar_t); - nb_comms1 = xbt_dynar_length(process_comms_pattern1); - nb_comms2 = xbt_dynar_length(process_comms_pattern2); - if(!xbt_dynar_is_empty((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, current_process, xbt_dynar_t))) - xbt_die("Damn ! Some communications from the process %u are incomplete (%lu)! That means one or several simcalls are not handle.", current_process, xbt_dynar_length((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, current_process, xbt_dynar_t))); - if (!partial && (nb_comms1 != nb_comms2)) { - XBT_INFO("The total number of communications is different between the compared patterns for the process %u.\n Communication determinism verification for this process cannot be performed.", current_process); - initial_global_state->send_deterministic = -1; - initial_global_state->comm_deterministic = -1; - } else { - while (cursor < nb_comms2) { - comm1 = (mc_comm_pattern_t)xbt_dynar_get_as(process_comms_pattern1, cursor, mc_comm_pattern_t); - if (comm1->type == SIMIX_COMM_SEND) { - comm2 = get_comm_pattern_from_idx(process_comms_pattern2, &send_index, comm1->type, current_process); - if (compare_comm_pattern(comm1, comm2)) { - XBT_INFO("The communications pattern of the process %u is different! (Different communication : %u)", current_process, cursor+1); - initial_global_state->send_deterministic = 0; - initial_global_state->comm_deterministic = 0; - return; - } - send_index++; - } else if (comm1->type == SIMIX_COMM_RECEIVE) { - comm2 = get_comm_pattern_from_idx(process_comms_pattern2, &recv_index, comm1->type, current_process); - if (compare_comm_pattern(comm1, comm2)) { - initial_global_state->comm_deterministic = 0; - if (!_sg_mc_send_determinism){ - XBT_INFO("The communications pattern of the process %u is different! (Different communication : %u)", current_process, cursor+1); - return; - } - } - recv_index++; - } - cursor++; - } +static void print_determinism_result(e_mc_comm_pattern_difference_t diff, int process, mc_comm_pattern_t comm, unsigned int cursor) { + if (_sg_mc_comms_determinism && !initial_global_state->comm_deterministic) { + XBT_INFO("****************************************************"); + XBT_INFO("***** Non-deterministic communications pattern *****"); + XBT_INFO("****************************************************"); + XBT_INFO("The communications pattern of the process %d is different!", process); + switch(diff) { + case TYPE_DIFF: + XBT_INFO("Different communication type for communication %s at index %d", comm->type == SIMIX_COMM_SEND ? "Send" : "Recv", cursor); + break; + case RDV_DIFF: + XBT_INFO("Different communication rdv for communication %s at index %d", comm->type == SIMIX_COMM_SEND ? "Send" : "Recv", cursor); + break; + case TAG_DIFF: + XBT_INFO("Different communication tag for communication %s at index %d", comm->type == SIMIX_COMM_SEND ? "Send" : "Recv", cursor); + break; + case SRC_PROC_DIFF: + XBT_INFO("Different communication source process for communication %s at index %d", comm->type == SIMIX_COMM_SEND ? "Send" : "Recv", cursor); + break; + case DST_PROC_DIFF: + XBT_INFO("Different communication destination process for communication %s at index %d", comm->type == SIMIX_COMM_SEND ? "Send" : "Recv", cursor); + break; + case DATA_SIZE_DIFF: + XBT_INFO("Different communication data size for communication %s at index %d", comm->type == SIMIX_COMM_SEND ? "Send" : "Recv", cursor); + break; + case DATA_DIFF: + XBT_INFO("Different communication data for communication %s at index %d", comm->type == SIMIX_COMM_SEND ? "Send" : "Recv", cursor); + break; + default: + break; } - current_process++; - cursor = 0; - send_index = 0; - recv_index = 0; - } -} - -static void print_communications_pattern(xbt_dynar_t comms_pattern) -{ - unsigned int cursor = 0; - mc_comm_pattern_t current_comm; - unsigned int current_process = 1; - xbt_dynar_t current_pattern; - while (current_process < simix_process_maxpid) { - current_pattern = (xbt_dynar_t)xbt_dynar_get_as(comms_pattern, current_process, xbt_dynar_t); - XBT_INFO("Communications from the process %u:", current_process); - xbt_dynar_foreach(current_pattern, cursor, current_comm) { - if (current_comm->type == SIMIX_COMM_SEND) { - XBT_INFO("[(%lu) %s -> (%lu) %s] %s ", current_comm->src_proc, - current_comm->src_host, current_comm->dst_proc, - current_comm->dst_host, "iSend"); - } else { - XBT_INFO("[(%lu) %s <- (%lu) %s] %s ", current_comm->dst_proc, - current_comm->dst_host, current_comm->src_proc, - current_comm->src_host, "iRecv"); - } + MC_print_statistics(mc_stats); + xbt_abort(); + } else if (_sg_mc_send_determinism && !initial_global_state->send_deterministic) { + XBT_INFO("*********************************************************"); + XBT_INFO("***** Non-send-deterministic communications pattern *****"); + XBT_INFO("*********************************************************"); + XBT_INFO("The communications pattern of the process %d is different!", process); + switch(diff) { + case TYPE_DIFF: + XBT_INFO("Different communication type for communication %s at index %d", comm->type == SIMIX_COMM_SEND ? "Send" : "Recv", cursor); + break; + case RDV_DIFF: + XBT_INFO("Different communication rdv for communication %s at index %d", comm->type == SIMIX_COMM_SEND ? "Send" : "Recv", cursor); + break; + case TAG_DIFF: + XBT_INFO("Different communication tag for communication %s at index %d", comm->type == SIMIX_COMM_SEND ? "Send" : "Recv", cursor); + break; + case SRC_PROC_DIFF: + XBT_INFO("Different communication source process for communication %s at index %d", comm->type == SIMIX_COMM_SEND ? "Send" : "Recv", cursor); + break; + case DST_PROC_DIFF: + XBT_INFO("Different communication destination process for communication %s at index %d", comm->type == SIMIX_COMM_SEND ? "Send" : "Recv", cursor); + break; + case DATA_SIZE_DIFF: + XBT_INFO("Different communication data size for communication %s at index %d", comm->type == SIMIX_COMM_SEND ? "Send" : "Recv", cursor); + break; + case DATA_DIFF: + XBT_INFO("Different communication data for communication %s at index %d", comm->type == SIMIX_COMM_SEND ? "Send" : "Recv", cursor); + break; + default: + break; } - current_process++; - cursor = 0; + MC_print_statistics(mc_stats); + xbt_abort(); } } -static void update_comm_pattern(mc_comm_pattern_t comm_pattern, smx_action_t comm) +static void update_comm_pattern(mc_comm_pattern_t comm_pattern, smx_synchro_t comm) { void *addr_pointed; comm_pattern->src_proc = comm->comm.src_proc->pid; comm_pattern->dst_proc = comm->comm.dst_proc->pid; - comm_pattern->src_host = - simcall_host_get_name(comm->comm.src_proc->smx_host); - comm_pattern->dst_host = - simcall_host_get_name(comm->comm.dst_proc->smx_host); - if (comm_pattern->data_size == -1) { + comm_pattern->src_host = simcall_host_get_name(comm->comm.src_proc->smx_host); + comm_pattern->dst_host = simcall_host_get_name(comm->comm.dst_proc->smx_host); + if (comm_pattern->data_size == -1 && comm->comm.src_buff != NULL) { comm_pattern->data_size = *(comm->comm.dst_buff_size); comm_pattern->data = xbt_malloc0(comm_pattern->data_size); addr_pointed = *(void **) comm->comm.src_buff; - if (addr_pointed > std_heap && addr_pointed < ((xbt_mheap_t) std_heap)->breakval) + if (addr_pointed > (void*) std_heap && addr_pointed < std_heap->breakval) memcpy(comm_pattern->data, addr_pointed, comm_pattern->data_size); else memcpy(comm_pattern->data, comm->comm.src_buff, comm_pattern->data_size); } } +static void deterministic_comm_pattern(int process, mc_comm_pattern_t comm, int backtracking) { + + mc_list_comm_pattern_t list_comm_pattern = (mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, process, mc_list_comm_pattern_t); + + if(!backtracking){ + mc_comm_pattern_t initial_comm = xbt_dynar_get_as(list_comm_pattern->list, comm->index, mc_comm_pattern_t); + e_mc_comm_pattern_difference_t diff; + + if((diff = compare_comm_pattern(initial_comm, comm)) != NONE_DIFF){ + if (comm->type == SIMIX_COMM_SEND) + initial_global_state->send_deterministic = 0; + initial_global_state->comm_deterministic = 0; + print_determinism_result(diff, process, comm, list_comm_pattern->index_comm + 1); + } + } + + list_comm_pattern->index_comm++; + comm_pattern_free(comm); + +} + /********** Non Static functions ***********/ -void get_comm_pattern(xbt_dynar_t list, smx_simcall_t request, int call) +void comm_pattern_free_voidp(void *p) { + comm_pattern_free((mc_comm_pattern_t) * (void **) p); +} + +void list_comm_pattern_free_voidp(void *p) { + list_comm_pattern_free((mc_list_comm_pattern_t) * (void **) p); +} + +void get_comm_pattern(xbt_dynar_t list, smx_simcall_t request, e_mc_call_type_t call_type) { + mc_comm_pattern_t pattern = NULL; pattern = xbt_new0(s_mc_comm_pattern_t, 1); - pattern->num = ++nb_comm_pattern; pattern->data_size = -1; + pattern->data = NULL; + + pattern->index = ((mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, request->issuer->pid, mc_list_comm_pattern_t))->index_comm + xbt_dynar_length((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, request->issuer->pid, xbt_dynar_t)); + void *addr_pointed; - if (call == 1) { // ISEND + + if (call_type == MC_CALL_TYPE_SEND) { + /* Create comm pattern */ pattern->type = SIMIX_COMM_SEND; pattern->comm = simcall_comm_isend__get__result(request); + pattern->rdv = (pattern->comm->comm.rdv != NULL) ? strdup(pattern->comm->comm.rdv->name) : strdup(pattern->comm->comm.rdv_cpy->name); pattern->src_proc = pattern->comm->comm.src_proc->pid; pattern->src_host = simcall_host_get_name(request->issuer->smx_host); - pattern->data_size = pattern->comm->comm.src_buff_size; - pattern->data = xbt_malloc0(pattern->data_size); - addr_pointed = *(void **) pattern->comm->comm.src_buff; - if (addr_pointed > std_heap && addr_pointed < ((xbt_mheap_t) std_heap)->breakval) - memcpy(pattern->data, addr_pointed, pattern->data_size); - else - memcpy(pattern->data, pattern->comm->comm.src_buff, pattern->data_size); - } else { // IRECV + pattern->tag = ((MPI_Request)simcall_comm_isend__get__data(request))->tag; + if(pattern->comm->comm.src_buff != NULL){ + pattern->data_size = pattern->comm->comm.src_buff_size; + pattern->data = xbt_malloc0(pattern->data_size); + addr_pointed = *(void **) pattern->comm->comm.src_buff; + if (addr_pointed > (void*) std_heap && addr_pointed < std_heap->breakval) + memcpy(pattern->data, addr_pointed, pattern->data_size); + else + memcpy(pattern->data, pattern->comm->comm.src_buff, pattern->data_size); + } + } else if (call_type == MC_CALL_TYPE_RECV) { pattern->type = SIMIX_COMM_RECEIVE; pattern->comm = simcall_comm_irecv__get__result(request); + pattern->tag = ((MPI_Request)simcall_comm_irecv__get__data(request))->tag; + pattern->rdv = (pattern->comm->comm.rdv != NULL) ? strdup(pattern->comm->comm.rdv->name) : strdup(pattern->comm->comm.rdv_cpy->name); pattern->dst_proc = pattern->comm->comm.dst_proc->pid; pattern->dst_host = simcall_host_get_name(request->issuer->smx_host); + } else { + xbt_die("Unexpected call_type %i", (int) call_type); } - if (pattern->comm->comm.rdv != NULL) - pattern->rdv = strdup(pattern->comm->comm.rdv->name); - else - pattern->rdv = strdup(pattern->comm->comm.rdv_cpy->name); - - xbt_dynar_push((xbt_dynar_t)xbt_dynar_get_as(list, request->issuer->pid, xbt_dynar_t), &pattern); - - xbt_dynar_push_as((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, request->issuer->pid, xbt_dynar_t), int, xbt_dynar_length((xbt_dynar_t)xbt_dynar_get_as(list, request->issuer->pid, xbt_dynar_t)) - 1); + xbt_dynar_push((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, request->issuer->pid, xbt_dynar_t), &pattern); + XBT_DEBUG("Insert incomplete comm pattern %p for process %lu", pattern, request->issuer->pid); } -void complete_comm_pattern(xbt_dynar_t list, smx_action_t comm) -{ +void complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm, int backtracking) { + mc_comm_pattern_t current_comm_pattern; unsigned int cursor = 0; - int index; unsigned int src = comm->comm.src_proc->pid; unsigned int dst = comm->comm.dst_proc->pid; + mc_comm_pattern_t src_comm_pattern; + mc_comm_pattern_t dst_comm_pattern; int src_completed = 0, dst_completed = 0; - /* Looking for the corresponding communication in the comm pattern list of the src process */ - xbt_dynar_foreach((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, src, xbt_dynar_t), cursor, index){ - current_comm_pattern = (mc_comm_pattern_t) xbt_dynar_get_as((xbt_dynar_t)xbt_dynar_get_as(list, src, xbt_dynar_t), index, mc_comm_pattern_t); - if(current_comm_pattern->comm == comm){ + /* Complete comm pattern */ + xbt_dynar_foreach((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, src, xbt_dynar_t), cursor, current_comm_pattern) { + if (current_comm_pattern-> comm == comm) { update_comm_pattern(current_comm_pattern, comm); - xbt_dynar_remove_at((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, src, xbt_dynar_t), cursor, NULL); src_completed = 1; + xbt_dynar_remove_at((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, src, xbt_dynar_t), cursor, &src_comm_pattern); + XBT_DEBUG("Remove incomplete comm pattern for process %u at cursor %u", src, cursor); break; } } - if(!src_completed) xbt_die("Corresponding communication for the source process not found!"); cursor = 0; - /* Looking for the corresponding communication in the comm pattern list of the dst process */ - xbt_dynar_foreach((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, dst, xbt_dynar_t), cursor, index){ - current_comm_pattern = (mc_comm_pattern_t) xbt_dynar_get_as((xbt_dynar_t)xbt_dynar_get_as(list, dst, xbt_dynar_t), index, mc_comm_pattern_t); - if(current_comm_pattern->comm == comm){ + xbt_dynar_foreach((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, dst, xbt_dynar_t), cursor, current_comm_pattern) { + if (current_comm_pattern-> comm == comm) { update_comm_pattern(current_comm_pattern, comm); - xbt_dynar_remove_at((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, dst, xbt_dynar_t), cursor, NULL); dst_completed = 1; + xbt_dynar_remove_at((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, dst, xbt_dynar_t), cursor, &dst_comm_pattern); + XBT_DEBUG("Remove incomplete comm pattern for process %u at cursor %u", dst, cursor); break; } } - if(!dst_completed) - xbt_die("Corresponding communication for the dest process not found!"); - - + xbt_die("Corresponding communication for the destination process not found!"); + + if (!initial_global_state->initial_communications_pattern_done) { + /* Store comm pattern */ + if(src_comm_pattern->index < xbt_dynar_length(((mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, src, mc_list_comm_pattern_t))->list)){ + xbt_dynar_set(((mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, src, mc_list_comm_pattern_t))->list, src_comm_pattern->index, &src_comm_pattern); + ((mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, src, mc_list_comm_pattern_t))->list->used++; + } else { + xbt_dynar_insert_at(((mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, src, mc_list_comm_pattern_t))->list, src_comm_pattern->index, &src_comm_pattern); + } + + if(dst_comm_pattern->index < xbt_dynar_length(((mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, dst, mc_list_comm_pattern_t))->list)) { + xbt_dynar_set(((mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, dst, mc_list_comm_pattern_t))->list, dst_comm_pattern->index, &dst_comm_pattern); + ((mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, dst, mc_list_comm_pattern_t))->list->used++; + } else { + xbt_dynar_insert_at(((mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, dst, mc_list_comm_pattern_t))->list, dst_comm_pattern->index, &dst_comm_pattern); + } + ((mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, src, mc_list_comm_pattern_t))->index_comm++; + ((mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, dst, mc_list_comm_pattern_t))->index_comm++; + } else { + /* Evaluate comm determinism */ + deterministic_comm_pattern(src, src_comm_pattern, backtracking); + deterministic_comm_pattern(dst, dst_comm_pattern, backtracking); + } } /************************ Main algorithm ************************/ @@ -264,28 +301,22 @@ void MC_pre_modelcheck_comm_determinism(void) if (_sg_mc_visited > 0) visited_states = xbt_dynar_new(sizeof(mc_visited_state_t), visited_state_free_voidp); - initial_communications_pattern = xbt_dynar_new(sizeof(xbt_dynar_t), xbt_dynar_free_voidp); + initial_communications_pattern = xbt_dynar_new(sizeof(mc_list_comm_pattern_t), list_comm_pattern_free_voidp); for (i=0; ilist = xbt_dynar_new(sizeof(mc_comm_pattern_t), comm_pattern_free_voidp); + process_list_pattern->index_comm = 0; + xbt_dynar_insert_at(initial_communications_pattern, i, &process_list_pattern); } incomplete_communications_pattern = xbt_dynar_new(sizeof(xbt_dynar_t), xbt_dynar_free_voidp); for (i=0; i 0) { /* Get current state */ - state = - (mc_state_t) - xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack)); + state = (mc_state_t) xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack)); XBT_DEBUG("**************************************************"); XBT_DEBUG("Exploration depth = %d (state = %d, interleaved processes = %d)", @@ -337,55 +364,35 @@ void MC_modelcheck_comm_determinism(void) && (req = MC_state_get_request(state, &value)) && (visited_state == NULL)) { - /* Debug information */ - if (XBT_LOG_ISENABLED(mc_comm_determinism, xbt_log_priority_debug)) { - req_str = MC_request_to_string(req, value); - XBT_DEBUG("Execute: %s", req_str); - xbt_free(req_str); - } - - MC_SET_MC_HEAP; - if (dot_output != NULL) + req_str = MC_request_to_string(req, value); + XBT_DEBUG("Execute: %s", req_str); + xbt_free(req_str); + + if (dot_output != NULL) { + MC_SET_MC_HEAP; req_str = MC_request_get_dot_output(req, value); - MC_SET_STD_HEAP; + MC_SET_STD_HEAP; + } MC_state_set_executed_request(state, req, value); mc_stats->executed_transitions++; /* TODO : handle test and testany simcalls */ + e_mc_call_type_t call = MC_CALL_TYPE_NONE; if (_sg_mc_comms_determinism || _sg_mc_send_determinism) { - if (req->call == SIMCALL_COMM_ISEND) - call = 1; - else if (req->call == SIMCALL_COMM_IRECV) - call = 2; - else if (req->call == SIMCALL_COMM_WAIT) - call = 3; - else if (req->call == SIMCALL_COMM_WAITANY) - call = 4; + call = mc_get_call_type(req); } /* Answer the request */ - SIMIX_simcall_pre(req, value); /* After this call req is no longer usefull */ + SIMIX_simcall_handle(req, value); /* After this call req is no longer useful */ MC_SET_MC_HEAP; - current_pattern = !initial_global_state->initial_communications_pattern_done ? initial_communications_pattern : communications_pattern; - if (call == 1) { /* Send */ - get_comm_pattern(current_pattern, req, call); - } else if (call == 2) { /* Recv */ - get_comm_pattern(current_pattern, req, call); - } else if (call == 3) { /* Wait */ - current_comm = simcall_comm_wait__get__comm(req); - if (current_comm->comm.refcount == 1) /* First wait only must be considered */ - complete_comm_pattern(current_pattern, current_comm); - } else if (call == 4) { /* WaitAny */ - current_comm = xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), value, smx_action_t); - if (current_comm->comm.refcount == 1) /* First wait only must be considered */ - complete_comm_pattern(current_pattern, current_comm); - } + if(!initial_global_state->initial_communications_pattern_done) + handle_comm_pattern(call, req, value, initial_communications_pattern, 0); + else + handle_comm_pattern(call, req, value, NULL, 0); MC_SET_STD_HEAP; - call = 0; - /* Wait for requests (schedules processes) */ MC_wait_for_requests(); @@ -394,7 +401,7 @@ void MC_modelcheck_comm_determinism(void) next_state = MC_state_new(); - if ((visited_state = is_visited_state()) == NULL) { + if ((visited_state = is_visited_state(next_state)) == NULL) { /* Get enabled processes and insert them in the interleave set of the next state */ xbt_swag_foreach(process, simix_global->process_list) { @@ -404,14 +411,12 @@ void MC_modelcheck_comm_determinism(void) } if (dot_output != NULL) - fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num, - next_state->num, req_str); + fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num, next_state->num, req_str); } else { if (dot_output != NULL) - fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num, - visited_state->other_num == -1 ? visited_state->num : visited_state->other_num, req_str); + fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num, visited_state->other_num == -1 ? visited_state->num : visited_state->other_num, req_str); } @@ -434,49 +439,13 @@ void MC_modelcheck_comm_determinism(void) MC_SET_MC_HEAP; - if (initial_global_state->initial_communications_pattern_done) { - if (!visited_state) { - deterministic_pattern(communications_pattern, 0); - } else { - deterministic_pattern(communications_pattern, 1); - } - - if (_sg_mc_comms_determinism && !initial_global_state->comm_deterministic) { - XBT_INFO("****************************************************"); - XBT_INFO("***** Non-deterministic communications pattern *****"); - XBT_INFO("****************************************************"); - XBT_INFO("** Initial communications pattern (per process): **"); - print_communications_pattern(initial_communications_pattern); - XBT_INFO("** Communications pattern counter-example (per process): **"); - print_communications_pattern(communications_pattern); - MC_print_statistics(mc_stats); - MC_SET_STD_HEAP; - return; - } else if (_sg_mc_send_determinism && !initial_global_state->send_deterministic) { - XBT_INFO - ("*********************************************************"); - XBT_INFO - ("***** Non-send-deterministic communications pattern *****"); - XBT_INFO - ("*********************************************************"); - XBT_INFO("** Initial communications pattern: **"); - print_communications_pattern(initial_communications_pattern); - XBT_INFO("** Communications pattern counter-example: **"); - print_communications_pattern(communications_pattern); - MC_print_statistics(mc_stats); - MC_SET_STD_HEAP; - return; - } - - } else { + if (!initial_global_state->initial_communications_pattern_done) initial_global_state->initial_communications_pattern_done = 1; - } /* Trash the current state, no longer needed */ xbt_fifo_shift(mc_stack); - MC_state_delete(state); - XBT_DEBUG("Delete state %d at depth %d", state->num, - xbt_fifo_size(mc_stack) + 1); + MC_state_delete(state, !state->in_visited_states ? 1 : 0); + XBT_DEBUG("Delete state %d at depth %d", state->num, xbt_fifo_size(mc_stack) + 1); MC_SET_STD_HEAP; @@ -491,23 +460,20 @@ void MC_modelcheck_comm_determinism(void) MC_SET_MC_HEAP; while ((state = xbt_fifo_shift(mc_stack)) != NULL) { - if (MC_state_interleave_size(state) - && xbt_fifo_size(mc_stack) < _sg_mc_max_depth) { + if (MC_state_interleave_size(state) && xbt_fifo_size(mc_stack) < _sg_mc_max_depth) { /* We found a back-tracking point, let's loop */ - XBT_DEBUG("Back-tracking to state %d at depth %d", state->num, - xbt_fifo_size(mc_stack) + 1); + XBT_DEBUG("Back-tracking to state %d at depth %d", state->num, xbt_fifo_size(mc_stack) + 1); xbt_fifo_unshift(mc_stack, state); MC_SET_STD_HEAP; - MC_replay(mc_stack, -1); + MC_replay(mc_stack); + + XBT_DEBUG("Back-tracking to state %d at depth %d done", state->num, xbt_fifo_size(mc_stack)); - XBT_DEBUG("Back-tracking to state %d at depth %d done", state->num, - xbt_fifo_size(mc_stack)); break; } else { - XBT_DEBUG("Delete state %d at depth %d", state->num, - xbt_fifo_size(mc_stack) + 1); - MC_state_delete(state); + XBT_DEBUG("Delete state %d at depth %d", state->num, xbt_fifo_size(mc_stack) + 1); + MC_state_delete(state, !state->in_visited_states ? 1 : 0); } } diff --git a/src/mc/mc_comm_pattern.h b/src/mc/mc_comm_pattern.h new file mode 100644 index 0000000000..e3cd1af92f --- /dev/null +++ b/src/mc/mc_comm_pattern.h @@ -0,0 +1,89 @@ +/* Copyright (c) 2007-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include + +#include +#include + +#include "../simix/smx_private.h" +#include "../smpi/private.h" +#include + +#ifndef MC_COMM_PATTERN_H +#define MC_COMM_PATTERN_H + +SG_BEGIN_DECL() + +typedef struct s_mc_comm_pattern{ + int num; + smx_synchro_t comm; + e_smx_comm_type_t type; + unsigned long src_proc; + unsigned long dst_proc; + const char *src_host; + const char *dst_host; + char *rdv; + ssize_t data_size; + void *data; + int tag; + int index; +} s_mc_comm_pattern_t, *mc_comm_pattern_t; + +typedef struct s_mc_list_comm_pattern{ + unsigned int index_comm; + xbt_dynar_t list; +}s_mc_list_comm_pattern_t, *mc_list_comm_pattern_t; + +extern xbt_dynar_t initial_communications_pattern; +extern xbt_dynar_t incomplete_communications_pattern; + +typedef enum { + MC_CALL_TYPE_NONE, + MC_CALL_TYPE_SEND, + MC_CALL_TYPE_RECV, + MC_CALL_TYPE_WAIT, + MC_CALL_TYPE_WAITANY, +} e_mc_call_type_t; + +typedef enum { + NONE_DIFF, + TYPE_DIFF, + RDV_DIFF, + TAG_DIFF, + SRC_PROC_DIFF, + DST_PROC_DIFF, + DATA_SIZE_DIFF, + DATA_DIFF, +} e_mc_comm_pattern_difference_t; + +static inline e_mc_call_type_t mc_get_call_type(smx_simcall_t req) +{ + switch(req->call) { + case SIMCALL_COMM_ISEND: + return MC_CALL_TYPE_SEND; + case SIMCALL_COMM_IRECV: + return MC_CALL_TYPE_RECV; + case SIMCALL_COMM_WAIT: + return MC_CALL_TYPE_WAIT; + case SIMCALL_COMM_WAITANY: + return MC_CALL_TYPE_WAITANY; + default: + return MC_CALL_TYPE_NONE; + } +} + +void get_comm_pattern(xbt_dynar_t communications_pattern, smx_simcall_t request, e_mc_call_type_t call_type); +void handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t request, int value, xbt_dynar_t current_pattern, int backtracking); +void comm_pattern_free_voidp(void *p); +void list_comm_pattern_free_voidp(void *p); +void complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm, int backtracking); +void MC_pre_modelcheck_comm_determinism(void); +void MC_modelcheck_comm_determinism(void); + +SG_END_DECL() + +#endif diff --git a/src/mc/mc_compare.cpp b/src/mc/mc_compare.cpp index 1891f31d8a..4745d3a4ee 100644 --- a/src/mc/mc_compare.cpp +++ b/src/mc/mc_compare.cpp @@ -9,6 +9,9 @@ #include #include "internal_config.h" +#include "mc_object_info.h" +#include "mc_safety.h" +#include "mc_liveness.h" #include "mc_private.h" #ifdef HAVE_SMPI @@ -18,6 +21,8 @@ #include "xbt/mmalloc.h" #include "xbt/mmalloc/mmprivate.h" +#include + XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_compare, mc, "Logging specific to mc_compare"); @@ -280,6 +285,7 @@ static int compare_global_variables(mc_object_info_t object_info, (char *) current_var->address, snapshot2, r2, bvariable_type, 0); if (res == 1) { + XBT_TRACE3(mc, global_diff, -1, -1, current_var->name); XBT_VERB("Global variable %s (%p) is different between snapshots", current_var->name, (char *) current_var->address); return 1; @@ -336,6 +342,7 @@ static int compare_local_variables(int process_index, if (res == 1) { // TODO, fix current_varX->subprogram->name to include name if DW_TAG_inlined_subprogram + XBT_TRACE3(mc, local_diff, -1, -1, current_var1->name); XBT_VERB ("Local variable %s (%p - %p) in frame %s is different between snapshots", current_var1->name, current_var1->address, current_var2->address, @@ -382,6 +389,7 @@ int snapshot_compare(void *state1, void *state2) if (_sg_mc_hash) { hash_result = (s1->hash != s2->hash); if (hash_result) { + XBT_TRACE2(mc, hash_diff, num1, num2); XBT_VERB("(%d - %d) Different hash : 0x%" PRIx64 "--0x%" PRIx64, num1, num2, s1->hash, s2->hash); #ifndef MC_DEBUG @@ -396,8 +404,11 @@ int snapshot_compare(void *state1, void *state2) unsigned int cursor; int pid; xbt_dynar_foreach(s1->enabled_processes, cursor, pid){ - if(!xbt_dynar_member(s2->enabled_processes, &pid)) + if(!xbt_dynar_member(s2->enabled_processes, &pid)) { + //XBT_TRACE3(mc, state_diff, num1, num2, "Different enabled processes"); XBT_VERB("(%d - %d) Different enabled processes", num1, num2); + // return 1; ?? + } } unsigned long i = 0; @@ -424,6 +435,7 @@ int snapshot_compare(void *state1, void *state2) XBT_VERB("(%d - %d) Different size used in stacks : %zu - %zu", num1, num2, size_used1, size_used2); #endif + XBT_TRACE3(mc, state_diff, num1, num2, "Different stack size"); xbt_os_walltimer_stop(timer); xbt_os_timer_free(timer); @@ -455,6 +467,7 @@ int snapshot_compare(void *state1, void *state2) errors++; #else #ifdef MC_VERBOSE + XBT_TRACE3(mc, state_diff, num1, num2, "Different heap information"); XBT_VERB("(%d - %d) Different heap information", num1, num2); #endif @@ -492,6 +505,7 @@ int snapshot_compare(void *state1, void *state2) else diff_local = compare_local_variables(stack1->process_index, s1, s2, stack1, stack2); if (diff_local > 0) { + XBT_TRACE3(mc, state_diff, num1, num2, "Different local variables"); #ifdef MC_DEBUG if (is_diff == 0) { xbt_os_walltimer_stop(timer); @@ -559,6 +573,7 @@ int snapshot_compare(void *state1, void *state2) compare_global_variables(object_infos[k], MC_NO_PROCESS_INDEX, s1->regions[k], s2->regions[k], s1, s2); if (is_diff != 0) { + XBT_TRACE3(mc, state_diff, num1, num2, "Different global variables"); #ifdef MC_DEBUG xbt_os_walltimer_stop(timer); *times[k] = xbt_os_timer_elapsed(timer); @@ -589,6 +604,7 @@ int snapshot_compare(void *state1, void *state2) /* Compare heap */ if (mmalloc_compare_heap(s1, s2) > 0) { + XBT_TRACE3(mc, state_diff, num1, num2, "Different heap"); #ifdef MC_DEBUG xbt_os_walltimer_stop(timer); @@ -674,7 +690,7 @@ void print_comparison_times() /**************************** MC snapshot compare simcall **************************/ /***********************************************************************************/ -int SIMIX_pre_mc_compare_snapshots(smx_simcall_t simcall, +int simcall_HANDLER_mc_compare_snapshots(smx_simcall_t simcall, mc_snapshot_t s1, mc_snapshot_t s2) { return snapshot_compare(s1, s2); diff --git a/src/mc/mc_config.c b/src/mc/mc_config.c new file mode 100644 index 0000000000..07c9179889 --- /dev/null +++ b/src/mc/mc_config.c @@ -0,0 +1,168 @@ +/* Copyright (c) 2008-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include + +#include +#include + +#include + +#include + +#ifdef HAVE_MC +#include "mc_safety.h" +#include "mc_private.h" +#endif + +#include "mc_record.h" + +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_config, mc, + "Configuration of MC"); + +#ifdef HAVE_MC +/* Configuration support */ +e_mc_reduce_t mc_reduce_kind = e_mc_reduce_unset; +#endif + +#ifndef HAVE_MC +#define _sg_do_model_check 0 +#endif + +int _sg_mc_timeout = 0; + +void _mc_cfg_cb_timeout(const char *name, int pos) +{ + if (_sg_cfg_init_status && !(_sg_do_model_check || MC_record_path)) { + xbt_die + ("You are specifying a value to enable/disable timeout for wait requests after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); + } + _sg_mc_timeout = xbt_cfg_get_boolean(_sg_cfg_set, name); +} + +#ifdef HAVE_MC +int _sg_do_model_check = 0; +int _sg_do_model_check_record = 0; +int _sg_mc_checkpoint = 0; +int _sg_mc_sparse_checkpoint = 0; +int _sg_mc_soft_dirty = 0; +char *_sg_mc_property_file = NULL; +int _sg_mc_hash = 0; +int _sg_mc_max_depth = 1000; +int _sg_mc_visited = 0; +char *_sg_mc_dot_output_file = NULL; +int _sg_mc_comms_determinism = 0; +int _sg_mc_send_determinism = 0; +int _sg_mc_safety = 0; +int _sg_mc_liveness = 0; + + +void _mc_cfg_cb_reduce(const char *name, int pos) +{ + if (_sg_cfg_init_status && !_sg_do_model_check) { + xbt_die + ("You are specifying a reduction strategy after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); + } + char *val = xbt_cfg_get_string(_sg_cfg_set, name); + if (!strcasecmp(val, "none")) { + mc_reduce_kind = e_mc_reduce_none; + } else if (!strcasecmp(val, "dpor")) { + mc_reduce_kind = e_mc_reduce_dpor; + } else { + xbt_die("configuration option %s can only take 'none' or 'dpor' as a value", + name); + } +} + +void _mc_cfg_cb_checkpoint(const char *name, int pos) +{ + if (_sg_cfg_init_status && !_sg_do_model_check) { + xbt_die + ("You are specifying a checkpointing value after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); + } + _sg_mc_checkpoint = xbt_cfg_get_int(_sg_cfg_set, name); +} + +void _mc_cfg_cb_sparse_checkpoint(const char *name, int pos) { + if (_sg_cfg_init_status && !_sg_do_model_check) { + xbt_die("You are specifying a checkpointing value after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); + } + _sg_mc_sparse_checkpoint = xbt_cfg_get_boolean(_sg_cfg_set, name); +} + +void _mc_cfg_cb_soft_dirty(const char *name, int pos) { + if (_sg_cfg_init_status && !_sg_do_model_check) { + xbt_die("You are specifying a soft dirty value after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); + } + _sg_mc_soft_dirty = xbt_cfg_get_boolean(_sg_cfg_set, name); +} + +void _mc_cfg_cb_property(const char *name, int pos) +{ + if (_sg_cfg_init_status && !_sg_do_model_check) { + xbt_die + ("You are specifying a property after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); + } + _sg_mc_property_file = xbt_cfg_get_string(_sg_cfg_set, name); +} + +void _mc_cfg_cb_hash(const char *name, int pos) +{ + if (_sg_cfg_init_status && !_sg_do_model_check) { + xbt_die + ("You are specifying a value to enable/disable the use of global hash to speedup state comparaison, but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); + } + _sg_mc_hash = xbt_cfg_get_boolean(_sg_cfg_set, name); +} + +void _mc_cfg_cb_max_depth(const char *name, int pos) +{ + if (_sg_cfg_init_status && !_sg_do_model_check) { + xbt_die + ("You are specifying a max depth value after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); + } + _sg_mc_max_depth = xbt_cfg_get_int(_sg_cfg_set, name); +} + +void _mc_cfg_cb_visited(const char *name, int pos) +{ + if (_sg_cfg_init_status && !_sg_do_model_check) { + xbt_die + ("You are specifying a number of stored visited states after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); + } + _sg_mc_visited = xbt_cfg_get_int(_sg_cfg_set, name); +} + +void _mc_cfg_cb_dot_output(const char *name, int pos) +{ + if (_sg_cfg_init_status && !_sg_do_model_check) { + xbt_die + ("You are specifying a file name for a dot output of graph state after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); + } + _sg_mc_dot_output_file = xbt_cfg_get_string(_sg_cfg_set, name); +} + +void _mc_cfg_cb_comms_determinism(const char *name, int pos) +{ + if (_sg_cfg_init_status && !_sg_do_model_check) { + xbt_die + ("You are specifying a value to enable/disable the detection of determinism in the communications schemes after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); + } + _sg_mc_comms_determinism = xbt_cfg_get_boolean(_sg_cfg_set, name); + mc_reduce_kind = e_mc_reduce_none; +} + +void _mc_cfg_cb_send_determinism(const char *name, int pos) +{ + if (_sg_cfg_init_status && !_sg_do_model_check) { + xbt_die + ("You are specifying a value to enable/disable the detection of send-determinism in the communications schemes after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); + } + _sg_mc_send_determinism = xbt_cfg_get_boolean(_sg_cfg_set, name); + mc_reduce_kind = e_mc_reduce_none; +} + +#endif diff --git a/src/mc/mc_diff.c b/src/mc/mc_diff.c index 377e3cbf26..03dfb36aba 100644 --- a/src/mc/mc_diff.c +++ b/src/mc/mc_diff.c @@ -10,8 +10,10 @@ #include "xbt/str.h" #include "mc/mc.h" #include "xbt/mmalloc.h" +#include "mc_object_info.h" #include "mc/datatypes.h" #include "mc/mc_private.h" +#include "mc/mc_snapshot.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_diff, xbt, "Logging specific to mc_diff in mc"); @@ -436,8 +438,8 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2) mc_mem_region_t heap_region2 = snapshot2->regions[0]; // This is in snapshot do not use them directly: - malloc_info* heapinfos1 = mc_snapshot_read_pointer(&((xbt_mheap_t)std_heap)->heapinfo, snapshot1, MC_NO_PROCESS_INDEX); - malloc_info* heapinfos2 = mc_snapshot_read_pointer(&((xbt_mheap_t)std_heap)->heapinfo, snapshot2, MC_NO_PROCESS_INDEX); + malloc_info* heapinfos1 = mc_snapshot_read_pointer(&std_heap->heapinfo, snapshot1, MC_NO_PROCESS_INDEX); + malloc_info* heapinfos2 = mc_snapshot_read_pointer(&std_heap->heapinfo, snapshot2, MC_NO_PROCESS_INDEX); while (i1 <= state->heaplimit) { @@ -1136,8 +1138,8 @@ int compare_heap_area(int process_index, void *area1, void *area2, mc_snapshot_t int match_pairs = 0; - malloc_info* heapinfos1 = mc_snapshot_read_pointer(&((xbt_mheap_t)std_heap)->heapinfo, snapshot1, process_index); - malloc_info* heapinfos2 = mc_snapshot_read_pointer(&((xbt_mheap_t)std_heap)->heapinfo, snapshot2, process_index); + malloc_info* heapinfos1 = mc_snapshot_read_pointer(&std_heap->heapinfo, snapshot1, process_index); + malloc_info* heapinfos2 = mc_snapshot_read_pointer(&std_heap->heapinfo, snapshot2, process_index); malloc_info heapinfo_temp1, heapinfo_temp2; diff --git a/src/mc/mc_dwarf.c b/src/mc/mc_dwarf.c index c1fd44722d..2b2c2a0aaa 100644 --- a/src/mc/mc_dwarf.c +++ b/src/mc/mc_dwarf.c @@ -14,8 +14,14 @@ #include #include +#include "mc_object_info.h" #include "mc_private.h" +static void MC_dwarf_register_global_variable(mc_object_info_t info, dw_variable_t variable); +static void MC_register_variable(mc_object_info_t info, dw_frame_t frame, dw_variable_t variable); +static void MC_dwarf_register_non_global_variable(mc_object_info_t info, dw_frame_t frame, dw_variable_t variable); +static void MC_dwarf_register_variable(mc_object_info_t info, dw_frame_t frame, dw_variable_t variable); + XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_dwarf, mc, "DWARF processing"); /** \brief The default DW_TAG_lower_bound for a given DW_AT_language. @@ -159,7 +165,6 @@ static mc_tag_class MC_dwarf_tag_classify(int tag) case DW_TAG_restrict_type: case DW_TAG_interface_type: case DW_TAG_unspecified_type: - case DW_TAG_mutable_type: case DW_TAG_shared_type: return mc_tag_type; @@ -1259,6 +1264,51 @@ static void MC_post_process_functions(mc_object_info_t info) } } + +/** \brief Fill/lookup the "subtype" field. + */ +static void MC_resolve_subtype(mc_object_info_t info, dw_type_t type) +{ + + if (type->dw_type_id == NULL) + return; + type->subtype = xbt_dict_get_or_null(info->types, type->dw_type_id); + if (type->subtype == NULL) + return; + if (type->subtype->byte_size != 0) + return; + if (type->subtype->name == NULL) + return; + // Try to find a more complete description of the type: + // We need to fix in order to support C++. + + dw_type_t subtype = + xbt_dict_get_or_null(info->full_types_by_name, type->subtype->name); + if (subtype != NULL) { + type->subtype = subtype; + } + +} + +static void MC_post_process_types(mc_object_info_t info) +{ + xbt_dict_cursor_t cursor = NULL; + char *origin; + dw_type_t type; + + // Lookup "subtype" field: + xbt_dict_foreach(info->types, cursor, origin, type) { + MC_resolve_subtype(info, type); + + dw_type_t member; + unsigned int i = 0; + if (type->members != NULL) + xbt_dynar_foreach(type->members, i, member) { + MC_resolve_subtype(info, member); + } + } +} + /** \brief Finds informations about a given shared object/executable */ mc_object_info_t MC_find_object_info(memory_map_t maps, char *name, int executable) diff --git a/src/mc/mc_dwarf_expression.c b/src/mc/mc_dwarf_expression.c index 3b6c9a4deb..7653210faf 100644 --- a/src/mc/mc_dwarf_expression.c +++ b/src/mc/mc_dwarf_expression.c @@ -10,6 +10,8 @@ #include #include +#include "mc_object_info.h" +#include "mc_snapshot.h" #include "mc_private.h" static int mc_dwarf_push_value(mc_expression_state_t state, Dwarf_Off value) @@ -403,11 +405,12 @@ int mc_dwarf_execute_expression(size_t n, const Dwarf_Op * ops, /** \brief Resolve a location expression * \deprecated Use mc_dwarf_resolve_expression */ -uintptr_t mc_dwarf_resolve_location(mc_expression_t expression, - mc_object_info_t object_info, - unw_cursor_t * c, - void *frame_pointer_address, - mc_snapshot_t snapshot, int process_index) +void mc_dwarf_resolve_location(mc_location_t location, + mc_expression_t expression, + mc_object_info_t object_info, + unw_cursor_t * c, + void *frame_pointer_address, + mc_snapshot_t snapshot, int process_index) { s_mc_expression_state_t state; memset(&state, 0, sizeof(s_mc_expression_state_t)); @@ -417,37 +420,62 @@ uintptr_t mc_dwarf_resolve_location(mc_expression_t expression, state.object_info = object_info; state.process_index = process_index; + if (expression->size >= 1 + && expression->ops[0].atom >=DW_OP_reg0 && expression->ops[0].atom <= DW_OP_reg31) { + int dwarf_register = expression->ops[0].atom - DW_OP_reg0; + xbt_assert(c, "Missing frame context for register operation DW_OP_reg%i", + dwarf_register); + location->memory_location = NULL; + location->cursor = c; + location->register_id = mc_dwarf_register_to_libunwind(dwarf_register); + return; + } + if (mc_dwarf_execute_expression(expression->size, expression->ops, &state)) xbt_die("Error evaluating DWARF expression"); if (state.stack_size == 0) xbt_die("No value on the stack"); - else - return state.stack[state.stack_size - 1]; + else { + location->memory_location = (void*) state.stack[state.stack_size - 1]; + location->cursor = NULL; + location->register_id = 0; + } +} + +static mc_expression_t mc_find_expression(mc_location_list_t locations, unw_word_t ip) { + for (size_t i = 0; i != locations->size; ++i) { + mc_expression_t expression = locations->locations + i; + if ((expression->lowpc == NULL && expression->highpc == NULL) + || (ip && ip >= (unw_word_t) expression->lowpc + && ip < (unw_word_t) expression->highpc)) { + return expression; + } + } + return NULL; } -uintptr_t mc_dwarf_resolve_locations(mc_location_list_t locations, +void mc_dwarf_resolve_locations(mc_location_t location, + mc_location_list_t locations, mc_object_info_t object_info, unw_cursor_t * c, void *frame_pointer_address, mc_snapshot_t snapshot, int process_index) { - unw_word_t ip; + unw_word_t ip = 0; if (c) { if (unw_get_reg(c, UNW_REG_IP, &ip)) xbt_die("Could not resolve IP"); } - for (size_t i = 0; i != locations->size; ++i) { - mc_expression_t expression = locations->locations + i; - if ((expression->lowpc == NULL && expression->highpc == NULL) - || (c && ip >= (unw_word_t) expression->lowpc - && ip < (unw_word_t) expression->highpc)) { - return mc_dwarf_resolve_location(expression, object_info, c, - frame_pointer_address, snapshot, process_index); - } + mc_expression_t expression = mc_find_expression(locations, ip); + if (expression) { + mc_dwarf_resolve_location(location, + expression, object_info, c, + frame_pointer_address, snapshot, process_index); + } else { + xbt_die("Could not resolve location"); } - xbt_die("Could not resolve location"); } /** \brief Find the frame base of a given frame @@ -458,8 +486,29 @@ uintptr_t mc_dwarf_resolve_locations(mc_location_list_t locations, void *mc_find_frame_base(dw_frame_t frame, mc_object_info_t object_info, unw_cursor_t * unw_cursor) { - return (void *) mc_dwarf_resolve_locations(&frame->frame_base, object_info, - unw_cursor, NULL, NULL, -1); + s_mc_location_t location; + mc_dwarf_resolve_locations(&location, + &frame->frame_base, object_info, + unw_cursor, NULL, NULL, -1); + switch(mc_get_location_type(&location)) { + case MC_LOCATION_TYPE_ADDRESS: + return location.memory_location; + + case MC_LOCATION_TYPE_REGISTER: { + // This is a special case. + // The register if not the location of the frame base + // (a frame base cannot be located in a register) + // Instead, DWARF defines this to mean that the register + // contains the address of the frame base. + unw_word_t word; + unw_get_reg(location.cursor, location.register_id, &word); + return (void*) word; + } + + default: + xbt_die("Cannot handle non-address frame base"); + return NULL; // Unreachable + } } void mc_dwarf_expression_clear(mc_expression_t expression) diff --git a/src/mc/mc_dwarf_tagnames.h b/src/mc/mc_dwarf_tagnames.h index e87aec4a56..5be001b9eb 100644 --- a/src/mc/mc_dwarf_tagnames.h +++ b/src/mc/mc_dwarf_tagnames.h @@ -59,7 +59,6 @@ case 0x3a: return "DW_TAG_imported_module"; case 0x3b: return "DW_TAG_unspecified_type"; case 0x3c: return "DW_TAG_partial_unit"; case 0x3d: return "DW_TAG_imported_unit"; -case 0x3e: return "DW_TAG_mutable_type"; case 0x3f: return "DW_TAG_condition"; case 0x40: return "DW_TAG_shared_type"; case 0x41: return "DW_TAG_type_unit"; diff --git a/src/mc/mc_forward.h b/src/mc/mc_forward.h new file mode 100644 index 0000000000..267f82cbfa --- /dev/null +++ b/src/mc/mc_forward.h @@ -0,0 +1,22 @@ +/* Copyright (c) 2007-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef MC_FORWARD_H +#define MC_FORWARD_H + +#include +#include "mc_interface.h" + +typedef struct s_mc_object_info s_mc_object_info_t, *mc_object_info_t; +typedef struct s_dw_type s_dw_type_t, *dw_type_t; +typedef struct s_memory_map s_memory_map_t, *memory_map_t; +typedef struct s_dw_variable s_dw_variable_t, *dw_variable_t; +typedef struct s_dw_frame s_dw_frame_t, *dw_frame_t; +typedef struct s_mc_pages_store s_mc_pages_store_t, *mc_pages_store_t; +typedef struct s_mc_model_checker s_mc_model_checker_t, *mc_model_checker_t; +extern mc_model_checker_t mc_model_checker; + +#endif diff --git a/src/mc/mc_global.c b/src/mc/mc_global.c index a97857f546..63ecd05968 100644 --- a/src/mc/mc_global.c +++ b/src/mc/mc_global.c @@ -4,164 +4,52 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "mc_base.h" + +#ifndef _XBT_WIN32 #include #include #include #include #include #include +#endif #include "simgrid/sg_config.h" #include "../surf/surf_private.h" #include "../simix/smx_private.h" -#include "../xbt/mmalloc/mmprivate.h" #include "xbt/fifo.h" -#include "mc_private.h" #include "xbt/automaton.h" #include "xbt/dict.h" -XBT_LOG_NEW_CATEGORY(mc, "All MC categories"); +#ifdef HAVE_MC +#define UNW_LOCAL_ONLY +#include + +#include "../xbt/mmalloc/mmprivate.h" +#include "mc_object_info.h" +#include "mc_comm_pattern.h" +#include "mc_request.h" +#include "mc_safety.h" +#include "mc_memory_map.h" +#include "mc_snapshot.h" +#include "mc_liveness.h" +#include "mc_private.h" +#endif +#include "mc_record.h" + XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_global, mc, "Logging specific to MC (global)"); -/* Configuration support */ -e_mc_reduce_t mc_reduce_kind = e_mc_reduce_unset; - -int _sg_do_model_check = 0; -int _sg_mc_checkpoint = 0; -int _sg_mc_sparse_checkpoint = 0; -int _sg_mc_soft_dirty = 0; -char *_sg_mc_property_file = NULL; -int _sg_mc_timeout = 0; -int _sg_mc_hash = 0; -int _sg_mc_max_depth = 1000; -int _sg_mc_visited = 0; -char *_sg_mc_dot_output_file = NULL; -int _sg_mc_comms_determinism = 0; -int _sg_mc_send_determinism = 0; -int _sg_mc_safety = 0; -int _sg_mc_liveness = 0; +double *mc_time = NULL; +#ifdef HAVE_MC int user_max_depth_reached = 0; -void _mc_cfg_cb_reduce(const char *name, int pos) -{ - if (_sg_cfg_init_status && !_sg_do_model_check) { - xbt_die - ("You are specifying a reduction strategy after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); - } - char *val = xbt_cfg_get_string(_sg_cfg_set, name); - if (!strcasecmp(val, "none")) { - mc_reduce_kind = e_mc_reduce_none; - } else if (!strcasecmp(val, "dpor")) { - mc_reduce_kind = e_mc_reduce_dpor; - } else { - xbt_die("configuration option %s can only take 'none' or 'dpor' as a value", - name); - } -} - -void _mc_cfg_cb_checkpoint(const char *name, int pos) -{ - if (_sg_cfg_init_status && !_sg_do_model_check) { - xbt_die - ("You are specifying a checkpointing value after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); - } - _sg_mc_checkpoint = xbt_cfg_get_int(_sg_cfg_set, name); -} - -void _mc_cfg_cb_sparse_checkpoint(const char *name, int pos) { - if (_sg_cfg_init_status && !_sg_do_model_check) { - xbt_die("You are specifying a checkpointing value after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); - } - _sg_mc_sparse_checkpoint = xbt_cfg_get_boolean(_sg_cfg_set, name); -} - -void _mc_cfg_cb_soft_dirty(const char *name, int pos) { - if (_sg_cfg_init_status && !_sg_do_model_check) { - xbt_die("You are specifying a soft dirty value after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); - } - _sg_mc_soft_dirty = xbt_cfg_get_boolean(_sg_cfg_set, name); -} - -void _mc_cfg_cb_property(const char *name, int pos) -{ - if (_sg_cfg_init_status && !_sg_do_model_check) { - xbt_die - ("You are specifying a property after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); - } - _sg_mc_property_file = xbt_cfg_get_string(_sg_cfg_set, name); -} - -void _mc_cfg_cb_timeout(const char *name, int pos) -{ - if (_sg_cfg_init_status && !_sg_do_model_check) { - xbt_die - ("You are specifying a value to enable/disable timeout for wait requests after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); - } - _sg_mc_timeout = xbt_cfg_get_boolean(_sg_cfg_set, name); -} - -void _mc_cfg_cb_hash(const char *name, int pos) -{ - if (_sg_cfg_init_status && !_sg_do_model_check) { - xbt_die - ("You are specifying a value to enable/disable the use of global hash to speedup state comparaison, but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); - } - _sg_mc_hash = xbt_cfg_get_boolean(_sg_cfg_set, name); -} - -void _mc_cfg_cb_max_depth(const char *name, int pos) -{ - if (_sg_cfg_init_status && !_sg_do_model_check) { - xbt_die - ("You are specifying a max depth value after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); - } - _sg_mc_max_depth = xbt_cfg_get_int(_sg_cfg_set, name); -} - -void _mc_cfg_cb_visited(const char *name, int pos) -{ - if (_sg_cfg_init_status && !_sg_do_model_check) { - xbt_die - ("You are specifying a number of stored visited states after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); - } - _sg_mc_visited = xbt_cfg_get_int(_sg_cfg_set, name); -} - -void _mc_cfg_cb_dot_output(const char *name, int pos) -{ - if (_sg_cfg_init_status && !_sg_do_model_check) { - xbt_die - ("You are specifying a file name for a dot output of graph state after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); - } - _sg_mc_dot_output_file = xbt_cfg_get_string(_sg_cfg_set, name); -} - -void _mc_cfg_cb_comms_determinism(const char *name, int pos) -{ - if (_sg_cfg_init_status && !_sg_do_model_check) { - xbt_die - ("You are specifying a value to enable/disable the detection of determinism in the communications schemes after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); - } - _sg_mc_comms_determinism = xbt_cfg_get_boolean(_sg_cfg_set, name); - mc_reduce_kind = e_mc_reduce_none; -} - -void _mc_cfg_cb_send_determinism(const char *name, int pos) -{ - if (_sg_cfg_init_status && !_sg_do_model_check) { - xbt_die - ("You are specifying a value to enable/disable the detection of send-determinism in the communications schemes after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry."); - } - _sg_mc_send_determinism = xbt_cfg_get_boolean(_sg_cfg_set, name); - mc_reduce_kind = e_mc_reduce_none; -} - /* MC global data structures */ mc_state_t mc_current_state = NULL; char mc_replay_mode = FALSE; -double *mc_time = NULL; + __thread mc_comparison_times_t mc_comp_times = NULL; __thread double mc_snapshot_comparison_time; mc_stats_t mc_stats = NULL; @@ -240,6 +128,21 @@ static void MC_init_debug_info(void) mc_model_checker_t mc_model_checker = NULL; +mc_model_checker_t MC_model_checker_new() +{ + mc_model_checker_t mc = xbt_new0(s_mc_model_checker_t, 1); + mc->pages = mc_pages_store_new(); + mc->fd_clear_refs = -1; + mc->fd_pagemap = -1; + return mc; +} + +void MC_model_checker_delete(mc_model_checker_t mc) { + mc_pages_store_delete(mc->pages); + if(mc->record) + xbt_dynar_free(&mc->record); +} + void MC_init() { int raw_mem_set = (mmalloc_get_current_heap() == mc_heap); @@ -251,10 +154,7 @@ void MC_init() MC_SET_MC_HEAP; - mc_model_checker = xbt_new0(s_mc_model_checker_t, 1); - mc_model_checker->pages = mc_pages_store_new(); - mc_model_checker->fd_clear_refs = -1; - mc_model_checker->fd_pagemap = -1; + mc_model_checker = MC_model_checker_new(); mc_comp_times = xbt_new0(s_mc_comparison_times_t, 1); @@ -292,33 +192,32 @@ void MC_init() /* Ignore local variable about time used for tracing */ MC_ignore_local_variable("start_time", "*"); + /* Main MC state: */ MC_ignore_global_variable("mc_model_checker"); + MC_ignore_global_variable("initial_communications_pattern"); + MC_ignore_global_variable("incomplete_communications_pattern"); + MC_ignore_global_variable("nb_comm_pattern"); - // Mot of those things could be moved into mc_model_checker: - MC_ignore_global_variable("compared_pointers"); + /* MC __thread variables: */ + MC_ignore_global_variable("mc_diff_info"); MC_ignore_global_variable("mc_comp_times"); MC_ignore_global_variable("mc_snapshot_comparison_time"); + + /* This MC state is used in MC replay as well: */ MC_ignore_global_variable("mc_time"); - MC_ignore_global_variable("smpi_current_rank"); - MC_ignore_global_variable("counter"); /* Static variable used for tracing */ - MC_ignore_global_variable("maestro_stack_start"); - MC_ignore_global_variable("maestro_stack_end"); - MC_ignore_global_variable("smx_total_comms"); - MC_ignore_global_variable("communications_pattern"); - MC_ignore_global_variable("initial_communications_pattern"); - MC_ignore_global_variable("incomplete_communications_pattern"); - if (MC_is_active()) { - MC_ignore_global_variable("mc_diff_info"); - } + /* Static variable used for tracing */ + MC_ignore_global_variable("counter"); + + /* SIMIX */ + MC_ignore_global_variable("smx_total_comms"); MC_ignore_heap(mc_time, simix_process_maxpid * sizeof(double)); smx_process_t process; xbt_swag_foreach(process, simix_global->process_list) { - MC_ignore_heap(&(process->process_hookup), - sizeof(process->process_hookup)); - } + MC_ignore_heap(&(process->process_hookup), sizeof(process->process_hookup)); + } } if (raw_mem_set) @@ -454,38 +353,6 @@ void MC_exit(void) //xbt_abort(); } -int SIMIX_pre_mc_random(smx_simcall_t simcall, int min, int max) -{ - - return simcall->mc_value; -} - - -int MC_random(int min, int max) -{ - /*FIXME: return mc_current_state->executed_transition->random.value; */ - return simcall_mc_random(min, max); -} - -/** - * \brief Schedules all the process that are ready to run - */ -void MC_wait_for_requests(void) -{ - smx_process_t process; - smx_simcall_t req; - unsigned int iter; - - while (!xbt_dynar_is_empty(simix_global->process_to_run)) { - SIMIX_process_runall(); - xbt_dynar_foreach(simix_global->process_that_ran, iter, process) { - req = &process->simcall; - if (req->call != SIMCALL_NONE && !MC_request_is_visible(req)) - SIMIX_simcall_pre(req, 0); - } - } -} - int MC_deadlock_check() { int deadlock = FALSE; @@ -493,8 +360,7 @@ int MC_deadlock_check() if (xbt_swag_size(simix_global->process_list)) { deadlock = TRUE; xbt_swag_foreach(process, simix_global->process_list) { - if (process->simcall.call != SIMCALL_NONE - && MC_request_is_enabled(&process->simcall)) { + if (MC_request_is_enabled(&process->simcall)) { deadlock = FALSE; break; } @@ -503,68 +369,123 @@ int MC_deadlock_check() return deadlock; } +void handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t req, int value, xbt_dynar_t pattern, int backtracking) { + + switch(call_type) { + case MC_CALL_TYPE_NONE: + break; + case MC_CALL_TYPE_SEND: + case MC_CALL_TYPE_RECV: + get_comm_pattern(pattern, req, call_type); + break; + case MC_CALL_TYPE_WAIT: + case MC_CALL_TYPE_WAITANY: + { + smx_synchro_t current_comm = NULL; + if (call_type == MC_CALL_TYPE_WAIT) + current_comm = simcall_comm_wait__get__comm(req); + else + current_comm = xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), value, smx_synchro_t); + // First wait only must be considered: + if (current_comm->comm.refcount == 1) + complete_comm_pattern(pattern, current_comm, backtracking); + break; + } + default: + xbt_die("Unexpected call type %i", (int)call_type); + } + +} + +static void MC_restore_communications_pattern(mc_state_t state) { + mc_list_comm_pattern_t list_process_comm; + unsigned int cursor, cursor2; + xbt_dynar_foreach(initial_communications_pattern, cursor, list_process_comm){ + list_process_comm->index_comm = (int)xbt_dynar_get_as(state->index_comm, cursor, int); + } + mc_comm_pattern_t comm; + cursor = 0; + xbt_dynar_t initial_incomplete_process_comms, incomplete_process_comms; + for(int i=0; iincomplete_comm_pattern, i, xbt_dynar_t); + xbt_dynar_foreach(incomplete_process_comms, cursor2, comm) { + mc_comm_pattern_t copy_comm = xbt_new0(s_mc_comm_pattern_t, 1); + copy_comm->index = comm->index; + copy_comm->type = comm->type; + copy_comm->comm = comm->comm; + copy_comm->rdv = strdup(comm->rdv); + copy_comm->data_size = -1; + copy_comm->data = NULL; + if(comm->type == SIMIX_COMM_SEND){ + copy_comm->src_proc = comm->src_proc; + copy_comm->src_host = comm->src_host; + if(comm->data != NULL){ + copy_comm->data_size = comm->data_size; + copy_comm->data = xbt_malloc0(comm->data_size); + memcpy(copy_comm->data, comm->data, comm->data_size); + } + }else{ + copy_comm->dst_proc = comm->dst_proc; + copy_comm->dst_host = comm->dst_host; + } + xbt_dynar_push(initial_incomplete_process_comms, ©_comm); + } + } +} + /** * \brief Re-executes from the state at position start all the transitions indicated by * a given model-checker stack. * \param stack The stack with the transitions to execute. * \param start Start index to begin the re-execution. */ -void MC_replay(xbt_fifo_t stack, int start) +void MC_replay(xbt_fifo_t stack) { int raw_mem = (mmalloc_get_current_heap() == mc_heap); - int value, i = 1, count = 1, call = 0, j; + int value, count = 1, j; char *req_str; smx_simcall_t req = NULL, saved_req = NULL; xbt_fifo_item_t item, start_item; mc_state_t state; - smx_process_t process = NULL; - smx_action_t current_comm; - + XBT_DEBUG("**** Begin Replay ****"); - if (start == -1) { - /* Restore the initial state */ - MC_restore_snapshot(initial_global_state->snapshot); - /* At the moment of taking the snapshot the raw heap was set, so restoring - * it will set it back again, we have to unset it to continue */ - MC_SET_STD_HEAP; - } - - start_item = xbt_fifo_get_last_item(stack); - if (start != -1) { - while (i != start) { - start_item = xbt_fifo_get_prev_item(start_item); - i++; + /* Intermediate backtracking */ + if(_sg_mc_checkpoint > 0) { + start_item = xbt_fifo_get_first_item(stack); + state = (mc_state_t)xbt_fifo_get_item_content(start_item); + if(state->system_state){ + MC_restore_snapshot(state->system_state); + if(_sg_mc_comms_determinism || _sg_mc_send_determinism) + MC_restore_communications_pattern(state); + MC_SET_STD_HEAP; + return; } } - MC_SET_MC_HEAP; - if (mc_reduce_kind == e_mc_reduce_dpor) { - xbt_dict_reset(first_enabled_state); - xbt_swag_foreach(process, simix_global->process_list) { - if (MC_process_is_enabled(process)) { - char *key = bprintf("%lu", process->pid); - char *data = bprintf("%d", count); - xbt_dict_set(first_enabled_state, key, data, NULL); - xbt_free(key); - } - } - } + /* Restore the initial state */ + MC_restore_snapshot(initial_global_state->snapshot); + /* At the moment of taking the snapshot the raw heap was set, so restoring + * it will set it back again, we have to unset it to continue */ + MC_SET_STD_HEAP; + + start_item = xbt_fifo_get_last_item(stack); + + MC_SET_MC_HEAP; if (_sg_mc_comms_determinism || _sg_mc_send_determinism) { - for (j=0; jindex_comm = 0; } } MC_SET_STD_HEAP; - /* Traverse the stack from the state at position start and re-execute the transitions */ for (item = start_item; item != xbt_fifo_get_first_item(stack); @@ -572,16 +493,7 @@ void MC_replay(xbt_fifo_t stack, int start) state = (mc_state_t) xbt_fifo_get_item_content(item); saved_req = MC_state_get_executed_request(state, &value); - - if (mc_reduce_kind == e_mc_reduce_dpor) { - MC_SET_MC_HEAP; - char *key = bprintf("%lu", saved_req->issuer->pid); - if(xbt_dict_get_or_null(first_enabled_state, key)) - xbt_dict_remove(first_enabled_state, key); - xbt_free(key); - MC_SET_STD_HEAP; - } - + if (saved_req) { /* because we got a copy of the executed request, we have to fetch the real one, pointed by the request field of the issuer process */ @@ -595,58 +507,20 @@ void MC_replay(xbt_fifo_t stack, int start) } /* TODO : handle test and testany simcalls */ - if (_sg_mc_comms_determinism || _sg_mc_send_determinism) { - if (req->call == SIMCALL_COMM_ISEND) - call = 1; - else if (req->call == SIMCALL_COMM_IRECV) - call = 2; - else if (req->call == SIMCALL_COMM_WAIT) - call = 3; - else if (req->call == SIMCALL_COMM_WAITANY) - call = 4; - } - - SIMIX_simcall_pre(req, value); - - if (_sg_mc_comms_determinism || _sg_mc_send_determinism) { - MC_SET_MC_HEAP; - if (call == 1) { /* Send */ - get_comm_pattern(communications_pattern, req, call); - } else if (call == 2) { /* Recv */ - get_comm_pattern(communications_pattern, req, call); - } else if (call == 3) { /* Wait */ - current_comm = simcall_comm_wait__get__comm(req); - if (current_comm->comm.refcount == 1) /* First wait only must be considered */ - complete_comm_pattern(communications_pattern, current_comm); - } else if (call == 4) { /* WaitAny */ - current_comm = xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), value, smx_action_t); - if (current_comm->comm.refcount == 1) /* First wait only must be considered */ - complete_comm_pattern(communications_pattern, current_comm); - } - MC_SET_STD_HEAP; - call = 0; - } + e_mc_call_type_t call = MC_CALL_TYPE_NONE; + if (_sg_mc_comms_determinism || _sg_mc_send_determinism) + call = mc_get_call_type(req); + SIMIX_simcall_handle(req, value); + MC_SET_MC_HEAP; + if (_sg_mc_comms_determinism || _sg_mc_send_determinism) + handle_comm_pattern(call, req, value, NULL, 1); + MC_SET_STD_HEAP; + MC_wait_for_requests(); count++; - - if (mc_reduce_kind == e_mc_reduce_dpor) { - MC_SET_MC_HEAP; - /* Insert in dict all enabled processes */ - xbt_swag_foreach(process, simix_global->process_list) { - if (MC_process_is_enabled(process) ) { - char *key = bprintf("%lu", process->pid); - if (xbt_dict_get_or_null(first_enabled_state, key) == NULL) { - char *data = bprintf("%d", count); - xbt_dict_set(first_enabled_state, key, data, NULL); - } - xbt_free(key); - } - } - MC_SET_STD_HEAP; - } } /* Update statistics */ @@ -665,16 +539,31 @@ void MC_replay(xbt_fifo_t stack, int start) } -void MC_replay_liveness(xbt_fifo_t stack, int all_stack) +void MC_replay_liveness(xbt_fifo_t stack) { initial_global_state->raw_mem_set = (mmalloc_get_current_heap() == mc_heap); xbt_fifo_item_t item; - int depth = 1; + mc_pair_t pair = NULL; + mc_state_t state = NULL; + smx_simcall_t req = NULL, saved_req = NULL; + int value, depth = 1; + char *req_str; XBT_DEBUG("**** Begin Replay ****"); + /* Intermediate backtracking */ + if(_sg_mc_checkpoint > 0) { + item = xbt_fifo_get_first_item(stack); + pair = (mc_pair_t) xbt_fifo_get_item_content(item); + if(pair->graph_state->system_state){ + MC_restore_snapshot(pair->graph_state->system_state); + MC_SET_STD_HEAP; + return; + } + } + /* Restore the initial state */ MC_restore_snapshot(initial_global_state->snapshot); @@ -685,26 +574,21 @@ void MC_replay_liveness(xbt_fifo_t stack, int all_stack) /* Traverse the stack from the initial state and re-execute the transitions */ for (item = xbt_fifo_get_last_item(stack); - all_stack ? depth <= xbt_fifo_size(stack) : item != xbt_fifo_get_first_item(stack); + item != xbt_fifo_get_first_item(stack); item = xbt_fifo_get_prev_item(item)) { - mc_pair_t pair = (mc_pair_t) xbt_fifo_get_item_content(item); + pair = (mc_pair_t) xbt_fifo_get_item_content(item); - mc_state_t state = (mc_state_t) pair->graph_state; - smx_simcall_t req = NULL, saved_req = NULL; - int value; - char *req_str; + state = (mc_state_t) pair->graph_state; - if (pair->requests > 0) { + if (pair->exploration_started) { saved_req = MC_state_get_executed_request(state, &value); - //XBT_DEBUG("SavedReq->call %u", saved_req->call); if (saved_req != NULL) { /* because we got a copy of the executed request, we have to fetch the real one, pointed by the request field of the issuer process */ req = &saved_req->issuer->simcall; - //XBT_DEBUG("Req->call %u", req->call); /* Debug information */ if (XBT_LOG_ISENABLED(mc_global, xbt_log_priority_debug)) { @@ -715,7 +599,7 @@ void MC_replay_liveness(xbt_fifo_t stack, int all_stack) } - SIMIX_simcall_pre(req, value); + SIMIX_simcall_handle(req, value); MC_wait_for_requests(); } @@ -724,7 +608,7 @@ void MC_replay_liveness(xbt_fifo_t stack, int all_stack) mc_stats->executed_transitions++; depth++; - + } XBT_DEBUG("**** End Replay ****"); @@ -747,17 +631,13 @@ void MC_dump_stack_safety(xbt_fifo_t stack) int raw_mem_set = (mmalloc_get_current_heap() == mc_heap); MC_show_stack_safety(stack); - - if (!_sg_mc_checkpoint) { - - mc_state_t state; - - MC_SET_MC_HEAP; - while ((state = (mc_state_t) xbt_fifo_pop(stack)) != NULL) - MC_state_delete(state); - MC_SET_STD_HEAP; - - } + + mc_state_t state; + + MC_SET_MC_HEAP; + while ((state = (mc_state_t) xbt_fifo_pop(stack)) != NULL) + MC_state_delete(state, !state->in_visited_states ? 1 : 0); + MC_SET_STD_HEAP; if (raw_mem_set) MC_SET_MC_HEAP; @@ -820,21 +700,18 @@ void MC_show_stack_liveness(xbt_fifo_t stack) char *req_str = NULL; for (item = xbt_fifo_get_last_item(stack); - (item ? (pair = (mc_pair_t) (xbt_fifo_get_item_content(item))) - : (NULL)); item = xbt_fifo_get_prev_item(item)) { + (item ? (pair = (mc_pair_t) (xbt_fifo_get_item_content(item))) : (NULL)); + item = xbt_fifo_get_prev_item(item)) { req = MC_state_get_executed_request(pair->graph_state, &value); - if (req) { - if (pair->requests > 0) { - req_str = MC_request_to_string(req, value); - XBT_INFO("%s", req_str); - xbt_free(req_str); - } else { - XBT_INFO("End of system requests but evolution in Büchi automaton"); - } + if (req && req->call != SIMCALL_NONE) { + req_str = MC_request_to_string(req, value); + XBT_INFO("%s", req_str); + xbt_free(req_str); } } } + void MC_dump_stack_liveness(xbt_fifo_t stack) { @@ -872,11 +749,9 @@ void MC_print_statistics(mc_stats_t stats) } if (initial_global_state != NULL) { if (_sg_mc_comms_determinism) - XBT_INFO("Communication-deterministic : %s", - !initial_global_state->comm_deterministic ? "No" : "Yes"); + XBT_INFO("Communication-deterministic : %s", !initial_global_state->comm_deterministic ? "No" : "Yes"); if (_sg_mc_send_determinism) - XBT_INFO("Send-deterministic : %s", - !initial_global_state->send_deterministic ? "No" : "Yes"); + XBT_INFO("Send-deterministic : %s", !initial_global_state->send_deterministic ? "No" : "Yes"); } mmalloc_set_current_heap(previous_heap); } @@ -888,6 +763,7 @@ void MC_assert(int prop) XBT_INFO("*** PROPERTY NOT VALID ***"); XBT_INFO("**************************"); XBT_INFO("Counter-example execution trace:"); + MC_record_dump_path(mc_stack); MC_dump_stack_safety(mc_stack); MC_print_statistics(mc_stats); xbt_abort(); @@ -899,23 +775,6 @@ void MC_cut(void) user_max_depth_reached = 1; } -void MC_process_clock_add(smx_process_t process, double amount) -{ - mc_time[process->pid] += amount; -} - -double MC_process_clock_get(smx_process_t process) -{ - if (mc_time) { - if (process != NULL) - return mc_time[process->pid]; - else - return -1; - } else { - return 0; - } -} - void MC_automaton_load(const char *file) { @@ -953,3 +812,51 @@ void MC_automaton_new_propositional_symbol(const char *id, void *fct) MC_SET_MC_HEAP; } + +void MC_dump_stacks(FILE* file) +{ + int raw_mem_set = (mmalloc_get_current_heap() == mc_heap); + MC_SET_MC_HEAP; + + int nstack = 0; + stack_region_t current_stack; + unsigned cursor; + xbt_dynar_foreach(stacks_areas, cursor, current_stack) { + unw_context_t * context = (unw_context_t *)current_stack->context; + fprintf(file, "Stack %i:\n", nstack); + + int nframe = 0; + char buffer[100]; + unw_cursor_t c; + unw_init_local (&c, context); + unw_word_t off; + do { + const char * name = !unw_get_proc_name(&c, buffer, 100, &off) ? buffer : "?"; + fprintf(file, " %i: %s\n", nframe, name); + ++nframe; + } while(unw_step(&c)); + + ++nstack; + } + + if (raw_mem_set) + MC_SET_MC_HEAP; +} +#endif + +double MC_process_clock_get(smx_process_t process) +{ + if (mc_time) { + if (process != NULL) + return mc_time[process->pid]; + else + return -1; + } else { + return 0; + } +} + +void MC_process_clock_add(smx_process_t process, double amount) +{ + mc_time[process->pid] += amount; +} diff --git a/src/mc/mc_ignore.c b/src/mc/mc_ignore.c index 48f770477b..13cab5e2e2 100644 --- a/src/mc/mc_ignore.c +++ b/src/mc/mc_ignore.c @@ -5,8 +5,10 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "internal_config.h" +#include "mc_object_info.h" #include "mc_private.h" #include "smpi/private.h" +#include "mc/mc_snapshot.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_ignore, mc, "Logging specific to MC ignore mechanism"); @@ -73,18 +75,16 @@ void MC_ignore_heap(void *address, size_t size) region->block = ((char *) address - - (char *) ((xbt_mheap_t) std_heap)->heapbase) / BLOCKSIZE + 1; + (char *) std_heap->heapbase) / BLOCKSIZE + 1; - if (((xbt_mheap_t) std_heap)->heapinfo[region->block].type == 0) { + if (std_heap->heapinfo[region->block].type == 0) { region->fragment = -1; - ((xbt_mheap_t) std_heap)->heapinfo[region->block].busy_block.ignore++; + std_heap->heapinfo[region->block].busy_block.ignore++; } else { region->fragment = - ((uintptr_t) (ADDR2UINT(address) % (BLOCKSIZE))) >> ((xbt_mheap_t) - std_heap)-> + ((uintptr_t) (ADDR2UINT(address) % (BLOCKSIZE))) >> std_heap-> heapinfo[region->block].type; - ((xbt_mheap_t) std_heap)->heapinfo[region->block].busy_frag.ignore[region-> - fragment]++; + std_heap->heapinfo[region->block].busy_frag.ignore[region->fragment]++; } if (mc_heap_comparison_ignore == NULL) { @@ -226,7 +226,8 @@ static void mc_ignore_local_variable_in_scope(const char *var_name, // Processing of direct variables: // If the current subprogram matche the given name: - if (subprogram_name == NULL || strcmp(subprogram_name, subprogram->name) == 0) { + if (!subprogram_name || + (subprogram->name && strcmp(subprogram_name, subprogram->name) == 0)) { // Try to find the variable and remove it: int start = 0; @@ -330,7 +331,7 @@ void MC_new_stack_area(void *stack, smx_process_t process, void *context, size_t region->size = size; region->block = ((char *) stack - - (char *) ((xbt_mheap_t) std_heap)->heapbase) / BLOCKSIZE + 1; + (char *) std_heap->heapbase) / BLOCKSIZE + 1; #ifdef HAVE_SMPI if (smpi_privatize_global_variables && process) { region->process_index = smpi_process_index_of_smx_process(process); diff --git a/src/mc/mc_interface.h b/src/mc/mc_interface.h new file mode 100644 index 0000000000..0bf35d0479 --- /dev/null +++ b/src/mc/mc_interface.h @@ -0,0 +1,18 @@ +/* MC interface: definitions that non-MC modules must see, but not the user */ + +/* Copyright (c) 2007-2014. The SimGrid Team. All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef MC_INTERFACE_H +#define MC_INTERFACE_H +#include "mc/mc.h" + +SG_BEGIN_DECL() + +typedef struct s_mc_snapshot s_mc_snapshot_t, *mc_snapshot_t; + +SG_END_DECL() + +#endif diff --git a/src/mc/mc_liveness.c b/src/mc/mc_liveness.c index 4717fcd02c..6a21a60f2c 100644 --- a/src/mc/mc_liveness.c +++ b/src/mc/mc_liveness.c @@ -4,17 +4,23 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "mc_private.h" #include #include +#include +#include + +#include "mc_request.h" +#include "mc_liveness.h" +#include "mc_private.h" +#include "mc_record.h" + XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_liveness, mc, "Logging specific to algorithms for liveness properties verification"); /********* Global variables *********/ xbt_dynar_t acceptance_pairs; -xbt_dynar_t successors; xbt_parmap_t parmap; /********* Static functions *********/ @@ -37,24 +43,19 @@ static xbt_dynar_t get_atomic_propositions_values() } -static mc_visited_pair_t is_reached_acceptance_pair(int pair_num, - xbt_automaton_state_t - automaton_state, - xbt_dynar_t - atomic_propositions) -{ +static mc_visited_pair_t is_reached_acceptance_pair(mc_pair_t pair){ int raw_mem_set = (mmalloc_get_current_heap() == mc_heap); MC_SET_MC_HEAP; - mc_visited_pair_t pair = NULL; - pair = MC_visited_pair_new(pair_num, automaton_state, atomic_propositions); - pair->acceptance_pair = 1; + mc_visited_pair_t new_pair = NULL; + new_pair = MC_visited_pair_new(pair->num, pair->automaton_state, pair->atomic_propositions, pair->graph_state); + new_pair->acceptance_pair = 1; if (xbt_dynar_is_empty(acceptance_pairs)) { - xbt_dynar_push(acceptance_pairs, &pair); + xbt_dynar_push(acceptance_pairs, &new_pair); } else { @@ -63,7 +64,7 @@ static mc_visited_pair_t is_reached_acceptance_pair(int pair_num, mc_visited_pair_t pair_test; int cursor; - index = get_search_interval(acceptance_pairs, pair, &min, &max); + index = get_search_interval(acceptance_pairs, new_pair, &min, &max); if (min != -1 && max != -1) { // Acceptance pair with same number of processes and same heap bytes used exists @@ -76,46 +77,37 @@ static mc_visited_pair_t is_reached_acceptance_pair(int pair_num, } */ cursor = min; - while (cursor <= max) { - pair_test = - (mc_visited_pair_t) xbt_dynar_get_as(acceptance_pairs, cursor, - mc_visited_pair_t); - if (xbt_automaton_state_compare - (pair_test->automaton_state, pair->automaton_state) == 0) { - if (xbt_automaton_propositional_symbols_compare_value - (pair_test->atomic_propositions, - pair->atomic_propositions) == 0) { - if (snapshot_compare(pair_test, pair) == 0) { - XBT_INFO("Pair %d already reached (equal to pair %d) !", - pair->num, pair_test->num); - - xbt_fifo_shift(mc_stack); - if (dot_output != NULL) - fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", - initial_global_state->prev_pair, pair_test->num, - initial_global_state->prev_req); - - if (!raw_mem_set) - MC_SET_STD_HEAP; - - return NULL; + if(pair->search_cycle == 1){ + while (cursor <= max) { + pair_test = (mc_visited_pair_t) xbt_dynar_get_as(acceptance_pairs, cursor, mc_visited_pair_t); + if (xbt_automaton_state_compare(pair_test->automaton_state, new_pair->automaton_state) == 0) { + if (xbt_automaton_propositional_symbols_compare_value(pair_test->atomic_propositions, new_pair->atomic_propositions) == 0) { + if (snapshot_compare(pair_test, new_pair) == 0) { + XBT_INFO("Pair %d already reached (equal to pair %d) !", new_pair->num, pair_test->num); + xbt_fifo_shift(mc_stack); + if (dot_output != NULL) + fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", initial_global_state->prev_pair, pair_test->num, initial_global_state->prev_req); + + if (!raw_mem_set) + MC_SET_STD_HEAP; + + return NULL; + } } } + cursor++; } - cursor++; } - xbt_dynar_insert_at(acceptance_pairs, min, &pair); + xbt_dynar_insert_at(acceptance_pairs, min, &new_pair); } else { - pair_test = - (mc_visited_pair_t) xbt_dynar_get_as(acceptance_pairs, index, - mc_visited_pair_t); - if (pair_test->nb_processes < pair->nb_processes) { - xbt_dynar_insert_at(acceptance_pairs, index + 1, &pair); + pair_test = (mc_visited_pair_t) xbt_dynar_get_as(acceptance_pairs, index, mc_visited_pair_t); + if (pair_test->nb_processes < new_pair->nb_processes) { + xbt_dynar_insert_at(acceptance_pairs, index + 1, &new_pair); } else { - if (pair_test->heap_bytes_used < pair->heap_bytes_used) - xbt_dynar_insert_at(acceptance_pairs, index + 1, &pair); + if (pair_test->heap_bytes_used < new_pair->heap_bytes_used) + xbt_dynar_insert_at(acceptance_pairs, index + 1, &new_pair); else - xbt_dynar_insert_at(acceptance_pairs, index, &pair); + xbt_dynar_insert_at(acceptance_pairs, index, &new_pair); } } @@ -124,12 +116,11 @@ static mc_visited_pair_t is_reached_acceptance_pair(int pair_num, if (!raw_mem_set) MC_SET_STD_HEAP; - return pair; + return new_pair; } -static void remove_acceptance_pair(int pair_num) -{ +static void remove_acceptance_pair(int pair_num) { int raw_mem_set = (mmalloc_get_current_heap() == mc_heap); @@ -137,21 +128,23 @@ static void remove_acceptance_pair(int pair_num) unsigned int cursor = 0; mc_visited_pair_t pair_test = NULL; + int pair_found = 0; xbt_dynar_foreach(acceptance_pairs, cursor, pair_test) { if (pair_test->num == pair_num) { + pair_found = 1; break; } } - xbt_dynar_remove_at(acceptance_pairs, cursor, &pair_test); + if(pair_found == 1) { + xbt_dynar_remove_at(acceptance_pairs, cursor, &pair_test); - pair_test->acceptance_removed = 1; + pair_test->acceptance_removed = 1; + + if (_sg_mc_visited == 0 || pair_test->visited_removed == 1) + MC_visited_pair_delete(pair_test); - if (_sg_mc_visited == 0) { - MC_visited_pair_delete(pair_test); - } else if (pair_test->visited_removed == 1) { - MC_visited_pair_delete(pair_test); } if (!raw_mem_set) @@ -165,36 +158,25 @@ static int MC_automaton_evaluate_label(xbt_automaton_exp_label_t l, switch (l->type) { case 0:{ - int left_res = - MC_automaton_evaluate_label(l->u.or_and.left_exp, - atomic_propositions_values); - int right_res = - MC_automaton_evaluate_label(l->u.or_and.right_exp, - atomic_propositions_values); + int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp, atomic_propositions_values); + int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp, atomic_propositions_values); return (left_res || right_res); } case 1:{ - int left_res = - MC_automaton_evaluate_label(l->u.or_and.left_exp, - atomic_propositions_values); - int right_res = - MC_automaton_evaluate_label(l->u.or_and.right_exp, - atomic_propositions_values); + int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp, atomic_propositions_values); + int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp, atomic_propositions_values); return (left_res && right_res); } case 2:{ - int res = - MC_automaton_evaluate_label(l->u.exp_not, atomic_propositions_values); + int res = MC_automaton_evaluate_label(l->u.exp_not, atomic_propositions_values); return (!res); } case 3:{ unsigned int cursor = 0; xbt_automaton_propositional_symbol_t p = NULL; - xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, - p) { + xbt_dynar_foreach(_mc_property_automaton->propositional_symbols, cursor, p) { if (strcmp(p->pred, l->u.predicat) == 0) - return (int) xbt_dynar_get_as(atomic_propositions_values, cursor, - int); + return (int) xbt_dynar_get_as(atomic_propositions_values, cursor, int); } return -1; } @@ -206,8 +188,7 @@ static int MC_automaton_evaluate_label(xbt_automaton_exp_label_t l, } } -void MC_pre_modelcheck_liveness(void) -{ +void MC_pre_modelcheck_liveness(void) { initial_global_state->raw_mem_set = (mmalloc_get_current_heap() == mc_heap); @@ -219,26 +200,23 @@ void MC_pre_modelcheck_liveness(void) MC_SET_MC_HEAP; acceptance_pairs = xbt_dynar_new(sizeof(mc_visited_pair_t), NULL); - visited_pairs = xbt_dynar_new(sizeof(mc_visited_pair_t), NULL); - successors = xbt_dynar_new(sizeof(mc_pair_t), NULL); + if(_sg_mc_visited > 0) + visited_pairs = xbt_dynar_new(sizeof(mc_visited_pair_t), NULL); initial_global_state->snapshot = MC_take_snapshot(0); initial_global_state->prev_pair = 0; - MC_SET_STD_HEAP; - unsigned int cursor = 0; xbt_automaton_state_t automaton_state; - + xbt_dynar_foreach(_mc_property_automaton->states, cursor, automaton_state) { if (automaton_state->type == -1) { /* Initial automaton state */ - MC_SET_MC_HEAP; - initial_pair = MC_pair_new(); initial_pair->automaton_state = automaton_state; initial_pair->graph_state = MC_state_new(); initial_pair->atomic_propositions = get_atomic_propositions_values(); + initial_pair->depth = 1; /* Get enabled processes and insert them in the interleave set of the graph_state */ xbt_swag_foreach(process, simix_global->process_list) { @@ -247,182 +225,136 @@ void MC_pre_modelcheck_liveness(void) } } - initial_pair->requests = - MC_state_interleave_size(initial_pair->graph_state); + initial_pair->requests = MC_state_interleave_size(initial_pair->graph_state); initial_pair->search_cycle = 0; xbt_fifo_unshift(mc_stack, initial_pair); - - MC_SET_STD_HEAP; - - MC_modelcheck_liveness(); - - if (cursor != 0) { - MC_restore_snapshot(initial_global_state->snapshot); - MC_SET_STD_HEAP; - } } } + MC_SET_STD_HEAP; + + MC_modelcheck_liveness(); + if (initial_global_state->raw_mem_set) MC_SET_MC_HEAP; - else - MC_SET_STD_HEAP; } +void MC_modelcheck_liveness() { -void MC_modelcheck_liveness() -{ - - smx_process_t process; + smx_process_t process = NULL; mc_pair_t current_pair = NULL; - - if (xbt_fifo_size(mc_stack) == 0) - return; - - /* Get current pair */ - current_pair = - (mc_pair_t) xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack)); - - /* Update current state in buchi automaton */ - _mc_property_automaton->current_state = current_pair->automaton_state; - - XBT_DEBUG - ("********************* ( Depth = %d, search_cycle = %d, interleave size %d, pair_num %d)", - xbt_fifo_size(mc_stack), current_pair->search_cycle, - MC_state_interleave_size(current_pair->graph_state), current_pair->num); - - mc_stats->visited_pairs++; - - int value; + int value, res, visited_num = -1; smx_simcall_t req = NULL; - char *req_str; - - xbt_automaton_transition_t transition_succ; - unsigned int cursor = 0; - int res; - int visited_num; - + xbt_automaton_transition_t transition_succ = NULL; + int cursor = 0; mc_pair_t next_pair = NULL; xbt_dynar_t prop_values = NULL; mc_visited_pair_t reached_pair = NULL; - int counter_example_depth = 0; + + while(xbt_fifo_size(mc_stack) > 0){ - if (xbt_fifo_size(mc_stack) < _sg_mc_max_depth) { + /* Get current pair */ + current_pair = (mc_pair_t) xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack)); - if (current_pair->requests > 0) { + /* Update current state in buchi automaton */ + _mc_property_automaton->current_state = current_pair->automaton_state; - if (current_pair->search_cycle) { - - if ((current_pair->automaton_state->type == 1) - || (current_pair->automaton_state->type == 2)) { - if ((reached_pair = - is_reached_acceptance_pair(current_pair->num, - current_pair->automaton_state, - current_pair->atomic_propositions)) == - NULL) { - - counter_example_depth = xbt_fifo_size(mc_stack); - XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"); - XBT_INFO("| ACCEPTANCE CYCLE |"); - XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"); - XBT_INFO("Counter-example that violates formula :"); - MC_show_stack_liveness(mc_stack); - MC_dump_stack_liveness(mc_stack); - MC_print_statistics(mc_stats); - XBT_INFO("Counter-example depth : %d", counter_example_depth); - xbt_abort(); + XBT_DEBUG("********************* ( Depth = %d, search_cycle = %d, interleave size %d, pair_num %d)", + current_pair->depth, current_pair->search_cycle, + MC_state_interleave_size(current_pair->graph_state), current_pair->num); - } + if (current_pair->requests > 0) { + + if (current_pair->automaton_state->type == 1 && current_pair->exploration_started == 0) { + /* If new acceptance pair, return new pair */ + if ((reached_pair = is_reached_acceptance_pair(current_pair)) == NULL) { + int counter_example_depth = current_pair->depth; + XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"); + XBT_INFO("| ACCEPTANCE CYCLE |"); + XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"); + XBT_INFO("Counter-example that violates formula :"); + MC_show_stack_liveness(mc_stack); + MC_dump_stack_liveness(mc_stack); + MC_print_statistics(mc_stats); + XBT_INFO("Counter-example depth : %d", counter_example_depth); + xbt_abort(); } } - if ((visited_num = - is_visited_pair(reached_pair, current_pair->num, - current_pair->automaton_state, - current_pair->atomic_propositions)) != -1) { - - MC_SET_MC_HEAP; - if (dot_output != NULL) - fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", - initial_global_state->prev_pair, visited_num, - initial_global_state->prev_req); - MC_SET_STD_HEAP; - - } else { - - while ((req = - MC_state_get_request(current_pair->graph_state, - &value)) != NULL) { + /* Pair already visited ? stop the exploration on the current path */ + if ((current_pair->exploration_started == 0) && (visited_num = is_visited_pair(reached_pair, current_pair)) != -1) { + if (dot_output != NULL){ MC_SET_MC_HEAP; - if (dot_output != NULL) { - if (initial_global_state->prev_pair != 0 - && initial_global_state->prev_pair != current_pair->num) { - fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", - initial_global_state->prev_pair, current_pair->num, - initial_global_state->prev_req); - xbt_free(initial_global_state->prev_req); - } - initial_global_state->prev_pair = current_pair->num; - } + fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", initial_global_state->prev_pair, visited_num, initial_global_state->prev_req); + fflush(dot_output); MC_SET_STD_HEAP; + } - /* Debug information */ - if (XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)) { - req_str = MC_request_to_string(req, value); - XBT_DEBUG("Execute: %s", req_str); - xbt_free(req_str); - } - - MC_SET_MC_HEAP; - if (dot_output != NULL) { - initial_global_state->prev_req = - MC_request_get_dot_output(req, value); - if (current_pair->search_cycle) - fprintf(dot_output, "%d [shape=doublecircle];\n", - current_pair->num); - } - MC_SET_STD_HEAP; - - MC_state_set_executed_request(current_pair->graph_state, req, value); - mc_stats->executed_transitions++; - - /* Answer the request */ - SIMIX_simcall_pre(req, value); - - /* Wait for requests (schedules processes) */ - MC_wait_for_requests(); - - MC_SET_MC_HEAP; - prop_values = get_atomic_propositions_values(); - MC_SET_STD_HEAP; - - int new_pair = 0; - - /* Evaluate enabled transition according to atomic propositions values */ - cursor = 0; - xbt_dynar_foreach(current_pair->automaton_state->out, cursor, - transition_succ) { - - res = - MC_automaton_evaluate_label(transition_succ->label, - prop_values); - - if (res == 1) { // enabled transition in automaton - - if (new_pair) - MC_replay_liveness(mc_stack, 1); - - MC_SET_MC_HEAP; - + XBT_DEBUG("Pair already visited (equal to pair %d), exploration on the current path stopped.", visited_num); + MC_SET_MC_HEAP; + current_pair->requests = 0; + MC_SET_STD_HEAP; + goto backtracking; + + }else{ + + req = MC_state_get_request(current_pair->graph_state, &value); + + if (dot_output != NULL) { + MC_SET_MC_HEAP; + if (initial_global_state->prev_pair != 0 && initial_global_state->prev_pair != current_pair->num) { + fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", initial_global_state->prev_pair, current_pair->num, initial_global_state->prev_req); + xbt_free(initial_global_state->prev_req); + } + initial_global_state->prev_pair = current_pair->num; + initial_global_state->prev_req = MC_request_get_dot_output(req, value); + if (current_pair->search_cycle) + fprintf(dot_output, "%d [shape=doublecircle];\n", current_pair->num); + fflush(dot_output); + MC_SET_STD_HEAP; + } + + char* req_str = MC_request_to_string(req, value); + XBT_DEBUG("Execute: %s", req_str); + xbt_free(req_str); + + /* Set request as executed */ + MC_state_set_executed_request(current_pair->graph_state, req, value); + + /* Update mc_stats */ + mc_stats->executed_transitions++; + if(current_pair->exploration_started == 0) + mc_stats->visited_pairs++; + + /* Answer the request */ + SIMIX_simcall_handle(req, value); + + /* Wait for requests (schedules processes) */ + MC_wait_for_requests(); + + MC_SET_MC_HEAP; + + current_pair->requests--; + current_pair->exploration_started = 1; + + /* Get values of atomic propositions (variables used in the property formula) */ + prop_values = get_atomic_propositions_values(); + + /* Evaluate enabled/true transitions in automaton according to atomic propositions values and create new pairs */ + cursor = xbt_dynar_length(current_pair->automaton_state->out) - 1; + while (cursor >= 0) { + transition_succ = (xbt_automaton_transition_t)xbt_dynar_get_as(current_pair->automaton_state->out, cursor, xbt_automaton_transition_t); + res = MC_automaton_evaluate_label(transition_succ->label, prop_values); + if (res == 1 || res == 2) { /* 1 = True transition (always enabled), 2 = enabled transition according to atomic prop values */ next_pair = MC_pair_new(); next_pair->graph_state = MC_state_new(); next_pair->automaton_state = transition_succ->dst; next_pair->atomic_propositions = get_atomic_propositions_values(); - + next_pair->depth = current_pair->depth + 1; /* Get enabled processes and insert them in the interleave set of the next graph_state */ xbt_swag_foreach(process, simix_global->process_list) { if (MC_process_is_enabled(process)) { @@ -430,122 +362,56 @@ void MC_modelcheck_liveness() } } - next_pair->requests = - MC_state_interleave_size(next_pair->graph_state); - - if (next_pair->automaton_state->type == 1 - || next_pair->automaton_state->type == 2 - || current_pair->search_cycle) - next_pair->search_cycle = 1; - - xbt_fifo_unshift(mc_stack, next_pair); - - if (mc_stats->expanded_pairs % 1000000 == 0) - XBT_INFO("Expanded pairs : %lu", mc_stats->expanded_pairs); - - MC_SET_STD_HEAP; - - new_pair = 1; - - MC_modelcheck_liveness(); - - } - - } - - /* Then, evaluate true transitions (always true, whatever atomic propositions values) */ - cursor = 0; - xbt_dynar_foreach(current_pair->automaton_state->out, cursor, - transition_succ) { - - res = - MC_automaton_evaluate_label(transition_succ->label, - prop_values); - - if (res == 2) { // true transition in automaton - - if (new_pair) - MC_replay_liveness(mc_stack, 1); - - MC_SET_MC_HEAP; - - next_pair = MC_pair_new(); - next_pair->graph_state = MC_state_new(); - next_pair->automaton_state = transition_succ->dst; - next_pair->atomic_propositions = get_atomic_propositions_values(); - - /* Get enabled process and insert it in the interleave set of the next graph_state */ - xbt_swag_foreach(process, simix_global->process_list) { - if (MC_process_is_enabled(process)) { - MC_state_interleave_process(next_pair->graph_state, process); - } - } - - next_pair->requests = - MC_state_interleave_size(next_pair->graph_state); + next_pair->requests = MC_state_interleave_size(next_pair->graph_state); - if (next_pair->automaton_state->type == 1 - || next_pair->automaton_state->type == 2 - || current_pair->search_cycle) + /* FIXME : get search_cycle value for each acceptant state */ + if (next_pair->automaton_state->type == 1 || current_pair->search_cycle) next_pair->search_cycle = 1; + /* Add new pair to the exploration stack */ xbt_fifo_unshift(mc_stack, next_pair); - if (mc_stats->expanded_pairs % 1000000 == 0) - XBT_INFO("Expanded pairs : %lu", mc_stats->expanded_pairs); - - MC_SET_STD_HEAP; - - new_pair = 1; - - MC_modelcheck_liveness(); - - } - - } - - if (MC_state_interleave_size(current_pair->graph_state) > 0) { - XBT_DEBUG("Backtracking to depth %d", xbt_fifo_size(mc_stack)); - MC_replay_liveness(mc_stack, 0); - } + } + cursor--; + } + + MC_SET_STD_HEAP; + + } /* End of visited_pair test */ + + } else { + backtracking: + if(visited_num == -1) + XBT_DEBUG("No more request to execute. Looking for backtracking point."); + + MC_SET_MC_HEAP; + + xbt_dynar_free(&prop_values); + + /* Traverse the stack backwards until a pair with a non empty interleave + set is found, deleting all the pairs that have it empty in the way. */ + while ((current_pair = xbt_fifo_shift(mc_stack)) != NULL) { + if (current_pair->requests > 0) { + /* We found a backtracking point */ + XBT_DEBUG("Backtracking to depth %d", current_pair->depth); + xbt_fifo_unshift(mc_stack, current_pair); + MC_SET_STD_HEAP; + MC_replay_liveness(mc_stack); + XBT_DEBUG("Backtracking done"); + break; + }else{ + /* Delete pair */ + XBT_DEBUG("Delete pair %d at depth %d", current_pair->num, current_pair->depth); + if (current_pair->automaton_state->type == 1) + remove_acceptance_pair(current_pair->num); + MC_pair_delete(current_pair); } - } - - } - - } else { - - XBT_WARN("/!\\ Max depth reached ! /!\\ "); - if (MC_state_interleave_size(current_pair->graph_state) > 0) { - XBT_WARN - ("/!\\ But, there are still processes to interleave. Model-checker will not be able to ensure the soundness of the verification from now. /!\\ "); - if (_sg_mc_max_depth == 1000) - XBT_WARN - ("Notice : the default value of max depth is 1000 but you can change it with cfg=model-check/max_depth:value."); - } - - } - - if (xbt_fifo_size(mc_stack) == _sg_mc_max_depth) { - XBT_DEBUG("Pair %d (depth = %d) shifted in stack, maximum depth reached", - current_pair->num, xbt_fifo_size(mc_stack)); - } else { - XBT_DEBUG("Pair %d (depth = %d) shifted in stack", current_pair->num, - xbt_fifo_size(mc_stack)); - } - - - MC_SET_MC_HEAP; - xbt_dynar_free(&prop_values); - current_pair = xbt_fifo_shift(mc_stack); - if (xbt_fifo_size(mc_stack) != _sg_mc_max_depth - 1 - && current_pair->requests > 0 && current_pair->search_cycle) { - remove_acceptance_pair(current_pair->num); - } - MC_pair_delete(current_pair); - - MC_SET_STD_HEAP; - + + MC_SET_STD_HEAP; + } /* End of if (current_pair->requests > 0) else ... */ + + } /* End of while(xbt_fifo_size(mc_stack) > 0) */ + } diff --git a/src/mc/mc_liveness.h b/src/mc/mc_liveness.h new file mode 100644 index 0000000000..e0f102f458 --- /dev/null +++ b/src/mc/mc_liveness.h @@ -0,0 +1,63 @@ +/* Copyright (c) 2007-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef MC_LIVENESS_H +#define MC_LIVENESS_H + +#include + +#include +#include +#include +#include +#include "mc_state.h" + +SG_BEGIN_DECL() + +extern xbt_automaton_t _mc_property_automaton; + +typedef struct s_mc_pair{ + int num; + int search_cycle; + mc_state_t graph_state; /* System state included */ + xbt_automaton_state_t automaton_state; + xbt_dynar_t atomic_propositions; + int requests; + int depth; + int exploration_started; + int visited_pair_removed; +} s_mc_pair_t, *mc_pair_t; + +typedef struct s_mc_visited_pair{ + int num; + int other_num; /* Dot output for */ + int acceptance_pair; + mc_state_t graph_state; /* System state included */ + xbt_automaton_state_t automaton_state; + xbt_dynar_t atomic_propositions; + size_t heap_bytes_used; + int nb_processes; + int acceptance_removed; + int visited_removed; +} s_mc_visited_pair_t, *mc_visited_pair_t; + +mc_pair_t MC_pair_new(void); +void MC_pair_delete(mc_pair_t); +void mc_pair_free_voidp(void *p); +mc_visited_pair_t MC_visited_pair_new(int pair_num, xbt_automaton_state_t automaton_state, xbt_dynar_t atomic_propositions, mc_state_t graph_state); +void MC_visited_pair_delete(mc_visited_pair_t p); + +void MC_pre_modelcheck_liveness(void); +void MC_modelcheck_liveness(void); +void MC_show_stack_liveness(xbt_fifo_t stack); +void MC_dump_stack_liveness(xbt_fifo_t stack); + +extern xbt_dynar_t visited_pairs; +int is_visited_pair(mc_visited_pair_t visited_pair, mc_pair_t pair); + +SG_END_DECL() + +#endif diff --git a/src/mc/mc_location.h b/src/mc/mc_location.h new file mode 100644 index 0000000000..45657f4551 --- /dev/null +++ b/src/mc/mc_location.h @@ -0,0 +1,117 @@ +/* Copyright (c) 2004-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef MC_OBJECT_LOCATION_H +#define MC_OBJECT_LOCATION_H + +#include + +#define UNW_LOCAL_ONLY +#include +#include +#include + +#include +#include "mc_interface.h" +#include "mc_object_info.h" +#include "mc_forward.h" + +SG_BEGIN_DECL() + +/** \brief a DWARF expression with optional validity contraints */ +typedef struct s_mc_expression { + size_t size; + Dwarf_Op* ops; + // Optional validity: + void* lowpc, *highpc; +} s_mc_expression_t, *mc_expression_t; + +/** A location list (list of location expressions) */ +typedef struct s_mc_location_list { + size_t size; + mc_expression_t locations; +} s_mc_location_list_t, *mc_location_list_t; + +/** A location is either a location in memory of a register location + * + * Usage: + * + * * mc_dwarf_resolve_locations or mc_dwarf_resolve_location is used + * to find the location of a given location expression or location list; + * + * * mc_get_location_type MUST be used to find the location type; + * + * * for MC_LOCATION_TYPE_ADDRESS, memory_address is the resulting address + * + * * for MC_LOCATION_TYPE_REGISTER, unw_get_reg(l.cursor, l.register_id, value) + * and unw_get_reg(l.cursor, l.register_id, value) can be used to read/write + * the value. + * + */ +typedef struct s_mc_location { + void* memory_location; + unw_cursor_t* cursor; + int register_id; +} s_mc_location_t, *mc_location_t; + +/** Type of a given location + * + * Use `mc_get_location_type(location)` to find the type. + * */ +typedef enum mc_location_type { + MC_LOCATION_TYPE_ADDRESS, + MC_LOCATION_TYPE_REGISTER +} mc_location_type; + +/** Find the type of a location */ +static inline __attribute__ ((always_inline)) +enum mc_location_type mc_get_location_type(mc_location_t location) { + if (location->cursor) { + return MC_LOCATION_TYPE_REGISTER; + } else { + return MC_LOCATION_TYPE_ADDRESS; + } +} + +void mc_dwarf_resolve_location(mc_location_t location, mc_expression_t expression, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot, int process_index); +void mc_dwarf_resolve_locations(mc_location_t location, mc_location_list_t locations, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot, int process_index); + +void mc_dwarf_expression_clear(mc_expression_t expression); +void mc_dwarf_expression_init(mc_expression_t expression, size_t len, Dwarf_Op* ops); + +void mc_dwarf_location_list_clear(mc_location_list_t list); + +void mc_dwarf_location_list_init_from_expression(mc_location_list_t target, size_t len, Dwarf_Op* ops); +void mc_dwarf_location_list_init(mc_location_list_t target, mc_object_info_t info, Dwarf_Die* die, Dwarf_Attribute* attr); + +#define MC_EXPRESSION_STACK_SIZE 64 + +#define MC_EXPRESSION_OK 0 +#define MC_EXPRESSION_E_UNSUPPORTED_OPERATION 1 +#define MC_EXPRESSION_E_STACK_OVERFLOW 2 +#define MC_EXPRESSION_E_STACK_UNDERFLOW 3 +#define MC_EXPRESSION_E_MISSING_STACK_CONTEXT 4 +#define MC_EXPRESSION_E_MISSING_FRAME_BASE 5 +#define MC_EXPRESSION_E_NO_BASE_ADDRESS 6 + +typedef struct s_mc_expression_state { + uintptr_t stack[MC_EXPRESSION_STACK_SIZE]; + size_t stack_size; + + unw_cursor_t* cursor; + void* frame_base; + mc_snapshot_t snapshot; + mc_object_info_t object_info; + int process_index; +} s_mc_expression_state_t, *mc_expression_state_t; + +int mc_dwarf_execute_expression(size_t n, const Dwarf_Op* ops, mc_expression_state_t state); + +void* mc_find_frame_base(dw_frame_t frame, mc_object_info_t object_info, unw_cursor_t* unw_cursor); + +SG_END_DECL() + +#endif diff --git a/src/mc/mc_member.c b/src/mc/mc_member.c index ff7667d8a7..b5ee0690f0 100644 --- a/src/mc/mc_member.c +++ b/src/mc/mc_member.c @@ -4,6 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "mc_object_info.h" #include "mc_private.h" /** Resolve snapshot in the process address space @@ -38,4 +39,3 @@ void *mc_member_resolve(const void *base, dw_type_t type, dw_type_t member, else return (void *) state.stack[state.stack_size - 1]; } - diff --git a/src/mc/mc_memory.c b/src/mc/mc_memory.c index c629cf54a9..b474b0ced6 100644 --- a/src/mc/mc_memory.c +++ b/src/mc/mc_memory.c @@ -6,16 +6,19 @@ #include #include + +#include "xbt/log.h" + #include "mc/mc.h" +#include "mc_object_info.h" #include "mc_private.h" -#include "xbt/log.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_memory, mc, "Logging specific to MC (memory)"); /* Pointers to each of the heap regions to use */ -void *std_heap = NULL; /* memory erased each time the MC stuff rollbacks to the beginning. Almost everything goes here */ -void *mc_heap = NULL; /* memory persistent over the MC rollbacks. Only MC stuff should go there */ +xbt_mheap_t std_heap = NULL; /* memory erased each time the MC stuff rollbacks to the beginning. Almost everything goes here */ +xbt_mheap_t mc_heap = NULL; /* memory persistent over the MC rollbacks. Only MC stuff should go there */ /* Initialize the model-checker memory subsystem */ /* It creates the two heap regions: std_heap and mc_heap */ @@ -25,7 +28,7 @@ void MC_memory_init() std_heap = mmalloc_get_default_md(); xbt_assert(std_heap != NULL); -#if defined HAVE_GNU_LD && !defined MMALLOC_WANT_OVERRIDE_LEGACY +#if 0 && defined HAVE_GNU_LD && !defined MMALLOC_WANT_OVERRIDE_LEGACY /* use the system malloc for the model-checker data */ mc_heap = NULL; #else diff --git a/src/mc/mc_memory_map.h b/src/mc/mc_memory_map.h new file mode 100644 index 0000000000..afa2b58c67 --- /dev/null +++ b/src/mc/mc_memory_map.h @@ -0,0 +1,48 @@ +/* Copyright (c) 2007-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef MC_MEMORY_MAP_H +#define MC_MEMORY_MAP_H + +#include +#include "mc_forward.h" + +SG_BEGIN_DECL() + +/** \file + * These functions and data structures implements a binary interface for + * the proc maps ascii interface */ + +/* Each field is defined as documented in proc's manual page */ +struct s_map_region { + + void *start_addr; /* Start address of the map */ + void *end_addr; /* End address of the map */ + int prot; /* Memory protection */ + int flags; /* Additional memory flags */ + void *offset; /* Offset in the file/whatever */ + char dev_major; /* Major of the device */ + char dev_minor; /* Minor of the device */ + unsigned long inode; /* Inode in the device */ + char *pathname; /* Path name of the mapped file */ + +}; +typedef struct s_map_region s_map_region_t, *map_region_t; + +struct s_memory_map { + + s_map_region_t *regions; /* Pointer to an array of regions */ + int mapsize; /* Number of regions in the memory */ + +}; + +void MC_init_memory_map_info(void); +memory_map_t MC_get_memory_map(void); +void MC_free_memory_map(memory_map_t map); + +SG_END_DECL() + +#endif diff --git a/src/mc/mc_mmalloc.h b/src/mc/mc_mmalloc.h new file mode 100644 index 0000000000..4ceecbd9df --- /dev/null +++ b/src/mc/mc_mmalloc.h @@ -0,0 +1,38 @@ +/* Copyright (c) 2007-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef MC_MMALLOC_H +#define MC_MMALLOC_H + +#include + +/** file + * Support for seperate heaps. + * + * The possible memory modes for the modelchecker are standard and raw. + * Normally the system should operate in std, for switching to raw mode + * you must wrap the code between MC_SET_RAW_MODE and MC_UNSET_RAW_MODE. + */ + +extern xbt_mheap_t std_heap; +extern xbt_mheap_t mc_heap; + +/* FIXME: Horrible hack! because the mmalloc library doesn't provide yet of */ +/* an API to query about the status of a heap, we simply call mmstats and */ +/* because I now how does structure looks like, then I redefine it here */ + +/* struct mstats { */ +/* size_t bytes_total; /\* Total size of the heap. *\/ */ +/* size_t chunks_used; /\* Chunks allocated by the user. *\/ */ +/* size_t bytes_used; /\* Byte total of user-allocated chunks. *\/ */ +/* size_t chunks_free; /\* Chunks in the free list. *\/ */ +/* size_t bytes_free; /\* Byte total of chunks in the free list. *\/ */ +/* }; */ + +#define MC_SET_MC_HEAP mmalloc_set_current_heap(mc_heap) +#define MC_SET_STD_HEAP mmalloc_set_current_heap(std_heap) + +#endif diff --git a/src/mc/mc_mmu.h b/src/mc/mc_mmu.h index f188da7446..6740829b8c 100644 --- a/src/mc/mc_mmu.h +++ b/src/mc/mc_mmu.h @@ -10,6 +10,10 @@ #include #include +#include + +SG_BEGIN_DECL() + extern int xbt_pagesize; extern int xbt_pagebits; @@ -68,4 +72,6 @@ bool mc_same_page(void* a, void* b) return ((uintptr_t) a >> xbt_pagebits) == ((uintptr_t) b >> xbt_pagebits); } +SG_END_DECL() + #endif diff --git a/src/mc/mc_model_checker.h b/src/mc/mc_model_checker.h new file mode 100644 index 0000000000..9ab2813c23 --- /dev/null +++ b/src/mc/mc_model_checker.h @@ -0,0 +1,37 @@ +/* Copyright (c) 2007-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef MC_MODEL_CHECKER_H +#define MC_MODEL_CHECKER_H + +#include + +#include "mc_forward.h" + +SG_BEGIN_DECL() + +/** @brief State of the model-checker (global variables for the model checker) + * + * Each part of the state of the model chercker represented as a global + * variable prevents some sharing between snapshots and must be ignored. + * By moving as much state as possible in this structure allocated + * on the model-chercker heap, we avoid those issues. + */ +struct s_mc_model_checker { + // This is the parent snapshot of the current state: + mc_snapshot_t parent_snapshot; + mc_pages_store_t pages; + int fd_clear_refs; + int fd_pagemap; + xbt_dynar_t record; +}; + +mc_model_checker_t MC_model_checker_new(void); +void MC_model_checker_delete(mc_model_checker_t mc); + +SG_END_DECL() + +#endif diff --git a/src/mc/mc_object_info.h b/src/mc/mc_object_info.h new file mode 100644 index 0000000000..2e0b68f43e --- /dev/null +++ b/src/mc/mc_object_info.h @@ -0,0 +1,150 @@ +/* Copyright (c) 2007-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +/** file + * Debug information for the MC. + */ + +#ifndef MC_OBJECT_INFO_H +#define MC_OBJECT_INFO_H + +#include + +#include +#include +#include + +#include "mc_forward.h" +#include "mc_location.h" + +SG_BEGIN_DECL(); + +// ***** Type + +typedef int e_dw_type_type; + +struct s_dw_type { + e_dw_type_type type; + Dwarf_Off id; /* Offset in the section (in hexadecimal form) */ + char *name; /* Name of the type */ + int byte_size; /* Size in bytes */ + int element_count; /* Number of elements for array type */ + char *dw_type_id; /* DW_AT_type id */ + xbt_dynar_t members; /* if DW_TAG_structure_type, DW_TAG_class_type, DW_TAG_union_type*/ + int is_pointer_type; + + // Location (for members) is either of: + struct s_mc_expression location; + int offset; + + dw_type_t subtype; // DW_AT_type + dw_type_t full_type; // The same (but more complete) type +}; + +void dw_type_free(dw_type_t t); +void dw_variable_free(dw_variable_t v); +void dw_variable_free_voidp(void *t); + +// ***** Object info + +enum mc_object_info_flags { + MC_OBJECT_INFO_NONE = 0, + MC_OBJECT_INFO_EXECUTABLE = 1 +}; + +struct s_mc_object_info { + enum mc_object_info_flags flags; + char* file_name; + char *start_exec, *end_exec; // Executable segment + char *start_rw, *end_rw; // Read-write segment + char *start_ro, *end_ro; // read-only segment + xbt_dict_t subprograms; // xbt_dict_t + xbt_dynar_t global_variables; // xbt_dynar_t + xbt_dict_t types; // xbt_dict_t + xbt_dict_t full_types_by_name; // xbt_dict_t (full defined type only) + + // Here we sort the minimal information for an efficient (and cache-efficient) + // lookup of a function given an instruction pointer. + // The entries are sorted by low_pc and a binary search can be used to look them up. + xbt_dynar_t functions_index; +}; + +/** Find the DWARF offset for this ELF object + * + * An offset is applied to address found in DWARF: + * + *
    + *
  • for an executable obejct, addresses are virtual address + * (there is no offset) i.e. \f$\text{virtual address} = \{dwarf address}\f$;
  • + *
  • for a shared object, the addreses are offset from the begining + * of the shared object (the base address of the mapped shared + * object must be used as offset + * i.e. \f$\text{virtual address} = \text{shared object base address} + * + \text{dwarf address}\f$.
  • + * + */ +void* MC_object_base_address(mc_object_info_t info); + +mc_object_info_t MC_new_object_info(void); +mc_object_info_t MC_find_object_info(memory_map_t maps, char* name, int executable); +void MC_free_object_info(mc_object_info_t* p); + +void MC_post_process_object_info(mc_object_info_t info); + +void MC_dwarf_get_variables(mc_object_info_t info); +void MC_dwarf_get_variables_libdw(mc_object_info_t info); +const char* MC_dwarf_attrname(int attr); +const char* MC_dwarf_tagname(int tag); + +// Not used: +char* get_type_description(mc_object_info_t info, char *type_name); + +extern mc_object_info_t mc_libsimgrid_info; +extern mc_object_info_t mc_binary_info; +extern mc_object_info_t mc_object_infos[2]; +extern size_t mc_object_infos_size; + +void* mc_member_resolve(const void* base, dw_type_t type, dw_type_t member, mc_snapshot_t snapshot, int process_index); + +struct s_dw_variable{ + Dwarf_Off dwarf_offset; /* Global offset of the field. */ + int global; + char *name; + char *type_origin; + dw_type_t type; + + // Use either of: + s_mc_location_list_t locations; + void* address; + + size_t start_scope; + mc_object_info_t object_info; + +}; + +struct s_dw_frame{ + int tag; + char *name; + void *low_pc; + void *high_pc; + s_mc_location_list_t frame_base; + xbt_dynar_t /* */ variables; /* Cannot use dict, there may be several variables with the same name (in different lexical blocks)*/ + unsigned long int id; /* DWARF offset of the subprogram */ + xbt_dynar_t /* */ scopes; + Dwarf_Off abstract_origin_id; + mc_object_info_t object_info; +}; + +struct s_mc_function_index_item { + void* low_pc, *high_pc; + dw_frame_t function; +}; + +void mc_frame_free(dw_frame_t freme); + +SG_END_DECL() + +#endif diff --git a/src/mc/mc_page_snapshot.cpp b/src/mc/mc_page_snapshot.cpp index 60ff820bc4..499e5f210f 100644 --- a/src/mc/mc_page_snapshot.cpp +++ b/src/mc/mc_page_snapshot.cpp @@ -1,6 +1,7 @@ #include "mc_page_store.h" #include "mc_mmu.h" #include "mc_private.h" +#include "mc_snapshot.h" #include @@ -176,7 +177,7 @@ mc_mem_region_t mc_region_new_sparse(int type, void *start_addr, void* permanent uint64_t* pagemap = NULL; if (_sg_mc_soft_dirty && mc_model_checker->parent_snapshot) { - pagemap = (uint64_t*) mmalloc_no_memset((xbt_mheap_t) mc_heap, sizeof(uint64_t) * page_count); + pagemap = (uint64_t*) mmalloc_no_memset(mc_heap, sizeof(uint64_t) * page_count); mc_read_pagemap(pagemap, mc_page_number(NULL, permanent_addr), page_count); } @@ -185,7 +186,7 @@ mc_mem_region_t mc_region_new_sparse(int type, void *start_addr, void* permanent ref_reg==NULL ? NULL : ref_reg->page_numbers); if(pagemap) { - mfree((xbt_mheap_t) mc_heap, pagemap); + mfree(mc_heap, pagemap); } return new_reg; } @@ -200,7 +201,7 @@ void mc_region_restore_sparse(mc_mem_region_t reg, mc_mem_region_t ref_reg) // Read soft-dirty bits if necessary in order to know which pages have changed: if (_sg_mc_soft_dirty && mc_model_checker->parent_snapshot) { - pagemap = (uint64_t*) mmalloc_no_memset((xbt_mheap_t) mc_heap, sizeof(uint64_t) * page_count); + pagemap = (uint64_t*) mmalloc_no_memset(mc_heap, sizeof(uint64_t) * page_count); mc_read_pagemap(pagemap, mc_page_number(NULL, reg->permanent_addr), page_count); } diff --git a/src/mc/mc_page_store.h b/src/mc/mc_page_store.h index 9b7841876e..2f79705354 100644 --- a/src/mc/mc_page_store.h +++ b/src/mc/mc_page_store.h @@ -18,6 +18,7 @@ #include #include "mc_mmu.h" +#include "mc_forward.h" #ifndef MC_PAGE_STORE_H #define MC_PAGE_STORE_H @@ -212,8 +213,7 @@ size_t s_mc_pages_store::capacity() { SG_BEGIN_DECL() -typedef struct s_mc_pages_store s_mc_pages_store_t, * mc_pages_store_t; -mc_pages_store_t mc_pages_store_new(); +mc_pages_store_t mc_pages_store_new(void); void mc_pages_store_delete(mc_pages_store_t store); /** diff --git a/src/mc/mc_pair.c b/src/mc/mc_pair.c index 29910e6cff..ee3ad5d3e5 100644 --- a/src/mc/mc_pair.c +++ b/src/mc/mc_pair.c @@ -4,6 +4,8 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include +#include "mc_liveness.h" #include "mc_private.h" mc_pair_t MC_pair_new() @@ -11,14 +13,17 @@ mc_pair_t MC_pair_new() mc_pair_t p = NULL; p = xbt_new0(s_mc_pair_t, 1); p->num = ++mc_stats->expanded_pairs; + p->exploration_started = 0; p->search_cycle = 0; + p->visited_pair_removed = _sg_mc_visited > 0 ? 0 : 1; return p; } void MC_pair_delete(mc_pair_t p) { p->automaton_state = NULL; - MC_state_delete(p->graph_state); + if(p->visited_pair_removed) + MC_state_delete(p->graph_state, 1); xbt_dynar_free(&(p->atomic_propositions)); xbt_free(p); p = NULL; diff --git a/src/mc/mc_private.h b/src/mc/mc_private.h index c06613eded..4a86245aeb 100644 --- a/src/mc/mc_private.h +++ b/src/mc/mc_private.h @@ -9,6 +9,7 @@ #include "simgrid_config.h" #include +#include #include #ifndef WIN32 #include @@ -16,6 +17,7 @@ #include #include "mc/mc.h" +#include "mc_base.h" #include "mc/datatypes.h" #include "xbt/fifo.h" #include "xbt/config.h" @@ -29,199 +31,19 @@ #include "msg/datatypes.h" #include "xbt/strbuff.h" #include "xbt/parmap.h" -#include "mc_mmu.h" -#include "mc_page_store.h" + +#include "mc_forward.h" SG_BEGIN_DECL() -typedef struct s_dw_frame s_dw_frame_t, *dw_frame_t; typedef struct s_mc_function_index_item s_mc_function_index_item_t, *mc_function_index_item_t; /****************************** Snapshots ***********************************/ -#define NB_REGIONS 3 /* binary data (data + BSS) (type = 2), libsimgrid data (data + BSS) (type = 1), std_heap (type = 0)*/ - -/** @brief Copy/snapshot of a given memory region - * - * Two types of region snapshots exist: - *
      - *
    • flat/dense snapshots are a simple copy of the region;
    • - *
    • sparse/per-page snapshots are snaapshots which shared - * identical pages.
    • - *
    - */ -typedef struct s_mc_mem_region{ - /** @brief Virtual address of the region in the simulated process */ - void *start_addr; - - /** @brief Permanent virtual address of the region - * - * This is usually the same address as the simuilated process address. - * However, when using SMPI privatization of global variables, - * each SMPI process has its own set of global variables stored - * at a different virtual address. The scheduler maps those region - * on the region of the global variables. - * - * */ - void *permanent_addr; - - /** @brief Copy of the snapshot for flat snapshots regions (NULL otherwise) */ - void *data; - - /** @brief Size of the data region in bytes */ - size_t size; - - /** @brief Pages indices in the page store for per-page snapshots (NULL otherwise) */ - size_t* page_numbers; - -} s_mc_mem_region_t, *mc_mem_region_t; - -static inline __attribute__ ((always_inline)) -bool mc_region_contain(mc_mem_region_t region, void* p) -{ - return p >= region->start_addr && - p < (void*)((char*) region->start_addr + region->size); -} - -/** Ignored data - * - * Some parts of the snapshot are ignored by zeroing them out: the real - * values is stored here. - * */ -typedef struct s_mc_snapshot_ignored_data { - void* start; - size_t size; - void* data; -} s_mc_snapshot_ignored_data_t, *mc_snapshot_ignored_data_t; - -typedef struct s_mc_snapshot{ - size_t heap_bytes_used; - mc_mem_region_t regions[NB_REGIONS]; - xbt_dynar_t enabled_processes; - mc_mem_region_t* privatization_regions; - int privatization_index; - size_t *stack_sizes; - xbt_dynar_t stacks; - xbt_dynar_t to_ignore; - uint64_t hash; - xbt_dynar_t ignored_data; -} s_mc_snapshot_t, *mc_snapshot_t; - -/** @brief Process index used when no process is available - * - * The expected behaviour is that if a process index is needed it will fail. - * */ -#define MC_NO_PROCESS_INDEX -1 - -/** @brief Process index when any process is suitable - * - * We could use a special negative value in the future. - */ -#define MC_ANY_PROCESS_INDEX 0 - -mc_mem_region_t mc_get_snapshot_region(void* addr, mc_snapshot_t snapshot, int process_index); - -static inline __attribute__ ((always_inline)) -mc_mem_region_t mc_get_region_hinted(void* addr, mc_snapshot_t snapshot, int process_index, mc_mem_region_t region) -{ - if (mc_region_contain(region, addr)) - return region; - else - return mc_get_snapshot_region(addr, snapshot, process_index); -} - -/** Information about a given stack frame - * - */ -typedef struct s_mc_stack_frame { - /** Instruction pointer */ - unw_word_t ip; - /** Stack pointer */ - unw_word_t sp; - unw_word_t frame_base; - dw_frame_t frame; - char* frame_name; - unw_cursor_t unw_cursor; -} s_mc_stack_frame_t, *mc_stack_frame_t; - -typedef struct s_mc_snapshot_stack{ - xbt_dynar_t local_variables; - xbt_dynar_t stack_frames; // mc_stack_frame_t - int process_index; -}s_mc_snapshot_stack_t, *mc_snapshot_stack_t; - -typedef struct s_mc_global_t{ - mc_snapshot_t snapshot; - int raw_mem_set; - int prev_pair; - char *prev_req; - int initial_communications_pattern_done; - int comm_deterministic; - int send_deterministic; -}s_mc_global_t, *mc_global_t; - -typedef struct s_mc_checkpoint_ignore_region{ - void *addr; - size_t size; -}s_mc_checkpoint_ignore_region_t, *mc_checkpoint_ignore_region_t; - -static void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot); - -mc_snapshot_t SIMIX_pre_mc_snapshot(smx_simcall_t simcall); -mc_snapshot_t MC_take_snapshot(int num_state); -void MC_restore_snapshot(mc_snapshot_t); -void MC_free_snapshot(mc_snapshot_t); - -int mc_important_snapshot(mc_snapshot_t snapshot); - -size_t* mc_take_page_snapshot_region(void* data, size_t page_count, uint64_t* pagemap, size_t* reference_pages); -void mc_free_page_snapshot_region(size_t* pagenos, size_t page_count); -void mc_restore_page_snapshot_region(void* start_addr, size_t page_count, size_t* pagenos, uint64_t* pagemap, size_t* reference_pagenos); - -mc_mem_region_t mc_region_new_sparse(int type, void *start_addr, void* data_addr, size_t size, mc_mem_region_t ref_reg); -void MC_region_destroy(mc_mem_region_t reg); -void mc_region_restore_sparse(mc_mem_region_t reg, mc_mem_region_t ref_reg); -void mc_softdirty_reset(); - -static inline __attribute__((always_inline)) -bool mc_snapshot_region_linear(mc_mem_region_t region) { - return !region || !region->data; -} - -void* mc_snapshot_read_fragmented(void* addr, mc_mem_region_t region, void* target, size_t size); - -void* mc_snapshot_read(void* addr, mc_snapshot_t snapshot, int process_index, void* target, size_t size); -int mc_snapshot_region_memcmp( - void* addr1, mc_mem_region_t region1, - void* addr2, mc_mem_region_t region2, size_t size); -int mc_snapshot_memcmp( - void* addr1, mc_snapshot_t snapshot1, - void* addr2, mc_snapshot_t snapshot2, int process_index, size_t size); - -static void* mc_snapshot_read_pointer(void* addr, mc_snapshot_t snapshot, int process_index); - -/** @brief State of the model-checker (global variables for the model checker) - * - * Each part of the state of the model chercker represented as a global - * variable prevents some sharing between snapshots and must be ignored. - * By moving as much state as possible in this structure allocated - * on the model-chercker heap, we avoid those issues. - */ -typedef struct s_mc_model_checker { - // This is the parent snapshot of the current state: - mc_snapshot_t parent_snapshot; - mc_pages_store_t pages; - int fd_clear_refs; - int fd_pagemap; -} s_mc_model_checker_t, *mc_model_checker_t; - -extern mc_model_checker_t mc_model_checker; - extern xbt_dynar_t mc_checkpoint_ignore; /********************************* MC Global **********************************/ -extern double *mc_time; extern FILE *dot_output; extern const char* colors[13]; extern xbt_parmap_t parmap; @@ -229,73 +51,20 @@ extern xbt_parmap_t parmap; extern int user_max_depth_reached; int MC_deadlock_check(void); -void MC_replay(xbt_fifo_t stack, int start); -void MC_replay_liveness(xbt_fifo_t stack, int all_stack); -void MC_wait_for_requests(void); +void MC_replay(xbt_fifo_t stack); +void MC_replay_liveness(xbt_fifo_t stack); void MC_show_deadlock(smx_simcall_t req); void MC_show_stack_safety(xbt_fifo_t stack); void MC_dump_stack_safety(xbt_fifo_t stack); -int SIMIX_pre_mc_random(smx_simcall_t simcall, int min, int max); +/** Stack (of `mc_state_t`) representing the current position of the + * the MC in the exploration graph + * + * It is managed by its head (`xbt_fifo_shift` and `xbt_fifo_unshift`). + */ extern xbt_fifo_t mc_stack; -int get_search_interval(xbt_dynar_t list, void *ref, int *min, int *max); - -/********************************* Requests ***********************************/ - -int MC_request_depend(smx_simcall_t req1, smx_simcall_t req2); -char* MC_request_to_string(smx_simcall_t req, int value); -unsigned int MC_request_testany_fail(smx_simcall_t req); -/*int MC_waitany_is_enabled_by_comm(smx_req_t req, unsigned int comm);*/ -int MC_request_is_visible(smx_simcall_t req); -int MC_request_is_enabled(smx_simcall_t req); -int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx); -int MC_process_is_enabled(smx_process_t process); -char *MC_request_get_dot_output(smx_simcall_t req, int value); - - -/******************************** States **************************************/ - -extern mc_global_t initial_global_state; - -/* Possible exploration status of a process in a state */ -typedef enum { - MC_NOT_INTERLEAVE=0, /* Do not interleave (do not execute) */ - MC_INTERLEAVE, /* Interleave the process (one or more request) */ - MC_MORE_INTERLEAVE, /* Interleave twice the process (for mc_random simcall) */ - MC_DONE /* Already interleaved */ -} e_mc_process_state_t; - -/* On every state, each process has an entry of the following type */ -typedef struct mc_procstate{ - e_mc_process_state_t state; /* Exploration control information */ - unsigned int interleave_count; /* Number of times that the process was - interleaved */ -} s_mc_procstate_t, *mc_procstate_t; - -/* An exploration state is composed of: */ -typedef struct mc_state { - unsigned long max_pid; /* Maximum pid at state's creation time */ - mc_procstate_t proc_status; /* State's exploration status by process */ - s_smx_action_t internal_comm; /* To be referenced by the internal_req */ - s_smx_simcall_t internal_req; /* Internal translation of request */ - s_smx_simcall_t executed_req; /* The executed request of the state */ - int req_num; /* The request number (in the case of a - multi-request like waitany ) */ - mc_snapshot_t system_state; /* Snapshot of system state */ - int num; -} s_mc_state_t, *mc_state_t; - -mc_state_t MC_state_new(void); -void MC_state_delete(mc_state_t state); -void MC_state_interleave_process(mc_state_t state, smx_process_t process); -unsigned int MC_state_interleave_size(mc_state_t state); -int MC_state_process_is_done(mc_state_t state, smx_process_t process); -void MC_state_set_executed_request(mc_state_t state, smx_simcall_t req, int value); -smx_simcall_t MC_state_get_executed_request(mc_state_t state, int *value); -smx_simcall_t MC_state_get_internal_request(mc_state_t state); -smx_simcall_t MC_state_get_request(mc_state_t state, int *value); -void MC_state_remove_interleave_process(mc_state_t state, smx_process_t process); +int get_search_interval(xbt_dynar_t list, void *ref, int *min, int *max); /****************************** Statistics ************************************/ @@ -311,64 +80,7 @@ typedef struct mc_stats { extern mc_stats_t mc_stats; -void MC_print_statistics(mc_stats_t); - - -/********************************** MEMORY ******************************/ -/* The possible memory modes for the modelchecker are standard and raw. */ -/* Normally the system should operate in std, for switching to raw mode */ -/* you must wrap the code between MC_SET_RAW_MODE and MC_UNSET_RAW_MODE */ - -extern void *std_heap; -extern void *mc_heap; - - -/* FIXME: Horrible hack! because the mmalloc library doesn't provide yet of */ -/* an API to query about the status of a heap, we simply call mmstats and */ -/* because I now how does structure looks like, then I redefine it here */ - -/* struct mstats { */ -/* size_t bytes_total; /\* Total size of the heap. *\/ */ -/* size_t chunks_used; /\* Chunks allocated by the user. *\/ */ -/* size_t bytes_used; /\* Byte total of user-allocated chunks. *\/ */ -/* size_t chunks_free; /\* Chunks in the free list. *\/ */ -/* size_t bytes_free; /\* Byte total of chunks in the free list. *\/ */ -/* }; */ - -#define MC_SET_MC_HEAP mmalloc_set_current_heap(mc_heap) -#define MC_SET_STD_HEAP mmalloc_set_current_heap(std_heap) - - -/******************************* MEMORY MAPPINGS ***************************/ -/* These functions and data structures implements a binary interface for */ -/* the proc maps ascii interface */ - -/* Each field is defined as documented in proc's manual page */ -typedef struct s_map_region { - - void *start_addr; /* Start address of the map */ - void *end_addr; /* End address of the map */ - int prot; /* Memory protection */ - int flags; /* Additional memory flags */ - void *offset; /* Offset in the file/whatever */ - char dev_major; /* Major of the device */ - char dev_minor; /* Minor of the device */ - unsigned long inode; /* Inode in the device */ - char *pathname; /* Path name of the mapped file */ - -} s_map_region_t; - -typedef struct s_memory_map { - - s_map_region_t *regions; /* Pointer to an array of regions */ - int mapsize; /* Number of regions in the memory */ - -} s_memory_map_t, *memory_map_t; - - -void MC_init_memory_map_info(void); -memory_map_t MC_get_memory_map(void); -void MC_free_memory_map(memory_map_t map); +void MC_print_statistics(mc_stats_t stats); extern char *libsimgrid_path; @@ -388,258 +100,17 @@ extern __thread mc_comparison_times_t mc_comp_times; extern __thread double mc_snapshot_comparison_time; int snapshot_compare(void *state1, void *state2); -int SIMIX_pre_mc_compare_snapshots(smx_simcall_t simcall, mc_snapshot_t s1, mc_snapshot_t s2); void print_comparison_times(void); //#define MC_DEBUG 1 #define MC_VERBOSE 1 -/********************************** Safety verification **************************************/ - -typedef enum { - e_mc_reduce_unset, - e_mc_reduce_none, - e_mc_reduce_dpor -} e_mc_reduce_t; - -extern e_mc_reduce_t mc_reduce_kind; -extern xbt_dict_t first_enabled_state; - -void MC_pre_modelcheck_safety(void); -void MC_modelcheck_safety(void); - -typedef struct s_mc_visited_state{ - mc_snapshot_t system_state; - size_t heap_bytes_used; - int nb_processes; - int num; - int other_num; // dot_output for -}s_mc_visited_state_t, *mc_visited_state_t; - -extern xbt_dynar_t visited_states; -mc_visited_state_t is_visited_state(void); -void visited_state_free(mc_visited_state_t state); -void visited_state_free_voidp(void *s); - -/********************************** Liveness verification **************************************/ - -extern xbt_automaton_t _mc_property_automaton; - -typedef struct s_mc_pair{ - int num; - int search_cycle; - mc_state_t graph_state; /* System state included */ - xbt_automaton_state_t automaton_state; - xbt_dynar_t atomic_propositions; - int requests; -}s_mc_pair_t, *mc_pair_t; - -typedef struct s_mc_visited_pair{ - int num; - int other_num; /* Dot output for */ - int acceptance_pair; - mc_state_t graph_state; /* System state included */ - xbt_automaton_state_t automaton_state; - xbt_dynar_t atomic_propositions; - size_t heap_bytes_used; - int nb_processes; - int acceptance_removed; - int visited_removed; -}s_mc_visited_pair_t, *mc_visited_pair_t; - -mc_pair_t MC_pair_new(void); -void MC_pair_delete(mc_pair_t); -void mc_pair_free_voidp(void *p); -mc_visited_pair_t MC_visited_pair_new(int pair_num, xbt_automaton_state_t automaton_state, xbt_dynar_t atomic_propositions); -void MC_visited_pair_delete(mc_visited_pair_t p); - -void MC_pre_modelcheck_liveness(void); -void MC_modelcheck_liveness(void); -void MC_show_stack_liveness(xbt_fifo_t stack); -void MC_dump_stack_liveness(xbt_fifo_t stack); - -extern xbt_dynar_t visited_pairs; -int is_visited_pair(mc_visited_pair_t pair, int pair_num, xbt_automaton_state_t automaton_state, xbt_dynar_t atomic_propositions); - - /********************************** Variables with DWARF **********************************/ -#define MC_OBJECT_INFO_EXECUTABLE 1 - -struct s_mc_object_info { - size_t flags; - char* file_name; - char *start_exec, *end_exec; // Executable segment - char *start_rw, *end_rw; // Read-write segment - char *start_ro, *end_ro; // read-only segment - xbt_dict_t subprograms; // xbt_dict_t - xbt_dynar_t global_variables; // xbt_dynar_t - xbt_dict_t types; // xbt_dict_t - xbt_dict_t full_types_by_name; // xbt_dict_t (full defined type only) - - // Here we sort the minimal information for an efficient (and cache-efficient) - // lookup of a function given an instruction pointer. - // The entries are sorted by low_pc and a binary search can be used to look them up. - xbt_dynar_t functions_index; -}; - -mc_object_info_t MC_new_object_info(void); -mc_object_info_t MC_find_object_info(memory_map_t maps, char* name, int executable); -void MC_free_object_info(mc_object_info_t* p); - -void MC_dwarf_get_variables(mc_object_info_t info); -void MC_dwarf_get_variables_libdw(mc_object_info_t info); -const char* MC_dwarf_attrname(int attr); -const char* MC_dwarf_tagname(int tag); - dw_frame_t MC_find_function_by_ip(void* ip); mc_object_info_t MC_ip_find_object_info(void* ip); -extern mc_object_info_t mc_libsimgrid_info; -extern mc_object_info_t mc_binary_info; -extern mc_object_info_t mc_object_infos[2]; -extern size_t mc_object_infos_size; - void MC_find_object_address(memory_map_t maps, mc_object_info_t result); -void MC_post_process_types(mc_object_info_t info); -void MC_post_process_object_info(mc_object_info_t info); - -// ***** Expressions - -/** \brief a DWARF expression with optional validity contraints */ -typedef struct s_mc_expression { - size_t size; - Dwarf_Op* ops; - // Optional validity: - void* lowpc, *highpc; -} s_mc_expression_t, *mc_expression_t; - -/** A location list (list of location expressions) */ -typedef struct s_mc_location_list { - size_t size; - mc_expression_t locations; -} s_mc_location_list_t, *mc_location_list_t; - -uintptr_t mc_dwarf_resolve_location(mc_expression_t expression, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot, int process_index); -uintptr_t mc_dwarf_resolve_locations(mc_location_list_t locations, mc_object_info_t object_info, unw_cursor_t* c, void* frame_pointer_address, mc_snapshot_t snapshot, int process_index); - -void mc_dwarf_expression_clear(mc_expression_t expression); -void mc_dwarf_expression_init(mc_expression_t expression, size_t len, Dwarf_Op* ops); - -void mc_dwarf_location_list_clear(mc_location_list_t list); - -void mc_dwarf_location_list_init_from_expression(mc_location_list_t target, size_t len, Dwarf_Op* ops); -void mc_dwarf_location_list_init(mc_location_list_t target, mc_object_info_t info, Dwarf_Die* die, Dwarf_Attribute* attr); - -// ***** Variables and functions - -struct s_dw_type{ - e_dw_type_type type; - Dwarf_Off id; /* Offset in the section (in hexadecimal form) */ - char *name; /* Name of the type */ - int byte_size; /* Size in bytes */ - int element_count; /* Number of elements for array type */ - char *dw_type_id; /* DW_AT_type id */ - xbt_dynar_t members; /* if DW_TAG_structure_type, DW_TAG_class_type, DW_TAG_union_type*/ - int is_pointer_type; - - // Location (for members) is either of: - struct s_mc_expression location; - int offset; - - dw_type_t subtype; // DW_AT_type - dw_type_t full_type; // The same (but more complete) type -}; - -void* mc_member_resolve(const void* base, dw_type_t type, dw_type_t member, mc_snapshot_t snapshot, int process_index); - -typedef struct s_dw_variable{ - Dwarf_Off dwarf_offset; /* Global offset of the field. */ - int global; - char *name; - char *type_origin; - dw_type_t type; - - // Use either of: - s_mc_location_list_t locations; - void* address; - - size_t start_scope; - mc_object_info_t object_info; - -}s_dw_variable_t, *dw_variable_t; - -struct s_dw_frame{ - int tag; - char *name; - void *low_pc; - void *high_pc; - s_mc_location_list_t frame_base; - xbt_dynar_t /* */ variables; /* Cannot use dict, there may be several variables with the same name (in different lexical blocks)*/ - unsigned long int id; /* DWARF offset of the subprogram */ - xbt_dynar_t /* */ scopes; - Dwarf_Off abstract_origin_id; - mc_object_info_t object_info; -}; - -struct s_mc_function_index_item { - void* low_pc, *high_pc; - dw_frame_t function; -}; - -void mc_frame_free(dw_frame_t freme); - -void dw_type_free(dw_type_t t); -void dw_variable_free(dw_variable_t v); -void dw_variable_free_voidp(void *t); - -void MC_dwarf_register_global_variable(mc_object_info_t info, dw_variable_t variable); -void MC_register_variable(mc_object_info_t info, dw_frame_t frame, dw_variable_t variable); -void MC_dwarf_register_non_global_variable(mc_object_info_t info, dw_frame_t frame, dw_variable_t variable); -void MC_dwarf_register_variable(mc_object_info_t info, dw_frame_t frame, dw_variable_t variable); - -/** Find the DWARF offset for this ELF object - * - * An offset is applied to address found in DWARF: - * - *
      - *
    • for an executable obejct, addresses are virtual address - * (there is no offset) i.e. \f$\text{virtual address} = \{dwarf address}\f$;
    • - *
    • for a shared object, the addreses are offset from the begining - * of the shared object (the base address of the mapped shared - * object must be used as offset - * i.e. \f$\text{virtual address} = \text{shared object base address} - * + \text{dwarf address}\f$.
    • - * - */ -void* MC_object_base_address(mc_object_info_t info); - -/********************************** DWARF **********************************/ - -#define MC_EXPRESSION_STACK_SIZE 64 - -#define MC_EXPRESSION_OK 0 -#define MC_EXPRESSION_E_UNSUPPORTED_OPERATION 1 -#define MC_EXPRESSION_E_STACK_OVERFLOW 2 -#define MC_EXPRESSION_E_STACK_UNDERFLOW 3 -#define MC_EXPRESSION_E_MISSING_STACK_CONTEXT 4 -#define MC_EXPRESSION_E_MISSING_FRAME_BASE 5 -#define MC_EXPRESSION_E_NO_BASE_ADDRESS 6 - -typedef struct s_mc_expression_state { - uintptr_t stack[MC_EXPRESSION_STACK_SIZE]; - size_t stack_size; - - unw_cursor_t* cursor; - void* frame_base; - mc_snapshot_t snapshot; - mc_object_info_t object_info; - int process_index; -} s_mc_expression_state_t, *mc_expression_state_t; - -int mc_dwarf_execute_expression(size_t n, const Dwarf_Op* ops, mc_expression_state_t state); - -void* mc_find_frame_base(dw_frame_t frame, mc_object_info_t object_info, unw_cursor_t* unw_cursor); /********************************** Miscellaneous **********************************/ @@ -652,35 +123,11 @@ typedef struct s_local_variable{ int region; }s_local_variable_t, *local_variable_t; -/********************************* Communications pattern ***************************/ - -typedef struct s_mc_comm_pattern{ - int num; - smx_action_t comm; - e_smx_comm_type_t type; - unsigned long src_proc; - unsigned long dst_proc; - const char *src_host; - const char *dst_host; - char *rdv; - ssize_t data_size; - void *data; -}s_mc_comm_pattern_t, *mc_comm_pattern_t; - -extern xbt_dynar_t initial_communications_pattern; -extern xbt_dynar_t communications_pattern; -extern xbt_dynar_t incomplete_communications_pattern; - -void get_comm_pattern(xbt_dynar_t communications_pattern, smx_simcall_t request, int call); -void complete_comm_pattern(xbt_dynar_t list, smx_action_t comm); -void MC_pre_modelcheck_comm_determinism(void); -void MC_modelcheck_comm_determinism(void); - /* *********** Sets *********** */ typedef struct s_mc_address_set *mc_address_set_t; -mc_address_set_t mc_address_set_new(); +mc_address_set_t mc_address_set_new(void); void mc_address_set_free(mc_address_set_t* p); void mc_address_add(mc_address_set_t p, const void* value); bool mc_address_test(mc_address_set_t p, const void* value); @@ -694,128 +141,15 @@ bool mc_address_test(mc_address_set_t p, const void* value); * */ uint64_t mc_hash_processes_state(int num_state, xbt_dynar_t stacks); -/* *********** Snapshot *********** */ - -static inline __attribute__((always_inline)) -void* mc_translate_address_region(uintptr_t addr, mc_mem_region_t region) -{ - size_t pageno = mc_page_number(region->start_addr, (void*) addr); - size_t snapshot_pageno = region->page_numbers[pageno]; - const void* snapshot_page = mc_page_store_get_page(mc_model_checker->pages, snapshot_pageno); - return (char*) snapshot_page + mc_page_offset((void*) addr); -} - -/** \brief Translate a pointer from process address space to snapshot address space - * - * The address space contains snapshot of the main/application memory: - * this function finds the address in a given snaphot for a given - * real/application address. +/** @brief Dump the stacks of the application processes * - * For read only memory regions and other regions which are not int the - * snapshot, the address is not changed. + * This functions is currently not used but it is quite convenient + * to call from the debugger. * - * \param addr Application address - * \param snapshot The snapshot of interest (if NULL no translation is done) - * \return Translated address in the snapshot address space - * */ -static inline __attribute__((always_inline)) -void* mc_translate_address(uintptr_t addr, mc_snapshot_t snapshot, int process_index) -{ - - // If not in a process state/clone: - if (!snapshot) { - return (uintptr_t *) addr; - } - - mc_mem_region_t region = mc_get_snapshot_region((void*) addr, snapshot, process_index); - - xbt_assert(mc_region_contain(region, (void*) addr), "Trying to read out of the region boundary."); - - if (!region) { - return (void *) addr; - } - - // Flat snapshot: - else if (region->data) { - uintptr_t offset = addr - (uintptr_t) region->start_addr; - return (void *) ((uintptr_t) region->data + offset); - } - - // Per-page snapshot: - else if (region->page_numbers) { - return mc_translate_address_region(addr, region); - } - - else { - xbt_die("No data for this memory region"); - } -} - -static inline __attribute__ ((always_inline)) - void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot) { - if(snapshot==NULL) - xbt_die("snapshot is NULL"); - void** addr = &((xbt_mheap_t)std_heap)->breakval; - return mc_snapshot_read_pointer(addr, snapshot, MC_ANY_PROCESS_INDEX); -} - -static inline __attribute__ ((always_inline)) -void* mc_snapshot_read_pointer(void* addr, mc_snapshot_t snapshot, int process_index) -{ - void* res; - return *(void**) mc_snapshot_read(addr, snapshot, process_index, &res, sizeof(void*)); -} - -/** @brief Read memory from a snapshot region - * - * @param addr Process (non-snapshot) address of the data - * @param region Snapshot memory region where the data is located - * @param target Buffer to store the value - * @param size Size of the data to read in bytes - * @return Pointer where the data is located (target buffer of original location) + * Does not work when an application thread is running. */ -static inline __attribute__((always_inline)) -void* mc_snapshot_read_region(void* addr, mc_mem_region_t region, void* target, size_t size) -{ - if (region==NULL) - return addr; - - uintptr_t offset = (char*) addr - (char*) region->start_addr; - - xbt_assert(mc_region_contain(region, addr), - "Trying to read out of the region boundary."); - - // Linear memory region: - if (region->data) { - return (char*) region->data + offset; - } - - // Fragmented memory region: - else if (region->page_numbers) { - // Last byte of the region: - void* end = (char*) addr + size - 1; - if( mc_same_page(addr, end) ) { - // The memory is contained in a single page: - return mc_translate_address_region((uintptr_t) addr, region); - } else { - // The memory spans several pages: - return mc_snapshot_read_fragmented(addr, region, target, size); - } - } - - else { - xbt_die("No data available for this region"); - } -} - -static inline __attribute__ ((always_inline)) -void* mc_snapshot_read_pointer_region(void* addr, mc_mem_region_t region) -{ - void* res; - return *(void**) mc_snapshot_read_region(addr, region, &res, sizeof(void*)); -} +void MC_dump_stacks(FILE* file); SG_END_DECL() #endif - diff --git a/src/mc/mc_record.c b/src/mc/mc_record.c new file mode 100644 index 0000000000..d9d79e1de8 --- /dev/null +++ b/src/mc/mc_record.c @@ -0,0 +1,146 @@ +/* Copyright (c) 2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include +#include + +#include +#include + +#include "mc_record.h" +#include "mc_base.h" + +#ifdef HAVE_MC +#include "mc_private.h" +#include "mc_model_checker.h" +#include "mc_state.h" +#endif + +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_record, mc, + " Logging specific to MC record/replay facility"); + +char* MC_record_path = NULL; + +void MC_record_replay(mc_record_item_t start, size_t len) +{ + MC_wait_for_requests(); + mc_record_item_t end = start + len; + + // Choose the recorded simcall and execute it: + for (mc_record_item_t item=start;item!=end; ++item) { + + XBT_DEBUG("Executing %i$%i", item->pid, item->value); +/* + if (xbt_dynar_is_empty(simix_global->process_to_run)) + xbt_die("Unexpected end of application."); +*/ + + // Choose a request: + smx_process_t process = SIMIX_process_from_PID(item->pid); + if (!process) + xbt_die("Unexpected process."); + smx_simcall_t simcall = &(process->simcall); + if(!simcall || simcall->call == SIMCALL_NONE) + xbt_die("No simcall for this process."); + if (!MC_request_is_visible(simcall) || !MC_request_is_enabled(simcall)) + xbt_die("Unexpected simcall."); + + // Execute the request: + SIMIX_simcall_handle(simcall, item->value); + MC_wait_for_requests(); + } +} + +xbt_dynar_t MC_record_from_string(const char* data) +{ + XBT_INFO("path=%s", data); + if (!data || !data[0]) + return NULL; + + xbt_dynar_t dynar = xbt_dynar_new(sizeof(s_mc_record_item_t), NULL); + + const char* current = data; + while (*current) { + + s_mc_record_item_t item = { 0, 0 }; + int count = sscanf(current, "%u/%u", &item.pid, &item.value); + if(count != 2 && count != 1) + goto fail; + xbt_dynar_push(dynar, &item); + + // Find next chunk: + char* end = strchr(current, ';'); + if(end==NULL) + break; + else + current = end + 1; + } + + return dynar; + +fail: + xbt_dynar_free(&dynar); + return NULL; +} + +#ifdef HAVE_MC +char* MC_record_stack_to_string(xbt_fifo_t stack) +{ + xbt_fifo_item_t start = xbt_fifo_get_last_item(stack); + + if (!start) { + char* res = (char*) malloc(1 * sizeof(char)); + res[0] = '\0'; + return res; + } + + char* buffer; + size_t size; + FILE* file = open_memstream(&buffer, &size); + + xbt_fifo_item_t item; + for (item = start; item; item = xbt_fifo_get_prev_item(item)) { + + // Find (pid, value): + mc_state_t state = (mc_state_t) xbt_fifo_get_item_content(item); + int value = 0; + smx_simcall_t saved_req = MC_state_get_executed_request(state, &value); + int pid = saved_req->issuer->pid; + + // Serialization the (pid, value) pair: + const char* sep = (item!=start) ? ";" : ""; + if (value) + fprintf(file, "%s%u/%u", sep, pid, value); + else + fprintf(file, "%s%u", sep, pid); + } + + fclose(file); + return buffer; +} + +void MC_record_dump_path(xbt_fifo_t stack) +{ + if (MC_record_is_active()) { + char* path = MC_record_stack_to_string(stack); + XBT_INFO("Path = %s", path); + free(path); + } +} +#endif + +void MC_record_replay_from_string(const char* path_string) +{ + xbt_dynar_t path = MC_record_from_string(path_string); + mc_record_item_t start = &xbt_dynar_get_as(path, 0, s_mc_record_item_t); + MC_record_replay(start, xbt_dynar_length(path)); + xbt_dynar_free(&path); +} + +void MC_record_replay_init() +{ + mc_time = xbt_new0(double, simix_process_maxpid); +} diff --git a/src/mc/mc_record.h b/src/mc/mc_record.h new file mode 100644 index 0000000000..3ea2d77dff --- /dev/null +++ b/src/mc/mc_record.h @@ -0,0 +1,83 @@ +/* Copyright (c) 2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +/** \file + * This file contains the MC replay/record functionnality. + * A MC path may be recorded by using ``-cfg=model-check/record:1`'`. + * The path is written in the log output and an be replayed with MC disabled + * (even with an non-LC build) with `--cfg=model-check/replay:$replayPath`. + * + * The same version of Simgrid should be used and the same arguments should be + * passed to the application (without the MC specific arguments). + */ + +#ifndef MC_RECORD_H +#define MC_RECORD_H + +#include + +#include "simgrid_config.h" + +SG_BEGIN_DECL() + +/** Whether the MC record mode is enabled + * + * The behaviour is not changed. The only real difference is that + * the path is writtent in the log when an interesting path is found. + */ +#define MC_record_is_active() _sg_do_model_check_record + +// **** Data conversion + +/** An element in the recorded path + * + * At each decision point, we need to record which process transition + * is trigerred and potentially which value is associated with this + * transition. The value is used to find which communication is triggerred + * in things like waitany and for associating a given value of MC_random() + * calls. + */ +typedef struct s_mc_record_item { + int pid; + int value; +} s_mc_record_item_t, *mc_record_item_t; + +/** Convert a string representation of the path into a array of `s_mc_record_item_t` + */ +xbt_dynar_t MC_record_from_string(const char* data); + +/** Generate a string representation +* +* The current format is a ";"-delimited list of pairs: +* "pid0,value0;pid2,value2;pid3,value3". The value can be +* omitted is it is null. +*/ +char* MC_record_stack_to_string(xbt_fifo_t stack); + +/** Dump the path represented by a given stack in the log + */ +void MC_record_dump_path(xbt_fifo_t stack); + +// ***** Replay + +/** Replay a path represented by the record items + * + * \param start Array of record item + * \item count Number of record items + */ +void MC_record_replay(mc_record_item_t start, size_t count); + +/** Replay a path represented by a string + * + * \param data String representation of the path + */ +void MC_record_replay_from_string(const char* data); + +void MC_record_replay_init(void); + +SG_END_DECL() + +#endif diff --git a/src/mc/mc_request.c b/src/mc/mc_request.c index cb13045859..af7f1ef766 100644 --- a/src/mc/mc_request.c +++ b/src/mc/mc_request.c @@ -4,6 +4,8 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "mc_request.h" +#include "mc_safety.h" #include "mc_private.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_request, mc, @@ -228,7 +230,7 @@ static char *buff_size_to_string(size_t buff_size) char *MC_request_to_string(smx_simcall_t req, int value) { char *type = NULL, *args = NULL, *str = NULL, *p = NULL, *bs = NULL; - smx_action_t act = NULL; + smx_synchro_t act = NULL; size_t size = 0; switch (req->call) { @@ -305,7 +307,7 @@ char *MC_request_to_string(smx_simcall_t req, int value) if (!xbt_dynar_is_empty(simcall_comm_waitany__get__comms(req))) { p = pointer_to_string(xbt_dynar_get_as (simcall_comm_waitany__get__comms(req), value, - smx_action_t)); + smx_synchro_t)); args = bprintf("comm=%s (%d of %lu)", p, value + 1, xbt_dynar_length(simcall_comm_waitany__get__comms(req))); @@ -367,7 +369,7 @@ char *MC_request_to_string(smx_simcall_t req, int value) unsigned int MC_request_testany_fail(smx_simcall_t req) { unsigned int cursor; - smx_action_t action; + smx_synchro_t action; xbt_dynar_foreach(simcall_comm_testany__get__comms(req), cursor, action) { if (action->comm.src_proc && action->comm.dst_proc) @@ -377,67 +379,9 @@ unsigned int MC_request_testany_fail(smx_simcall_t req) return TRUE; } -int MC_request_is_visible(smx_simcall_t req) -{ - return req->call == SIMCALL_COMM_ISEND - || req->call == SIMCALL_COMM_IRECV - || req->call == SIMCALL_COMM_WAIT - || req->call == SIMCALL_COMM_WAITANY - || req->call == SIMCALL_COMM_TEST - || req->call == SIMCALL_COMM_TESTANY - || req->call == SIMCALL_MC_RANDOM - || req->call == SIMCALL_MC_SNAPSHOT - || req->call == SIMCALL_MC_COMPARE_SNAPSHOTS; -} - -int MC_request_is_enabled(smx_simcall_t req) -{ - unsigned int index = 0; - smx_action_t act; - - switch (req->call) { - - case SIMCALL_COMM_WAIT: - /* FIXME: check also that src and dst processes are not suspended */ - - /* If it has a timeout it will be always be enabled, because even if the - * communication is not ready, it can timeout and won't block. - * On the other hand if it hasn't a timeout, check if the comm is ready.*/ - if (simcall_comm_wait__get__timeout(req) >= 0) { - if (_sg_mc_timeout == 1) { - return TRUE; - } else { - act = simcall_comm_wait__get__comm(req); - return (act->comm.src_proc && act->comm.dst_proc); - } - } else { - act = simcall_comm_wait__get__comm(req); - if (act->comm.detached && act->comm.src_proc == NULL - && act->comm.type == SIMIX_COMM_READY) - return (act->comm.dst_proc != NULL); - return (act->comm.src_proc && act->comm.dst_proc); - } - break; - - case SIMCALL_COMM_WAITANY: - /* Check if it has at least one communication ready */ - xbt_dynar_foreach(simcall_comm_waitany__get__comms(req), index, act) { - if (act->comm.src_proc && act->comm.dst_proc) { - return TRUE; - } - } - return FALSE; - break; - - default: - /* The rest of the request are always enabled */ - return TRUE; - } -} - int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx) { - smx_action_t act; + smx_synchro_t act; switch (req->call) { @@ -450,14 +394,14 @@ int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx) case SIMCALL_COMM_WAITANY: act = xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), idx, - smx_action_t); + smx_synchro_t); return (act->comm.src_proc && act->comm.dst_proc); break; case SIMCALL_COMM_TESTANY: act = xbt_dynar_get_as(simcall_comm_testany__get__comms(req), idx, - smx_action_t); + smx_synchro_t); return (act->comm.src_proc && act->comm.dst_proc); break; @@ -468,18 +412,14 @@ int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx) int MC_process_is_enabled(smx_process_t process) { - if (process->simcall.call != SIMCALL_NONE - && MC_request_is_enabled(&process->simcall)) - return TRUE; - - return FALSE; + return MC_request_is_enabled(&process->simcall); } char *MC_request_get_dot_output(smx_simcall_t req, int value) { char *str = NULL, *label = NULL; - smx_action_t act = NULL; + smx_synchro_t act = NULL; switch (req->call) { case SIMCALL_COMM_ISEND: diff --git a/src/mc/mc_request.h b/src/mc/mc_request.h new file mode 100644 index 0000000000..1bc9eb8d7f --- /dev/null +++ b/src/mc/mc_request.h @@ -0,0 +1,42 @@ +/* Copyright (c) 2007-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include + +#include "../simix/smx_private.h" + +#ifndef MC_REQUEST_H +#define MC_REQUEST_H + +SG_BEGIN_DECL() + +int MC_request_depend(smx_simcall_t req1, smx_simcall_t req2); +char* MC_request_to_string(smx_simcall_t req, int value); +unsigned int MC_request_testany_fail(smx_simcall_t req); +/*int MC_waitany_is_enabled_by_comm(smx_req_t req, unsigned int comm);*/ +int MC_request_is_visible(smx_simcall_t req); + +/** Can this requests can be executed. + * + * Most requests are always enabled but WAIT and WAITANY + * are not always enabled: a WAIT where the communication does not + * have both a source and a destination yet is not enabled + * (unless timeout is enabled in the wait and enabeld in SimGridMC). + */ +int MC_request_is_enabled(smx_simcall_t req); +int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx); + +/** Is the process ready to execute its simcall? + * + * This is true if the request associated with the process is ready. + */ +int MC_process_is_enabled(smx_process_t process); + +char *MC_request_get_dot_output(smx_simcall_t req, int value); + +SG_END_DECL() + +#endif diff --git a/src/mc/mc_safety.c b/src/mc/mc_safety.c index 6f671f2bdf..83460ff5da 100644 --- a/src/mc/mc_safety.c +++ b/src/mc/mc_safety.c @@ -4,15 +4,17 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "mc_state.h" +#include "mc_request.h" +#include "mc_safety.h" #include "mc_private.h" +#include "mc_record.h" #include "xbt/mmalloc/mmprivate.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_safety, mc, "Logging specific to MC safety verification "); -xbt_dict_t first_enabled_state; - /** * \brief Initialize the DPOR exploration algorithm */ @@ -29,11 +31,7 @@ void MC_pre_modelcheck_safety() MC_SET_MC_HEAP; if (_sg_mc_visited > 0) - visited_states = - xbt_dynar_new(sizeof(mc_visited_state_t), visited_state_free_voidp); - - if (mc_reduce_kind == e_mc_reduce_dpor) - first_enabled_state = xbt_dict_new_homogeneous(&xbt_free_f); + visited_states = xbt_dynar_new(sizeof(mc_visited_state_t), visited_state_free_voidp); initial_state = MC_state_new(); @@ -58,21 +56,6 @@ void MC_pre_modelcheck_safety() xbt_fifo_unshift(mc_stack, initial_state); - if (mc_reduce_kind == e_mc_reduce_dpor) { - /* To ensure the soundness of DPOR, we have to keep a list of - processes which are still enabled at each step of the exploration. - If max depth is reached, we interleave them in the state in which they have - been enabled for the first time. */ - xbt_swag_foreach(process, simix_global->process_list) { - if (MC_process_is_enabled(process)) { - char *key = bprintf("%lu", process->pid); - char *data = bprintf("%d", xbt_fifo_size(mc_stack)); - xbt_dict_set(first_enabled_state, key, data, NULL); - xbt_free(key); - } - } - } - if (!mc_mem_set) MC_SET_STD_HEAP; } @@ -87,27 +70,21 @@ void MC_modelcheck_safety(void) char *req_str = NULL; int value; smx_simcall_t req = NULL, prev_req = NULL; - mc_state_t state = NULL, prev_state = NULL, next_state = - NULL, restored_state = NULL; + mc_state_t state = NULL, prev_state = NULL, next_state = NULL; smx_process_t process = NULL; xbt_fifo_item_t item = NULL; - mc_state_t state_test = NULL; - int pos; mc_visited_state_t visited_state = NULL; - int enabled = 0; while (xbt_fifo_size(mc_stack) > 0) { /* Get current state */ - state = (mc_state_t) - xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack)); + state = (mc_state_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack)); XBT_DEBUG("**************************************************"); XBT_DEBUG - ("Exploration depth=%d (state=%p, num %d)(%u interleave, user_max_depth %d, first_enabled_state size : %d)", + ("Exploration depth=%d (state=%p, num %d)(%u interleave, user_max_depth %d)", xbt_fifo_size(mc_stack), state, state->num, - MC_state_interleave_size(state), user_max_depth_reached, - xbt_dict_size(first_enabled_state)); + MC_state_interleave_size(state), user_max_depth_reached); /* Update statistics */ mc_stats->visited_states++; @@ -117,31 +94,21 @@ void MC_modelcheck_safety(void) if (xbt_fifo_size(mc_stack) <= _sg_mc_max_depth && !user_max_depth_reached && (req = MC_state_get_request(state, &value)) && visited_state == NULL) { - /* Debug information */ - if (XBT_LOG_ISENABLED(mc_safety, xbt_log_priority_debug)) { - req_str = MC_request_to_string(req, value); - XBT_DEBUG("Execute: %s", req_str); - xbt_free(req_str); - } + char* req_str = MC_request_to_string(req, value); + XBT_DEBUG("Execute: %s", req_str); + xbt_free(req_str); - MC_SET_MC_HEAP; - if (dot_output != NULL) + if (dot_output != NULL) { + MC_SET_MC_HEAP; req_str = MC_request_get_dot_output(req, value); - MC_SET_STD_HEAP; + MC_SET_STD_HEAP; + } MC_state_set_executed_request(state, req, value); mc_stats->executed_transitions++; - if (mc_reduce_kind == e_mc_reduce_dpor) { - MC_SET_MC_HEAP; - char *key = bprintf("%lu", req->issuer->pid); - xbt_dict_remove(first_enabled_state, key); - xbt_free(key); - MC_SET_STD_HEAP; - } - /* Answer the request */ - SIMIX_simcall_pre(req, value); + SIMIX_simcall_handle(req, value); /* Wait for requests (schedules processes) */ MC_wait_for_requests(); @@ -151,7 +118,7 @@ void MC_modelcheck_safety(void) next_state = MC_state_new(); - if ((visited_state = is_visited_state()) == NULL) { + if ((visited_state = is_visited_state(next_state)) == NULL) { /* Get an enabled process and insert it in the interleave set of the next state */ xbt_swag_foreach(process, simix_global->process_list) { @@ -162,39 +129,18 @@ void MC_modelcheck_safety(void) } } - if (_sg_mc_checkpoint - && ((xbt_fifo_size(mc_stack) + 1) % _sg_mc_checkpoint == 0)) { - next_state->system_state = MC_take_snapshot(next_state->num); - } - if (dot_output != NULL) - fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num, - next_state->num, req_str); + fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num, next_state->num, req_str); } else { if (dot_output != NULL) - fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num, - visited_state->other_num == -1 ? visited_state->num : visited_state->other_num, req_str); + fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n", state->num, visited_state->other_num == -1 ? visited_state->num : visited_state->other_num, req_str); } xbt_fifo_unshift(mc_stack, next_state); - if (mc_reduce_kind == e_mc_reduce_dpor) { - /* Insert in dict all enabled processes, if not included yet */ - xbt_swag_foreach(process, simix_global->process_list) { - if (MC_process_is_enabled(process)) { - char *key = bprintf("%lu", process->pid); - if (xbt_dict_get_or_null(first_enabled_state, key) == NULL) { - char *data = bprintf("%d", xbt_fifo_size(mc_stack)); - xbt_dict_set(first_enabled_state, key, data, NULL); - } - xbt_free(key); - } - } - } - if (dot_output != NULL) xbt_free(req_str); @@ -205,8 +151,7 @@ void MC_modelcheck_safety(void) /* The interleave set is empty or the maximum depth is reached, let's back-track */ } else { - if ((xbt_fifo_size(mc_stack) > _sg_mc_max_depth) || user_max_depth_reached - || visited_state != NULL) { + if ((xbt_fifo_size(mc_stack) > _sg_mc_max_depth) || user_max_depth_reached || visited_state != NULL) { if (user_max_depth_reached && visited_state == NULL) XBT_DEBUG("User max depth reached !"); @@ -215,35 +160,9 @@ void MC_modelcheck_safety(void) else XBT_DEBUG("State already visited (equal to state %d), exploration stopped on this path.", visited_state->other_num == -1 ? visited_state->num : visited_state->other_num); - if (mc_reduce_kind == e_mc_reduce_dpor) { - /* Interleave enabled processes in the state in which they have been enabled for the first time */ - xbt_swag_foreach(process, simix_global->process_list) { - if (MC_process_is_enabled(process)) { - char *key = bprintf("%lu", process->pid); - enabled = - (int) strtoul(xbt_dict_get_or_null(first_enabled_state, key), - 0, 10); - xbt_free(key); - int cursor = xbt_fifo_size(mc_stack); - xbt_fifo_foreach(mc_stack, item, state_test, mc_state_t) { - if (cursor-- == enabled) { - if (!MC_state_process_is_done(state_test, process) - && state_test->num != state->num) { - XBT_DEBUG("Interleave process %lu in state %d", - process->pid, state_test->num); - MC_state_interleave_process(state_test, process); - break; - } - } - } - } - } - } - } else { - XBT_DEBUG("There are no more processes to interleave. (depth %d)", - xbt_fifo_size(mc_stack) + 1); + XBT_DEBUG("There are no more processes to interleave. (depth %d)", xbt_fifo_size(mc_stack) + 1); } @@ -251,9 +170,8 @@ void MC_modelcheck_safety(void) /* Trash the current state, no longer needed */ xbt_fifo_shift(mc_stack); - MC_state_delete(state); - XBT_DEBUG("Delete state %d at depth %d", state->num, - xbt_fifo_size(mc_stack) + 1); + MC_state_delete(state, !state->in_visited_states ? 1 : 0); + XBT_DEBUG("Delete state %d at depth %d", state->num, xbt_fifo_size(mc_stack) + 1); MC_SET_STD_HEAP; @@ -277,8 +195,7 @@ void MC_modelcheck_safety(void) if (mc_reduce_kind == e_mc_reduce_dpor) { req = MC_state_get_internal_request(state); xbt_fifo_foreach(mc_stack, item, prev_state, mc_state_t) { - if (MC_request_depend - (req, MC_state_get_internal_request(prev_state))) { + if (MC_request_depend(req, MC_state_get_internal_request(prev_state))) { if (XBT_LOG_ISENABLED(mc_safety, xbt_log_priority_debug)) { XBT_DEBUG("Dependent Transitions:"); prev_req = MC_state_get_executed_request(prev_state, &value); @@ -298,65 +215,33 @@ void MC_modelcheck_safety(void) break; - } else if (req->issuer == - MC_state_get_internal_request(prev_state)->issuer) { + } else if (req->issuer == MC_state_get_internal_request(prev_state)->issuer) { - XBT_DEBUG("Simcall %d and %d with same issuer", req->call, - MC_state_get_internal_request(prev_state)->call); + XBT_DEBUG("Simcall %d and %d with same issuer", req->call, MC_state_get_internal_request(prev_state)->call); break; } else { - XBT_DEBUG - ("Simcall %d, process %lu (state %d) and simcall %d, process %lu (state %d) are independant", - req->call, req->issuer->pid, state->num, - MC_state_get_internal_request(prev_state)->call, - MC_state_get_internal_request(prev_state)->issuer->pid, - prev_state->num); + XBT_DEBUG("Simcall %d, process %lu (state %d) and simcall %d, process %lu (state %d) are independant", + req->call, req->issuer->pid, state->num, + MC_state_get_internal_request(prev_state)->call, + MC_state_get_internal_request(prev_state)->issuer->pid, + prev_state->num); } } } - if (MC_state_interleave_size(state) - && xbt_fifo_size(mc_stack) < _sg_mc_max_depth) { + if (MC_state_interleave_size(state) && xbt_fifo_size(mc_stack) < _sg_mc_max_depth) { /* We found a back-tracking point, let's loop */ - XBT_DEBUG("Back-tracking to state %d at depth %d", state->num, - xbt_fifo_size(mc_stack) + 1); - if (_sg_mc_checkpoint) { - if (state->system_state != NULL) { - MC_restore_snapshot(state->system_state); - xbt_fifo_unshift(mc_stack, state); - MC_SET_STD_HEAP; - } else { - pos = xbt_fifo_size(mc_stack); - item = xbt_fifo_get_first_item(mc_stack); - while (pos > 0) { - restored_state = (mc_state_t) xbt_fifo_get_item_content(item); - if (restored_state->system_state != NULL) { - break; - } else { - item = xbt_fifo_get_next_item(item); - pos--; - } - } - MC_restore_snapshot(restored_state->system_state); - xbt_fifo_unshift(mc_stack, state); - MC_SET_STD_HEAP; - MC_replay(mc_stack, pos); - } - } else { - xbt_fifo_unshift(mc_stack, state); - MC_SET_STD_HEAP; - MC_replay(mc_stack, -1); - } - XBT_DEBUG("Back-tracking to state %d at depth %d done", state->num, - xbt_fifo_size(mc_stack)); + XBT_DEBUG("Back-tracking to state %d at depth %d", state->num, xbt_fifo_size(mc_stack) + 1); + xbt_fifo_unshift(mc_stack, state); + MC_replay(mc_stack); + XBT_DEBUG("Back-tracking to state %d at depth %d done", state->num, xbt_fifo_size(mc_stack)); break; } else { - XBT_DEBUG("Delete state %d at depth %d", state->num, - xbt_fifo_size(mc_stack) + 1); - MC_state_delete(state); + XBT_DEBUG("Delete state %d at depth %d", state->num, xbt_fifo_size(mc_stack) + 1); + MC_state_delete(state, !state->in_visited_states ? 1 : 0); } } MC_SET_STD_HEAP; diff --git a/src/mc/mc_safety.h b/src/mc/mc_safety.h new file mode 100644 index 0000000000..183ebac313 --- /dev/null +++ b/src/mc/mc_safety.h @@ -0,0 +1,45 @@ +/* Copyright (c) 2007-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef MC_SAFETY_H +#define MC_SAFETY_H + +#include + +#include +#include +#include "mc_interface.h" +#include "mc_state.h" + +SG_BEGIN_DECL() + +typedef enum { + e_mc_reduce_unset, + e_mc_reduce_none, + e_mc_reduce_dpor +} e_mc_reduce_t; + +extern e_mc_reduce_t mc_reduce_kind; + +void MC_pre_modelcheck_safety(void); +void MC_modelcheck_safety(void); + +typedef struct s_mc_visited_state{ + mc_snapshot_t system_state; + size_t heap_bytes_used; + int nb_processes; + int num; + int other_num; // dot_output for +}s_mc_visited_state_t, *mc_visited_state_t; + +extern xbt_dynar_t visited_states; +mc_visited_state_t is_visited_state(mc_state_t graph_state); +void visited_state_free(mc_visited_state_t state); +void visited_state_free_voidp(void *s); + +SG_END_DECL() + +#endif diff --git a/src/mc/mc_snapshot.c b/src/mc/mc_snapshot.c index bc1b5535d1..97c4017b0e 100644 --- a/src/mc/mc_snapshot.c +++ b/src/mc/mc_snapshot.c @@ -9,6 +9,7 @@ #include "internal_config.h" #include "smpi/private.h" +#include "mc_snapshot.h" #include "mc_private.h" #include "mc_mmu.h" #include "mc_page_store.h" @@ -172,6 +173,8 @@ int mc_snapshot_memcmp( #include #include "mc/mc_private.h" +#include "mc/mc_snapshot.h" +#include "mc/mc_mmu.h" XBT_TEST_SUITE("mc_snapshot", "Snapshots"); @@ -281,4 +284,3 @@ static void test_snapshot(bool sparse_checkpoint) { } #endif /* SIMGRID_TEST */ - diff --git a/src/mc/mc_snapshot.h b/src/mc/mc_snapshot.h new file mode 100644 index 0000000000..1d0f9b0937 --- /dev/null +++ b/src/mc/mc_snapshot.h @@ -0,0 +1,320 @@ +/* Copyright (c) 2007-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef MC_SNAPSHOT_H +#define MC_SNAPSHOT_H + +#include // off_t +#include // size_t + +#include +#include "../xbt/mmalloc/mmprivate.h" +#include +#include + +#include "mc_forward.h" +#include "mc_model_checker.h" +#include "mc_page_store.h" +#include "mc_mmalloc.h" + +SG_BEGIN_DECL() + +void mc_softdirty_reset(void); + +// ***** Snapshot region + +#define NB_REGIONS 3 /* binary data (data + BSS) (type = 2), libsimgrid data (data + BSS) (type = 1), std_heap (type = 0)*/ + +/** @brief Copy/snapshot of a given memory region + * + * Two types of region snapshots exist: + *
        + *
      • flat/dense snapshots are a simple copy of the region;
      • + *
      • sparse/per-page snapshots are snaapshots which shared + * identical pages.
      • + *
      + */ +typedef struct s_mc_mem_region{ + /** @brief Virtual address of the region in the simulated process */ + void *start_addr; + + /** @brief Permanent virtual address of the region + * + * This is usually the same address as the simuilated process address. + * However, when using SMPI privatization of global variables, + * each SMPI process has its own set of global variables stored + * at a different virtual address. The scheduler maps those region + * on the region of the global variables. + * + * */ + void *permanent_addr; + + /** @brief Copy of the snapshot for flat snapshots regions (NULL otherwise) */ + void *data; + + /** @brief Size of the data region in bytes */ + size_t size; + + /** @brief Pages indices in the page store for per-page snapshots (NULL otherwise) */ + size_t* page_numbers; + +} s_mc_mem_region_t, *mc_mem_region_t; + +mc_mem_region_t mc_region_new_sparse(int type, void *start_addr, void* data_addr, size_t size, mc_mem_region_t ref_reg); +void MC_region_destroy(mc_mem_region_t reg); +void mc_region_restore_sparse(mc_mem_region_t reg, mc_mem_region_t ref_reg); + +static inline __attribute__ ((always_inline)) +bool mc_region_contain(mc_mem_region_t region, void* p) +{ + return p >= region->start_addr && + p < (void*)((char*) region->start_addr + region->size); +} + +static inline __attribute__((always_inline)) +void* mc_translate_address_region(uintptr_t addr, mc_mem_region_t region) +{ + size_t pageno = mc_page_number(region->start_addr, (void*) addr); + size_t snapshot_pageno = region->page_numbers[pageno]; + const void* snapshot_page = mc_page_store_get_page(mc_model_checker->pages, snapshot_pageno); + return (char*) snapshot_page + mc_page_offset((void*) addr); +} + +mc_mem_region_t mc_get_snapshot_region(void* addr, mc_snapshot_t snapshot, int process_index); + +/** \brief Translate a pointer from process address space to snapshot address space + * + * The address space contains snapshot of the main/application memory: + * this function finds the address in a given snaphot for a given + * real/application address. + * + * For read only memory regions and other regions which are not int the + * snapshot, the address is not changed. + * + * \param addr Application address + * \param snapshot The snapshot of interest (if NULL no translation is done) + * \return Translated address in the snapshot address space + * */ +static inline __attribute__((always_inline)) +void* mc_translate_address(uintptr_t addr, mc_snapshot_t snapshot, int process_index) +{ + + // If not in a process state/clone: + if (!snapshot) { + return (uintptr_t *) addr; + } + + mc_mem_region_t region = mc_get_snapshot_region((void*) addr, snapshot, process_index); + + xbt_assert(mc_region_contain(region, (void*) addr), "Trying to read out of the region boundary."); + + if (!region) { + return (void *) addr; + } + + // Flat snapshot: + else if (region->data) { + uintptr_t offset = addr - (uintptr_t) region->start_addr; + return (void *) ((uintptr_t) region->data + offset); + } + + // Per-page snapshot: + else if (region->page_numbers) { + return mc_translate_address_region(addr, region); + } + + else { + xbt_die("No data for this memory region"); + } +} + +// ***** MC Snapshot + +/** Ignored data + * + * Some parts of the snapshot are ignored by zeroing them out: the real + * values is stored here. + * */ +typedef struct s_mc_snapshot_ignored_data { + void* start; + size_t size; + void* data; +} s_mc_snapshot_ignored_data_t, *mc_snapshot_ignored_data_t; + +typedef struct s_fd_infos{ + char *filename; + int number; + off_t current_position; + int flags; +}s_fd_infos_t, *fd_infos_t; + +struct s_mc_snapshot{ + size_t heap_bytes_used; + mc_mem_region_t regions[NB_REGIONS]; + xbt_dynar_t enabled_processes; + mc_mem_region_t* privatization_regions; + int privatization_index; + size_t *stack_sizes; + xbt_dynar_t stacks; + xbt_dynar_t to_ignore; + uint64_t hash; + xbt_dynar_t ignored_data; + int total_fd; + fd_infos_t *current_fd; +}; + +/** @brief Process index used when no process is available + * + * The expected behaviour is that if a process index is needed it will fail. + * */ +#define MC_NO_PROCESS_INDEX -1 + +/** @brief Process index when any process is suitable + * + * We could use a special negative value in the future. + */ +#define MC_ANY_PROCESS_INDEX 0 + +static inline __attribute__ ((always_inline)) +mc_mem_region_t mc_get_region_hinted(void* addr, mc_snapshot_t snapshot, int process_index, mc_mem_region_t region) +{ + if (mc_region_contain(region, addr)) + return region; + else + return mc_get_snapshot_region(addr, snapshot, process_index); +} + +/** Information about a given stack frame + * + */ +typedef struct s_mc_stack_frame { + /** Instruction pointer */ + unw_word_t ip; + /** Stack pointer */ + unw_word_t sp; + unw_word_t frame_base; + dw_frame_t frame; + char* frame_name; + unw_cursor_t unw_cursor; +} s_mc_stack_frame_t, *mc_stack_frame_t; + +typedef struct s_mc_snapshot_stack{ + xbt_dynar_t local_variables; + xbt_dynar_t stack_frames; // mc_stack_frame_t + int process_index; +}s_mc_snapshot_stack_t, *mc_snapshot_stack_t; + +typedef struct s_mc_global_t{ + mc_snapshot_t snapshot; + int raw_mem_set; + int prev_pair; + char *prev_req; + int initial_communications_pattern_done; + int comm_deterministic; + int send_deterministic; +}s_mc_global_t, *mc_global_t; + +typedef struct s_mc_checkpoint_ignore_region{ + void *addr; + size_t size; +}s_mc_checkpoint_ignore_region_t, *mc_checkpoint_ignore_region_t; + +static void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot); + +mc_snapshot_t MC_take_snapshot(int num_state); +void MC_restore_snapshot(mc_snapshot_t); +void MC_free_snapshot(mc_snapshot_t); + +int mc_important_snapshot(mc_snapshot_t snapshot); + +size_t* mc_take_page_snapshot_region(void* data, size_t page_count, uint64_t* pagemap, size_t* reference_pages); +void mc_free_page_snapshot_region(size_t* pagenos, size_t page_count); +void mc_restore_page_snapshot_region(void* start_addr, size_t page_count, size_t* pagenos, uint64_t* pagemap, size_t* reference_pagenos); + +static inline __attribute__((always_inline)) +bool mc_snapshot_region_linear(mc_mem_region_t region) { + return !region || !region->data; +} + +void* mc_snapshot_read_fragmented(void* addr, mc_mem_region_t region, void* target, size_t size); + +void* mc_snapshot_read(void* addr, mc_snapshot_t snapshot, int process_index, void* target, size_t size); +int mc_snapshot_region_memcmp( + void* addr1, mc_mem_region_t region1, + void* addr2, mc_mem_region_t region2, size_t size); +int mc_snapshot_memcmp( + void* addr1, mc_snapshot_t snapshot1, + void* addr2, mc_snapshot_t snapshot2, int process_index, size_t size); + +static void* mc_snapshot_read_pointer(void* addr, mc_snapshot_t snapshot, int process_index); + +static inline __attribute__ ((always_inline)) +void* mc_snapshot_read_pointer(void* addr, mc_snapshot_t snapshot, int process_index) +{ + void* res; + return *(void**) mc_snapshot_read(addr, snapshot, process_index, &res, sizeof(void*)); +} + +static inline __attribute__ ((always_inline)) + void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot) { + if(snapshot==NULL) + xbt_die("snapshot is NULL"); + void** addr = &(std_heap->breakval); + return mc_snapshot_read_pointer(addr, snapshot, MC_ANY_PROCESS_INDEX); +} + +/** @brief Read memory from a snapshot region + * + * @param addr Process (non-snapshot) address of the data + * @param region Snapshot memory region where the data is located + * @param target Buffer to store the value + * @param size Size of the data to read in bytes + * @return Pointer where the data is located (target buffer of original location) + */ +static inline __attribute__((always_inline)) +void* mc_snapshot_read_region(void* addr, mc_mem_region_t region, void* target, size_t size) +{ + if (region==NULL) + return addr; + + uintptr_t offset = (char*) addr - (char*) region->start_addr; + + xbt_assert(mc_region_contain(region, addr), + "Trying to read out of the region boundary."); + + // Linear memory region: + if (region->data) { + return (char*) region->data + offset; + } + + // Fragmented memory region: + else if (region->page_numbers) { + // Last byte of the region: + void* end = (char*) addr + size - 1; + if( mc_same_page(addr, end) ) { + // The memory is contained in a single page: + return mc_translate_address_region((uintptr_t) addr, region); + } else { + // The memory spans several pages: + return mc_snapshot_read_fragmented(addr, region, target, size); + } + } + + else { + xbt_die("No data available for this region"); + } +} + +static inline __attribute__ ((always_inline)) +void* mc_snapshot_read_pointer_region(void* addr, mc_mem_region_t region) +{ + void* res; + return *(void**) mc_snapshot_read_region(addr, region, &res, sizeof(void*)); +} + +SG_END_DECL() + +#endif diff --git a/src/mc/mc_state.c b/src/mc/mc_state.c index d48d10cd4d..84db3e8ec3 100644 --- a/src/mc/mc_state.c +++ b/src/mc/mc_state.c @@ -6,7 +6,55 @@ #include "../simix/smx_private.h" #include "xbt/fifo.h" +#include "mc_state.h" +#include "mc_request.h" #include "mc_private.h" +#include "mc_comm_pattern.h" + +static void copy_incomplete_communications_pattern(mc_state_t state) { + int i; + xbt_dynar_t incomplete_process_comms; + mc_comm_pattern_t comm; + unsigned int cursor; + state->incomplete_comm_pattern = xbt_dynar_new(sizeof(xbt_dynar_t), xbt_dynar_free_voidp); + for (i=0; iindex = comm->index; + copy_comm->type = comm->type; + copy_comm->comm = comm->comm; + copy_comm->rdv = strdup(comm->rdv); + copy_comm->data_size = -1; + copy_comm->data = NULL; + if(comm->type == SIMIX_COMM_SEND){ + copy_comm->src_proc = comm->src_proc; + copy_comm->src_host = comm->src_host; + if (comm->data != NULL) { + copy_comm->data_size = comm->data_size; + copy_comm->data = xbt_malloc0(comm->data_size); + memcpy(copy_comm->data, comm->data, comm->data_size); + } + }else{ + copy_comm->dst_proc = comm->dst_proc; + copy_comm->dst_host = comm->dst_host; + } + xbt_dynar_push(incomplete_process_comms_copy, ©_comm); + } + xbt_dynar_insert_at(state->incomplete_comm_pattern, i, &incomplete_process_comms_copy); + } +} + +static void copy_index_communications_pattern(mc_state_t state) { + + state->index_comm = xbt_dynar_new(sizeof(unsigned int), NULL); + mc_list_comm_pattern_t list_process_comm; + unsigned int cursor; + xbt_dynar_foreach(initial_communications_pattern, cursor, list_process_comm){ + xbt_dynar_push_as(state->index_comm, unsigned int, list_process_comm->index_comm); + } +} /** * \brief Creates a state data structure used by the exploration algorithm @@ -20,7 +68,16 @@ mc_state_t MC_state_new() state->proc_status = xbt_new0(s_mc_procstate_t, state->max_pid); state->system_state = NULL; state->num = ++mc_stats->expanded_states; - + state->in_visited_states = 0; + state->incomplete_comm_pattern = NULL; + /* Stateful model checking */ + if(_sg_mc_checkpoint > 0 && mc_stats->expanded_states % _sg_mc_checkpoint == 0){ + state->system_state = MC_take_snapshot(state->num); + if(_sg_mc_comms_determinism || _sg_mc_send_determinism){ + copy_incomplete_communications_pattern(state); + copy_index_communications_pattern(state); + } + } return state; } @@ -28,10 +85,14 @@ mc_state_t MC_state_new() * \brief Deletes a state data structure * \param trans The state to be deleted */ -void MC_state_delete(mc_state_t state) -{ - if (state->system_state) +void MC_state_delete(mc_state_t state, int free_snapshot){ + if (state->system_state && free_snapshot){ MC_free_snapshot(state->system_state); + } + if(_sg_mc_comms_determinism || _sg_mc_send_determinism){ + xbt_free(state->index_comm); + xbt_free(state->incomplete_comm_pattern); + } xbt_free(state->proc_status); xbt_free(state); } @@ -83,7 +144,7 @@ void MC_state_set_executed_request(mc_state_t state, smx_simcall_t req, state->internal_req.issuer = req->issuer; state->internal_comm = *xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), value, - smx_action_t); + smx_synchro_t); simcall_comm_wait__set__comm(&state->internal_req, &state->internal_comm); simcall_comm_wait__set__timeout(&state->internal_req, 0); break; @@ -95,7 +156,7 @@ void MC_state_set_executed_request(mc_state_t state, smx_simcall_t req, if (value > 0) state->internal_comm = *xbt_dynar_get_as(simcall_comm_testany__get__comms(req), value, - smx_action_t); + smx_synchro_t); simcall_comm_test__set__comm(&state->internal_req, &state->internal_comm); simcall_comm_test__set__result(&state->internal_req, value); @@ -150,7 +211,7 @@ smx_simcall_t MC_state_get_request(mc_state_t state, int *value) smx_process_t process = NULL; mc_procstate_t procstate = NULL; unsigned int start_count; - smx_action_t act = NULL; + smx_synchro_t act = NULL; xbt_swag_foreach(process, simix_global->process_list) { procstate = &state->proc_status[process->pid]; diff --git a/src/mc/mc_state.h b/src/mc/mc_state.h new file mode 100644 index 0000000000..863a21a09f --- /dev/null +++ b/src/mc/mc_state.h @@ -0,0 +1,67 @@ +/* Copyright (c) 2007-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef MC_STATE_H +#define MC_STATE_H + +#include +#include "../simix/smx_private.h" +#include "mc_snapshot.h" + +SG_BEGIN_DECL() + +extern mc_global_t initial_global_state; + +/* Possible exploration status of a process in a state */ +typedef enum { + MC_NOT_INTERLEAVE=0, /* Do not interleave (do not execute) */ + MC_INTERLEAVE, /* Interleave the process (one or more request) */ + MC_MORE_INTERLEAVE, /* Interleave twice the process (for mc_random simcall) */ + MC_DONE /* Already interleaved */ +} e_mc_process_state_t; + +/* On every state, each process has an entry of the following type */ +typedef struct mc_procstate{ + e_mc_process_state_t state; /* Exploration control information */ + unsigned int interleave_count; /* Number of times that the process was + interleaved */ +} s_mc_procstate_t, *mc_procstate_t; + +/* An exploration state. + * + * The `executed_state` is sometimes transformed into another `internal_req`. + * For example WAITANY is transformes into a WAIT and TESTANY into TEST. + * See `MC_state_set_executed_request()`. + */ +typedef struct mc_state { + unsigned long max_pid; /* Maximum pid at state's creation time */ + mc_procstate_t proc_status; /* State's exploration status by process */ + s_smx_synchro_t internal_comm; /* To be referenced by the internal_req */ + s_smx_simcall_t internal_req; /* Internal translation of request */ + s_smx_simcall_t executed_req; /* The executed request of the state */ + int req_num; /* The request number (in the case of a + multi-request like waitany ) */ + mc_snapshot_t system_state; /* Snapshot of system state */ + int num; + int in_visited_states; + xbt_dynar_t incomplete_comm_pattern; // comm determinism verification + xbt_dynar_t index_comm; // comm determinism verification +} s_mc_state_t, *mc_state_t; + +mc_state_t MC_state_new(void); +void MC_state_delete(mc_state_t state, int free_snapshot); +void MC_state_interleave_process(mc_state_t state, smx_process_t process); +unsigned int MC_state_interleave_size(mc_state_t state); +int MC_state_process_is_done(mc_state_t state, smx_process_t process); +void MC_state_set_executed_request(mc_state_t state, smx_simcall_t req, int value); +smx_simcall_t MC_state_get_executed_request(mc_state_t state, int *value); +smx_simcall_t MC_state_get_internal_request(mc_state_t state); +smx_simcall_t MC_state_get_request(mc_state_t state, int *value); +void MC_state_remove_interleave_process(mc_state_t state, smx_process_t process); + +SG_END_DECL() + +#endif diff --git a/src/mc/mc_visited.c b/src/mc/mc_visited.c index ac7c56b3c4..f792c80b1e 100644 --- a/src/mc/mc_visited.c +++ b/src/mc/mc_visited.c @@ -4,20 +4,38 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "mc_private.h" #include #include +#include "mc_comm_pattern.h" +#include "mc_safety.h" +#include "mc_liveness.h" +#include "mc_private.h" + XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_visited, mc, "Logging specific to state equaity detection mechanisms"); xbt_dynar_t visited_pairs; xbt_dynar_t visited_states; +static int is_exploration_stack_state(mc_visited_state_t state){ + xbt_fifo_item_t item = xbt_fifo_get_first_item(mc_stack); + while (item) { + if (((mc_state_t)xbt_fifo_get_item_content(item))->num == state->num){ + ((mc_state_t)xbt_fifo_get_item_content(item))->in_visited_states = 0; + return 1; + } + item = xbt_fifo_get_next_item(item); + } + return 0; +} + void visited_state_free(mc_visited_state_t state) { if (state) { - MC_free_snapshot(state->system_state); + if(!is_exploration_stack_state(state)){ + MC_free_snapshot(state->system_state); + } xbt_free(state); } } @@ -43,15 +61,13 @@ static mc_visited_state_t visited_state_new() return new_state; } - -mc_visited_pair_t MC_visited_pair_new(int pair_num, - xbt_automaton_state_t automaton_state, - xbt_dynar_t atomic_propositions) +mc_visited_pair_t MC_visited_pair_new(int pair_num, xbt_automaton_state_t automaton_state, xbt_dynar_t atomic_propositions, mc_state_t graph_state) { mc_visited_pair_t pair = NULL; pair = xbt_new0(s_mc_visited_pair_t, 1); - pair->graph_state = MC_state_new(); - pair->graph_state->system_state = MC_take_snapshot(pair_num); + pair->graph_state = graph_state; + if(pair->graph_state->system_state == NULL) + pair->graph_state->system_state = MC_take_snapshot(pair_num); pair->heap_bytes_used = mmalloc_get_bytes_used(std_heap); pair->nb_processes = xbt_swag_size(simix_global->process_list); pair->automaton_state = automaton_state; @@ -68,10 +84,23 @@ mc_visited_pair_t MC_visited_pair_new(int pair_num, return pair; } +static int is_exploration_stack_pair(mc_visited_pair_t pair){ + xbt_fifo_item_t item = xbt_fifo_get_first_item(mc_stack); + while (item) { + if (((mc_pair_t)xbt_fifo_get_item_content(item))->num == pair->num){ + ((mc_pair_t)xbt_fifo_get_item_content(item))->visited_pair_removed = 1; + return 1; + } + item = xbt_fifo_get_next_item(item); + } + return 0; +} + void MC_visited_pair_delete(mc_visited_pair_t p) { p->automaton_state = NULL; - MC_state_delete(p->graph_state); + if( !is_exploration_stack_pair(p)) + MC_state_delete(p->graph_state, 1); xbt_dynar_free(&(p->atomic_propositions)); xbt_free(p); p = NULL; @@ -118,14 +147,11 @@ int get_search_interval(xbt_dynar_t list, void *ref, int *min, int *max) while (start <= end) { cursor = (start + end) / 2; if (_sg_mc_liveness) { - ref_test = - (mc_visited_pair_t) xbt_dynar_get_as(list, cursor, mc_visited_pair_t); + ref_test = (mc_visited_pair_t) xbt_dynar_get_as(list, cursor, mc_visited_pair_t); nb_processes_test = ((mc_visited_pair_t) ref_test)->nb_processes; heap_bytes_used_test = ((mc_visited_pair_t) ref_test)->heap_bytes_used; } else { - ref_test = - (mc_visited_state_t) xbt_dynar_get_as(list, cursor, - mc_visited_state_t); + ref_test = (mc_visited_state_t) xbt_dynar_get_as(list, cursor, mc_visited_state_t); nb_processes_test = ((mc_visited_state_t) ref_test)->nb_processes; heap_bytes_used_test = ((mc_visited_state_t) ref_test)->heap_bytes_used; } @@ -143,22 +169,15 @@ int get_search_interval(xbt_dynar_t list, void *ref, int *min, int *max) previous_cursor = cursor - 1; while (previous_cursor >= 0) { if (_sg_mc_liveness) { - ref_test = - (mc_visited_pair_t) xbt_dynar_get_as(list, previous_cursor, - mc_visited_pair_t); + ref_test = (mc_visited_pair_t) xbt_dynar_get_as(list, previous_cursor, mc_visited_pair_t); nb_processes_test = ((mc_visited_pair_t) ref_test)->nb_processes; - heap_bytes_used_test = - ((mc_visited_pair_t) ref_test)->heap_bytes_used; + heap_bytes_used_test = ((mc_visited_pair_t) ref_test)->heap_bytes_used; } else { - ref_test = - (mc_visited_state_t) xbt_dynar_get_as(list, previous_cursor, - mc_visited_state_t); + ref_test = (mc_visited_state_t) xbt_dynar_get_as(list, previous_cursor, mc_visited_state_t); nb_processes_test = ((mc_visited_state_t) ref_test)->nb_processes; - heap_bytes_used_test = - ((mc_visited_state_t) ref_test)->heap_bytes_used; + heap_bytes_used_test = ((mc_visited_state_t) ref_test)->heap_bytes_used; } - if (nb_processes_test != nb_processes - || heap_bytes_used_test != heap_bytes_used) + if (nb_processes_test != nb_processes || heap_bytes_used_test != heap_bytes_used) break; *min = previous_cursor; previous_cursor--; @@ -166,22 +185,15 @@ int get_search_interval(xbt_dynar_t list, void *ref, int *min, int *max) next_cursor = cursor + 1; while (next_cursor < xbt_dynar_length(list)) { if (_sg_mc_liveness) { - ref_test = - (mc_visited_pair_t) xbt_dynar_get_as(list, next_cursor, - mc_visited_pair_t); + ref_test = (mc_visited_pair_t) xbt_dynar_get_as(list, next_cursor, mc_visited_pair_t); nb_processes_test = ((mc_visited_pair_t) ref_test)->nb_processes; - heap_bytes_used_test = - ((mc_visited_pair_t) ref_test)->heap_bytes_used; + heap_bytes_used_test = ((mc_visited_pair_t) ref_test)->heap_bytes_used; } else { - ref_test = - (mc_visited_state_t) xbt_dynar_get_as(list, next_cursor, - mc_visited_state_t); + ref_test = (mc_visited_state_t) xbt_dynar_get_as(list, next_cursor, mc_visited_state_t); nb_processes_test = ((mc_visited_state_t) ref_test)->nb_processes; - heap_bytes_used_test = - ((mc_visited_state_t) ref_test)->heap_bytes_used; + heap_bytes_used_test = ((mc_visited_state_t) ref_test)->heap_bytes_used; } - if (nb_processes_test != nb_processes - || heap_bytes_used_test != heap_bytes_used) + if (nb_processes_test != nb_processes || heap_bytes_used_test != heap_bytes_used) break; *max = next_cursor; next_cursor++; @@ -204,20 +216,25 @@ int get_search_interval(xbt_dynar_t list, void *ref, int *min, int *max) * \brief Checks whether a given state has already been visited by the algorithm. */ -mc_visited_state_t is_visited_state() +mc_visited_state_t is_visited_state(mc_state_t graph_state) { if (_sg_mc_visited == 0) return NULL; + int partial_comm = 0; + /* If comm determinism verification, we cannot stop the exploration if some communications are not finished (at least, data are transfered). These communications - are incomplete and they cannot be analyzed and compared with the initial pattern */ + are incomplete and they cannot be analyzed and compared with the initial pattern. */ if (_sg_mc_comms_determinism || _sg_mc_send_determinism) { int current_process = 1; while (current_process < simix_process_maxpid) { - if (!xbt_dynar_is_empty((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, current_process, xbt_dynar_t))) - return NULL; + if (!xbt_dynar_is_empty((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, current_process, xbt_dynar_t))){ + XBT_DEBUG("Some communications are not finished, cannot stop the exploration ! State not visited."); + partial_comm = 1; + break; + } current_process++; } } @@ -227,6 +244,9 @@ mc_visited_state_t is_visited_state() MC_SET_MC_HEAP; mc_visited_state_t new_state = visited_state_new(); + graph_state->system_state = new_state->system_state; + graph_state->in_visited_states = 1; + XBT_DEBUG("Snapshot %p of visited state %d (exploration stack state %d)", new_state->system_state, new_state->num, graph_state->num); if (xbt_dynar_is_empty(visited_states)) { @@ -267,48 +287,45 @@ mc_visited_state_t is_visited_state() return new_state->other_num; } */ - cursor = min; - while (cursor <= max) { - state_test = - (mc_visited_state_t) xbt_dynar_get_as(visited_states, cursor, - mc_visited_state_t); - if (snapshot_compare(state_test, new_state) == 0) { - // The state has been visited: - - if (state_test->other_num == -1) - new_state->other_num = state_test->num; - else - new_state->other_num = state_test->other_num; - if (dot_output == NULL) - XBT_DEBUG("State %d already visited ! (equal to state %d)", - new_state->num, state_test->num); - else - XBT_DEBUG - ("State %d already visited ! (equal to state %d (state %d in dot_output))", - new_state->num, state_test->num, new_state->other_num); - - /* Replace the old state with the new one (with a bigger num) - (when the max number of visited states is reached, the oldest - one is removed according to its number (= with the min number) */ - xbt_dynar_remove_at(visited_states, cursor, NULL); - xbt_dynar_insert_at(visited_states, cursor, &new_state); - - if (!mc_mem_set) - MC_SET_STD_HEAP; - return state_test; + if(!partial_comm && initial_global_state->initial_communications_pattern_done){ + + cursor = min; + while (cursor <= max) { + state_test = (mc_visited_state_t) xbt_dynar_get_as(visited_states, cursor, mc_visited_state_t); + if (snapshot_compare(state_test, new_state) == 0) { + // The state has been visited: + + if (state_test->other_num == -1) + new_state->other_num = state_test->num; + else + new_state->other_num = state_test->other_num; + if (dot_output == NULL) + XBT_DEBUG("State %d already visited ! (equal to state %d)", new_state->num, state_test->num); + else + XBT_DEBUG("State %d already visited ! (equal to state %d (state %d in dot_output))", new_state->num, state_test->num, new_state->other_num); + + /* Replace the old state with the new one (with a bigger num) + (when the max number of visited states is reached, the oldest + one is removed according to its number (= with the min number) */ + xbt_dynar_remove_at(visited_states, cursor, NULL); + xbt_dynar_insert_at(visited_states, cursor, &new_state); + XBT_DEBUG("Replace visited state %d with the new visited state %d", state_test->num, new_state->num); + + if (!mc_mem_set) + MC_SET_STD_HEAP; + return state_test; + } + cursor++; } - cursor++; } - - // The state has not been visited: insert the state in the dynamic array. + xbt_dynar_insert_at(visited_states, min, &new_state); - + XBT_DEBUG("Insert new visited state %d (total : %lu)", new_state->num, xbt_dynar_length(visited_states)); + } else { // The state has not been visited: insert the state in the dynamic array. - state_test = - (mc_visited_state_t) xbt_dynar_get_as(visited_states, index, - mc_visited_state_t); + state_test = (mc_visited_state_t) xbt_dynar_get_as(visited_states, index, mc_visited_state_t); if (state_test->nb_processes < new_state->nb_processes) { xbt_dynar_insert_at(visited_states, index + 1, &new_state); } else { @@ -318,11 +335,15 @@ mc_visited_state_t is_visited_state() xbt_dynar_insert_at(visited_states, index, &new_state); } + XBT_DEBUG("Insert new visited state %d (total : %lu)", new_state->num, xbt_dynar_length(visited_states)); + } // We have reached the maximum number of stored states; if (xbt_dynar_length(visited_states) > _sg_mc_visited) { + XBT_DEBUG("Try to remove visited state (maximum number of stored states reached)"); + // Find the (index of the) older state (with the smallest num): int min2 = mc_stats->expanded_states; unsigned int cursor2 = 0; @@ -336,6 +357,7 @@ mc_visited_state_t is_visited_state() // and drop it: xbt_dynar_remove_at(visited_states, index2, NULL); + XBT_DEBUG("Remove visited state (maximum number of stored states reached)"); } if (!mc_mem_set) @@ -349,10 +371,7 @@ mc_visited_state_t is_visited_state() /** * \brief Checks whether a given pair has already been visited by the algorithm. */ -int is_visited_pair(mc_visited_pair_t pair, int pair_num, - xbt_automaton_state_t automaton_state, - xbt_dynar_t atomic_propositions) -{ +int is_visited_pair(mc_visited_pair_t visited_pair, mc_pair_t pair) { if (_sg_mc_visited == 0) return -1; @@ -361,18 +380,17 @@ int is_visited_pair(mc_visited_pair_t pair, int pair_num, MC_SET_MC_HEAP; - mc_visited_pair_t new_pair = NULL; + mc_visited_pair_t new_visited_pair = NULL; - if (pair == NULL) { - new_pair = - MC_visited_pair_new(pair_num, automaton_state, atomic_propositions); + if (visited_pair == NULL) { + new_visited_pair = MC_visited_pair_new(pair->num, pair->automaton_state, pair->atomic_propositions, pair->graph_state); } else { - new_pair = pair; + new_visited_pair = visited_pair; } if (xbt_dynar_is_empty(visited_pairs)) { - xbt_dynar_push(visited_pairs, &new_pair); + xbt_dynar_push(visited_pairs, &new_visited_pair); } else { @@ -381,7 +399,7 @@ int is_visited_pair(mc_visited_pair_t pair, int pair_num, mc_visited_pair_t pair_test; int cursor; - index = get_search_interval(visited_pairs, new_pair, &min, &max); + index = get_search_interval(visited_pairs, new_visited_pair, &min, &max); if (min != -1 && max != -1) { // Visited pair with same number of processes and same heap bytes used exists /*res = xbt_parmap_mc_apply(parmap, snapshot_compare, xbt_dynar_get_ptr(visited_pairs, min), (max-min)+1, pair); @@ -413,28 +431,20 @@ int is_visited_pair(mc_visited_pair_t pair, int pair_num, } */ cursor = min; while (cursor <= max) { - pair_test = - (mc_visited_pair_t) xbt_dynar_get_as(visited_pairs, cursor, - mc_visited_pair_t); - if (xbt_automaton_state_compare - (pair_test->automaton_state, new_pair->automaton_state) == 0) { - if (xbt_automaton_propositional_symbols_compare_value - (pair_test->atomic_propositions, - new_pair->atomic_propositions) == 0) { - if (snapshot_compare(pair_test, new_pair) == 0) { + pair_test = (mc_visited_pair_t) xbt_dynar_get_as(visited_pairs, cursor, mc_visited_pair_t); + if (xbt_automaton_state_compare(pair_test->automaton_state, new_visited_pair->automaton_state) == 0) { + if (xbt_automaton_propositional_symbols_compare_value(pair_test->atomic_propositions, new_visited_pair->atomic_propositions) == 0) { + if (snapshot_compare(pair_test, new_visited_pair) == 0) { if (pair_test->other_num == -1) - new_pair->other_num = pair_test->num; + new_visited_pair->other_num = pair_test->num; else - new_pair->other_num = pair_test->other_num; + new_visited_pair->other_num = pair_test->other_num; if (dot_output == NULL) - XBT_DEBUG("Pair %d already visited ! (equal to pair %d)", - new_pair->num, pair_test->num); + XBT_DEBUG("Pair %d already visited ! (equal to pair %d)", new_visited_pair->num, pair_test->num); else - XBT_DEBUG - ("Pair %d already visited ! (equal to pair %d (pair %d in dot_output))", - new_pair->num, pair_test->num, new_pair->other_num); - xbt_dynar_remove_at(visited_pairs, cursor, NULL); - xbt_dynar_insert_at(visited_pairs, cursor, &new_pair); + XBT_DEBUG("Pair %d already visited ! (equal to pair %d (pair %d in dot_output))", new_visited_pair->num, pair_test->num, new_visited_pair->other_num); + xbt_dynar_remove_at(visited_pairs, cursor, &pair_test); + xbt_dynar_insert_at(visited_pairs, cursor, &new_visited_pair); pair_test->visited_removed = 1; if (pair_test->acceptance_pair) { if (pair_test->acceptance_removed == 1) @@ -444,24 +454,22 @@ int is_visited_pair(mc_visited_pair_t pair, int pair_num, } if (!mc_mem_set) MC_SET_STD_HEAP; - return new_pair->other_num; + return new_visited_pair->other_num; } } } cursor++; } - xbt_dynar_insert_at(visited_pairs, min, &new_pair); + xbt_dynar_insert_at(visited_pairs, min, &new_visited_pair); } else { - pair_test = - (mc_visited_pair_t) xbt_dynar_get_as(visited_pairs, index, - mc_visited_pair_t); - if (pair_test->nb_processes < new_pair->nb_processes) { - xbt_dynar_insert_at(visited_pairs, index + 1, &new_pair); + pair_test = (mc_visited_pair_t) xbt_dynar_get_as(visited_pairs, index, mc_visited_pair_t); + if (pair_test->nb_processes < new_visited_pair->nb_processes) { + xbt_dynar_insert_at(visited_pairs, index + 1, &new_visited_pair); } else { - if (pair_test->heap_bytes_used < new_pair->heap_bytes_used) - xbt_dynar_insert_at(visited_pairs, index + 1, &new_pair); + if (pair_test->heap_bytes_used < new_visited_pair->heap_bytes_used) + xbt_dynar_insert_at(visited_pairs, index + 1, &new_visited_pair); else - xbt_dynar_insert_at(visited_pairs, index, &new_pair); + xbt_dynar_insert_at(visited_pairs, index, &new_visited_pair); } } diff --git a/src/mc/memory_map.c b/src/mc/memory_map.c index e63cab775f..b867a86d6f 100644 --- a/src/mc/memory_map.c +++ b/src/mc/memory_map.c @@ -4,6 +4,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "mc_memory_map.h" #include "mc_private.h" #include diff --git a/src/msg/instr_msg_vm.c b/src/msg/instr_msg_vm.c index 3171f4d5b1..825b71b942 100644 --- a/src/msg/instr_msg_vm.c +++ b/src/msg/instr_msg_vm.c @@ -74,7 +74,7 @@ void TRACE_msg_vm_start(msg_vm_t vm) container_t vm_container = PJ_container_get (instr_vm_id(vm, str, len)); type_t type = PJ_type_get ("MSG_VM_STATE", vm_container->type); - val_t value = PJ_value_get ("start", type); + val_t value = PJ_value_get_or_new ("start", "0 0 1", type); //start is blue new_pajePushState (MSG_get_clock(), vm_container, type, value); } @@ -100,7 +100,7 @@ void TRACE_msg_vm_suspend(msg_vm_t vm) container_t vm_container = PJ_container_get (instr_vm_id(vm, str, len)); type_t type = PJ_type_get ("MSG_VM_STATE", vm_container->type); - val_t value = PJ_value_get ("suspend", type); + val_t value = PJ_value_get_or_new ("suspend", "1 0 0", type); //suspend is red new_pajePushState (MSG_get_clock(), vm_container, type, value); } } @@ -125,7 +125,7 @@ void TRACE_msg_vm_save(msg_vm_t vm) container_t vm_container = PJ_container_get (instr_vm_id(vm, str, len)); type_t type = PJ_type_get ("MSG_VM_STATE", vm_container->type); - val_t value = PJ_value_get ("save", type); + val_t value = PJ_value_get_or_new ("save", "0 1 0", type); //save is green new_pajePushState (MSG_get_clock(), vm_container, type, value); } } diff --git a/src/msg/msg_gos.c b/src/msg/msg_gos.c index 73c91df534..b36b3eb1cf 100644 --- a/src/msg/msg_gos.c +++ b/src/msg/msg_gos.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2004-2014. The SimGrid Team. +/* Copyright (c) 2004-2015. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -399,7 +399,7 @@ MSG_task_receive_ext_bounded(msg_task_t * task, const char *alias, double timeou */ static XBT_INLINE msg_comm_t MSG_task_isend_internal(msg_task_t task, const char *alias, - int (*match_fun)(void*,void*, smx_action_t), + int (*match_fun)(void*,void*, smx_synchro_t), void *match_data, void_f_pvoid_t cleanup, int detached) { @@ -436,7 +436,7 @@ msg_comm_t MSG_task_isend_internal(msg_task_t task, const char *alias, msg_global->sent_msg++; /* Send it by calling SIMIX network layer */ - smx_action_t act = simcall_comm_isend(SIMIX_process_self(), mailbox, t_simdata->message_size, + smx_synchro_t act = simcall_comm_isend(SIMIX_process_self(), mailbox, t_simdata->message_size, t_simdata->rate, task, sizeof(void *), match_fun, cleanup, NULL, match_data,detached); t_simdata->comm = act; /* FIXME: is the field t_simdata->comm still useful? */ @@ -511,13 +511,13 @@ msg_comm_t MSG_task_isend_bounded(msg_task_t task, const char *alias, * \param match_fun boolean function which parameters are: * - match_data_provided_here * - match_data_provided_by_other_side_if_any - * - the_smx_action_describing_the_other_side + * - the_smx_synchro_describing_the_other_side * \param match_data user provided data passed to match_fun * \return the msg_comm_t communication created */ msg_comm_t MSG_task_isend_with_matching(msg_task_t task, const char *alias, int (*match_fun)(void*, void*, - smx_action_t), + smx_synchro_t), void *match_data) { return MSG_task_isend_internal(task, alias, match_fun, match_data, NULL, 0); @@ -676,7 +676,7 @@ int MSG_comm_testany(xbt_dynar_t comms) int finished_index = -1; /* create the equivalent dynar with SIMIX objects */ - xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_action_t), NULL); + xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_synchro_t), NULL); msg_comm_t comm; unsigned int cursor; xbt_dynar_foreach(comms, cursor, comm) { @@ -799,7 +799,7 @@ int MSG_comm_waitany(xbt_dynar_t comms) int finished_index = -1; /* create the equivalent dynar with SIMIX objects */ - xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_action_t), NULL); + xbt_dynar_t s_comms = xbt_dynar_new(sizeof(smx_synchro_t), NULL); msg_comm_t comm; unsigned int cursor; xbt_dynar_foreach(comms, cursor, comm) { @@ -876,7 +876,7 @@ msg_task_t MSG_comm_get_task(msg_comm_t comm) * \param buff the data copied * \param buff_size size of the buffer */ -void MSG_comm_copy_data_from_SIMIX(smx_action_t comm, void* buff, size_t buff_size) { +void MSG_comm_copy_data_from_SIMIX(smx_synchro_t comm, void* buff, size_t buff_size) { // copy the task SIMIX_comm_copy_pointer_callback(comm, buff, buff_size); diff --git a/src/msg/msg_host.c b/src/msg/msg_host.c index 1f36f3b5af..14aff6cb60 100644 --- a/src/msg/msg_host.c +++ b/src/msg/msg_host.c @@ -356,7 +356,7 @@ void MSG_host_get_params(msg_host_t host, ws_params_t params) * \param pstate_index pstate to test * \return Returns the processor speed associated with pstate_index */ -double MSG_get_host_power_peak_at(msg_host_t host, int pstate_index) { +double MSG_host_get_power_peak_at(msg_host_t host, int pstate_index) { xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); return (simcall_host_get_power_peak_at(host, pstate_index)); } @@ -367,7 +367,7 @@ double MSG_get_host_power_peak_at(msg_host_t host, int pstate_index) { * \param host host to test * \return Returns the current processor speed */ -double MSG_get_host_current_power_peak(msg_host_t host) { +double MSG_host_get_current_power_peak(msg_host_t host) { xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); return simcall_host_get_current_power_peak(host); } @@ -377,7 +377,7 @@ double MSG_get_host_current_power_peak(msg_host_t host) { * * \param host host to test */ -int MSG_get_host_nb_pstates(msg_host_t host) { +int MSG_host_get_pstate_number(msg_host_t host) { xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); return (simcall_host_get_nb_pstates(host)); @@ -389,7 +389,7 @@ int MSG_get_host_nb_pstates(msg_host_t host) { * \param host host to test * \param pstate_index pstate to switch to */ -void MSG_set_host_power_peak_at(msg_host_t host, int pstate_index) { +void MSG_host_set_pstate(msg_host_t host, int pstate_index) { xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); simcall_host_set_power_peak_at(host, pstate_index); @@ -401,7 +401,7 @@ void MSG_set_host_power_peak_at(msg_host_t host, int pstate_index) { * \param host host to test * \return Returns the consumed energy */ -double MSG_get_host_consumed_energy(msg_host_t host) { +double MSG_host_get_consumed_energy(msg_host_t host) { xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); return simcall_host_get_consumed_energy(host); } diff --git a/src/msg/msg_mailbox.c b/src/msg/msg_mailbox.c index fce49537de..53f99df9df 100644 --- a/src/msg/msg_mailbox.c +++ b/src/msg/msg_mailbox.c @@ -29,7 +29,7 @@ int MSG_mailbox_is_empty(msg_mailbox_t mailbox) msg_task_t MSG_mailbox_get_head(msg_mailbox_t mailbox) { - smx_action_t comm = simcall_rdv_get_head(mailbox); + smx_synchro_t comm = simcall_rdv_get_head(mailbox); if (!comm) return NULL; @@ -206,7 +206,7 @@ MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, msg_task_t task, /* Try to send it by calling SIMIX network layer */ TRY { - smx_action_t comm = NULL; /* MC needs the comm to be set to NULL during the simix call */ + smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simix call */ comm = simcall_comm_isend(SIMIX_process_self(), mailbox,t_simdata->message_size, t_simdata->rate, task, sizeof(void *), NULL, NULL, NULL, task, 0); diff --git a/src/msg/msg_new_api.c b/src/msg/msg_new_api.c deleted file mode 100644 index 0bc6ba80e0..0000000000 --- a/src/msg/msg_new_api.c +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (c) 2004-2014. The SimGrid Team. - * All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#include "msg_private.h" -#include "xbt/log.h" - -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_new_API, msg, - "Logging specific to MSG (new_API)"); - - -/* ****************************************************************************************** */ -/* TUTORIAL: New API */ -/* All functions for the API */ -/* ****************************************************************************************** */ -int MSG_new_API_fct(const char* param1, double param2) -{ - int result = simcall_new_api_fct(param1, param2); - return result; -} diff --git a/src/msg/msg_private.h b/src/msg/msg_private.h index d461ecc824..c6c17a3598 100644 --- a/src/msg/msg_private.h +++ b/src/msg/msg_private.h @@ -39,8 +39,8 @@ SG_BEGIN_DECL() ptr = _xbt_ex_t; } while(0) typedef struct simdata_task { - smx_action_t compute; /* SIMIX modeling of computation */ - smx_action_t comm; /* SIMIX modeling of communication */ + smx_synchro_t compute; /* SIMIX modeling of computation */ + smx_synchro_t comm; /* SIMIX modeling of communication */ double message_size; /* Data size */ double computation_amount; /* Computation size */ msg_process_t sender; @@ -83,7 +83,7 @@ typedef struct simdata_process { #ifdef MSG_USE_DEPRECATED m_channel_t put_channel; /* used for debugging purposes */ #endif - smx_action_t waiting_action; + smx_synchro_t waiting_action; msg_task_t waiting_task; char **argv; /* arguments table if any */ int argc; /* arguments number if any */ @@ -103,7 +103,7 @@ typedef struct process_arg { } s_process_arg_t, *process_arg_t; typedef struct msg_comm { - smx_action_t s_comm; /* SIMIX communication object encapsulated (the same for both processes) */ + smx_synchro_t s_comm; /* SIMIX communication object encapsulated (the same for both processes) */ msg_task_t task_sent; /* task sent (NULL for the receiver) */ msg_task_t *task_received; /* where the task will be received (NULL for the sender) */ msg_error_t status; /* status of the communication once finished */ @@ -167,7 +167,7 @@ void MSG_process_create_from_SIMIX(smx_process_t *process, const char *name, int argc, char **argv, xbt_dict_t properties, int auto_restart, smx_process_t parent_process); -void MSG_comm_copy_data_from_SIMIX(smx_action_t comm, void* buff, size_t buff_size); +void MSG_comm_copy_data_from_SIMIX(smx_synchro_t comm, void* buff, size_t buff_size); void MSG_post_create_environment(void); diff --git a/src/msg/msg_process.c b/src/msg/msg_process.c index 70725e7341..927a4a982f 100644 --- a/src/msg/msg_process.c +++ b/src/msg/msg_process.c @@ -294,7 +294,7 @@ msg_host_t MSG_process_get_host(msg_process_t process) else { simdata = simcall_process_get_data(process); } - return simdata->m_host; + return simdata ? simdata->m_host : NULL; } /** \ingroup m_process_management diff --git a/src/msg/msg_task.c b/src/msg/msg_task.c index 537364d752..2488dac1ef 100644 --- a/src/msg/msg_task.c +++ b/src/msg/msg_task.c @@ -266,7 +266,7 @@ void MSG_task_set_name(msg_task_t task, const char *name) */ msg_error_t MSG_task_destroy(msg_task_t task) { - smx_action_t action = NULL; + smx_synchro_t action = NULL; xbt_assert((task != NULL), "Invalid parameter"); if (task->simdata->isused) { @@ -535,7 +535,7 @@ void MSG_task_set_affinity(msg_task_t task, msg_host_t host, unsigned long mask) } { - smx_action_t compute = task->simdata->compute; + smx_synchro_t compute = task->simdata->compute; msg_host_t host_now = compute->execution.host; // simix_private.h is necessary if (host_now != host) { /* task is not yet executed on this host */ diff --git a/src/msg/msg_vm.c b/src/msg/msg_vm.c index 64c3a49680..4d83a7d308 100644 --- a/src/msg/msg_vm.c +++ b/src/msg/msg_vm.c @@ -75,7 +75,7 @@ void MSG_vm_set_property_value(msg_vm_t vm, const char *name, void *value, void_ msg_vm_t MSG_vm_get_by_name(const char *name) { - return MSG_get_host_by_name(name); + return MSG_get_host_by_name(name); } /** \ingroup m_vm_management @@ -204,8 +204,8 @@ msg_vm_t MSG_vm_create_core(msg_host_t ind_pm, const char *name) { /* make sure the VM of the same name does not exit */ { - void *ind_host_tmp = xbt_lib_get_elm_or_null(host_lib, name); - if (ind_host_tmp) { + xbt_dictelm_t ind_host_tmp = xbt_lib_get_elm_or_null(host_lib, name); + if (ind_host_tmp && xbt_lib_get_level(ind_host_tmp, SIMIX_HOST_LEVEL) != NULL) { XBT_ERROR("host %s already exits", name); return NULL; } @@ -339,8 +339,6 @@ static inline char *get_mig_task_name(msg_vm_t vm, msg_host_t src_pm, msg_host_t return bprintf("__task_mig_stage%d:%s(%s-%s)", stage, vm_name, src_pm_name, dst_pm_name); } -static void launch_deferred_exec_process(msg_host_t host, double computation, double prio); - struct migration_session { msg_vm_t vm; @@ -365,28 +363,22 @@ static int migration_rx_fun(int argc, char *argv[]) s_ws_params_t params; simcall_host_get_params(ms->vm, ¶ms); - const double xfer_cpu_overhead = params.xfer_cpu_overhead; int need_exit = 0; char *finalize_task_name = get_mig_task_name(ms->vm, ms->src_pm, ms->dst_pm, 3); + int ret = 0; for (;;) { msg_task_t task = NULL; - MSG_task_recv(&task, ms->mbox); + ret = MSG_task_recv(&task, ms->mbox); { - double received ; - if (task) - received = MSG_task_get_data_size(task); - else{ - // An error occured, clean the code and return + if (ret != MSG_OK) { + // An error occured, clean the code and return // The owner did not change, hence the task should be only destroyed on the other side xbt_free(finalize_task_name); - return 0; + return 0; } - /* TODO: clean up */ - // const double alpha = 0.22L * 1.0E8 / (80L * 1024 * 1024); - launch_deferred_exec_process(ms->vm, received * xfer_cpu_overhead, 1); } if (strcmp(task->name, finalize_task_name) == 0) @@ -398,39 +390,61 @@ static int migration_rx_fun(int argc, char *argv[]) break; } - // Here Stage 1, 2 and 3 have been performed. + // Here Stage 1, 2 and 3 have been performed. // Hence complete the migration + // Copy the reference to the vm (if SRC crashes now, do_migration will free ms) + // This is clearly ugly but I (Adrien) need more time to do something cleaner (actually we should copy the whole ms structure at the begining and free it at the end of each function) + msg_vm_t vm = ms->vm; + msg_host_t src_pm = ms->src_pm; + msg_host_t dst_pm = ms-> dst_pm; + msg_host_priv_t priv = msg_host_resource_priv(vm); + // TODO: we have an issue, if the DST node is turning off during the three next calls, then the VM is in an inconsistent state // I should check with Takahiro in order to make this portion of code atomic /* deinstall the current affinity setting for the CPU */ - simcall_vm_set_affinity(ms->vm, ms->src_pm, 0); + simcall_vm_set_affinity(vm, src_pm, 0); /* Update the vm location */ - simcall_vm_migrate(ms->vm, ms->dst_pm); - + simcall_vm_migrate(vm, dst_pm); + /* Resume the VM */ - simcall_vm_resume(ms->vm); + simcall_vm_resume(vm); /* install the affinity setting of the VM on the destination pm */ { - msg_host_priv_t priv = msg_host_resource_priv(ms->vm); - unsigned long affinity_mask = (unsigned long) xbt_dict_get_or_null_ext(priv->affinity_mask_db, (char *) ms->dst_pm, sizeof(msg_host_t)); - simcall_vm_set_affinity(ms->vm, ms->dst_pm, affinity_mask); - XBT_INFO("set affinity(0x%04lx@%s) for %s", affinity_mask, MSG_host_get_name(ms->dst_pm), MSG_host_get_name(ms->vm)); + unsigned long affinity_mask = (unsigned long) xbt_dict_get_or_null_ext(priv->affinity_mask_db, (char *)dst_pm, sizeof(msg_host_t)); + simcall_vm_set_affinity(vm, dst_pm, affinity_mask); + XBT_DEBUG("set affinity(0x%04lx@%s) for %s", affinity_mask, MSG_host_get_name(dst_pm), MSG_host_get_name(vm)); } { - char *task_name = get_mig_task_name(ms->vm, ms->src_pm, ms->dst_pm, 4); + // Now the VM is running on the new host (the migration is completed) (even if the SRC crash) + msg_host_priv_t priv = msg_host_resource_priv(vm); + priv->is_migrating = 0; + XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", ms->vm->key, ms->src_pm->key, ms->dst_pm->key); + #ifdef HAVE_TRACING + TRACE_msg_vm_change_host(ms->vm, ms->src_pm, ms->dst_pm); + #endif + + } + // Inform the SRC that the migration has been correctly performed + { + char *task_name = get_mig_task_name(ms->vm, ms->src_pm, ms->dst_pm, 4); msg_task_t task = MSG_task_create(task_name, 0, 0, NULL); msg_error_t ret = MSG_task_send(task, ms->mbox_ctl); // xbt_assert(ret == MSG_OK); if(ret == MSG_HOST_FAILURE){ - // The SRC has crashed, this is not a problem has the VM has been correctly migrated on the DST node - MSG_task_destroy(task); + // The DST has crashed, this is a problem has the VM since we are not sure whether SRC is considering that the VM has been correctly migrated on the DST node + // TODO What does it mean ? What should we do ? + MSG_task_destroy(task); + } else if(ret == MSG_TRANSFER_FAILURE){ + // The SRC has crashed, this is not a problem has the VM has been correctly migrated on the DST node + MSG_task_destroy(task); } + xbt_free(task_name); } @@ -513,7 +527,7 @@ static double lookup_computed_flop_counts(msg_vm_t vm, int stage_for_fancy_debug xbt_dict_foreach(priv->dp_objs, cursor, key, dp) { double remaining = MSG_task_get_remaining_computation(dp->task); - double clock = MSG_get_clock(); + double clock = MSG_get_clock(); // total += calc_updated_pages(key, vm, dp, remaining, clock); total += get_computed(key, vm, dp, remaining, clock); @@ -591,256 +605,12 @@ void MSG_host_del_task(msg_host_t host, msg_task_t task) } -static int deferred_exec_fun(int argc, char *argv[]) -{ - xbt_assert(argc == 3); - const char *comp_str = argv[1]; - double computaion = atof(comp_str); - const char *prio_str = argv[2]; - double prio = atof(prio_str); - - msg_task_t task = MSG_task_create("__task_deferred", computaion, 0, NULL); - // XBT_INFO("exec deferred %f", computation); - - /* dpt is the results of the VM activity */ - MSG_task_set_priority(task, prio); - MSG_task_execute(task); - - - - MSG_task_destroy(task); - - return 0; -} - -static void launch_deferred_exec_process(msg_host_t host, double computation, double prio) -{ - char *pr_name = bprintf("__pr_deferred_exec_%s", MSG_host_get_name(host)); - - int nargvs = 4; - char **argv = xbt_new(char *, nargvs); - argv[0] = pr_name; - argv[1] = bprintf("%f", computation); - argv[2] = bprintf("%f", prio); - argv[3] = NULL; - - MSG_process_create_with_arguments(pr_name, deferred_exec_fun, NULL, host, nargvs - 1, argv); -} - - -static int task_tx_overhead_fun(int argc, char *argv[]) -{ - xbt_assert(argc == 2); - const char *mbox = argv[1]; - - int need_exit = 0; - - // XBT_INFO("start %s", mbox); - - for (;;) { - msg_task_t task = NULL; - MSG_task_recv(&task, mbox); - - // XBT_INFO("task->name %s", task->name); - - if (strcmp(task->name, "finalize_making_overhead") == 0) - need_exit = 1; - - // XBT_INFO("exec"); - // MSG_task_set_priority(task, 1000000); - MSG_task_execute(task); - MSG_task_destroy(task); - - if (need_exit) - break; - } - - // XBT_INFO("bye"); - - return 0; -} - -static void start_overhead_process(msg_task_t comm_task) -{ - char *pr_name = bprintf("__pr_task_tx_overhead_%s", MSG_task_get_name(comm_task)); - char *mbox = bprintf("__mb_task_tx_overhead_%s", MSG_task_get_name(comm_task)); - - int nargvs = 3; - char **argv = xbt_new(char *, nargvs); - argv[0] = pr_name; - argv[1] = mbox; - argv[2] = NULL; - // XBT_INFO("micro start: mbox %s", mbox); - MSG_process_create_with_arguments(pr_name, task_tx_overhead_fun, NULL, MSG_host_self(), nargvs - 1, argv); -} -static void shutdown_overhead_process(msg_task_t comm_task) -{ - char *mbox = bprintf("__mb_task_tx_overhead_%s", MSG_task_get_name(comm_task)); - - msg_task_t task = MSG_task_create("finalize_making_overhead", 0, 0, NULL); - - // XBT_INFO("micro shutdown: mbox %s", mbox); - msg_error_t ret = MSG_task_send(task, mbox); - if(ret != MSG_OK) - xbt_die("shutdown error - task not sent"); - - xbt_free(mbox); - // XBT_INFO("shutdown done"); -} - -static void request_overhead(msg_task_t comm_task, double computation) -{ - char *mbox = bprintf("__mb_task_tx_overhead_%s", MSG_task_get_name(comm_task)); - - msg_task_t task = MSG_task_create("micro", computation, 0, NULL); - - // XBT_INFO("req overhead"); - msg_error_t ret = MSG_task_send(task, mbox); - if(ret != MSG_OK) - xbt_die("req overhead error - task not sent"); - - xbt_free(mbox); -} - -/* alpha is (floating_operations / bytes). - * - * When actual migration traffic was 32 mbytes/s, we observed the CPU - * utilization of the main thread of the Qemu process was 10 %. - * alpha = 0.1 * C / (32 * 1024 * 1024) - * where the CPU capacity of the PM is C flops/s. - * - * */ -static void task_send_bounded_with_cpu_overhead(msg_task_t comm_task, char *mbox, double mig_speed, double alpha) -{ - const double chunk_size = 1024 * 1024 * 10; - double remaining = MSG_task_get_data_size(comm_task); - - start_overhead_process(comm_task); - - - while (remaining > 0) { - double data_size = chunk_size; - if (remaining < chunk_size) - data_size = remaining; - - remaining -= data_size; - - // XBT_INFO("remaining %f bytes", remaining); - - - double clock_sta = MSG_get_clock(); - - /* create a micro task */ - { - char *mtask_name = bprintf("__micro_%s", MSG_task_get_name(comm_task)); - msg_task_t mtask = MSG_task_create(mtask_name, 0, data_size, NULL); - - request_overhead(comm_task, data_size * alpha); - - msg_error_t ret = MSG_task_send(mtask, mbox); - if(ret != MSG_OK) - xbt_die("migration error - task not sent"); - - xbt_free(mtask_name); - } - -#if 0 - { - /* In the real world, sending data involves small CPU computation. */ - char *mtask_name = bprintf("__micro_%s", MSG_task_get_name(comm_task)); - msg_task_t mtask = MSG_task_create(mtask_name, data_size * alpha, data_size, NULL); - MSG_task_execute(mtask); - MSG_task_destroy(mtask); - xbt_free(mtask_name); - } -#endif - - /* TODO */ - - double clock_end = MSG_get_clock(); - - - if (mig_speed > 0) { - /* - * (max bandwidth) > data_size / ((elapsed time) + time_to_sleep) - * - * Thus, we get - * time_to_sleep > data_size / (max bandwidth) - (elapsed time) - * - * If time_to_sleep is smaller than zero, the elapsed time was too big. We - * do not need a micro sleep. - **/ - double time_to_sleep = data_size / mig_speed - (clock_end - clock_sta); - if (time_to_sleep > 0) - MSG_process_sleep(time_to_sleep); - - - //XBT_INFO("duration %f", clock_end - clock_sta); - //XBT_INFO("time_to_sleep %f", time_to_sleep); - } - } - - // XBT_INFO("%s", MSG_task_get_name(comm_task)); - shutdown_overhead_process(comm_task); - -} - - -#if 0 -static void make_cpu_overhead_of_data_transfer(msg_task_t comm_task, double init_comm_size) -{ - double prev_remaining = init_comm_size; - - for (;;) { - double remaining = MSG_task_get_remaining_communication(comm_task); - if (remaining == 0) - need_exit = 1; - - double sent = prev_remaining - remaining; - double comp_size = sent * overhead; - - - char *comp_task_name = bprintf("__sender_overhead%s", MSG_task_get_name(comm_task)); - msg_task_t comp_task = MSG_task_create(comp_task_name, comp_size, 0, NULL); - MSG_task_execute(comp_task); - MSG_task_destroy(comp_task); - - if (need_exit) - break; - - prev_remaining = remaining; - - } - - xbt_free(comp_task_name); -} -#endif - -// #define USE_MICRO_TASK 1 - -#if 0 -// const double alpha = 0.1L * 1.0E8 / (32L * 1024 * 1024); -// const double alpha = 0.25L * 1.0E8 / (85L * 1024 * 1024); -// const double alpha = 0.20L * 1.0E8 / (85L * 1024 * 1024); -// const double alpha = 0.25L * 1.0E8 / (85L * 1024 * 1024); -// const double alpha = 0.32L * 1.0E8 / (24L * 1024 * 1024); // makes super good values for 32 mbytes/s -//const double alpha = 0.32L * 1.0E8 / (32L * 1024 * 1024); -// const double alpha = 0.56L * 1.0E8 / (80L * 1024 * 1024); -////const double alpha = 0.20L * 1.0E8 / (80L * 1024 * 1024); -// const double alpha = 0.56L * 1.0E8 / (90L * 1024 * 1024); -// const double alpha = 0.66L * 1.0E8 / (90L * 1024 * 1024); -// const double alpha = 0.20L * 1.0E8 / (80L * 1024 * 1024); - -/* CPU 22% when 80Mbyte/s */ -const double alpha = 0.22L * 1.0E8 / (80L * 1024 * 1024); -#endif - - -static void send_migration_data(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm, - sg_size_t size, char *mbox, int stage, int stage2_round, double mig_speed, double xfer_cpu_overhead) +static sg_size_t send_migration_data(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm, + sg_size_t size, char *mbox, int stage, int stage2_round, double mig_speed, double timeout) { + sg_size_t sent = 0; char *task_name = get_mig_task_name(vm, src_pm, dst_pm, stage); msg_task_t task = MSG_task_create(task_name, 0, size, NULL); @@ -848,68 +618,47 @@ static void send_migration_data(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_p double clock_sta = MSG_get_clock(); -#ifdef USE_MICRO_TASK - - task_send_bounded_with_cpu_overhead(task, mbox, mig_speed, xfer_cpu_overhead); - -#else msg_error_t ret; if (mig_speed > 0) - ret = MSG_task_send_bounded(task, mbox, mig_speed); + ret = MSG_task_send_with_timeout_bounded(task, mbox, timeout, mig_speed); else ret = MSG_task_send(task, mbox); -// xbt_assert(ret == MSG_OK); - xbt_free(task_name); - if(ret == MSG_HOST_FAILURE){ - THROWF(host_error, 0, "host failed during migration of %s (stage %d)", sg_host_name(vm), stage); - //XBT_INFO("host failed during migration of %s (stage %d)", sg_host_name(vm), stage); - MSG_task_destroy(task); - return; - - } -#endif - double clock_end = MSG_get_clock(); - double duration = clock_end - clock_sta; - double actual_speed = size / duration; -#ifdef USE_MICRO_TASK - double cpu_utilization = size * xfer_cpu_overhead / duration / 1.0E8; -#else - double cpu_utilization = 0; -#endif + xbt_free(task_name); - if (stage == 2){ - XBT_DEBUG("mig-stage%d.%d: sent %llu duration %f actual_speed %f (target %f) cpu %f", stage, stage2_round, size, duration, actual_speed, mig_speed, cpu_utilization);} - else{ - XBT_DEBUG("mig-stage%d: sent %llu duration %f actual_speed %f (target %f) cpu %f", stage, size, duration, actual_speed, mig_speed, cpu_utilization); + if (ret == MSG_OK) { + sent = size; + } else if (ret == MSG_TIMEOUT) { + sg_size_t remaining = MSG_task_get_remaining_communication(task); + sent = size - remaining; + XBT_INFO("timeout (%lf s) in sending_migration_data, remaining %llu bytes of %llu", + timeout, remaining, size); } - -#ifdef USE_MICRO_TASK - /* The name of a micro task starts with __micro, which does not match the - * special name that finalizes the receiver loop. Thus, we send the special task. - **/ - { - if (stage == 3) { - char *task_name = get_mig_task_name(vm_name, src_pm_name, dst_pm_name, stage); - msg_task_t task = MSG_task_create(task_name, 0, 0, NULL); - msg_error_t ret = MSG_task_send(task, mbox); -// xbt_assert(ret == MSG_OK); - xbt_free(task_name); - if(ret == MSG_HOST_FAILURE){ - THROWF(host_error, 0, "host failed during migration of VM %s (stage 3)", sg_host_name(vm)); - //XBT_INFO("host failed during migration of %s (stage 3)", sg_host_name(vm)); - // The owner of the task did not change so destroy the task - MSG_task_destroy(task); - return; - } - } + /* FIXME: why try-and-catch is used here? */ + if(ret == MSG_HOST_FAILURE){ + //XBT_INFO("SRC host failed during migration of %s (stage %d)", sg_host_name(vm), stage); + MSG_task_destroy(task); + THROWF(host_error, 0, "SRC host failed during migration of %s (stage %d)", sg_host_name(vm), stage); + }else if(ret == MSG_TRANSFER_FAILURE){ + //XBT_INFO("DST host failed during migration of %s (stage %d)", sg_host_name(vm), stage); + MSG_task_destroy(task); + THROWF(host_error, 0, "DST host failed during migration of %s (stage %d)", sg_host_name(vm), stage); } -#endif + double clock_end = MSG_get_clock(); + double duration = clock_end - clock_sta; + double actual_speed = size / duration; + + if (stage == 2) + XBT_DEBUG("mig-stage%d.%d: sent %llu duration %f actual_speed %f (target %f)", stage, stage2_round, size, duration, actual_speed, mig_speed); + else + XBT_DEBUG("mig-stage%d: sent %llu duration %f actual_speed %f (target %f)", stage, size, duration, actual_speed, mig_speed); + + return sent; } -static double get_updated_size(double computed, double dp_rate, double dp_cap) +static sg_size_t get_updated_size(double computed, double dp_rate, double dp_cap) { double updated_size = computed * dp_rate; XBT_DEBUG("updated_size %f dp_rate %f", updated_size, dp_rate); @@ -918,11 +667,11 @@ static double get_updated_size(double computed, double dp_rate, double dp_cap) updated_size = dp_cap; } - return updated_size; + return (sg_size_t) updated_size; } static double send_stage1(struct migration_session *ms, - sg_size_t ramsize, double mig_speed, double xfer_cpu_overhead, double dp_rate, double dp_cap, double dpt_cpu_overhead) + sg_size_t ramsize, double mig_speed, double dp_rate, double dp_cap) { // const long chunksize = (sg_size_t)1024 * 1024 * 100; @@ -936,17 +685,9 @@ static double send_stage1(struct migration_session *ms, datasize = remaining; remaining -= datasize; - - send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, datasize, ms->mbox, 1, 0, mig_speed, xfer_cpu_overhead); + send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, datasize, ms->mbox, 1, 0, mig_speed, -1); double computed = lookup_computed_flop_counts(ms->vm, 1, 0); computed_total += computed; - - // { - // double updated_size = get_updated_size(computed, dp_rate, dp_cap); - - // double overhead = dpt_cpu_overhead * updated_size; - // launch_deferred_exec_process(vm, overhead, 10000); - // } } return computed_total; @@ -956,18 +697,14 @@ static double send_stage1(struct migration_session *ms, static double get_threshold_value(double bandwidth, double max_downtime) { - /* This value assumes the network link is 1Gbps. */ - // double threshold = max_downtime * 125 * 1024 * 1024; - double threshold = max_downtime * bandwidth; - - return threshold; + return max_downtime * bandwidth; } static int migration_tx_fun(int argc, char *argv[]) { XBT_DEBUG("mig: tx_start"); - // Note that the ms structure has been allocated in do_migration and hence should be freed in the same function ;) + // Note that the ms structure has been allocated in do_migration and hence should be freed in the same function ;) struct migration_session *ms = MSG_process_get_data(MSG_process_self()); s_ws_params_t params; @@ -975,56 +712,70 @@ static int migration_tx_fun(int argc, char *argv[]) const sg_size_t ramsize = params.ramsize; const sg_size_t devsize = params.devsize; const int skip_stage1 = params.skip_stage1; - const int skip_stage2 = params.skip_stage2; + int skip_stage2 = params.skip_stage2; const double dp_rate = params.dp_rate; const double dp_cap = params.dp_cap; const double mig_speed = params.mig_speed; - const double xfer_cpu_overhead = params.xfer_cpu_overhead; - const double dpt_cpu_overhead = params.dpt_cpu_overhead; + double max_downtime = params.max_downtime; + + /* hard code it temporally. Fix Me */ +#define MIGRATION_TIMEOUT_DO_NOT_HARDCODE_ME 10000000.0 + double mig_timeout = MIGRATION_TIMEOUT_DO_NOT_HARDCODE_ME; double remaining_size = ramsize + devsize; + double threshold = 0.0; + + /* check parameters */ + if (ramsize == 0) + XBT_WARN("migrate a VM, but ramsize is zero"); - double max_downtime = params.max_downtime; if (max_downtime == 0) { XBT_WARN("use the default max_downtime value 30ms"); max_downtime = 0.03; } - double threshold = 0.00001; /* TODO: cleanup */ - - /* setting up parameters has done */ - - - if (ramsize == 0) - XBT_WARN("migrate a VM, but ramsize is zero"); - - - XBT_INFO("mig-stage1: remaining_size %f", remaining_size); - /* Stage1: send all memory pages to the destination. */ + XBT_DEBUG("mig-stage1: remaining_size %f", remaining_size); start_dirty_page_tracking(ms->vm); double computed_during_stage1 = 0; if (!skip_stage1) { - // send_migration_data(vm_name, src_pm_name, dst_pm_name, ramsize, mbox, 1, 0, mig_speed, xfer_cpu_overhead); - - /* send ramsize, but split it */ double clock_prev_send = MSG_get_clock(); - TRY{ - computed_during_stage1 = send_stage1(ms, ramsize, mig_speed, xfer_cpu_overhead, dp_rate, dp_cap, dpt_cpu_overhead); - } CATCH_ANONYMOUS{ - //hostfailure - // Stop the dirty page tracking an return (there is no memory space to release) + TRY { + /* At stage 1, we do not need timeout. We have to send all the memory + * pages even though the duration of this tranfer exceeds the timeout + * value. */ + XBT_INFO("Stage 1: Gonna send %llu", ramsize); + sg_size_t sent = send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, ramsize, ms->mbox, 1, 0, mig_speed, -1); + remaining_size -= sent; + computed_during_stage1 = lookup_computed_flop_counts(ms->vm, 1, 0); + + if (sent < ramsize) { + XBT_INFO("mig-stage1: timeout, force moving to stage 3"); + skip_stage2 = 1; + } else if (sent > ramsize) + XBT_CRITICAL("bug"); + + } CATCH_ANONYMOUS { + //hostfailure (if you want to know whether this is the SRC or the DST please check directly in send_migration_data code) + // Stop the dirty page tracking an return (there is no memory space to release) stop_dirty_page_tracking(ms->vm); - return 0; + return 0; } - remaining_size -= ramsize; double clock_post_send = MSG_get_clock(); + mig_timeout -= (clock_post_send - clock_prev_send); + if (mig_timeout < 0) { + XBT_INFO("The duration of stage 1 exceeds the timeout value (%lf > %lf), skip stage 2", + (clock_post_send - clock_prev_send), MIGRATION_TIMEOUT_DO_NOT_HARDCODE_ME); + skip_stage2 = 1; + } + + /* estimate bandwidth */ double bandwidth = ramsize / (clock_post_send - clock_prev_send); threshold = get_threshold_value(bandwidth, max_downtime); - XBT_INFO("actual bandwidth %f (MB/s), threshold %f", bandwidth / 1024 / 1024, threshold); + XBT_DEBUG("actual bandwidth %f (MB/s), threshold %f", bandwidth / 1024 / 1024, threshold); } @@ -1032,92 +783,99 @@ static int migration_tx_fun(int argc, char *argv[]) * becomes smaller than the threshold value. */ if (skip_stage2) goto stage3; - if (max_downtime == 0) { - XBT_WARN("no max_downtime parameter, skip stage2"); - goto stage3; - } int stage2_round = 0; for (;;) { - double updated_size = 0; - if (stage2_round == 0) { - /* just after stage1, nothing has been updated. But, we have to send the data updated during stage1 */ + sg_size_t updated_size = 0; + if (stage2_round == 0) { + /* just after stage1, nothing has been updated. But, we have to send the + * data updated during stage1 */ updated_size = get_updated_size(computed_during_stage1, dp_rate, dp_cap); } else { double computed = lookup_computed_flop_counts(ms->vm, 2, stage2_round); updated_size = get_updated_size(computed, dp_rate, dp_cap); } - XBT_INFO("mig-stage 2:%d updated_size %f computed_during_stage1 %f dp_rate %f dp_cap %f", + XBT_DEBUG("mig-stage 2:%d updated_size %llu computed_during_stage1 %f dp_rate %f dp_cap %f", stage2_round, updated_size, computed_during_stage1, dp_rate, dp_cap); - // if (stage2_round != 0) { - // /* during stage1, we have already created overhead tasks */ - // double overhead = dpt_cpu_overhead * updated_size; - // XBT_DEBUG("updated %f overhead %f", updated_size, overhead); - // launch_deferred_exec_process(vm, overhead, 10000); - // } - - - { - remaining_size += updated_size; - - XBT_INFO("mig-stage2.%d: remaining_size %f (%s threshold %f)", stage2_round, - remaining_size, (remaining_size < threshold) ? "<" : ">", threshold); + /* Check whether the remaining size is below the threshold value. If so, + * move to stage 3. */ + remaining_size += updated_size; + XBT_DEBUG("mig-stage2.%d: remaining_size %f (%s threshold %f)", stage2_round, + remaining_size, (remaining_size < threshold) ? "<" : ">", threshold); + if (remaining_size < threshold) + break; - if (remaining_size < threshold) - break; - } + sg_size_t sent = 0; double clock_prev_send = MSG_get_clock(); - TRY{ - send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, updated_size, ms->mbox, 2, stage2_round, mig_speed, xfer_cpu_overhead); - }CATCH_ANONYMOUS{ - //hostfailure - // Stop the dirty page tracking an return (there is no memory space to release) + TRY { + XBT_INFO("Stage 2, gonna send %llu", updated_size); + sent = send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, updated_size, ms->mbox, 2, stage2_round, mig_speed, mig_timeout); + } CATCH_ANONYMOUS { + //hostfailure (if you want to know whether this is the SRC or the DST please check directly in send_migration_data code) + // Stop the dirty page tracking an return (there is no memory space to release) stop_dirty_page_tracking(ms->vm); - return 0; + return 0; } double clock_post_send = MSG_get_clock(); - double bandwidth = updated_size / (clock_post_send - clock_prev_send); - threshold = get_threshold_value(bandwidth, max_downtime); - XBT_INFO("actual bandwidth %f, threshold %f", bandwidth / 1024 / 1024, threshold); + if (sent == updated_size) { + /* timeout did not happen */ + double bandwidth = updated_size / (clock_post_send - clock_prev_send); + threshold = get_threshold_value(bandwidth, max_downtime); + XBT_DEBUG("actual bandwidth %f, threshold %f", bandwidth / 1024 / 1024, threshold); + remaining_size -= sent; + stage2_round += 1; + mig_timeout -= (clock_post_send - clock_prev_send); + xbt_assert(mig_timeout > 0); + + } else if (sent < updated_size) { + /* When timeout happens, we move to stage 3. The size of memory pages + * updated before timeout must be added to the remaining size. */ + XBT_INFO("mig-stage2.%d: timeout, force moving to stage 3. sent %llu / %llu, eta %lf", + stage2_round, sent, updated_size, (clock_post_send - clock_prev_send)); + remaining_size -= sent; + double computed = lookup_computed_flop_counts(ms->vm, 2, stage2_round); + updated_size = get_updated_size(computed, dp_rate, dp_cap); + remaining_size += updated_size; + break; - remaining_size -= updated_size; - stage2_round += 1; + } else + XBT_CRITICAL("bug"); } stage3: /* Stage3: stop the VM and copy the rest of states. */ - XBT_INFO("mig-stage3: remaining_size %f", remaining_size); + XBT_DEBUG("mig-stage3: remaining_size %f", remaining_size); simcall_vm_suspend(ms->vm); stop_dirty_page_tracking(ms->vm); - - TRY{ - send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, remaining_size, ms->mbox, 3, 0, mig_speed, xfer_cpu_overhead); - }CATCH_ANONYMOUS{ - //hostfailure - // Stop the dirty page tracking an return (there is no memory space to release) - simcall_vm_resume(ms->vm); - return 0; - } - - // At that point the Migration is considered valid for the SRC node but remind that the DST side should relocate effectively the VM on the DST node. - XBT_DEBUG("mig: tx_done"); + TRY { + XBT_INFO("Stage 3: Gonna send %f", remaining_size); + send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, remaining_size, ms->mbox, 3, 0, mig_speed, -1); + } CATCH_ANONYMOUS { + //hostfailure (if you want to know whether this is the SRC or the DST please check directly in send_migration_data code) + // Stop the dirty page tracking an return (there is no memory space to release) + simcall_vm_resume(ms->vm); + return 0; + } + + // At that point the Migration is considered valid for the SRC node but remind that the DST side should relocate effectively the VM on the DST node. + XBT_INFO("mig: tx_done"); return 0; } -static void do_migration(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm) +static int do_migration(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm) { struct migration_session *ms = xbt_new(struct migration_session, 1); ms->vm = vm; @@ -1125,11 +883,12 @@ static void do_migration(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm) ms->dst_pm = dst_pm; ms->mbox_ctl = get_mig_mbox_ctl(vm, src_pm, dst_pm); ms->mbox = get_mig_mbox_src_dst(vm, src_pm, dst_pm); - + char *pr_rx_name = get_mig_process_rx_name(vm, src_pm, dst_pm); char *pr_tx_name = get_mig_process_tx_name(vm, src_pm, dst_pm); +// msg_process_t tx_process, rx_process; // MSG_process_create(pr_rx_name, migration_rx_fun, ms, dst_pm); // MSG_process_create(pr_tx_name, migration_tx_fun, ms, src_pm); #if 1 @@ -1137,36 +896,47 @@ static void do_migration(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm) char **argv = xbt_new(char *, 2); argv[0] = pr_rx_name; argv[1] = NULL; - MSG_process_create_with_arguments(pr_rx_name, migration_rx_fun, ms, dst_pm, 1, argv); +/*rx_process = */ MSG_process_create_with_arguments(pr_rx_name, migration_rx_fun, ms, dst_pm, 1, argv); } { char **argv = xbt_new(char *, 2); argv[0] = pr_tx_name; argv[1] = NULL; - MSG_process_create_with_arguments(pr_tx_name, migration_tx_fun, ms, src_pm, 1, argv); +/* tx_process = */MSG_process_create_with_arguments(pr_tx_name, migration_tx_fun, ms, src_pm, 1, argv); } #endif /* wait until the migration have finished or on error has occured */ { + XBT_DEBUG("wait for reception of the final ACK (i.e. migration has been correctly performed"); msg_task_t task = NULL; - msg_error_t ret = MSG_task_recv(&task, ms->mbox_ctl); + msg_error_t ret = MSG_TIMEOUT; + while (ret == MSG_TIMEOUT && MSG_host_is_on(dst_pm)) //Wait while you receive the message o + ret = MSG_task_receive_with_timeout(&task, ms->mbox_ctl, 4); xbt_free(ms->mbox_ctl); xbt_free(ms->mbox); xbt_free(ms); - + //xbt_assert(ret == MSG_OK); if(ret == MSG_HOST_FAILURE){ // Note that since the communication failed, the owner did not change and the task should be destroyed on the other side. // Hence, just throw the execption - THROWF(host_error, 0, "DST host failed during the migration of %s", sg_host_name(vm)); + XBT_INFO("SRC crashes, throw an exception (m-control)"); + //MSG_process_kill(tx_process); // Adrien, I made a merge on Nov 28th 2014, I'm not sure whether this line is required or not + return -1; } + else if((ret == MSG_TRANSFER_FAILURE) || (ret == MSG_TIMEOUT)){ // MSG_TIMEOUT here means that MSG_host_is_avail() returned false. + XBT_INFO("DST crashes, throw an exception (m-control)"); + return -2; + } + char *expected_task_name = get_mig_task_name(vm, src_pm, dst_pm, 4); xbt_assert(strcmp(task->name, expected_task_name) == 0); xbt_free(expected_task_name); MSG_task_destroy(task); + return 0; } } @@ -1200,7 +970,7 @@ void MSG_vm_migrate(msg_vm_t vm, msg_host_t new_pm) * physical host. * * The second one would be easier. - * + * */ msg_host_t old_pm = simcall_vm_get_pm(vm); @@ -1214,19 +984,25 @@ void MSG_vm_migrate(msg_vm_t vm, msg_host_t new_pm) msg_host_priv_t priv = msg_host_resource_priv(vm); priv->is_migrating = 1; - TRY{ - do_migration(vm, old_pm, new_pm); - } CATCH_ANONYMOUS{ - RETHROW; - // TODO clean the code Adrien + { + + int ret = do_migration(vm, old_pm, new_pm); + if (ret == -1){ + priv->is_migrating = 0; + THROWF(host_error, 0, "SRC host failed during migration"); + } + else if(ret == -2){ + priv->is_migrating = 0; + THROWF(host_error, 0, "DST host failed during migration"); + } } - priv->is_migrating = 0; - XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", vm->key, old_pm->key, new_pm->key); - - #ifdef HAVE_TRACING - TRACE_msg_vm_change_host(vm, old_pm, new_pm); - #endif + // This part is done in the RX code, to handle the corner case where SRC can crash just at the end of the migration process + // In that case, the VM has been already assigned to the DST node. + //XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", vm->key, old_pm->key, new_pm->key); + //#ifdef HAVE_TRACING + //TRACE_msg_vm_change_host(vm, old_pm, new_pm); + //#endif } @@ -1325,7 +1101,7 @@ msg_host_t MSG_vm_get_pm(msg_vm_t vm) * On PM0, there are Task1 and VM0. * On VM0, there is Task2. * Now we bound 75% to Task1\@PM0 and bound 25% to Task2\@VM0. - * Then, + * Then, * Task1\@PM0 gets 50%. * Task2\@VM0 gets 25%. * This is NOT 75% for Task1\@PM0 and 25% for Task2\@VM0, respectively. @@ -1351,7 +1127,7 @@ msg_host_t MSG_vm_get_pm(msg_vm_t vm) */ void MSG_vm_set_bound(msg_vm_t vm, double bound) { - return simcall_vm_set_bound(vm, bound); + return simcall_vm_set_bound(vm, bound); } @@ -1372,8 +1148,8 @@ void MSG_vm_set_affinity(msg_vm_t vm, msg_host_t pm, unsigned long mask) msg_host_t pm_now = MSG_vm_get_pm(vm); if (pm_now == pm) { - XBT_INFO("set affinity(0x%04lx@%s) for %s", mask, MSG_host_get_name(pm), MSG_host_get_name(vm)); + XBT_DEBUG("set affinity(0x%04lx@%s) for %s", mask, MSG_host_get_name(pm), MSG_host_get_name(vm)); simcall_vm_set_affinity(vm, pm, mask); } else - XBT_INFO("set affinity(0x%04lx@%s) for %s (not active now)", mask, MSG_host_get_name(pm), MSG_host_get_name(vm)); + XBT_DEBUG("set affinity(0x%04lx@%s) for %s (not active now)", mask, MSG_host_get_name(pm), MSG_host_get_name(vm)); } diff --git a/src/probes.tp b/src/probes.tp new file mode 100644 index 0000000000..6ccc0aa5d9 --- /dev/null +++ b/src/probes.tp @@ -0,0 +1,61 @@ +TRACEPOINT_EVENT( + mc, + state_diff, + TP_ARGS( + int, state1, + int, state2, + char*, message + ), + TP_FIELDS( + ctf_integer(int, state1, state1) + ctf_integer(int, state2, state2) + ctf_string(message, message) + ) +) +TRACEPOINT_LOGLEVEL(mc, state_diff, TRACE_INFO) + +TRACEPOINT_EVENT( + mc, + hash_diff, + TP_ARGS( + int, state1, + int, state2 + ), + TP_FIELDS( + ctf_integer(int, state1, state1) + ctf_integer(int, state2, state2) + ) +) +TRACEPOINT_LOGLEVEL(mc, hash_diff, TRACE_INFO) + +TRACEPOINT_EVENT( + mc, + global_diff, + TP_ARGS( + int, state1, + int, state2, + char*, variable + ), + TP_FIELDS( + ctf_integer(int, state1, state1) + ctf_integer(int, state2, state2) + ctf_string(variable, variable) + ) +) +TRACEPOINT_LOGLEVEL(mc, global_diff, TRACE_INFO) + +TRACEPOINT_EVENT( + mc, + local_diff, + TP_ARGS( + int, state1, + int, state2, + char*, variable + ), + TP_FIELDS( + ctf_integer(int, state1, state1) + ctf_integer(int, state2, state2) + ctf_string(variable, variable) + ) +) +TRACEPOINT_LOGLEVEL(mc, local_diff, TRACE_INFO) diff --git a/src/simdag/dax_dtd.c b/src/simdag/dax_dtd.c index bdf87cc58a..24afd327d4 100644 --- a/src/simdag/dax_dtd.c +++ b/src/simdag/dax_dtd.c @@ -1344,81 +1344,81 @@ const char dax__flexml_version[] = "1.9.6"; int dax__pcdata_ix; extern char *dax__bufferstack; #define dax__pcdata (dax__bufferstack + dax__pcdata_ix) -AT_dax__uses_file AX_dax__uses_file; -#define A_dax__uses_file (dax__bufferstack + AX_dax__uses_file) -short int dax__uses_file_isset; -AT_dax__adag_count AX_dax__adag_count; -#define A_dax__adag_count (dax__bufferstack + AX_dax__adag_count) -short int dax__adag_count_isset; -AT_dax__uses_register AX_dax__uses_register; -#define A_dax__uses_register AX_dax__uses_register -short int dax__uses_register_isset; -AT_dax__uses_size AX_dax__uses_size; -#define A_dax__uses_size (dax__bufferstack + AX_dax__uses_size) -short int dax__uses_size_isset; -AT_dax__uses_link AX_dax__uses_link; -#define A_dax__uses_link AX_dax__uses_link -short int dax__uses_link_isset; -AT_dax__adag_fileCount AX_dax__adag_fileCount; -#define A_dax__adag_fileCount (dax__bufferstack + AX_dax__adag_fileCount) -short int dax__adag_fileCount_isset; AT_dax__adag_childCount AX_dax__adag_childCount; #define A_dax__adag_childCount (dax__bufferstack + AX_dax__adag_childCount) short int dax__adag_childCount_isset; -AT_dax__job_level AX_dax__job_level; -#define A_dax__job_level (dax__bufferstack + AX_dax__job_level) -short int dax__job_level_isset; -AT_dax__child_ref AX_dax__child_ref; -#define A_dax__child_ref (dax__bufferstack + AX_dax__child_ref) -short int dax__child_ref_isset; -AT_dax__job_version AX_dax__job_version; -#define A_dax__job_version (dax__bufferstack + AX_dax__job_version) -short int dax__job_version_isset; +AT_dax__adag_xsi_c_schemaLocation AX_dax__adag_xsi_c_schemaLocation; +#define A_dax__adag_xsi_c_schemaLocation (dax__bufferstack + AX_dax__adag_xsi_c_schemaLocation) +short int dax__adag_xsi_c_schemaLocation_isset; AT_dax__job_namespace AX_dax__job_namespace; #define A_dax__job_namespace (dax__bufferstack + AX_dax__job_namespace) short int dax__job_namespace_isset; -AT_dax__parent_ref AX_dax__parent_ref; -#define A_dax__parent_ref (dax__bufferstack + AX_dax__parent_ref) -short int dax__parent_ref_isset; +AT_dax__uses_file AX_dax__uses_file; +#define A_dax__uses_file (dax__bufferstack + AX_dax__uses_file) +short int dax__uses_file_isset; +AT_dax__adag_xmlns_c_xsi AX_dax__adag_xmlns_c_xsi; +#define A_dax__adag_xmlns_c_xsi (dax__bufferstack + AX_dax__adag_xmlns_c_xsi) +short int dax__adag_xmlns_c_xsi_isset; AT_dax__adag_xmlns AX_dax__adag_xmlns; #define A_dax__adag_xmlns (dax__bufferstack + AX_dax__adag_xmlns) short int dax__adag_xmlns_isset; -AT_dax__uses_optional AX_dax__uses_optional; -#define A_dax__uses_optional AX_dax__uses_optional -short int dax__uses_optional_isset; -AT_dax__job_runtime AX_dax__job_runtime; -#define A_dax__job_runtime (dax__bufferstack + AX_dax__job_runtime) -short int dax__job_runtime_isset; -AT_dax__adag_name AX_dax__adag_name; -#define A_dax__adag_name (dax__bufferstack + AX_dax__adag_name) -short int dax__adag_name_isset; -AT_dax__adag_version AX_dax__adag_version; -#define A_dax__adag_version (dax__bufferstack + AX_dax__adag_version) -short int dax__adag_version_isset; -AT_dax__adag_xsi_c_schemaLocation AX_dax__adag_xsi_c_schemaLocation; -#define A_dax__adag_xsi_c_schemaLocation (dax__bufferstack + AX_dax__adag_xsi_c_schemaLocation) -short int dax__adag_xsi_c_schemaLocation_isset; -AT_dax__uses_transfer AX_dax__uses_transfer; -#define A_dax__uses_transfer AX_dax__uses_transfer -short int dax__uses_transfer_isset; -AT_dax__adag_index AX_dax__adag_index; -#define A_dax__adag_index (dax__bufferstack + AX_dax__adag_index) -short int dax__adag_index_isset; +AT_dax__adag_fileCount AX_dax__adag_fileCount; +#define A_dax__adag_fileCount (dax__bufferstack + AX_dax__adag_fileCount) +short int dax__adag_fileCount_isset; +AT_dax__uses_size AX_dax__uses_size; +#define A_dax__uses_size (dax__bufferstack + AX_dax__uses_size) +short int dax__uses_size_isset; AT_dax__uses_type AX_dax__uses_type; #define A_dax__uses_type (dax__bufferstack + AX_dax__uses_type) short int dax__uses_type_isset; +AT_dax__adag_version AX_dax__adag_version; +#define A_dax__adag_version (dax__bufferstack + AX_dax__adag_version) +short int dax__adag_version_isset; +AT_dax__job_runtime AX_dax__job_runtime; +#define A_dax__job_runtime (dax__bufferstack + AX_dax__job_runtime) +short int dax__job_runtime_isset; AT_dax__job_id AX_dax__job_id; #define A_dax__job_id (dax__bufferstack + AX_dax__job_id) short int dax__job_id_isset; -AT_dax__adag_xmlns_c_xsi AX_dax__adag_xmlns_c_xsi; -#define A_dax__adag_xmlns_c_xsi (dax__bufferstack + AX_dax__adag_xmlns_c_xsi) -short int dax__adag_xmlns_c_xsi_isset; AT_dax__adag_jobCount AX_dax__adag_jobCount; #define A_dax__adag_jobCount (dax__bufferstack + AX_dax__adag_jobCount) short int dax__adag_jobCount_isset; +AT_dax__uses_register AX_dax__uses_register; +#define A_dax__uses_register AX_dax__uses_register +short int dax__uses_register_isset; +AT_dax__job_level AX_dax__job_level; +#define A_dax__job_level (dax__bufferstack + AX_dax__job_level) +short int dax__job_level_isset; +AT_dax__adag_index AX_dax__adag_index; +#define A_dax__adag_index (dax__bufferstack + AX_dax__adag_index) +short int dax__adag_index_isset; +AT_dax__child_ref AX_dax__child_ref; +#define A_dax__child_ref (dax__bufferstack + AX_dax__child_ref) +short int dax__child_ref_isset; +AT_dax__parent_ref AX_dax__parent_ref; +#define A_dax__parent_ref (dax__bufferstack + AX_dax__parent_ref) +short int dax__parent_ref_isset; +AT_dax__uses_link AX_dax__uses_link; +#define A_dax__uses_link AX_dax__uses_link +short int dax__uses_link_isset; +AT_dax__uses_transfer AX_dax__uses_transfer; +#define A_dax__uses_transfer AX_dax__uses_transfer +short int dax__uses_transfer_isset; +AT_dax__job_version AX_dax__job_version; +#define A_dax__job_version (dax__bufferstack + AX_dax__job_version) +short int dax__job_version_isset; +AT_dax__adag_count AX_dax__adag_count; +#define A_dax__adag_count (dax__bufferstack + AX_dax__adag_count) +short int dax__adag_count_isset; AT_dax__job_name AX_dax__job_name; #define A_dax__job_name (dax__bufferstack + AX_dax__job_name) short int dax__job_name_isset; +AT_dax__adag_name AX_dax__adag_name; +#define A_dax__adag_name (dax__bufferstack + AX_dax__adag_name) +short int dax__adag_name_isset; +AT_dax__uses_optional AX_dax__uses_optional; +#define A_dax__uses_optional AX_dax__uses_optional +short int dax__uses_optional_isset; /* XML state. */ #ifdef FLEX_DEBUG @@ -2213,10 +2213,10 @@ YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",dax_text[0]); YY_BREAK case YY_STATE_EOF(E_dax__adag): -case YY_STATE_EOF(S_dax__adag_1): case YY_STATE_EOF(S_dax__adag): -case YY_STATE_EOF(S_dax__adag_3): case YY_STATE_EOF(S_dax__adag_5): +case YY_STATE_EOF(S_dax__adag_3): +case YY_STATE_EOF(S_dax__adag_1): FAIL("Premature EOF: `' expected."); YY_BREAK @@ -2322,7 +2322,7 @@ YY_RULE_SETUP if (!AX_dax__job_runtime) FAIL("Required attribute `runtime' not set for `job' element."); LEAVE; STag_dax__job(); dax__pcdata_ix = 0; ETag_dax__job(); popbuffer(); /* attribute */ switch (YY_START) { - case S_dax__adag_3: case S_dax__adag: case S_dax__adag_2: SET(S_dax__adag_3); break; + case S_dax__adag_2: case S_dax__adag_3: case S_dax__adag: SET(S_dax__adag_3); break; } } YY_BREAK @@ -2346,7 +2346,7 @@ YY_RULE_SETUP ETag_dax__job(); popbuffer(); /* attribute */ switch (YY_START) { - case S_dax__adag_3: case S_dax__adag: case S_dax__adag_2: SET(S_dax__adag_3); break; + case S_dax__adag_2: case S_dax__adag_3: case S_dax__adag: SET(S_dax__adag_3); break; } } YY_BREAK @@ -2360,8 +2360,8 @@ YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",dax_text[0]); YY_BREAK case YY_STATE_EOF(S_dax__job): -case YY_STATE_EOF(S_dax__job_2): case YY_STATE_EOF(E_dax__job): +case YY_STATE_EOF(S_dax__job_2): FAIL("Premature EOF: `' expected."); YY_BREAK @@ -2495,7 +2495,7 @@ YY_RULE_SETUP if (!AX_dax__uses_size) FAIL("Required attribute `size' not set for `uses' element."); LEAVE; STag_dax__uses(); dax__pcdata_ix = 0; ETag_dax__uses(); popbuffer(); /* attribute */ switch (YY_START) { - case S_dax__job_1: case S_dax__job: case S_dax__job_2: SET(S_dax__job_2); break; + case S_dax__job_2: case S_dax__job_1: case S_dax__job: SET(S_dax__job_2); break; } } YY_BREAK @@ -2519,7 +2519,7 @@ YY_RULE_SETUP ETag_dax__uses(); popbuffer(); /* attribute */ switch (YY_START) { - case S_dax__job_1: case S_dax__job: case S_dax__job_2: SET(S_dax__job_2); break; + case S_dax__job_2: case S_dax__job_1: case S_dax__job: SET(S_dax__job_2); break; } } YY_BREAK @@ -2574,7 +2574,7 @@ YY_RULE_SETUP if (!AX_dax__child_ref) FAIL("Required attribute `ref' not set for `child' element."); LEAVE; STag_dax__child(); dax__pcdata_ix = 0; ETag_dax__child(); popbuffer(); /* attribute */ switch (YY_START) { - case S_dax__adag_3: case S_dax__adag_5: case S_dax__adag_1: case S_dax__adag: case S_dax__adag_4: SET(S_dax__adag_5); break; + case S_dax__adag_4: case S_dax__adag: case S_dax__adag_1: case S_dax__adag_3: case S_dax__adag_5: SET(S_dax__adag_5); break; } } YY_BREAK @@ -2598,7 +2598,7 @@ YY_RULE_SETUP ETag_dax__child(); popbuffer(); /* attribute */ switch (YY_START) { - case S_dax__adag_3: case S_dax__adag_5: case S_dax__adag_1: case S_dax__adag: case S_dax__adag_4: SET(S_dax__adag_5); break; + case S_dax__adag_4: case S_dax__adag: case S_dax__adag_1: case S_dax__adag_3: case S_dax__adag_5: SET(S_dax__adag_5); break; } } YY_BREAK @@ -2611,9 +2611,9 @@ case 107: YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",dax_text[0]); YY_BREAK -case YY_STATE_EOF(E_dax__child): case YY_STATE_EOF(S_dax__child): case YY_STATE_EOF(S_dax__child_2): +case YY_STATE_EOF(E_dax__child): FAIL("Premature EOF: `' expected."); YY_BREAK diff --git a/src/simdag/dax_dtd.h b/src/simdag/dax_dtd.h index 3649459e1f..b62dabe4b4 100644 --- a/src/simdag/dax_dtd.h +++ b/src/simdag/dax_dtd.h @@ -60,132 +60,132 @@ XBT_PUBLIC(void) STag_dax__parent(void); XBT_PUBLIC(void) ETag_dax__parent(void); /* XML application data. */ -typedef int AT_dax__job_id; -#define AU_dax__job_id NULL -typedef int AT_dax__job_version; -#define AU_dax__job_version NULL +typedef enum { AU_dax__uses_link, A_dax__uses_link_input,A_dax__uses_link_output } AT_dax__uses_link; +typedef int AT_dax__child_ref; +#define AU_dax__child_ref NULL +typedef int AT_dax__uses_size; +#define AU_dax__uses_size NULL +typedef int AT_dax__job_namespace; +#define AU_dax__job_namespace NULL +typedef int AT_dax__adag_fileCount; +#define AU_dax__adag_fileCount NULL +typedef enum { AU_dax__uses_register, A_dax__uses_register_false,A_dax__uses_register_true } AT_dax__uses_register; +typedef int AT_dax__adag_xmlns; +#define AU_dax__adag_xmlns NULL typedef int AT_dax__uses_type; #define AU_dax__uses_type NULL +typedef int AT_dax__job_id; +#define AU_dax__job_id NULL +typedef int AT_dax__job_name; +#define AU_dax__job_name NULL +typedef int AT_dax__job_level; +#define AU_dax__job_level NULL typedef int AT_dax__adag_childCount; #define AU_dax__adag_childCount NULL -typedef enum { AU_dax__uses_optional, A_dax__uses_optional_false,A_dax__uses_optional_true } AT_dax__uses_optional; -typedef enum { AU_dax__uses_link, A_dax__uses_link_input,A_dax__uses_link_output } AT_dax__uses_link; -typedef int AT_dax__adag_xmlns_c_xsi; -#define AU_dax__adag_xmlns_c_xsi NULL -typedef int AT_dax__job_runtime; -#define AU_dax__job_runtime NULL -typedef int AT_dax__uses_file; -#define AU_dax__uses_file NULL -typedef int AT_dax__adag_jobCount; -#define AU_dax__adag_jobCount NULL -typedef enum { AU_dax__uses_register, A_dax__uses_register_false,A_dax__uses_register_true } AT_dax__uses_register; typedef int AT_dax__adag_name; #define AU_dax__adag_name NULL -typedef int AT_dax__job_level; -#define AU_dax__job_level NULL -typedef int AT_dax__job_namespace; -#define AU_dax__job_namespace NULL -typedef int AT_dax__adag_fileCount; -#define AU_dax__adag_fileCount NULL -typedef enum { AU_dax__uses_transfer, A_dax__uses_transfer_false,A_dax__uses_transfer_true } AT_dax__uses_transfer; -typedef int AT_dax__adag_count; -#define AU_dax__adag_count NULL -typedef int AT_dax__child_ref; -#define AU_dax__child_ref NULL typedef int AT_dax__adag_version; #define AU_dax__adag_version NULL -typedef int AT_dax__job_name; -#define AU_dax__job_name NULL -typedef int AT_dax__adag_xmlns; -#define AU_dax__adag_xmlns NULL +typedef int AT_dax__uses_file; +#define AU_dax__uses_file NULL typedef int AT_dax__adag_xsi_c_schemaLocation; #define AU_dax__adag_xsi_c_schemaLocation NULL -typedef int AT_dax__parent_ref; -#define AU_dax__parent_ref NULL -typedef int AT_dax__uses_size; -#define AU_dax__uses_size NULL typedef int AT_dax__adag_index; #define AU_dax__adag_index NULL +typedef int AT_dax__job_runtime; +#define AU_dax__job_runtime NULL +typedef int AT_dax__parent_ref; +#define AU_dax__parent_ref NULL +typedef int AT_dax__adag_xmlns_c_xsi; +#define AU_dax__adag_xmlns_c_xsi NULL +typedef enum { AU_dax__uses_transfer, A_dax__uses_transfer_false,A_dax__uses_transfer_true } AT_dax__uses_transfer; +typedef int AT_dax__job_version; +#define AU_dax__job_version NULL +typedef int AT_dax__adag_count; +#define AU_dax__adag_count NULL +typedef enum { AU_dax__uses_optional, A_dax__uses_optional_false,A_dax__uses_optional_true } AT_dax__uses_optional; +typedef int AT_dax__adag_jobCount; +#define AU_dax__adag_jobCount NULL /* FleXML-provided data. */ XBT_PUBLIC_DATA(int) dax__pcdata_ix; XBT_PUBLIC_DATA(char *) dax__bufferstack; #define dax__pcdata (dax__bufferstack + dax__pcdata_ix) -XBT_PUBLIC_DATA(AT_dax__job_id) AX_dax__job_id; -#define A_dax__job_id (dax__bufferstack + AX_dax__job_id) -XBT_PUBLIC_DATA(short int) dax__job_id_isset; -XBT_PUBLIC_DATA(AT_dax__job_version) AX_dax__job_version; -#define A_dax__job_version (dax__bufferstack + AX_dax__job_version) -XBT_PUBLIC_DATA(short int) dax__job_version_isset; -XBT_PUBLIC_DATA(AT_dax__uses_type) AX_dax__uses_type; -#define A_dax__uses_type (dax__bufferstack + AX_dax__uses_type) -XBT_PUBLIC_DATA(short int) dax__uses_type_isset; -XBT_PUBLIC_DATA(AT_dax__adag_childCount) AX_dax__adag_childCount; -#define A_dax__adag_childCount (dax__bufferstack + AX_dax__adag_childCount) -XBT_PUBLIC_DATA(short int) dax__adag_childCount_isset; -XBT_PUBLIC_DATA(AT_dax__uses_optional) AX_dax__uses_optional; -#define A_dax__uses_optional AX_dax__uses_optional -XBT_PUBLIC_DATA(short int) dax__uses_optional_isset; XBT_PUBLIC_DATA(AT_dax__uses_link) AX_dax__uses_link; #define A_dax__uses_link AX_dax__uses_link XBT_PUBLIC_DATA(short int) dax__uses_link_isset; -XBT_PUBLIC_DATA(AT_dax__adag_xmlns_c_xsi) AX_dax__adag_xmlns_c_xsi; -#define A_dax__adag_xmlns_c_xsi (dax__bufferstack + AX_dax__adag_xmlns_c_xsi) -XBT_PUBLIC_DATA(short int) dax__adag_xmlns_c_xsi_isset; -XBT_PUBLIC_DATA(AT_dax__job_runtime) AX_dax__job_runtime; -#define A_dax__job_runtime (dax__bufferstack + AX_dax__job_runtime) -XBT_PUBLIC_DATA(short int) dax__job_runtime_isset; -XBT_PUBLIC_DATA(AT_dax__uses_file) AX_dax__uses_file; -#define A_dax__uses_file (dax__bufferstack + AX_dax__uses_file) -XBT_PUBLIC_DATA(short int) dax__uses_file_isset; -XBT_PUBLIC_DATA(AT_dax__adag_jobCount) AX_dax__adag_jobCount; -#define A_dax__adag_jobCount (dax__bufferstack + AX_dax__adag_jobCount) -XBT_PUBLIC_DATA(short int) dax__adag_jobCount_isset; -XBT_PUBLIC_DATA(AT_dax__uses_register) AX_dax__uses_register; -#define A_dax__uses_register AX_dax__uses_register -XBT_PUBLIC_DATA(short int) dax__uses_register_isset; -XBT_PUBLIC_DATA(AT_dax__adag_name) AX_dax__adag_name; -#define A_dax__adag_name (dax__bufferstack + AX_dax__adag_name) -XBT_PUBLIC_DATA(short int) dax__adag_name_isset; -XBT_PUBLIC_DATA(AT_dax__job_level) AX_dax__job_level; -#define A_dax__job_level (dax__bufferstack + AX_dax__job_level) -XBT_PUBLIC_DATA(short int) dax__job_level_isset; +XBT_PUBLIC_DATA(AT_dax__child_ref) AX_dax__child_ref; +#define A_dax__child_ref (dax__bufferstack + AX_dax__child_ref) +XBT_PUBLIC_DATA(short int) dax__child_ref_isset; +XBT_PUBLIC_DATA(AT_dax__uses_size) AX_dax__uses_size; +#define A_dax__uses_size (dax__bufferstack + AX_dax__uses_size) +XBT_PUBLIC_DATA(short int) dax__uses_size_isset; XBT_PUBLIC_DATA(AT_dax__job_namespace) AX_dax__job_namespace; #define A_dax__job_namespace (dax__bufferstack + AX_dax__job_namespace) XBT_PUBLIC_DATA(short int) dax__job_namespace_isset; XBT_PUBLIC_DATA(AT_dax__adag_fileCount) AX_dax__adag_fileCount; #define A_dax__adag_fileCount (dax__bufferstack + AX_dax__adag_fileCount) XBT_PUBLIC_DATA(short int) dax__adag_fileCount_isset; -XBT_PUBLIC_DATA(AT_dax__uses_transfer) AX_dax__uses_transfer; -#define A_dax__uses_transfer AX_dax__uses_transfer -XBT_PUBLIC_DATA(short int) dax__uses_transfer_isset; -XBT_PUBLIC_DATA(AT_dax__adag_count) AX_dax__adag_count; -#define A_dax__adag_count (dax__bufferstack + AX_dax__adag_count) -XBT_PUBLIC_DATA(short int) dax__adag_count_isset; -XBT_PUBLIC_DATA(AT_dax__child_ref) AX_dax__child_ref; -#define A_dax__child_ref (dax__bufferstack + AX_dax__child_ref) -XBT_PUBLIC_DATA(short int) dax__child_ref_isset; -XBT_PUBLIC_DATA(AT_dax__adag_version) AX_dax__adag_version; -#define A_dax__adag_version (dax__bufferstack + AX_dax__adag_version) -XBT_PUBLIC_DATA(short int) dax__adag_version_isset; -XBT_PUBLIC_DATA(AT_dax__job_name) AX_dax__job_name; -#define A_dax__job_name (dax__bufferstack + AX_dax__job_name) -XBT_PUBLIC_DATA(short int) dax__job_name_isset; +XBT_PUBLIC_DATA(AT_dax__uses_register) AX_dax__uses_register; +#define A_dax__uses_register AX_dax__uses_register +XBT_PUBLIC_DATA(short int) dax__uses_register_isset; XBT_PUBLIC_DATA(AT_dax__adag_xmlns) AX_dax__adag_xmlns; #define A_dax__adag_xmlns (dax__bufferstack + AX_dax__adag_xmlns) XBT_PUBLIC_DATA(short int) dax__adag_xmlns_isset; +XBT_PUBLIC_DATA(AT_dax__uses_type) AX_dax__uses_type; +#define A_dax__uses_type (dax__bufferstack + AX_dax__uses_type) +XBT_PUBLIC_DATA(short int) dax__uses_type_isset; +XBT_PUBLIC_DATA(AT_dax__job_id) AX_dax__job_id; +#define A_dax__job_id (dax__bufferstack + AX_dax__job_id) +XBT_PUBLIC_DATA(short int) dax__job_id_isset; +XBT_PUBLIC_DATA(AT_dax__job_name) AX_dax__job_name; +#define A_dax__job_name (dax__bufferstack + AX_dax__job_name) +XBT_PUBLIC_DATA(short int) dax__job_name_isset; +XBT_PUBLIC_DATA(AT_dax__job_level) AX_dax__job_level; +#define A_dax__job_level (dax__bufferstack + AX_dax__job_level) +XBT_PUBLIC_DATA(short int) dax__job_level_isset; +XBT_PUBLIC_DATA(AT_dax__adag_childCount) AX_dax__adag_childCount; +#define A_dax__adag_childCount (dax__bufferstack + AX_dax__adag_childCount) +XBT_PUBLIC_DATA(short int) dax__adag_childCount_isset; +XBT_PUBLIC_DATA(AT_dax__adag_name) AX_dax__adag_name; +#define A_dax__adag_name (dax__bufferstack + AX_dax__adag_name) +XBT_PUBLIC_DATA(short int) dax__adag_name_isset; +XBT_PUBLIC_DATA(AT_dax__adag_version) AX_dax__adag_version; +#define A_dax__adag_version (dax__bufferstack + AX_dax__adag_version) +XBT_PUBLIC_DATA(short int) dax__adag_version_isset; +XBT_PUBLIC_DATA(AT_dax__uses_file) AX_dax__uses_file; +#define A_dax__uses_file (dax__bufferstack + AX_dax__uses_file) +XBT_PUBLIC_DATA(short int) dax__uses_file_isset; XBT_PUBLIC_DATA(AT_dax__adag_xsi_c_schemaLocation) AX_dax__adag_xsi_c_schemaLocation; #define A_dax__adag_xsi_c_schemaLocation (dax__bufferstack + AX_dax__adag_xsi_c_schemaLocation) XBT_PUBLIC_DATA(short int) dax__adag_xsi_c_schemaLocation_isset; -XBT_PUBLIC_DATA(AT_dax__parent_ref) AX_dax__parent_ref; -#define A_dax__parent_ref (dax__bufferstack + AX_dax__parent_ref) -XBT_PUBLIC_DATA(short int) dax__parent_ref_isset; -XBT_PUBLIC_DATA(AT_dax__uses_size) AX_dax__uses_size; -#define A_dax__uses_size (dax__bufferstack + AX_dax__uses_size) -XBT_PUBLIC_DATA(short int) dax__uses_size_isset; XBT_PUBLIC_DATA(AT_dax__adag_index) AX_dax__adag_index; #define A_dax__adag_index (dax__bufferstack + AX_dax__adag_index) XBT_PUBLIC_DATA(short int) dax__adag_index_isset; +XBT_PUBLIC_DATA(AT_dax__job_runtime) AX_dax__job_runtime; +#define A_dax__job_runtime (dax__bufferstack + AX_dax__job_runtime) +XBT_PUBLIC_DATA(short int) dax__job_runtime_isset; +XBT_PUBLIC_DATA(AT_dax__parent_ref) AX_dax__parent_ref; +#define A_dax__parent_ref (dax__bufferstack + AX_dax__parent_ref) +XBT_PUBLIC_DATA(short int) dax__parent_ref_isset; +XBT_PUBLIC_DATA(AT_dax__adag_xmlns_c_xsi) AX_dax__adag_xmlns_c_xsi; +#define A_dax__adag_xmlns_c_xsi (dax__bufferstack + AX_dax__adag_xmlns_c_xsi) +XBT_PUBLIC_DATA(short int) dax__adag_xmlns_c_xsi_isset; +XBT_PUBLIC_DATA(AT_dax__uses_transfer) AX_dax__uses_transfer; +#define A_dax__uses_transfer AX_dax__uses_transfer +XBT_PUBLIC_DATA(short int) dax__uses_transfer_isset; +XBT_PUBLIC_DATA(AT_dax__job_version) AX_dax__job_version; +#define A_dax__job_version (dax__bufferstack + AX_dax__job_version) +XBT_PUBLIC_DATA(short int) dax__job_version_isset; +XBT_PUBLIC_DATA(AT_dax__adag_count) AX_dax__adag_count; +#define A_dax__adag_count (dax__bufferstack + AX_dax__adag_count) +XBT_PUBLIC_DATA(short int) dax__adag_count_isset; +XBT_PUBLIC_DATA(AT_dax__uses_optional) AX_dax__uses_optional; +#define A_dax__uses_optional AX_dax__uses_optional +XBT_PUBLIC_DATA(short int) dax__uses_optional_isset; +XBT_PUBLIC_DATA(AT_dax__adag_jobCount) AX_dax__adag_jobCount; +#define A_dax__adag_jobCount (dax__bufferstack + AX_dax__adag_jobCount) +XBT_PUBLIC_DATA(short int) dax__adag_jobCount_isset; /* XML application utilities. */ XBT_PUBLIC(int) dax__element_context(int); diff --git a/src/simgrid/sg_config.c b/src/simgrid/sg_config.c index 5bf6c4aa7a..3fc88bcb1b 100644 --- a/src/simgrid/sg_config.c +++ b/src/simgrid/sg_config.c @@ -20,6 +20,7 @@ #include "simgrid/sg_config.h" #include "smpi/smpi_interface.h" #include "mc/mc.h" +#include "mc/mc_record.h" #include "instr/instr.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_config, surf, @@ -368,10 +369,17 @@ static void _sg_cfg_cb__surf_path(const char *name, int pos) /* callback to decide if we want to use the model-checking */ #include "xbt_modinter.h" + #ifdef HAVE_MC extern int _sg_do_model_check; /* this variable lives in xbt_main until I find a right location for it */ +extern int _sg_do_model_check_record; #endif +static void _sg_cfg_cb_model_check_replay(const char *name, int pos) +{ + MC_record_path = xbt_cfg_get_string(_sg_cfg_set, name); +} + static void _sg_cfg_cb_model_check(const char *name, int pos) { #ifdef HAVE_MC @@ -383,6 +391,17 @@ static void _sg_cfg_cb_model_check(const char *name, int pos) #endif } +static void _sg_cfg_cb_model_check_record(const char *name, int pos) +{ +#ifdef HAVE_MC + _sg_do_model_check_record = xbt_cfg_get_boolean(_sg_cfg_set, name); +#else + if (xbt_cfg_get_boolean(_sg_cfg_set, name)) { + xbt_die("You tried to activate the model-checking record from the command line, but it was not compiled in. Change your settings in cmake, recompile and try again"); + } +#endif +} + extern int _sg_do_verbose_exit; static void _sg_cfg_cb_verbose_exit(const char *name, int pos) @@ -603,6 +622,11 @@ void sg_config_init(int *argc, char **argv) xbt_cfgelm_boolean, 1, 1, NULL, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/maxmin_selective_update", "no"); + /* Replay (this part is enabled event if MC it disabled) */ + xbt_cfg_register(&_sg_cfg_set, "model-check/replay", + "Uenable replay mode with the given path", + xbt_cfgelm_string, 0, 1, _sg_cfg_cb_model_check_replay, NULL); + #ifdef HAVE_MC /* do model-checking */ xbt_cfg_register(&_sg_cfg_set, "model-check", @@ -610,6 +634,12 @@ void sg_config_init(int *argc, char **argv) xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb_model_check, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check", "no"); + /* do model-checking-record */ + xbt_cfg_register(&_sg_cfg_set, "model-check/record", + "Record the model-checking paths", + xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb_model_check_record, NULL); + xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/record", "no"); + /* do stateful model-checking */ xbt_cfg_register(&_sg_cfg_set, "model-check/checkpoint", "Specify the amount of steps between checkpoints during stateful model-checking (default: 0 => stateless verification). " @@ -781,6 +811,27 @@ void sg_config_init(int *argc, char **argv) xbt_cfg_setdefault_string(_sg_cfg_set, "ns3/TcpModel", "default"); #endif + //For smpi/bw_factor and smpi/lat_factor + //Default value have to be "threshold0:value0;threshold1:value1;...;thresholdN:valueN" + //test is if( size >= thresholdN ) return valueN; + //Values can be modified with command line --cfg=smpi/bw_factor:"threshold0:value0;threshold1:value1;...;thresholdN:valueN" + // or with tag config put line + // SMPI model can be used without enable_smpi, so keep this the ifdef. + xbt_cfg_register(&_sg_cfg_set, "smpi/bw_factor", + "Bandwidth factors for smpi.", + xbt_cfgelm_string, 1, 1, NULL, NULL); + xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/bw_factor", "65472:0.940694;15424:0.697866;9376:0.58729;5776:1.08739;3484:0.77493;1426:0.608902;732:0.341987;257:0.338112;0:0.812084"); + + xbt_cfg_register(&_sg_cfg_set, "smpi/lat_factor", + "Latency factors for smpi.", + xbt_cfgelm_string, 1, 1, NULL, NULL); + xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/lat_factor", "65472:11.6436;15424:3.48845;9376:2.59299;5776:2.18796;3484:1.88101;1426:1.61075;732:1.9503;257:1.95341;0:2.01467"); + + xbt_cfg_register(&_sg_cfg_set, "smpi/IB_penalty_factors", + "Correction factor to communications using Infiniband model with contention (default value based on Stampede cluster profiling)", + xbt_cfgelm_string, 1, 1, NULL, NULL); + xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/IB_penalty_factors", "0.965;0.925;1.35"); + #ifdef HAVE_SMPI xbt_cfg_register(&_sg_cfg_set, "smpi/running_power", "Power of the host running the simulation (in flop/s). Used to bench the operations.", @@ -822,21 +873,6 @@ void sg_config_init(int *argc, char **argv) xbt_cfgelm_boolean, 1, 1, NULL, NULL); xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/privatize_global_variables", "no"); - //For smpi/bw_factor and smpi/lat_factor - //Default value have to be "threshold0:value0;threshold1:value1;...;thresholdN:valueN" - //test is if( size >= thresholdN ) return valueN; - //Values can be modified with command line --cfg=smpi/bw_factor:"threshold0:value0;threshold1:value1;...;thresholdN:valueN" - // or with tag config put line - xbt_cfg_register(&_sg_cfg_set, "smpi/bw_factor", - "Bandwidth factors for smpi.", - xbt_cfgelm_string, 1, 1, NULL, NULL); - xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/bw_factor", "65472:0.940694;15424:0.697866;9376:0.58729;5776:1.08739;3484:0.77493;1426:0.608902;732:0.341987;257:0.338112;0:0.812084"); - - xbt_cfg_register(&_sg_cfg_set, "smpi/lat_factor", - "Latency factors for smpi.", - xbt_cfgelm_string, 1, 1, NULL, NULL); - xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/lat_factor", "65472:11.6436;15424:3.48845;9376:2.59299;5776:2.18796;3484:1.88101;1426:1.61075;732:1.9503;257:1.95341;0:2.01467"); - xbt_cfg_register(&_sg_cfg_set, "smpi/os", "Small messages timings (MPI_Send minimum time for small messages)", xbt_cfgelm_string, 1, 1, NULL, NULL); diff --git a/src/simix/README_attempt_without_stack b/src/simix/README_attempt_without_stack index a7b145fad7..1652308da7 100644 --- a/src/simix/README_attempt_without_stack +++ b/src/simix/README_attempt_without_stack @@ -66,7 +66,7 @@ simcall_* functions). Moreover, you must know that each blocking simcall will result in an interruption of your execution flow. Let's take an example: If your code contains: - smx_action_t act = simcall_comm_isend(......); + smx_synchro_t act = simcall_comm_isend(......); simcall_comm_wait(act); simcall_comm_destroy(act); diff --git a/src/simix/smx_user.c b/src/simix/libsmx.c similarity index 82% rename from src/simix/smx_user.c rename to src/simix/libsmx.c index 7a0f5d1c7d..eb50d4df4c 100644 --- a/src/simix/smx_user.c +++ b/src/simix/libsmx.c @@ -1,25 +1,23 @@ -/* smx_user.c - public interface to simix */ +/* libsmx.c - public interface to simix */ +/* -------- */ +/* These functions are the only ones that are visible from the higher levels */ +/* (most of them simply add some documentation to the generated simcall body) */ +/* */ +/* This is somehow the "libc" of SimGrid */ -/* Copyright (c) 2010-2014. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2010-2014. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ + * under the terms of the license (GNU LGPL) which comes with this package. */ #include "smx_private.h" -#include "mc/mc.h" +#include "mc/mc_interface.h" #include "xbt/ex.h" #include /* isfinite() */ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix); -/* generate strings from the enumeration values */ -static const char* simcall_names[] = { -#include "simcalls_generated_string.c" -[SIMCALL_NONE] = "NONE" -}; - -#include "simcalls_generated_body.c" +#include "popping_bodies.c" /** * \ingroup simix_host_management @@ -197,7 +195,6 @@ int simcall_host_get_nb_pstates(smx_host_t host) * * \param host A SIMIX host * \param pstate_index The pstate to which the CPU power will be set - * \return void */ void simcall_host_set_power_peak_at(smx_host_t host, int pstate_index) { @@ -219,20 +216,20 @@ double simcall_host_get_consumed_energy(smx_host_t host) /** * \ingroup simix_host_management - * \brief Creates an action that executes some computation of an host. + * \brief Creates a synchro that executes some computation of an host. * * This function creates a SURF action and allocates the data necessary - * to create the SIMIX action. It can raise a host_error exception if the host crashed. + * to create the SIMIX synchro. It can raise a host_error exception if the host crashed. * - * \param name Name of the execution action to create - * \param host SIMIX host where the action will be executed + * \param name Name of the execution synchro to create + * \param host SIMIX host where the synchro will be executed * \param computation_amount amount Computation amount (in bytes) * \param priority computation priority * \param bound * \param affinity_mask - * \return A new SIMIX execution action + * \return A new SIMIX execution synchronization */ -smx_action_t simcall_host_execute(const char *name, smx_host_t host, +smx_synchro_t simcall_host_execute(const char *name, smx_host_t host, double computation_amount, double priority, double bound, unsigned long affinity_mask) { @@ -245,20 +242,20 @@ smx_action_t simcall_host_execute(const char *name, smx_host_t host, /** * \ingroup simix_host_management - * \brief Creates an action that may involve parallel computation on + * \brief Creates a synchro that may involve parallel computation on * several hosts and communication between them. * - * \param name Name of the execution action to create - * \param host_nb Number of hosts where the action will be executed - * \param host_list Array (of size host_nb) of hosts where the action will be executed + * \param name Name of the execution synchro to create + * \param host_nb Number of hosts where the synchro will be executed + * \param host_list Array (of size host_nb) of hosts where the synchro will be executed * \param computation_amount Array (of size host_nb) of computation amount of hosts (in bytes) * \param communication_amount Array (of size host_nb * host_nb) representing the communication * amount between each pair of hosts * \param amount the SURF action amount * \param rate the SURF action rate - * \return A new SIMIX execution action + * \return A new SIMIX execution synchronization */ -smx_action_t simcall_host_parallel_execute(const char *name, +smx_synchro_t simcall_host_parallel_execute(const char *name, int host_nb, smx_host_t *host_list, double *computation_amount, @@ -288,61 +285,61 @@ smx_action_t simcall_host_parallel_execute(const char *name, /** * \ingroup simix_host_management - * \brief Destroys an execution action. + * \brief Destroys an execution synchro. * - * Destroys an action, freing its memory. This function cannot be called if there are a conditional waiting for it. - * \param execution The execution action to destroy + * Destroys a synchro, freeing its memory. This function cannot be called if there are a conditional waiting for it. + * \param execution The execution synchro to destroy */ -void simcall_host_execution_destroy(smx_action_t execution) +void simcall_host_execution_destroy(smx_synchro_t execution) { simcall_BODY_host_execution_destroy(execution); } /** * \ingroup simix_host_management - * \brief Cancels an execution action. + * \brief Cancels an execution synchro. * * This functions stops the execution. It calls a surf function. - * \param execution The execution action to cancel + * \param execution The execution synchro to cancel */ -void simcall_host_execution_cancel(smx_action_t execution) +void simcall_host_execution_cancel(smx_synchro_t execution) { simcall_BODY_host_execution_cancel(execution); } /** * \ingroup simix_host_management - * \brief Returns how much of an execution action remains to be done. + * \brief Returns how much of an execution synchro remains to be done. * - * \param execution The execution action + * \param execution The execution synchro * \return The remaining amount */ -double simcall_host_execution_get_remains(smx_action_t execution) +double simcall_host_execution_get_remains(smx_synchro_t execution) { return simcall_BODY_host_execution_get_remains(execution); } /** * \ingroup simix_host_management - * \brief Returns the state of an execution action. + * \brief Returns the state of an execution synchro. * - * \param execution The execution action + * \param execution The execution synchro * \return The state */ -e_smx_state_t simcall_host_execution_get_state(smx_action_t execution) +e_smx_state_t simcall_host_execution_get_state(smx_synchro_t execution) { return simcall_BODY_host_execution_get_state(execution); } /** * \ingroup simix_host_management - * \brief Changes the priority of an execution action. + * \brief Changes the priority of an execution synchro. * * This functions changes the priority only. It calls a surf function. - * \param execution The execution action + * \param execution The execution synchro * \param priority The new priority */ -void simcall_host_execution_set_priority(smx_action_t execution, double priority) +void simcall_host_execution_set_priority(smx_synchro_t execution, double priority) { /* checking for infinite values */ xbt_assert(isfinite(priority), "priority is not finite!"); @@ -352,38 +349,38 @@ void simcall_host_execution_set_priority(smx_action_t execution, double priority /** * \ingroup simix_host_management - * \brief Changes the capping (the maximum CPU utilization) of an execution action. + * \brief Changes the capping (the maximum CPU utilization) of an execution synchro. * * This functions changes the capping only. It calls a surf function. - * \param execution The execution action + * \param execution The execution synchro * \param bound The new bound */ -void simcall_host_execution_set_bound(smx_action_t execution, double bound) +void simcall_host_execution_set_bound(smx_synchro_t execution, double bound) { simcall_BODY_host_execution_set_bound(execution, bound); } /** * \ingroup simix_host_management - * \brief Changes the CPU affinity of an execution action. + * \brief Changes the CPU affinity of an execution synchro. * - * This functions changes the CPU affinity of an execution action. See taskset(1) on Linux. - * \param execution The execution action + * This functions changes the CPU affinity of an execution synchro. See taskset(1) on Linux. + * \param execution The execution synchro * \param host Host * \param mask Affinity mask */ -void simcall_host_execution_set_affinity(smx_action_t execution, smx_host_t host, unsigned long mask) +void simcall_host_execution_set_affinity(smx_synchro_t execution, smx_host_t host, unsigned long mask) { simcall_BODY_host_execution_set_affinity(execution, host, mask); } /** * \ingroup simix_host_management - * \brief Waits for the completion of an execution action and destroy it. + * \brief Waits for the completion of an execution synchro and destroy it. * - * \param execution The execution action + * \param execution The execution synchro */ -e_smx_state_t simcall_host_execution_wait(smx_action_t execution) +e_smx_state_t simcall_host_execution_wait(smx_synchro_t execution) { return simcall_BODY_host_execution_wait(execution); } @@ -399,7 +396,6 @@ e_smx_state_t simcall_host_execution_wait(smx_action_t execution) * \return The host object of the VM */ void* simcall_vm_create(const char *name, smx_host_t phys_host){ - /* will jump to SIMIX_pre_vm_create() in src/simix/smx_smurf_private.h */ return simcall_BODY_vm_create(name, phys_host); } @@ -411,7 +407,6 @@ void* simcall_vm_create(const char *name, smx_host_t phys_host){ */ void simcall_vm_start(smx_host_t vm) { - /* will jump to SIMIX_pre_vm_start in src/simix/smx_smurf_private.h */ simcall_BODY_vm_start(vm); } @@ -424,7 +419,6 @@ void simcall_vm_start(smx_host_t vm) */ int simcall_vm_get_state(smx_host_t vm) { - /* will jump to SIMIX_pre_vm_get_state in src/simix/smx_smurf_private.h */ return simcall_BODY_vm_get_state(vm); } @@ -437,31 +431,26 @@ int simcall_vm_get_state(smx_host_t vm) */ void *simcall_vm_get_pm(smx_host_t vm) { - /* will jump to SIMIX_pre_vm_get_pm in src/simix/smx_smurf_private.h */ return simcall_BODY_vm_get_pm(vm); } void simcall_vm_set_bound(smx_host_t vm, double bound) { - /* will jump to SIMIX_pre_vm_set_bound in src/simix/smx_smurf_private.h */ simcall_BODY_vm_set_bound(vm, bound); } void simcall_vm_set_affinity(smx_host_t vm, smx_host_t pm, unsigned long mask) { - /* will jump to SIMIX_pre_vm_set_affinity in src/simix/smx_smurf_private.h */ simcall_BODY_vm_set_affinity(vm, pm, mask); } void simcall_host_get_params(smx_host_t vm, ws_params_t params) { - /* will jump to SIMIX_pre_host_get_params in src/simix/smx_smurf_private.h */ simcall_BODY_host_get_params(vm, params); } void simcall_host_set_params(smx_host_t vm, ws_params_t params) { - /* will jump to SIMIX_pre_host_set_params in src/simix/smx_smurf_private.h */ simcall_BODY_host_set_params(vm, params); } @@ -474,7 +463,6 @@ void simcall_host_set_params(smx_host_t vm, ws_params_t params) */ void simcall_vm_migrate(smx_host_t vm, smx_host_t host) { - /* will jump to SIMIX_pre_vm_migrate in src/simix/smx_smurf_private.h */ simcall_BODY_vm_migrate(vm, host); } @@ -486,7 +474,6 @@ void simcall_vm_migrate(smx_host_t vm, smx_host_t host) */ void simcall_vm_suspend(smx_host_t vm) { - /* will jump to SIMIX_pre_vm_suspend in src/simix/smx_smurf_private.h */ simcall_BODY_vm_suspend(vm); } @@ -498,7 +485,6 @@ void simcall_vm_suspend(smx_host_t vm) */ void simcall_vm_resume(smx_host_t vm) { - /* will jump to SIMIX_pre_vm_resume in src/simix/smx_smurf_private.h */ simcall_BODY_vm_resume(vm); } @@ -510,7 +496,6 @@ void simcall_vm_resume(smx_host_t vm) */ void simcall_vm_save(smx_host_t vm) { - /* will jump to SIMIX_pre_vm_save in src/simix/smx_smurf_private.h */ simcall_BODY_vm_save(vm); } @@ -522,7 +507,6 @@ void simcall_vm_save(smx_host_t vm) */ void simcall_vm_restore(smx_host_t vm) { - /* will jump to SIMIX_pre_vm_restore in src/simix/smx_smurf_private.h */ simcall_BODY_vm_restore(vm); } @@ -534,7 +518,6 @@ void simcall_vm_restore(smx_host_t vm) */ void simcall_vm_shutdown(smx_host_t vm) { - /* will jump to SIMIX_pre_vm_shutdown in src/simix/smx_smurf_private.h */ simcall_BODY_vm_shutdown(vm); } @@ -546,7 +529,6 @@ void simcall_vm_shutdown(smx_host_t vm) */ void simcall_vm_destroy(smx_host_t vm) { - /* will jump to SIMIX_pre_vm_destroy in src/simix/smx_smurf_private.h */ simcall_BODY_vm_destroy(vm); } @@ -638,7 +620,7 @@ void simcall_process_join(smx_process_t process, double timeout) * \ingroup simix_process_management * \brief Suspends a process. * - * This function suspends the process by suspending the action + * This function suspends the process by suspending the synchro * it was waiting for completion. * * \param process a SIMIX process @@ -654,7 +636,7 @@ void simcall_process_suspend(smx_process_t process) * \ingroup simix_process_management * \brief Resumes a suspended process. * - * This function resumes a suspended process by resuming the action + * This function resumes a suspended process by resuming the synchro * it was waiting for completion. * * \param process a SIMIX process @@ -844,11 +826,11 @@ XBT_PUBLIC(smx_process_t) simcall_process_restart(smx_process_t process) } /** * \ingroup simix_process_management - * \brief Creates a new sleep SIMIX action. + * \brief Creates a new sleep SIMIX synchro. * * This function creates a SURF action and allocates the data necessary - * to create the SIMIX action. It can raise a host_error exception if the - * host crashed. The default SIMIX name of the action is "sleep". + * to create the SIMIX synchro. It can raise a host_error exception if the + * host crashed. The default SIMIX name of the synchro is "sleep". * * \param duration Time duration of the sleep. * \return A result telling whether the sleep was successful @@ -898,11 +880,11 @@ smx_rdv_t simcall_rdv_get_by_name(const char *name) /** * \ingroup simix_rdv_management - * \brief Counts the number of communication actions of a given host pending + * \brief Counts the number of communication synchros of a given host pending * on a rendez-vous point. * \param rdv The rendez-vous point * \param host The host to be counted - * \return The number of comm actions pending in the rdv + * \return The number of comm synchros pending in the rdv */ int simcall_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host) { @@ -915,7 +897,7 @@ int simcall_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host) * \param rdv The rendez-vous point * \return The communication or NULL if empty */ -smx_action_t simcall_rdv_get_head(smx_rdv_t rdv) +smx_synchro_t simcall_rdv_get_head(smx_rdv_t rdv) { return simcall_BODY_rdv_get_head(rdv); } @@ -935,8 +917,8 @@ smx_process_t simcall_rdv_get_receiver(smx_rdv_t rdv) */ void simcall_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void *src_buff, size_t src_buff_size, - int (*match_fun)(void *, void *, smx_action_t), - void (*copy_data_fun)(smx_action_t, void*, size_t), void *data, + int (*match_fun)(void *, void *, smx_synchro_t), + void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double timeout) { /* checking for infinite values */ @@ -946,9 +928,9 @@ void simcall_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, doubl xbt_assert(rdv, "No rendez-vous point defined for send"); - if (MC_is_active()) { + if (MC_is_active() || MC_record_replay_is_active()) { /* the model-checker wants two separate simcalls */ - smx_action_t comm = NULL; /* MC needs the comm to be set to NULL during the simcall */ + smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simcall */ comm = simcall_comm_isend(src, rdv, task_size, rate, src_buff, src_buff_size, match_fun, NULL, copy_data_fun, data, 0); simcall_comm_wait(comm, timeout); @@ -963,11 +945,11 @@ void simcall_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, doubl /** * \ingroup simix_comm_management */ -smx_action_t simcall_comm_isend(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, +smx_synchro_t simcall_comm_isend(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void *src_buff, size_t src_buff_size, - int (*match_fun)(void *, void *, smx_action_t), + int (*match_fun)(void *, void *, smx_synchro_t), void (*clean_fun)(void *), - void (*copy_data_fun)(smx_action_t, void*, size_t), + void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, int detached) { @@ -986,16 +968,16 @@ smx_action_t simcall_comm_isend(smx_process_t src, smx_rdv_t rdv, double task_si * \ingroup simix_comm_management */ void simcall_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, - int (*match_fun)(void *, void *, smx_action_t), - void (*copy_data_fun)(smx_action_t, void*, size_t), + int (*match_fun)(void *, void *, smx_synchro_t), + void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double timeout, double rate) { xbt_assert(isfinite(timeout), "timeout is not finite!"); xbt_assert(rdv, "No rendez-vous point defined for recv"); - if (MC_is_active()) { + if (MC_is_active() || MC_record_replay_is_active()) { /* the model-checker wants two separate simcalls */ - smx_action_t comm = NULL; /* MC needs the comm to be set to NULL during the simcall */ + smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simcall */ comm = simcall_comm_irecv(rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); simcall_comm_wait(comm, timeout); @@ -1009,9 +991,9 @@ void simcall_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, /** * \ingroup simix_comm_management */ -smx_action_t simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_size, - int (*match_fun)(void *, void *, smx_action_t), - void (*copy_data_fun)(smx_action_t, void*, size_t), +smx_synchro_t simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_size, + int (*match_fun)(void *, void *, smx_synchro_t), + void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double rate) { xbt_assert(rdv, "No rendez-vous point defined for irecv"); @@ -1023,8 +1005,8 @@ smx_action_t simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_ /** * \ingroup simix_comm_management */ -smx_action_t simcall_comm_iprobe(smx_rdv_t rdv, int type, int src, int tag, - int (*match_fun)(void *, void *, smx_action_t), void *data) +smx_synchro_t simcall_comm_iprobe(smx_rdv_t rdv, int type, int src, int tag, + int (*match_fun)(void *, void *, smx_synchro_t), void *data) { xbt_assert(rdv, "No rendez-vous point defined for iprobe"); @@ -1034,7 +1016,7 @@ smx_action_t simcall_comm_iprobe(smx_rdv_t rdv, int type, int src, int tag, /** * \ingroup simix_comm_management */ -void simcall_comm_cancel(smx_action_t comm) +void simcall_comm_cancel(smx_synchro_t comm) { simcall_BODY_comm_cancel(comm); } @@ -1060,7 +1042,7 @@ int simcall_comm_testany(xbt_dynar_t comms) /** * \ingroup simix_comm_management */ -void simcall_comm_wait(smx_action_t comm, double timeout) +void simcall_comm_wait(smx_synchro_t comm, double timeout) { xbt_assert(isfinite(timeout), "timeout is not finite!"); simcall_BODY_comm_wait(comm, timeout); @@ -1068,18 +1050,18 @@ void simcall_comm_wait(smx_action_t comm, double timeout) #ifdef HAVE_TRACING /** - * \brief Set the category of an action. + * \brief Set the category of an synchro. * * This functions changes the category only. It calls a surf function. - * \param execution The execution action + * \param execution The execution synchro * \param category The tracing category */ -void simcall_set_category(smx_action_t action, const char *category) +void simcall_set_category(smx_synchro_t synchro, const char *category) { if (category == NULL) { return; } - simcall_BODY_set_category(action, category); + simcall_BODY_set_category(synchro, category); } #endif @@ -1087,7 +1069,7 @@ void simcall_set_category(smx_action_t action, const char *category) * \ingroup simix_comm_management * */ -int simcall_comm_test(smx_action_t comm) +int simcall_comm_test(smx_synchro_t comm) { return simcall_BODY_comm_test(comm); } @@ -1096,7 +1078,7 @@ int simcall_comm_test(smx_action_t comm) * \ingroup simix_comm_management * */ -double simcall_comm_get_remains(smx_action_t comm) +double simcall_comm_get_remains(smx_synchro_t comm) { return simcall_BODY_comm_get_remains(comm); } @@ -1105,7 +1087,7 @@ double simcall_comm_get_remains(smx_action_t comm) * \ingroup simix_comm_management * */ -e_smx_state_t simcall_comm_get_state(smx_action_t comm) +e_smx_state_t simcall_comm_get_state(smx_synchro_t comm) { return simcall_BODY_comm_get_state(comm); } @@ -1114,7 +1096,7 @@ e_smx_state_t simcall_comm_get_state(smx_action_t comm) * \ingroup simix_comm_management * */ -void *simcall_comm_get_src_data(smx_action_t comm) +void *simcall_comm_get_src_data(smx_synchro_t comm) { return simcall_BODY_comm_get_src_data(comm); } @@ -1123,7 +1105,7 @@ void *simcall_comm_get_src_data(smx_action_t comm) * \ingroup simix_comm_management * */ -void *simcall_comm_get_dst_data(smx_action_t comm) +void *simcall_comm_get_dst_data(smx_synchro_t comm) { return simcall_BODY_comm_get_dst_data(comm); } @@ -1132,7 +1114,7 @@ void *simcall_comm_get_dst_data(smx_action_t comm) * \ingroup simix_comm_management * */ -smx_process_t simcall_comm_get_src_proc(smx_action_t comm) +smx_process_t simcall_comm_get_src_proc(smx_synchro_t comm) { return simcall_BODY_comm_get_src_proc(comm); } @@ -1141,13 +1123,13 @@ smx_process_t simcall_comm_get_src_proc(smx_action_t comm) * \ingroup simix_comm_management * */ -smx_process_t simcall_comm_get_dst_proc(smx_action_t comm) +smx_process_t simcall_comm_get_dst_proc(smx_synchro_t comm) { return simcall_BODY_comm_get_dst_proc(comm); } #ifdef HAVE_LATENCY_BOUND_TRACKING -int simcall_comm_is_latency_bounded(smx_action_t comm) +int simcall_comm_is_latency_bounded(smx_synchro_t comm) { return simcall_BODY_comm_is_latency_bounded(comm); } @@ -1477,37 +1459,22 @@ xbt_dict_t simcall_storage_get_content(smx_storage_t storage) return simcall_BODY_storage_get_content(storage); } + + #ifdef HAVE_MC -void *simcall_mc_snapshot(void) -{ +void *simcall_mc_snapshot(void) { return simcall_BODY_mc_snapshot(); } -int simcall_mc_compare_snapshots(void *s1, void *s2){ +int simcall_mc_compare_snapshots(void *s1, void *s2) { return simcall_BODY_mc_compare_snapshots(s1, s2); } -int simcall_mc_random(int min, int max) -{ - return simcall_BODY_mc_random(min, max); -} - - #endif /* HAVE_MC */ -/* ****************************************************************************************** */ -/* TUTORIAL: New API */ -/* All functions for simcall */ -/* ****************************************************************************************** */ -int simcall_new_api_fct(const char* param1, double param2){ - smx_simcall_t simcall = SIMIX_simcall_mine(); - simcall->call = SIMCALL_NEW_API_INIT; - simcall->new_api.param1 = param1; - simcall->new_api.param2 = param2; - - SIMIX_simcall_push(simcall->issuer); - return simcall->new_api.result; +int simcall_mc_random(int min, int max) { + return simcall_BODY_mc_random(min, max); } /* ************************************************************************** */ diff --git a/src/simix/popping.c b/src/simix/popping.c new file mode 100644 index 0000000000..0d510c5dbf --- /dev/null +++ b/src/simix/popping.c @@ -0,0 +1,61 @@ +/* Copyright (c) 2010-2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include "smx_private.h" +#include "xbt/fifo.h" +#include "xbt/xbt_os_thread.h" +#ifdef HAVE_MC +#include "mc/mc_private.h" +#endif + +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_popping, simix, + "Popping part of SIMIX (transmuting from user request into kernel handlers)"); + +void SIMIX_simcall_answer(smx_simcall_t simcall) +{ + if (simcall->issuer != simix_global->maestro_process){ + XBT_DEBUG("Answer simcall %s (%d) issued by %s (%p)", SIMIX_simcall_name(simcall->call), (int)simcall->call, + simcall->issuer->name, simcall->issuer); + simcall->issuer->simcall.call = SIMCALL_NONE; +/* This check should be useless and slows everyone. Reactivate if you see something + * weird in process scheduling. + */ +/* if(!xbt_dynar_member(simix_global->process_to_run, &(simcall->issuer))) */ + xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, simcall->issuer); +/* else DIE_IMPOSSIBLE; */ + } +} + +void SIMIX_simcall_exit(smx_synchro_t synchro) +{ + switch (synchro->type) { + + case SIMIX_SYNC_EXECUTE: + case SIMIX_SYNC_PARALLEL_EXECUTE: + SIMIX_post_host_execute(synchro); + break; + + case SIMIX_SYNC_COMMUNICATE: + SIMIX_post_comm(synchro); + break; + + case SIMIX_SYNC_SLEEP: + SIMIX_post_process_sleep(synchro); + break; + + case SIMIX_SYNC_JOIN: + SIMIX_post_process_sleep(synchro); + break; + + case SIMIX_SYNC_SYNCHRO: + SIMIX_post_synchro(synchro); + break; + + case SIMIX_SYNC_IO: + SIMIX_post_io(synchro); + break; + } +} diff --git a/src/simix/simcalls_generated_args_getter_setter.h b/src/simix/popping_accessors.h similarity index 53% rename from src/simix/simcalls_generated_args_getter_setter.h rename to src/simix/popping_accessors.h index 9a9635eca5..de024d6e24 100644 --- a/src/simix/simcalls_generated_args_getter_setter.h +++ b/src/simix/popping_accessors.h @@ -1,1309 +1,1945 @@ -/********************************************* - * File Generated by src/simix/simcalls.py * - * from src/simix/simcalls.in * - * Do not modify this file, add new simcalls * - * in src/simix/simcalls.in * - *********************************************/ - -static inline const char* simcall_host_get_by_name__get__name(smx_simcall_t simcall){ +/**********************************************************************/ +/* File generated by src/simix/simcalls.py from src/simix/simcalls.in */ +/* */ +/* DO NOT EVER CHANGE THIS FILE */ +/* */ +/* change simcalls specification in src/simix/simcalls.in */ +/**********************************************************************/ + +/* + * Note that the name comes from http://en.wikipedia.org/wiki/Popping + * Indeed, the control flow is doing a strange dance in there. + * + * That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :) + */ + + +static inline const char* simcall_host_get_by_name__get__name(smx_simcall_t simcall) { return simcall->args[0].cc; } -static inline void simcall_host_get_by_name__set__name(smx_simcall_t simcall, const char* arg){ +static inline void simcall_host_get_by_name__set__name(smx_simcall_t simcall, const char* arg) { simcall->args[0].cc = arg; } -static inline smx_host_t simcall_host_get_name__get__host(smx_simcall_t simcall){ +static inline smx_host_t simcall_host_get_by_name__get__result(smx_simcall_t simcall){ + return (smx_host_t) simcall->result.dp; +} +static inline void simcall_host_get_by_name__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_host_t simcall_host_get_name__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_get_name__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_name__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_on__get__host(smx_simcall_t simcall){ +static inline const char* simcall_host_get_name__get__result(smx_simcall_t simcall){ + return simcall->result.cc; +} +static inline void simcall_host_get_name__set__result(smx_simcall_t simcall, const char* result){ + simcall->result.cc = result; +} + +static inline smx_host_t simcall_host_on__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_on__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_on__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_off__get__host(smx_simcall_t simcall){ + +static inline smx_host_t simcall_host_off__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_off__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_off__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_get_properties__get__host(smx_simcall_t simcall){ + +static inline smx_host_t simcall_host_get_properties__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_get_properties__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_properties__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_get_core__get__host(smx_simcall_t simcall){ +static inline xbt_dict_t simcall_host_get_properties__get__result(smx_simcall_t simcall){ + return (xbt_dict_t) simcall->result.dp; +} +static inline void simcall_host_get_properties__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_host_t simcall_host_get_core__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_get_core__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_core__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_get_process_list__get__host(smx_simcall_t simcall){ +static inline int simcall_host_get_core__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_host_get_core__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_host_t simcall_host_get_process_list__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_get_process_list__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_process_list__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_get_speed__get__host(smx_simcall_t simcall){ +static inline xbt_swag_t simcall_host_get_process_list__get__result(smx_simcall_t simcall){ + return (xbt_swag_t) simcall->result.dp; +} +static inline void simcall_host_get_process_list__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_host_t simcall_host_get_speed__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_get_speed__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_speed__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_get_available_speed__get__host(smx_simcall_t simcall){ +static inline double simcall_host_get_speed__get__result(smx_simcall_t simcall){ + return simcall->result.d; +} +static inline void simcall_host_get_speed__set__result(smx_simcall_t simcall, double result){ + simcall->result.d = result; +} + +static inline smx_host_t simcall_host_get_available_speed__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_get_available_speed__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_available_speed__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_get_state__get__host(smx_simcall_t simcall){ +static inline double simcall_host_get_available_speed__get__result(smx_simcall_t simcall){ + return simcall->result.d; +} +static inline void simcall_host_get_available_speed__set__result(smx_simcall_t simcall, double result){ + simcall->result.d = result; +} + +static inline smx_host_t simcall_host_get_state__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_get_state__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_state__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_get_current_power_peak__get__host(smx_simcall_t simcall){ +static inline int simcall_host_get_state__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_host_get_state__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_host_t simcall_host_get_current_power_peak__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_get_current_power_peak__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_current_power_peak__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_get_power_peak_at__get__host(smx_simcall_t simcall){ +static inline double simcall_host_get_current_power_peak__get__result(smx_simcall_t simcall){ + return simcall->result.d; +} +static inline void simcall_host_get_current_power_peak__set__result(smx_simcall_t simcall, double result){ + simcall->result.d = result; +} + +static inline smx_host_t simcall_host_get_power_peak_at__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_get_power_peak_at__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_power_peak_at__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline int simcall_host_get_power_peak_at__get__pstate_index(smx_simcall_t simcall){ +static inline int simcall_host_get_power_peak_at__get__pstate_index(smx_simcall_t simcall) { return simcall->args[1].i; } -static inline void simcall_host_get_power_peak_at__set__pstate_index(smx_simcall_t simcall, int arg){ +static inline void simcall_host_get_power_peak_at__set__pstate_index(smx_simcall_t simcall, int arg) { simcall->args[1].i = arg; } -static inline smx_host_t simcall_host_get_nb_pstates__get__host(smx_simcall_t simcall){ +static inline double simcall_host_get_power_peak_at__get__result(smx_simcall_t simcall){ + return simcall->result.d; +} +static inline void simcall_host_get_power_peak_at__set__result(smx_simcall_t simcall, double result){ + simcall->result.d = result; +} + +static inline smx_host_t simcall_host_get_nb_pstates__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_get_nb_pstates__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_nb_pstates__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_set_power_peak_at__get__host(smx_simcall_t simcall){ +static inline int simcall_host_get_nb_pstates__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_host_get_nb_pstates__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_host_t simcall_host_set_power_peak_at__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_set_power_peak_at__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_set_power_peak_at__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline int simcall_host_set_power_peak_at__get__pstate_index(smx_simcall_t simcall){ +static inline int simcall_host_set_power_peak_at__get__pstate_index(smx_simcall_t simcall) { return simcall->args[1].i; } -static inline void simcall_host_set_power_peak_at__set__pstate_index(smx_simcall_t simcall, int arg){ +static inline void simcall_host_set_power_peak_at__set__pstate_index(smx_simcall_t simcall, int arg) { simcall->args[1].i = arg; } -static inline smx_host_t simcall_host_get_consumed_energy__get__host(smx_simcall_t simcall){ + +static inline smx_host_t simcall_host_get_consumed_energy__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_get_consumed_energy__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_consumed_energy__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline const char* simcall_host_execute__get__name(smx_simcall_t simcall){ +static inline double simcall_host_get_consumed_energy__get__result(smx_simcall_t simcall){ + return simcall->result.d; +} +static inline void simcall_host_get_consumed_energy__set__result(smx_simcall_t simcall, double result){ + simcall->result.d = result; +} + +static inline const char* simcall_host_execute__get__name(smx_simcall_t simcall) { return simcall->args[0].cc; } -static inline void simcall_host_execute__set__name(smx_simcall_t simcall, const char* arg){ +static inline void simcall_host_execute__set__name(smx_simcall_t simcall, const char* arg) { simcall->args[0].cc = arg; } -static inline smx_host_t simcall_host_execute__get__host(smx_simcall_t simcall){ +static inline smx_host_t simcall_host_execute__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[1].dp; } -static inline void simcall_host_execute__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_execute__set__host(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline double simcall_host_execute__get__computation_amount(smx_simcall_t simcall){ +static inline double simcall_host_execute__get__computation_amount(smx_simcall_t simcall) { return simcall->args[2].d; } -static inline void simcall_host_execute__set__computation_amount(smx_simcall_t simcall, double arg){ +static inline void simcall_host_execute__set__computation_amount(smx_simcall_t simcall, double arg) { simcall->args[2].d = arg; } -static inline double simcall_host_execute__get__priority(smx_simcall_t simcall){ +static inline double simcall_host_execute__get__priority(smx_simcall_t simcall) { return simcall->args[3].d; } -static inline void simcall_host_execute__set__priority(smx_simcall_t simcall, double arg){ +static inline void simcall_host_execute__set__priority(smx_simcall_t simcall, double arg) { simcall->args[3].d = arg; } -static inline double simcall_host_execute__get__bound(smx_simcall_t simcall){ +static inline double simcall_host_execute__get__bound(smx_simcall_t simcall) { return simcall->args[4].d; } -static inline void simcall_host_execute__set__bound(smx_simcall_t simcall, double arg){ +static inline void simcall_host_execute__set__bound(smx_simcall_t simcall, double arg) { simcall->args[4].d = arg; } -static inline unsigned long simcall_host_execute__get__affinity_mask(smx_simcall_t simcall){ +static inline unsigned long simcall_host_execute__get__affinity_mask(smx_simcall_t simcall) { return simcall->args[5].ul; } -static inline void simcall_host_execute__set__affinity_mask(smx_simcall_t simcall, unsigned long arg){ +static inline void simcall_host_execute__set__affinity_mask(smx_simcall_t simcall, unsigned long arg) { simcall->args[5].ul = arg; } -static inline const char* simcall_host_parallel_execute__get__name(smx_simcall_t simcall){ +static inline smx_synchro_t simcall_host_execute__get__result(smx_simcall_t simcall){ + return (smx_synchro_t) simcall->result.dp; +} +static inline void simcall_host_execute__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline const char* simcall_host_parallel_execute__get__name(smx_simcall_t simcall) { return simcall->args[0].cc; } -static inline void simcall_host_parallel_execute__set__name(smx_simcall_t simcall, const char* arg){ +static inline void simcall_host_parallel_execute__set__name(smx_simcall_t simcall, const char* arg) { simcall->args[0].cc = arg; } -static inline int simcall_host_parallel_execute__get__host_nb(smx_simcall_t simcall){ +static inline int simcall_host_parallel_execute__get__host_nb(smx_simcall_t simcall) { return simcall->args[1].i; } -static inline void simcall_host_parallel_execute__set__host_nb(smx_simcall_t simcall, int arg){ +static inline void simcall_host_parallel_execute__set__host_nb(smx_simcall_t simcall, int arg) { simcall->args[1].i = arg; } -static inline smx_host_t* simcall_host_parallel_execute__get__host_list(smx_simcall_t simcall){ +static inline smx_host_t* simcall_host_parallel_execute__get__host_list(smx_simcall_t simcall) { return (smx_host_t*) simcall->args[2].dp; } -static inline void simcall_host_parallel_execute__set__host_list(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_parallel_execute__set__host_list(smx_simcall_t simcall, void* arg) { simcall->args[2].dp = arg; } -static inline double* simcall_host_parallel_execute__get__computation_amount(smx_simcall_t simcall){ +static inline double* simcall_host_parallel_execute__get__computation_amount(smx_simcall_t simcall) { return (double*) simcall->args[3].dp; } -static inline void simcall_host_parallel_execute__set__computation_amount(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_parallel_execute__set__computation_amount(smx_simcall_t simcall, void* arg) { simcall->args[3].dp = arg; } -static inline double* simcall_host_parallel_execute__get__communication_amount(smx_simcall_t simcall){ +static inline double* simcall_host_parallel_execute__get__communication_amount(smx_simcall_t simcall) { return (double*) simcall->args[4].dp; } -static inline void simcall_host_parallel_execute__set__communication_amount(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_parallel_execute__set__communication_amount(smx_simcall_t simcall, void* arg) { simcall->args[4].dp = arg; } -static inline double simcall_host_parallel_execute__get__amount(smx_simcall_t simcall){ +static inline double simcall_host_parallel_execute__get__amount(smx_simcall_t simcall) { return simcall->args[5].d; } -static inline void simcall_host_parallel_execute__set__amount(smx_simcall_t simcall, double arg){ +static inline void simcall_host_parallel_execute__set__amount(smx_simcall_t simcall, double arg) { simcall->args[5].d = arg; } -static inline double simcall_host_parallel_execute__get__rate(smx_simcall_t simcall){ +static inline double simcall_host_parallel_execute__get__rate(smx_simcall_t simcall) { return simcall->args[6].d; } -static inline void simcall_host_parallel_execute__set__rate(smx_simcall_t simcall, double arg){ +static inline void simcall_host_parallel_execute__set__rate(smx_simcall_t simcall, double arg) { simcall->args[6].d = arg; } -static inline smx_action_t simcall_host_execution_destroy__get__execution(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; +static inline smx_synchro_t simcall_host_parallel_execute__get__result(smx_simcall_t simcall){ + return (smx_synchro_t) simcall->result.dp; +} +static inline void simcall_host_parallel_execute__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_synchro_t simcall_host_execution_destroy__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; } -static inline void simcall_host_execution_destroy__set__execution(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_execution_destroy__set__execution(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_action_t simcall_host_execution_cancel__get__execution(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; + +static inline smx_synchro_t simcall_host_execution_cancel__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; } -static inline void simcall_host_execution_cancel__set__execution(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_execution_cancel__set__execution(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_action_t simcall_host_execution_get_remains__get__execution(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; + +static inline smx_synchro_t simcall_host_execution_get_remains__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; } -static inline void simcall_host_execution_get_remains__set__execution(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_execution_get_remains__set__execution(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_action_t simcall_host_execution_get_state__get__execution(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; +static inline double simcall_host_execution_get_remains__get__result(smx_simcall_t simcall){ + return simcall->result.d; +} +static inline void simcall_host_execution_get_remains__set__result(smx_simcall_t simcall, double result){ + simcall->result.d = result; +} + +static inline smx_synchro_t simcall_host_execution_get_state__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; } -static inline void simcall_host_execution_get_state__set__execution(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_execution_get_state__set__execution(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_action_t simcall_host_execution_set_priority__get__execution(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; +static inline e_smx_state_t simcall_host_execution_get_state__get__result(smx_simcall_t simcall){ + return (e_smx_state_t) simcall->result.i; } -static inline void simcall_host_execution_set_priority__set__execution(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_execution_get_state__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_synchro_t simcall_host_execution_set_priority__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_host_execution_set_priority__set__execution(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline double simcall_host_execution_set_priority__get__priority(smx_simcall_t simcall){ +static inline double simcall_host_execution_set_priority__get__priority(smx_simcall_t simcall) { return simcall->args[1].d; } -static inline void simcall_host_execution_set_priority__set__priority(smx_simcall_t simcall, double arg){ +static inline void simcall_host_execution_set_priority__set__priority(smx_simcall_t simcall, double arg) { simcall->args[1].d = arg; } -static inline smx_action_t simcall_host_execution_set_bound__get__execution(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; + +static inline smx_synchro_t simcall_host_execution_set_bound__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; } -static inline void simcall_host_execution_set_bound__set__execution(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_execution_set_bound__set__execution(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline double simcall_host_execution_set_bound__get__bound(smx_simcall_t simcall){ +static inline double simcall_host_execution_set_bound__get__bound(smx_simcall_t simcall) { return simcall->args[1].d; } -static inline void simcall_host_execution_set_bound__set__bound(smx_simcall_t simcall, double arg){ +static inline void simcall_host_execution_set_bound__set__bound(smx_simcall_t simcall, double arg) { simcall->args[1].d = arg; } -static inline smx_action_t simcall_host_execution_set_affinity__get__execution(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; + +static inline smx_synchro_t simcall_host_execution_set_affinity__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; } -static inline void simcall_host_execution_set_affinity__set__execution(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_execution_set_affinity__set__execution(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_execution_set_affinity__get__ws(smx_simcall_t simcall){ +static inline smx_host_t simcall_host_execution_set_affinity__get__ws(smx_simcall_t simcall) { return (smx_host_t) simcall->args[1].dp; } -static inline void simcall_host_execution_set_affinity__set__ws(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_execution_set_affinity__set__ws(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline unsigned long simcall_host_execution_set_affinity__get__mask(smx_simcall_t simcall){ +static inline unsigned long simcall_host_execution_set_affinity__get__mask(smx_simcall_t simcall) { return simcall->args[2].ul; } -static inline void simcall_host_execution_set_affinity__set__mask(smx_simcall_t simcall, unsigned long arg){ +static inline void simcall_host_execution_set_affinity__set__mask(smx_simcall_t simcall, unsigned long arg) { simcall->args[2].ul = arg; } -static inline smx_action_t simcall_host_execution_wait__get__execution(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; + +static inline smx_synchro_t simcall_host_execution_wait__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; } -static inline void simcall_host_execution_wait__set__execution(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_execution_wait__set__execution(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_get_mounted_storage_list__get__host(smx_simcall_t simcall){ +static inline int simcall_host_execution_wait__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_host_execution_wait__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_host_t simcall_host_get_mounted_storage_list__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_get_mounted_storage_list__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_mounted_storage_list__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_get_attached_storage_list__get__host(smx_simcall_t simcall){ +static inline xbt_dict_t simcall_host_get_mounted_storage_list__get__result(smx_simcall_t simcall){ + return (xbt_dict_t) simcall->result.dp; +} +static inline void simcall_host_get_mounted_storage_list__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_host_t simcall_host_get_attached_storage_list__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_get_attached_storage_list__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_attached_storage_list__set__host(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_host_get_params__get__ind_vm(smx_simcall_t simcall){ +static inline xbt_dynar_t simcall_host_get_attached_storage_list__get__result(smx_simcall_t simcall){ + return (xbt_dynar_t) simcall->result.dp; +} +static inline void simcall_host_get_attached_storage_list__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_host_t simcall_host_get_params__get__ind_vm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_get_params__set__ind_vm(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_params__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline ws_params_t simcall_host_get_params__get__params(smx_simcall_t simcall){ +static inline ws_params_t simcall_host_get_params__get__params(smx_simcall_t simcall) { return (ws_params_t) simcall->args[1].dp; } -static inline void simcall_host_get_params__set__params(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_get_params__set__params(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline smx_host_t simcall_host_set_params__get__ind_vm(smx_simcall_t simcall){ + +static inline smx_host_t simcall_host_set_params__get__ind_vm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_host_set_params__set__ind_vm(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_set_params__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline ws_params_t simcall_host_set_params__get__params(smx_simcall_t simcall){ +static inline ws_params_t simcall_host_set_params__get__params(smx_simcall_t simcall) { return (ws_params_t) simcall->args[1].dp; } -static inline void simcall_host_set_params__set__params(smx_simcall_t simcall, void* arg){ +static inline void simcall_host_set_params__set__params(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline const char* simcall_vm_create__get__name(smx_simcall_t simcall){ + +static inline const char* simcall_vm_create__get__name(smx_simcall_t simcall) { return simcall->args[0].cc; } -static inline void simcall_vm_create__set__name(smx_simcall_t simcall, const char* arg){ +static inline void simcall_vm_create__set__name(smx_simcall_t simcall, const char* arg) { simcall->args[0].cc = arg; } -static inline smx_host_t simcall_vm_create__get__ind_pm(smx_simcall_t simcall){ +static inline smx_host_t simcall_vm_create__get__ind_pm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[1].dp; } -static inline void simcall_vm_create__set__ind_pm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_create__set__ind_pm(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline smx_host_t simcall_vm_start__get__ind_vm(smx_simcall_t simcall){ +static inline smx_host_t simcall_vm_create__get__result(smx_simcall_t simcall){ + return (smx_host_t) simcall->result.dp; +} +static inline void simcall_vm_create__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_host_t simcall_vm_start__get__ind_vm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_vm_start__set__ind_vm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_start__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_vm_get_state__get__ind_vm(smx_simcall_t simcall){ + +static inline smx_host_t simcall_vm_get_state__get__ind_vm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_vm_get_state__set__ind_vm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_get_state__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_vm_migrate__get__ind_vm(smx_simcall_t simcall){ +static inline int simcall_vm_get_state__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_vm_get_state__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_host_t simcall_vm_migrate__get__ind_vm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_vm_migrate__set__ind_vm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_migrate__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_vm_migrate__get__ind_dst_pm(smx_simcall_t simcall){ +static inline smx_host_t simcall_vm_migrate__get__ind_dst_pm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[1].dp; } -static inline void simcall_vm_migrate__set__ind_dst_pm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_migrate__set__ind_dst_pm(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline smx_host_t simcall_vm_get_pm__get__ind_vm(smx_simcall_t simcall){ + +static inline smx_host_t simcall_vm_get_pm__get__ind_vm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_vm_get_pm__set__ind_vm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_get_pm__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_vm_set_bound__get__ind_vm(smx_simcall_t simcall){ +static inline void* simcall_vm_get_pm__get__result(smx_simcall_t simcall){ + return simcall->result.dp; +} +static inline void simcall_vm_get_pm__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_host_t simcall_vm_set_bound__get__ind_vm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_vm_set_bound__set__ind_vm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_set_bound__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline double simcall_vm_set_bound__get__bound(smx_simcall_t simcall){ +static inline double simcall_vm_set_bound__get__bound(smx_simcall_t simcall) { return simcall->args[1].d; } -static inline void simcall_vm_set_bound__set__bound(smx_simcall_t simcall, double arg){ +static inline void simcall_vm_set_bound__set__bound(smx_simcall_t simcall, double arg) { simcall->args[1].d = arg; } -static inline smx_host_t simcall_vm_set_affinity__get__ind_vm(smx_simcall_t simcall){ + +static inline smx_host_t simcall_vm_set_affinity__get__ind_vm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_vm_set_affinity__set__ind_vm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_set_affinity__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_vm_set_affinity__get__ind_pm(smx_simcall_t simcall){ +static inline smx_host_t simcall_vm_set_affinity__get__ind_pm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[1].dp; } -static inline void simcall_vm_set_affinity__set__ind_pm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_set_affinity__set__ind_pm(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline unsigned long simcall_vm_set_affinity__get__mask(smx_simcall_t simcall){ +static inline unsigned long simcall_vm_set_affinity__get__mask(smx_simcall_t simcall) { return simcall->args[2].ul; } -static inline void simcall_vm_set_affinity__set__mask(smx_simcall_t simcall, unsigned long arg){ +static inline void simcall_vm_set_affinity__set__mask(smx_simcall_t simcall, unsigned long arg) { simcall->args[2].ul = arg; } -static inline smx_host_t simcall_vm_destroy__get__ind_vm(smx_simcall_t simcall){ + +static inline smx_host_t simcall_vm_destroy__get__ind_vm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_vm_destroy__set__ind_vm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_destroy__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_vm_suspend__get__ind_vm(smx_simcall_t simcall){ + +static inline smx_host_t simcall_vm_suspend__get__ind_vm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_vm_suspend__set__ind_vm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_suspend__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_vm_resume__get__ind_vm(smx_simcall_t simcall){ + +static inline smx_host_t simcall_vm_resume__get__ind_vm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_vm_resume__set__ind_vm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_resume__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_vm_shutdown__get__ind_vm(smx_simcall_t simcall){ + +static inline smx_host_t simcall_vm_shutdown__get__ind_vm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_vm_shutdown__set__ind_vm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_shutdown__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_vm_save__get__ind_vm(smx_simcall_t simcall){ + +static inline smx_host_t simcall_vm_save__get__ind_vm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_vm_save__set__ind_vm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_save__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_vm_restore__get__ind_vm(smx_simcall_t simcall){ + +static inline smx_host_t simcall_vm_restore__get__ind_vm(smx_simcall_t simcall) { return (smx_host_t) simcall->args[0].dp; } -static inline void simcall_vm_restore__set__ind_vm(smx_simcall_t simcall, void* arg){ +static inline void simcall_vm_restore__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_process_t* simcall_process_create__get__process(smx_simcall_t simcall){ + +static inline smx_process_t* simcall_process_create__get__process(smx_simcall_t simcall) { return (smx_process_t*) simcall->args[0].dp; } -static inline void simcall_process_create__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_create__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline const char* simcall_process_create__get__name(smx_simcall_t simcall){ +static inline const char* simcall_process_create__get__name(smx_simcall_t simcall) { return simcall->args[1].cc; } -static inline void simcall_process_create__set__name(smx_simcall_t simcall, const char* arg){ +static inline void simcall_process_create__set__name(smx_simcall_t simcall, const char* arg) { simcall->args[1].cc = arg; } -static inline xbt_main_func_t simcall_process_create__get__code(smx_simcall_t simcall){ +static inline xbt_main_func_t simcall_process_create__get__code(smx_simcall_t simcall) { return (xbt_main_func_t) simcall->args[2].fp; } -static inline void simcall_process_create__set__code(smx_simcall_t simcall, FPtr arg){ +static inline void simcall_process_create__set__code(smx_simcall_t simcall, FPtr arg) { simcall->args[2].fp = arg; } -static inline void* simcall_process_create__get__data(smx_simcall_t simcall){ +static inline void* simcall_process_create__get__data(smx_simcall_t simcall) { return simcall->args[3].dp; } -static inline void simcall_process_create__set__data(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_create__set__data(smx_simcall_t simcall, void* arg) { simcall->args[3].dp = arg; } -static inline const char* simcall_process_create__get__hostname(smx_simcall_t simcall){ +static inline const char* simcall_process_create__get__hostname(smx_simcall_t simcall) { return simcall->args[4].cc; } -static inline void simcall_process_create__set__hostname(smx_simcall_t simcall, const char* arg){ +static inline void simcall_process_create__set__hostname(smx_simcall_t simcall, const char* arg) { simcall->args[4].cc = arg; } -static inline double simcall_process_create__get__kill_time(smx_simcall_t simcall){ +static inline double simcall_process_create__get__kill_time(smx_simcall_t simcall) { return simcall->args[5].d; } -static inline void simcall_process_create__set__kill_time(smx_simcall_t simcall, double arg){ +static inline void simcall_process_create__set__kill_time(smx_simcall_t simcall, double arg) { simcall->args[5].d = arg; } -static inline int simcall_process_create__get__argc(smx_simcall_t simcall){ +static inline int simcall_process_create__get__argc(smx_simcall_t simcall) { return simcall->args[6].i; } -static inline void simcall_process_create__set__argc(smx_simcall_t simcall, int arg){ +static inline void simcall_process_create__set__argc(smx_simcall_t simcall, int arg) { simcall->args[6].i = arg; } -static inline char** simcall_process_create__get__argv(smx_simcall_t simcall){ +static inline char** simcall_process_create__get__argv(smx_simcall_t simcall) { return (char**) simcall->args[7].dp; } -static inline void simcall_process_create__set__argv(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_create__set__argv(smx_simcall_t simcall, void* arg) { simcall->args[7].dp = arg; } -static inline xbt_dict_t simcall_process_create__get__properties(smx_simcall_t simcall){ +static inline xbt_dict_t simcall_process_create__get__properties(smx_simcall_t simcall) { return (xbt_dict_t) simcall->args[8].dp; } -static inline void simcall_process_create__set__properties(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_create__set__properties(smx_simcall_t simcall, void* arg) { simcall->args[8].dp = arg; } -static inline int simcall_process_create__get__auto_restart(smx_simcall_t simcall){ +static inline int simcall_process_create__get__auto_restart(smx_simcall_t simcall) { return simcall->args[9].i; } -static inline void simcall_process_create__set__auto_restart(smx_simcall_t simcall, int arg){ +static inline void simcall_process_create__set__auto_restart(smx_simcall_t simcall, int arg) { simcall->args[9].i = arg; } -static inline smx_process_t simcall_process_kill__get__process(smx_simcall_t simcall){ + +static inline smx_process_t simcall_process_kill__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_kill__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_kill__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline int simcall_process_killall__get__reset_pid(smx_simcall_t simcall){ + +static inline int simcall_process_killall__get__reset_pid(smx_simcall_t simcall) { return simcall->args[0].i; } -static inline void simcall_process_killall__set__reset_pid(smx_simcall_t simcall, int arg){ +static inline void simcall_process_killall__set__reset_pid(smx_simcall_t simcall, int arg) { simcall->args[0].i = arg; } -static inline smx_process_t simcall_process_cleanup__get__process(smx_simcall_t simcall){ + +static inline smx_process_t simcall_process_cleanup__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_cleanup__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_cleanup__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_process_t simcall_process_change_host__get__process(smx_simcall_t simcall){ + +static inline smx_process_t simcall_process_change_host__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_change_host__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_change_host__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_process_change_host__get__dest(smx_simcall_t simcall){ +static inline smx_host_t simcall_process_change_host__get__dest(smx_simcall_t simcall) { return (smx_host_t) simcall->args[1].dp; } -static inline void simcall_process_change_host__set__dest(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_change_host__set__dest(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline smx_process_t simcall_process_suspend__get__process(smx_simcall_t simcall){ + +static inline smx_process_t simcall_process_suspend__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_suspend__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_suspend__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_process_t simcall_process_resume__get__process(smx_simcall_t simcall){ + +static inline smx_process_t simcall_process_resume__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_resume__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_resume__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_process_t simcall_process_get_PID__get__process(smx_simcall_t simcall){ +static inline int simcall_process_count__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_process_count__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_process_t simcall_process_get_PID__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_get_PID__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_get_PID__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_process_t simcall_process_get_PPID__get__process(smx_simcall_t simcall){ +static inline int simcall_process_get_PID__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_process_get_PID__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_process_t simcall_process_get_PPID__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_get_PPID__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_get_PPID__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_process_t simcall_process_get_data__get__process(smx_simcall_t simcall){ +static inline int simcall_process_get_PPID__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_process_get_PPID__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_process_t simcall_process_get_data__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_get_data__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_get_data__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_process_t simcall_process_set_data__get__process(smx_simcall_t simcall){ +static inline void* simcall_process_get_data__get__result(smx_simcall_t simcall){ + return simcall->result.dp; +} +static inline void simcall_process_get_data__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_process_t simcall_process_set_data__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_set_data__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_set_data__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline void* simcall_process_set_data__get__data(smx_simcall_t simcall){ +static inline void* simcall_process_set_data__get__data(smx_simcall_t simcall) { return simcall->args[1].dp; } -static inline void simcall_process_set_data__set__data(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_set_data__set__data(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline smx_process_t simcall_process_get_host__get__process(smx_simcall_t simcall){ + +static inline smx_process_t simcall_process_get_host__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_get_host__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_get_host__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_process_t simcall_process_get_name__get__process(smx_simcall_t simcall){ +static inline smx_host_t simcall_process_get_host__get__result(smx_simcall_t simcall){ + return (smx_host_t) simcall->result.dp; +} +static inline void simcall_process_get_host__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_process_t simcall_process_get_name__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_get_name__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_get_name__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_process_t simcall_process_is_suspended__get__process(smx_simcall_t simcall){ +static inline const char* simcall_process_get_name__get__result(smx_simcall_t simcall){ + return simcall->result.cc; +} +static inline void simcall_process_get_name__set__result(smx_simcall_t simcall, const char* result){ + simcall->result.cc = result; +} + +static inline smx_process_t simcall_process_is_suspended__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_is_suspended__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_is_suspended__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_process_t simcall_process_get_properties__get__process(smx_simcall_t simcall){ +static inline int simcall_process_is_suspended__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_process_is_suspended__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_process_t simcall_process_get_properties__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_get_properties__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_get_properties__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_process_t simcall_process_join__get__process(smx_simcall_t simcall){ +static inline xbt_dict_t simcall_process_get_properties__get__result(smx_simcall_t simcall){ + return (xbt_dict_t) simcall->result.dp; +} +static inline void simcall_process_get_properties__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_process_t simcall_process_join__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_join__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_join__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline double simcall_process_join__get__timeout(smx_simcall_t simcall){ +static inline double simcall_process_join__get__timeout(smx_simcall_t simcall) { return simcall->args[1].d; } -static inline void simcall_process_join__set__timeout(smx_simcall_t simcall, double arg){ +static inline void simcall_process_join__set__timeout(smx_simcall_t simcall, double arg) { simcall->args[1].d = arg; } -static inline double simcall_process_sleep__get__duration(smx_simcall_t simcall){ +static inline int simcall_process_join__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_process_join__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline double simcall_process_sleep__get__duration(smx_simcall_t simcall) { return simcall->args[0].d; } -static inline void simcall_process_sleep__set__duration(smx_simcall_t simcall, double arg){ +static inline void simcall_process_sleep__set__duration(smx_simcall_t simcall, double arg) { simcall->args[0].d = arg; } -static inline smx_process_t simcall_process_on_exit__get__process(smx_simcall_t simcall){ +static inline int simcall_process_sleep__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_process_sleep__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_process_t simcall_process_on_exit__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_on_exit__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_on_exit__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline int_f_pvoid_pvoid_t simcall_process_on_exit__get__fun(smx_simcall_t simcall){ +static inline int_f_pvoid_pvoid_t simcall_process_on_exit__get__fun(smx_simcall_t simcall) { return (int_f_pvoid_pvoid_t) simcall->args[1].fp; } -static inline void simcall_process_on_exit__set__fun(smx_simcall_t simcall, FPtr arg){ +static inline void simcall_process_on_exit__set__fun(smx_simcall_t simcall, FPtr arg) { simcall->args[1].fp = arg; } -static inline void* simcall_process_on_exit__get__data(smx_simcall_t simcall){ +static inline void* simcall_process_on_exit__get__data(smx_simcall_t simcall) { return simcall->args[2].dp; } -static inline void simcall_process_on_exit__set__data(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_on_exit__set__data(smx_simcall_t simcall, void* arg) { simcall->args[2].dp = arg; } -static inline smx_process_t simcall_process_auto_restart_set__get__process(smx_simcall_t simcall){ + +static inline smx_process_t simcall_process_auto_restart_set__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_auto_restart_set__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_auto_restart_set__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline int simcall_process_auto_restart_set__get__auto_restart(smx_simcall_t simcall){ +static inline int simcall_process_auto_restart_set__get__auto_restart(smx_simcall_t simcall) { return simcall->args[1].i; } -static inline void simcall_process_auto_restart_set__set__auto_restart(smx_simcall_t simcall, int arg){ +static inline void simcall_process_auto_restart_set__set__auto_restart(smx_simcall_t simcall, int arg) { simcall->args[1].i = arg; } -static inline smx_process_t simcall_process_restart__get__process(smx_simcall_t simcall){ + +static inline smx_process_t simcall_process_restart__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_process_restart__set__process(smx_simcall_t simcall, void* arg){ +static inline void simcall_process_restart__set__process(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline const char* simcall_rdv_create__get__name(smx_simcall_t simcall){ +static inline smx_process_t simcall_process_restart__get__result(smx_simcall_t simcall){ + return (smx_process_t) simcall->result.dp; +} +static inline void simcall_process_restart__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline const char* simcall_rdv_create__get__name(smx_simcall_t simcall) { return simcall->args[0].cc; } -static inline void simcall_rdv_create__set__name(smx_simcall_t simcall, const char* arg){ +static inline void simcall_rdv_create__set__name(smx_simcall_t simcall, const char* arg) { simcall->args[0].cc = arg; } -static inline smx_rdv_t simcall_rdv_destroy__get__rdv(smx_simcall_t simcall){ +static inline smx_rdv_t simcall_rdv_create__get__result(smx_simcall_t simcall){ + return (smx_rdv_t) simcall->result.dp; +} +static inline void simcall_rdv_create__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_rdv_t simcall_rdv_destroy__get__rdv(smx_simcall_t simcall) { return (smx_rdv_t) simcall->args[0].dp; } -static inline void simcall_rdv_destroy__set__rdv(smx_simcall_t simcall, void* arg){ +static inline void simcall_rdv_destroy__set__rdv(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_rdv_t simcall_rdv_comm_count_by_host__get__rdv(smx_simcall_t simcall){ + +static inline smx_rdv_t simcall_rdv_comm_count_by_host__get__rdv(smx_simcall_t simcall) { return (smx_rdv_t) simcall->args[0].dp; } -static inline void simcall_rdv_comm_count_by_host__set__rdv(smx_simcall_t simcall, void* arg){ +static inline void simcall_rdv_comm_count_by_host__set__rdv(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_rdv_comm_count_by_host__get__host(smx_simcall_t simcall){ +static inline smx_host_t simcall_rdv_comm_count_by_host__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[1].dp; } -static inline void simcall_rdv_comm_count_by_host__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_rdv_comm_count_by_host__set__host(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline smx_rdv_t simcall_rdv_get_head__get__rdv(smx_simcall_t simcall){ +static inline unsigned int simcall_rdv_comm_count_by_host__get__result(smx_simcall_t simcall){ + return simcall->result.ui; +} +static inline void simcall_rdv_comm_count_by_host__set__result(smx_simcall_t simcall, unsigned int result){ + simcall->result.ui = result; +} + +static inline smx_rdv_t simcall_rdv_get_head__get__rdv(smx_simcall_t simcall) { return (smx_rdv_t) simcall->args[0].dp; } -static inline void simcall_rdv_get_head__set__rdv(smx_simcall_t simcall, void* arg){ +static inline void simcall_rdv_get_head__set__rdv(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_rdv_t simcall_rdv_set_receiver__get__rdv(smx_simcall_t simcall){ +static inline smx_synchro_t simcall_rdv_get_head__get__result(smx_simcall_t simcall){ + return (smx_synchro_t) simcall->result.dp; +} +static inline void simcall_rdv_get_head__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_rdv_t simcall_rdv_set_receiver__get__rdv(smx_simcall_t simcall) { return (smx_rdv_t) simcall->args[0].dp; } -static inline void simcall_rdv_set_receiver__set__rdv(smx_simcall_t simcall, void* arg){ +static inline void simcall_rdv_set_receiver__set__rdv(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_process_t simcall_rdv_set_receiver__get__receiver(smx_simcall_t simcall){ +static inline smx_process_t simcall_rdv_set_receiver__get__receiver(smx_simcall_t simcall) { return (smx_process_t) simcall->args[1].dp; } -static inline void simcall_rdv_set_receiver__set__receiver(smx_simcall_t simcall, void* arg){ +static inline void simcall_rdv_set_receiver__set__receiver(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline smx_rdv_t simcall_rdv_get_receiver__get__rdv(smx_simcall_t simcall){ + +static inline smx_rdv_t simcall_rdv_get_receiver__get__rdv(smx_simcall_t simcall) { return (smx_rdv_t) simcall->args[0].dp; } -static inline void simcall_rdv_get_receiver__set__rdv(smx_simcall_t simcall, void* arg){ +static inline void simcall_rdv_get_receiver__set__rdv(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_rdv_t simcall_comm_iprobe__get__rdv(smx_simcall_t simcall){ +static inline smx_process_t simcall_rdv_get_receiver__get__result(smx_simcall_t simcall){ + return (smx_process_t) simcall->result.dp; +} +static inline void simcall_rdv_get_receiver__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_rdv_t simcall_comm_iprobe__get__rdv(smx_simcall_t simcall) { return (smx_rdv_t) simcall->args[0].dp; } -static inline void simcall_comm_iprobe__set__rdv(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_iprobe__set__rdv(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline int simcall_comm_iprobe__get__type(smx_simcall_t simcall){ +static inline int simcall_comm_iprobe__get__type(smx_simcall_t simcall) { return simcall->args[1].i; } -static inline void simcall_comm_iprobe__set__type(smx_simcall_t simcall, int arg){ +static inline void simcall_comm_iprobe__set__type(smx_simcall_t simcall, int arg) { simcall->args[1].i = arg; } -static inline int simcall_comm_iprobe__get__src(smx_simcall_t simcall){ +static inline int simcall_comm_iprobe__get__src(smx_simcall_t simcall) { return simcall->args[2].i; } -static inline void simcall_comm_iprobe__set__src(smx_simcall_t simcall, int arg){ +static inline void simcall_comm_iprobe__set__src(smx_simcall_t simcall, int arg) { simcall->args[2].i = arg; } -static inline int simcall_comm_iprobe__get__tag(smx_simcall_t simcall){ +static inline int simcall_comm_iprobe__get__tag(smx_simcall_t simcall) { return simcall->args[3].i; } -static inline void simcall_comm_iprobe__set__tag(smx_simcall_t simcall, int arg){ +static inline void simcall_comm_iprobe__set__tag(smx_simcall_t simcall, int arg) { simcall->args[3].i = arg; } -static inline simix_match_func_t simcall_comm_iprobe__get__match_fun(smx_simcall_t simcall){ +static inline simix_match_func_t simcall_comm_iprobe__get__match_fun(smx_simcall_t simcall) { return (simix_match_func_t) simcall->args[4].fp; } -static inline void simcall_comm_iprobe__set__match_fun(smx_simcall_t simcall, FPtr arg){ +static inline void simcall_comm_iprobe__set__match_fun(smx_simcall_t simcall, FPtr arg) { simcall->args[4].fp = arg; } -static inline void* simcall_comm_iprobe__get__data(smx_simcall_t simcall){ +static inline void* simcall_comm_iprobe__get__data(smx_simcall_t simcall) { return simcall->args[5].dp; } -static inline void simcall_comm_iprobe__set__data(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_iprobe__set__data(smx_simcall_t simcall, void* arg) { simcall->args[5].dp = arg; } -static inline smx_process_t simcall_comm_send__get__src(smx_simcall_t simcall){ +static inline smx_synchro_t simcall_comm_iprobe__get__result(smx_simcall_t simcall){ + return (smx_synchro_t) simcall->result.dp; +} +static inline void simcall_comm_iprobe__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_process_t simcall_comm_send__get__src(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_comm_send__set__src(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_send__set__src(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_rdv_t simcall_comm_send__get__rdv(smx_simcall_t simcall){ +static inline smx_rdv_t simcall_comm_send__get__rdv(smx_simcall_t simcall) { return (smx_rdv_t) simcall->args[1].dp; } -static inline void simcall_comm_send__set__rdv(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_send__set__rdv(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline double simcall_comm_send__get__task_size(smx_simcall_t simcall){ +static inline double simcall_comm_send__get__task_size(smx_simcall_t simcall) { return simcall->args[2].d; } -static inline void simcall_comm_send__set__task_size(smx_simcall_t simcall, double arg){ +static inline void simcall_comm_send__set__task_size(smx_simcall_t simcall, double arg) { simcall->args[2].d = arg; } -static inline double simcall_comm_send__get__rate(smx_simcall_t simcall){ +static inline double simcall_comm_send__get__rate(smx_simcall_t simcall) { return simcall->args[3].d; } -static inline void simcall_comm_send__set__rate(smx_simcall_t simcall, double arg){ +static inline void simcall_comm_send__set__rate(smx_simcall_t simcall, double arg) { simcall->args[3].d = arg; } -static inline void* simcall_comm_send__get__src_buff(smx_simcall_t simcall){ +static inline void* simcall_comm_send__get__src_buff(smx_simcall_t simcall) { return simcall->args[4].dp; } -static inline void simcall_comm_send__set__src_buff(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_send__set__src_buff(smx_simcall_t simcall, void* arg) { simcall->args[4].dp = arg; } -static inline size_t simcall_comm_send__get__src_buff_size(smx_simcall_t simcall){ +static inline size_t simcall_comm_send__get__src_buff_size(smx_simcall_t simcall) { return simcall->args[5].sz; } -static inline void simcall_comm_send__set__src_buff_size(smx_simcall_t simcall, size_t arg){ +static inline void simcall_comm_send__set__src_buff_size(smx_simcall_t simcall, size_t arg) { simcall->args[5].sz = arg; } -static inline simix_match_func_t simcall_comm_send__get__match_fun(smx_simcall_t simcall){ +static inline simix_match_func_t simcall_comm_send__get__match_fun(smx_simcall_t simcall) { return (simix_match_func_t) simcall->args[6].fp; } -static inline void simcall_comm_send__set__match_fun(smx_simcall_t simcall, FPtr arg){ +static inline void simcall_comm_send__set__match_fun(smx_simcall_t simcall, FPtr arg) { simcall->args[6].fp = arg; } -static inline simix_copy_data_func_t simcall_comm_send__get__copy_data_fun(smx_simcall_t simcall){ +static inline simix_copy_data_func_t simcall_comm_send__get__copy_data_fun(smx_simcall_t simcall) { return (simix_copy_data_func_t) simcall->args[7].fp; } -static inline void simcall_comm_send__set__copy_data_fun(smx_simcall_t simcall, FPtr arg){ +static inline void simcall_comm_send__set__copy_data_fun(smx_simcall_t simcall, FPtr arg) { simcall->args[7].fp = arg; } -static inline void* simcall_comm_send__get__data(smx_simcall_t simcall){ +static inline void* simcall_comm_send__get__data(smx_simcall_t simcall) { return simcall->args[8].dp; } -static inline void simcall_comm_send__set__data(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_send__set__data(smx_simcall_t simcall, void* arg) { simcall->args[8].dp = arg; } -static inline double simcall_comm_send__get__timeout(smx_simcall_t simcall){ +static inline double simcall_comm_send__get__timeout(smx_simcall_t simcall) { return simcall->args[9].d; } -static inline void simcall_comm_send__set__timeout(smx_simcall_t simcall, double arg){ +static inline void simcall_comm_send__set__timeout(smx_simcall_t simcall, double arg) { simcall->args[9].d = arg; } -static inline smx_process_t simcall_comm_isend__get__src(smx_simcall_t simcall){ + +static inline smx_process_t simcall_comm_isend__get__src(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_comm_isend__set__src(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_isend__set__src(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_rdv_t simcall_comm_isend__get__rdv(smx_simcall_t simcall){ +static inline smx_rdv_t simcall_comm_isend__get__rdv(smx_simcall_t simcall) { return (smx_rdv_t) simcall->args[1].dp; } -static inline void simcall_comm_isend__set__rdv(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_isend__set__rdv(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline double simcall_comm_isend__get__task_size(smx_simcall_t simcall){ +static inline double simcall_comm_isend__get__task_size(smx_simcall_t simcall) { return simcall->args[2].d; } -static inline void simcall_comm_isend__set__task_size(smx_simcall_t simcall, double arg){ +static inline void simcall_comm_isend__set__task_size(smx_simcall_t simcall, double arg) { simcall->args[2].d = arg; } -static inline double simcall_comm_isend__get__rate(smx_simcall_t simcall){ +static inline double simcall_comm_isend__get__rate(smx_simcall_t simcall) { return simcall->args[3].d; } -static inline void simcall_comm_isend__set__rate(smx_simcall_t simcall, double arg){ +static inline void simcall_comm_isend__set__rate(smx_simcall_t simcall, double arg) { simcall->args[3].d = arg; } -static inline void* simcall_comm_isend__get__src_buff(smx_simcall_t simcall){ +static inline void* simcall_comm_isend__get__src_buff(smx_simcall_t simcall) { return simcall->args[4].dp; } -static inline void simcall_comm_isend__set__src_buff(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_isend__set__src_buff(smx_simcall_t simcall, void* arg) { simcall->args[4].dp = arg; } -static inline size_t simcall_comm_isend__get__src_buff_size(smx_simcall_t simcall){ +static inline size_t simcall_comm_isend__get__src_buff_size(smx_simcall_t simcall) { return simcall->args[5].sz; } -static inline void simcall_comm_isend__set__src_buff_size(smx_simcall_t simcall, size_t arg){ +static inline void simcall_comm_isend__set__src_buff_size(smx_simcall_t simcall, size_t arg) { simcall->args[5].sz = arg; } -static inline simix_match_func_t simcall_comm_isend__get__match_fun(smx_simcall_t simcall){ +static inline simix_match_func_t simcall_comm_isend__get__match_fun(smx_simcall_t simcall) { return (simix_match_func_t) simcall->args[6].fp; } -static inline void simcall_comm_isend__set__match_fun(smx_simcall_t simcall, FPtr arg){ +static inline void simcall_comm_isend__set__match_fun(smx_simcall_t simcall, FPtr arg) { simcall->args[6].fp = arg; } -static inline simix_clean_func_t simcall_comm_isend__get__clean_fun(smx_simcall_t simcall){ +static inline simix_clean_func_t simcall_comm_isend__get__clean_fun(smx_simcall_t simcall) { return (simix_clean_func_t) simcall->args[7].fp; } -static inline void simcall_comm_isend__set__clean_fun(smx_simcall_t simcall, FPtr arg){ +static inline void simcall_comm_isend__set__clean_fun(smx_simcall_t simcall, FPtr arg) { simcall->args[7].fp = arg; } -static inline simix_copy_data_func_t simcall_comm_isend__get__copy_data_fun(smx_simcall_t simcall){ +static inline simix_copy_data_func_t simcall_comm_isend__get__copy_data_fun(smx_simcall_t simcall) { return (simix_copy_data_func_t) simcall->args[8].fp; } -static inline void simcall_comm_isend__set__copy_data_fun(smx_simcall_t simcall, FPtr arg){ +static inline void simcall_comm_isend__set__copy_data_fun(smx_simcall_t simcall, FPtr arg) { simcall->args[8].fp = arg; } -static inline void* simcall_comm_isend__get__data(smx_simcall_t simcall){ +static inline void* simcall_comm_isend__get__data(smx_simcall_t simcall) { return simcall->args[9].dp; } -static inline void simcall_comm_isend__set__data(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_isend__set__data(smx_simcall_t simcall, void* arg) { simcall->args[9].dp = arg; } -static inline int simcall_comm_isend__get__detached(smx_simcall_t simcall){ +static inline int simcall_comm_isend__get__detached(smx_simcall_t simcall) { return simcall->args[10].i; } -static inline void simcall_comm_isend__set__detached(smx_simcall_t simcall, int arg){ +static inline void simcall_comm_isend__set__detached(smx_simcall_t simcall, int arg) { simcall->args[10].i = arg; } -static inline smx_rdv_t simcall_comm_recv__get__rdv(smx_simcall_t simcall){ +static inline smx_synchro_t simcall_comm_isend__get__result(smx_simcall_t simcall){ + return (smx_synchro_t) simcall->result.dp; +} +static inline void simcall_comm_isend__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_rdv_t simcall_comm_recv__get__rdv(smx_simcall_t simcall) { return (smx_rdv_t) simcall->args[0].dp; } -static inline void simcall_comm_recv__set__rdv(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_recv__set__rdv(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline void* simcall_comm_recv__get__dst_buff(smx_simcall_t simcall){ +static inline void* simcall_comm_recv__get__dst_buff(smx_simcall_t simcall) { return simcall->args[1].dp; } -static inline void simcall_comm_recv__set__dst_buff(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_recv__set__dst_buff(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline size_t* simcall_comm_recv__get__dst_buff_size(smx_simcall_t simcall){ +static inline size_t* simcall_comm_recv__get__dst_buff_size(smx_simcall_t simcall) { return (size_t*) simcall->args[2].dp; } -static inline void simcall_comm_recv__set__dst_buff_size(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_recv__set__dst_buff_size(smx_simcall_t simcall, void* arg) { simcall->args[2].dp = arg; } -static inline simix_match_func_t simcall_comm_recv__get__match_fun(smx_simcall_t simcall){ +static inline simix_match_func_t simcall_comm_recv__get__match_fun(smx_simcall_t simcall) { return (simix_match_func_t) simcall->args[3].fp; } -static inline void simcall_comm_recv__set__match_fun(smx_simcall_t simcall, FPtr arg){ +static inline void simcall_comm_recv__set__match_fun(smx_simcall_t simcall, FPtr arg) { simcall->args[3].fp = arg; } -static inline simix_copy_data_func_t simcall_comm_recv__get__copy_data_fun(smx_simcall_t simcall){ +static inline simix_copy_data_func_t simcall_comm_recv__get__copy_data_fun(smx_simcall_t simcall) { return (simix_copy_data_func_t) simcall->args[4].fp; } -static inline void simcall_comm_recv__set__copy_data_fun(smx_simcall_t simcall, FPtr arg){ +static inline void simcall_comm_recv__set__copy_data_fun(smx_simcall_t simcall, FPtr arg) { simcall->args[4].fp = arg; } -static inline void* simcall_comm_recv__get__data(smx_simcall_t simcall){ +static inline void* simcall_comm_recv__get__data(smx_simcall_t simcall) { return simcall->args[5].dp; } -static inline void simcall_comm_recv__set__data(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_recv__set__data(smx_simcall_t simcall, void* arg) { simcall->args[5].dp = arg; } -static inline double simcall_comm_recv__get__timeout(smx_simcall_t simcall){ +static inline double simcall_comm_recv__get__timeout(smx_simcall_t simcall) { return simcall->args[6].d; } -static inline void simcall_comm_recv__set__timeout(smx_simcall_t simcall, double arg){ +static inline void simcall_comm_recv__set__timeout(smx_simcall_t simcall, double arg) { simcall->args[6].d = arg; } -static inline double simcall_comm_recv__get__rate(smx_simcall_t simcall){ +static inline double simcall_comm_recv__get__rate(smx_simcall_t simcall) { return simcall->args[7].d; } -static inline void simcall_comm_recv__set__rate(smx_simcall_t simcall, double arg){ +static inline void simcall_comm_recv__set__rate(smx_simcall_t simcall, double arg) { simcall->args[7].d = arg; } -static inline smx_rdv_t simcall_comm_irecv__get__rdv(smx_simcall_t simcall){ + +static inline smx_rdv_t simcall_comm_irecv__get__rdv(smx_simcall_t simcall) { return (smx_rdv_t) simcall->args[0].dp; } -static inline void simcall_comm_irecv__set__rdv(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_irecv__set__rdv(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline void* simcall_comm_irecv__get__dst_buff(smx_simcall_t simcall){ +static inline void* simcall_comm_irecv__get__dst_buff(smx_simcall_t simcall) { return simcall->args[1].dp; } -static inline void simcall_comm_irecv__set__dst_buff(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_irecv__set__dst_buff(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline size_t* simcall_comm_irecv__get__dst_buff_size(smx_simcall_t simcall){ +static inline size_t* simcall_comm_irecv__get__dst_buff_size(smx_simcall_t simcall) { return (size_t*) simcall->args[2].dp; } -static inline void simcall_comm_irecv__set__dst_buff_size(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_irecv__set__dst_buff_size(smx_simcall_t simcall, void* arg) { simcall->args[2].dp = arg; } -static inline simix_match_func_t simcall_comm_irecv__get__match_fun(smx_simcall_t simcall){ +static inline simix_match_func_t simcall_comm_irecv__get__match_fun(smx_simcall_t simcall) { return (simix_match_func_t) simcall->args[3].fp; } -static inline void simcall_comm_irecv__set__match_fun(smx_simcall_t simcall, FPtr arg){ +static inline void simcall_comm_irecv__set__match_fun(smx_simcall_t simcall, FPtr arg) { simcall->args[3].fp = arg; } -static inline simix_copy_data_func_t simcall_comm_irecv__get__copy_data_fun(smx_simcall_t simcall){ +static inline simix_copy_data_func_t simcall_comm_irecv__get__copy_data_fun(smx_simcall_t simcall) { return (simix_copy_data_func_t) simcall->args[4].fp; } -static inline void simcall_comm_irecv__set__copy_data_fun(smx_simcall_t simcall, FPtr arg){ +static inline void simcall_comm_irecv__set__copy_data_fun(smx_simcall_t simcall, FPtr arg) { simcall->args[4].fp = arg; } -static inline void* simcall_comm_irecv__get__data(smx_simcall_t simcall){ +static inline void* simcall_comm_irecv__get__data(smx_simcall_t simcall) { return simcall->args[5].dp; } -static inline void simcall_comm_irecv__set__data(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_irecv__set__data(smx_simcall_t simcall, void* arg) { simcall->args[5].dp = arg; } -static inline double simcall_comm_irecv__get__rate(smx_simcall_t simcall){ +static inline double simcall_comm_irecv__get__rate(smx_simcall_t simcall) { return simcall->args[6].d; } -static inline void simcall_comm_irecv__set__rate(smx_simcall_t simcall, double arg){ +static inline void simcall_comm_irecv__set__rate(smx_simcall_t simcall, double arg) { simcall->args[6].d = arg; } -static inline smx_action_t simcall_comm_cancel__get__comm(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; +static inline smx_synchro_t simcall_comm_irecv__get__result(smx_simcall_t simcall){ + return (smx_synchro_t) simcall->result.dp; +} +static inline void simcall_comm_irecv__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; } -static inline void simcall_comm_cancel__set__comm(smx_simcall_t simcall, void* arg){ + +static inline smx_synchro_t simcall_comm_cancel__get__comm(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_comm_cancel__set__comm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline xbt_dynar_t simcall_comm_waitany__get__comms(smx_simcall_t simcall){ + +static inline xbt_dynar_t simcall_comm_waitany__get__comms(smx_simcall_t simcall) { return (xbt_dynar_t) simcall->args[0].dp; } -static inline void simcall_comm_waitany__set__comms(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_waitany__set__comms(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_action_t simcall_comm_wait__get__comm(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; +static inline int simcall_comm_waitany__get__result(smx_simcall_t simcall){ + return simcall->result.i; } -static inline void simcall_comm_wait__set__comm(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_waitany__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_synchro_t simcall_comm_wait__get__comm(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_comm_wait__set__comm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline double simcall_comm_wait__get__timeout(smx_simcall_t simcall){ +static inline double simcall_comm_wait__get__timeout(smx_simcall_t simcall) { return simcall->args[1].d; } -static inline void simcall_comm_wait__set__timeout(smx_simcall_t simcall, double arg){ +static inline void simcall_comm_wait__set__timeout(smx_simcall_t simcall, double arg) { simcall->args[1].d = arg; } -static inline smx_action_t simcall_comm_test__get__comm(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; + +static inline smx_synchro_t simcall_comm_test__get__comm(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; } -static inline void simcall_comm_test__set__comm(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_test__set__comm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline xbt_dynar_t simcall_comm_testany__get__comms(smx_simcall_t simcall){ +static inline int simcall_comm_test__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_comm_test__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline xbt_dynar_t simcall_comm_testany__get__comms(smx_simcall_t simcall) { return (xbt_dynar_t) simcall->args[0].dp; } -static inline void simcall_comm_testany__set__comms(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_testany__set__comms(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_action_t simcall_comm_get_remains__get__comm(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; +static inline int simcall_comm_testany__get__result(smx_simcall_t simcall){ + return simcall->result.i; } -static inline void simcall_comm_get_remains__set__comm(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_testany__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_synchro_t simcall_comm_get_remains__get__comm(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_comm_get_remains__set__comm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_action_t simcall_comm_get_state__get__comm(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; +static inline double simcall_comm_get_remains__get__result(smx_simcall_t simcall){ + return simcall->result.d; +} +static inline void simcall_comm_get_remains__set__result(smx_simcall_t simcall, double result){ + simcall->result.d = result; } -static inline void simcall_comm_get_state__set__comm(smx_simcall_t simcall, void* arg){ + +static inline smx_synchro_t simcall_comm_get_state__get__comm(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_comm_get_state__set__comm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_action_t simcall_comm_get_src_data__get__comm(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; +static inline e_smx_state_t simcall_comm_get_state__get__result(smx_simcall_t simcall){ + return (e_smx_state_t) simcall->result.i; +} +static inline void simcall_comm_get_state__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_synchro_t simcall_comm_get_src_data__get__comm(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; } -static inline void simcall_comm_get_src_data__set__comm(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_get_src_data__set__comm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_action_t simcall_comm_get_dst_data__get__comm(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; +static inline void* simcall_comm_get_src_data__get__result(smx_simcall_t simcall){ + return simcall->result.dp; } -static inline void simcall_comm_get_dst_data__set__comm(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_get_src_data__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_synchro_t simcall_comm_get_dst_data__get__comm(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_comm_get_dst_data__set__comm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_action_t simcall_comm_get_src_proc__get__comm(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; +static inline void* simcall_comm_get_dst_data__get__result(smx_simcall_t simcall){ + return simcall->result.dp; +} +static inline void simcall_comm_get_dst_data__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; } -static inline void simcall_comm_get_src_proc__set__comm(smx_simcall_t simcall, void* arg){ + +static inline smx_synchro_t simcall_comm_get_src_proc__get__comm(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_comm_get_src_proc__set__comm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_action_t simcall_comm_get_dst_proc__get__comm(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; +static inline smx_process_t simcall_comm_get_src_proc__get__result(smx_simcall_t simcall){ + return (smx_process_t) simcall->result.dp; +} +static inline void simcall_comm_get_src_proc__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_synchro_t simcall_comm_get_dst_proc__get__comm(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; } -static inline void simcall_comm_get_dst_proc__set__comm(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_get_dst_proc__set__comm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } +static inline smx_process_t simcall_comm_get_dst_proc__get__result(smx_simcall_t simcall){ + return (smx_process_t) simcall->result.dp; +} +static inline void simcall_comm_get_dst_proc__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_mutex_t simcall_mutex_init__get__result(smx_simcall_t simcall){ + return (smx_mutex_t) simcall->result.dp; +} +static inline void simcall_mutex_init__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} -static inline smx_mutex_t simcall_mutex_destroy__get__mutex(smx_simcall_t simcall){ +static inline smx_mutex_t simcall_mutex_destroy__get__mutex(smx_simcall_t simcall) { return (smx_mutex_t) simcall->args[0].dp; } -static inline void simcall_mutex_destroy__set__mutex(smx_simcall_t simcall, void* arg){ +static inline void simcall_mutex_destroy__set__mutex(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_mutex_t simcall_mutex_lock__get__mutex(smx_simcall_t simcall){ + +static inline smx_mutex_t simcall_mutex_lock__get__mutex(smx_simcall_t simcall) { return (smx_mutex_t) simcall->args[0].dp; } -static inline void simcall_mutex_lock__set__mutex(smx_simcall_t simcall, void* arg){ +static inline void simcall_mutex_lock__set__mutex(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_mutex_t simcall_mutex_trylock__get__mutex(smx_simcall_t simcall){ + +static inline smx_mutex_t simcall_mutex_trylock__get__mutex(smx_simcall_t simcall) { return (smx_mutex_t) simcall->args[0].dp; } -static inline void simcall_mutex_trylock__set__mutex(smx_simcall_t simcall, void* arg){ +static inline void simcall_mutex_trylock__set__mutex(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_mutex_t simcall_mutex_unlock__get__mutex(smx_simcall_t simcall){ +static inline int simcall_mutex_trylock__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_mutex_trylock__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_mutex_t simcall_mutex_unlock__get__mutex(smx_simcall_t simcall) { return (smx_mutex_t) simcall->args[0].dp; } -static inline void simcall_mutex_unlock__set__mutex(smx_simcall_t simcall, void* arg){ +static inline void simcall_mutex_unlock__set__mutex(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_cond_t simcall_cond_destroy__get__cond(smx_simcall_t simcall){ +static inline smx_cond_t simcall_cond_init__get__result(smx_simcall_t simcall){ + return (smx_cond_t) simcall->result.dp; +} +static inline void simcall_cond_init__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_cond_t simcall_cond_destroy__get__cond(smx_simcall_t simcall) { return (smx_cond_t) simcall->args[0].dp; } -static inline void simcall_cond_destroy__set__cond(smx_simcall_t simcall, void* arg){ +static inline void simcall_cond_destroy__set__cond(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_cond_t simcall_cond_signal__get__cond(smx_simcall_t simcall){ + +static inline smx_cond_t simcall_cond_signal__get__cond(smx_simcall_t simcall) { return (smx_cond_t) simcall->args[0].dp; } -static inline void simcall_cond_signal__set__cond(smx_simcall_t simcall, void* arg){ +static inline void simcall_cond_signal__set__cond(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_cond_t simcall_cond_wait__get__cond(smx_simcall_t simcall){ + +static inline smx_cond_t simcall_cond_wait__get__cond(smx_simcall_t simcall) { return (smx_cond_t) simcall->args[0].dp; } -static inline void simcall_cond_wait__set__cond(smx_simcall_t simcall, void* arg){ +static inline void simcall_cond_wait__set__cond(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_mutex_t simcall_cond_wait__get__mutex(smx_simcall_t simcall){ +static inline smx_mutex_t simcall_cond_wait__get__mutex(smx_simcall_t simcall) { return (smx_mutex_t) simcall->args[1].dp; } -static inline void simcall_cond_wait__set__mutex(smx_simcall_t simcall, void* arg){ +static inline void simcall_cond_wait__set__mutex(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline smx_cond_t simcall_cond_wait_timeout__get__cond(smx_simcall_t simcall){ + +static inline smx_cond_t simcall_cond_wait_timeout__get__cond(smx_simcall_t simcall) { return (smx_cond_t) simcall->args[0].dp; } -static inline void simcall_cond_wait_timeout__set__cond(smx_simcall_t simcall, void* arg){ +static inline void simcall_cond_wait_timeout__set__cond(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_mutex_t simcall_cond_wait_timeout__get__mutex(smx_simcall_t simcall){ +static inline smx_mutex_t simcall_cond_wait_timeout__get__mutex(smx_simcall_t simcall) { return (smx_mutex_t) simcall->args[1].dp; } -static inline void simcall_cond_wait_timeout__set__mutex(smx_simcall_t simcall, void* arg){ +static inline void simcall_cond_wait_timeout__set__mutex(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline double simcall_cond_wait_timeout__get__timeout(smx_simcall_t simcall){ +static inline double simcall_cond_wait_timeout__get__timeout(smx_simcall_t simcall) { return simcall->args[2].d; } -static inline void simcall_cond_wait_timeout__set__timeout(smx_simcall_t simcall, double arg){ +static inline void simcall_cond_wait_timeout__set__timeout(smx_simcall_t simcall, double arg) { simcall->args[2].d = arg; } -static inline smx_cond_t simcall_cond_broadcast__get__cond(smx_simcall_t simcall){ + +static inline smx_cond_t simcall_cond_broadcast__get__cond(smx_simcall_t simcall) { return (smx_cond_t) simcall->args[0].dp; } -static inline void simcall_cond_broadcast__set__cond(smx_simcall_t simcall, void* arg){ +static inline void simcall_cond_broadcast__set__cond(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline int simcall_sem_init__get__capacity(smx_simcall_t simcall){ - return simcall->args[0].i; + +static inline unsigned int simcall_sem_init__get__capacity(smx_simcall_t simcall) { + return simcall->args[0].ui; } -static inline void simcall_sem_init__set__capacity(smx_simcall_t simcall, int arg){ - simcall->args[0].i = arg; +static inline void simcall_sem_init__set__capacity(smx_simcall_t simcall, unsigned int arg) { + simcall->args[0].ui = arg; +} +static inline smx_sem_t simcall_sem_init__get__result(smx_simcall_t simcall){ + return (smx_sem_t) simcall->result.dp; } -static inline smx_sem_t simcall_sem_destroy__get__sem(smx_simcall_t simcall){ +static inline void simcall_sem_init__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_sem_t simcall_sem_destroy__get__sem(smx_simcall_t simcall) { return (smx_sem_t) simcall->args[0].dp; } -static inline void simcall_sem_destroy__set__sem(smx_simcall_t simcall, void* arg){ +static inline void simcall_sem_destroy__set__sem(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_sem_t simcall_sem_release__get__sem(smx_simcall_t simcall){ + +static inline smx_sem_t simcall_sem_release__get__sem(smx_simcall_t simcall) { return (smx_sem_t) simcall->args[0].dp; } -static inline void simcall_sem_release__set__sem(smx_simcall_t simcall, void* arg){ +static inline void simcall_sem_release__set__sem(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_sem_t simcall_sem_would_block__get__sem(smx_simcall_t simcall){ + +static inline smx_sem_t simcall_sem_would_block__get__sem(smx_simcall_t simcall) { return (smx_sem_t) simcall->args[0].dp; } -static inline void simcall_sem_would_block__set__sem(smx_simcall_t simcall, void* arg){ +static inline void simcall_sem_would_block__set__sem(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_sem_t simcall_sem_acquire__get__sem(smx_simcall_t simcall){ +static inline int simcall_sem_would_block__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_sem_would_block__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_sem_t simcall_sem_acquire__get__sem(smx_simcall_t simcall) { return (smx_sem_t) simcall->args[0].dp; } -static inline void simcall_sem_acquire__set__sem(smx_simcall_t simcall, void* arg){ +static inline void simcall_sem_acquire__set__sem(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_sem_t simcall_sem_acquire_timeout__get__sem(smx_simcall_t simcall){ + +static inline smx_sem_t simcall_sem_acquire_timeout__get__sem(smx_simcall_t simcall) { return (smx_sem_t) simcall->args[0].dp; } -static inline void simcall_sem_acquire_timeout__set__sem(smx_simcall_t simcall, void* arg){ +static inline void simcall_sem_acquire_timeout__set__sem(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline double simcall_sem_acquire_timeout__get__timeout(smx_simcall_t simcall){ +static inline double simcall_sem_acquire_timeout__get__timeout(smx_simcall_t simcall) { return simcall->args[1].d; } -static inline void simcall_sem_acquire_timeout__set__timeout(smx_simcall_t simcall, double arg){ +static inline void simcall_sem_acquire_timeout__set__timeout(smx_simcall_t simcall, double arg) { simcall->args[1].d = arg; } -static inline smx_sem_t simcall_sem_get_capacity__get__sem(smx_simcall_t simcall){ + +static inline smx_sem_t simcall_sem_get_capacity__get__sem(smx_simcall_t simcall) { return (smx_sem_t) simcall->args[0].dp; } -static inline void simcall_sem_get_capacity__set__sem(smx_simcall_t simcall, void* arg){ +static inline void simcall_sem_get_capacity__set__sem(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_file_t simcall_file_read__get__fd(smx_simcall_t simcall){ +static inline int simcall_sem_get_capacity__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_sem_get_capacity__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_file_t simcall_file_read__get__fd(smx_simcall_t simcall) { return (smx_file_t) simcall->args[0].dp; } -static inline void simcall_file_read__set__fd(smx_simcall_t simcall, void* arg){ +static inline void simcall_file_read__set__fd(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline sg_size_t simcall_file_read__get__size(smx_simcall_t simcall){ +static inline sg_size_t simcall_file_read__get__size(smx_simcall_t simcall) { return simcall->args[1].sgsz; } -static inline void simcall_file_read__set__size(smx_simcall_t simcall, sg_size_t arg){ +static inline void simcall_file_read__set__size(smx_simcall_t simcall, sg_size_t arg) { simcall->args[1].sgsz = arg; } -static inline smx_host_t simcall_file_read__get__host(smx_simcall_t simcall){ +static inline smx_host_t simcall_file_read__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[2].dp; } -static inline void simcall_file_read__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_file_read__set__host(smx_simcall_t simcall, void* arg) { simcall->args[2].dp = arg; } -static inline smx_file_t simcall_file_write__get__fd(smx_simcall_t simcall){ +static inline sg_size_t simcall_file_read__get__result(smx_simcall_t simcall){ + return simcall->result.sgsz; +} +static inline void simcall_file_read__set__result(smx_simcall_t simcall, sg_size_t result){ + simcall->result.sgsz = result; +} + +static inline smx_file_t simcall_file_write__get__fd(smx_simcall_t simcall) { return (smx_file_t) simcall->args[0].dp; } -static inline void simcall_file_write__set__fd(smx_simcall_t simcall, void* arg){ +static inline void simcall_file_write__set__fd(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline sg_size_t simcall_file_write__get__size(smx_simcall_t simcall){ +static inline sg_size_t simcall_file_write__get__size(smx_simcall_t simcall) { return simcall->args[1].sgsz; } -static inline void simcall_file_write__set__size(smx_simcall_t simcall, sg_size_t arg){ +static inline void simcall_file_write__set__size(smx_simcall_t simcall, sg_size_t arg) { simcall->args[1].sgsz = arg; } -static inline smx_host_t simcall_file_write__get__host(smx_simcall_t simcall){ +static inline smx_host_t simcall_file_write__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[2].dp; } -static inline void simcall_file_write__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_file_write__set__host(smx_simcall_t simcall, void* arg) { simcall->args[2].dp = arg; } -static inline const char* simcall_file_open__get__fullpath(smx_simcall_t simcall){ +static inline sg_size_t simcall_file_write__get__result(smx_simcall_t simcall){ + return simcall->result.sgsz; +} +static inline void simcall_file_write__set__result(smx_simcall_t simcall, sg_size_t result){ + simcall->result.sgsz = result; +} + +static inline const char* simcall_file_open__get__fullpath(smx_simcall_t simcall) { return simcall->args[0].cc; } -static inline void simcall_file_open__set__fullpath(smx_simcall_t simcall, const char* arg){ +static inline void simcall_file_open__set__fullpath(smx_simcall_t simcall, const char* arg) { simcall->args[0].cc = arg; } -static inline smx_host_t simcall_file_open__get__host(smx_simcall_t simcall){ +static inline smx_host_t simcall_file_open__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[1].dp; } -static inline void simcall_file_open__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_file_open__set__host(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline smx_file_t simcall_file_close__get__fd(smx_simcall_t simcall){ +static inline smx_file_t simcall_file_open__get__result(smx_simcall_t simcall){ + return (smx_file_t) simcall->result.dp; +} +static inline void simcall_file_open__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_file_t simcall_file_close__get__fd(smx_simcall_t simcall) { return (smx_file_t) simcall->args[0].dp; } -static inline void simcall_file_close__set__fd(smx_simcall_t simcall, void* arg){ +static inline void simcall_file_close__set__fd(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_file_close__get__host(smx_simcall_t simcall){ +static inline smx_host_t simcall_file_close__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[1].dp; } -static inline void simcall_file_close__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_file_close__set__host(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline smx_file_t simcall_file_unlink__get__fd(smx_simcall_t simcall){ +static inline int simcall_file_close__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_file_close__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_file_t simcall_file_unlink__get__fd(smx_simcall_t simcall) { return (smx_file_t) simcall->args[0].dp; } -static inline void simcall_file_unlink__set__fd(smx_simcall_t simcall, void* arg){ +static inline void simcall_file_unlink__set__fd(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_host_t simcall_file_unlink__get__host(smx_simcall_t simcall){ +static inline smx_host_t simcall_file_unlink__get__host(smx_simcall_t simcall) { return (smx_host_t) simcall->args[1].dp; } -static inline void simcall_file_unlink__set__host(smx_simcall_t simcall, void* arg){ +static inline void simcall_file_unlink__set__host(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline smx_file_t simcall_file_get_size__get__fd(smx_simcall_t simcall){ +static inline int simcall_file_unlink__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_file_unlink__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_file_t simcall_file_get_size__get__fd(smx_simcall_t simcall) { return (smx_file_t) simcall->args[0].dp; } -static inline void simcall_file_get_size__set__fd(smx_simcall_t simcall, void* arg){ +static inline void simcall_file_get_size__set__fd(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_file_t simcall_file_tell__get__fd(smx_simcall_t simcall){ +static inline sg_size_t simcall_file_get_size__get__result(smx_simcall_t simcall){ + return simcall->result.sgsz; +} +static inline void simcall_file_get_size__set__result(smx_simcall_t simcall, sg_size_t result){ + simcall->result.sgsz = result; +} + +static inline smx_file_t simcall_file_tell__get__fd(smx_simcall_t simcall) { return (smx_file_t) simcall->args[0].dp; } -static inline void simcall_file_tell__set__fd(smx_simcall_t simcall, void* arg){ +static inline void simcall_file_tell__set__fd(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_file_t simcall_file_seek__get__fd(smx_simcall_t simcall){ +static inline sg_size_t simcall_file_tell__get__result(smx_simcall_t simcall){ + return simcall->result.sgsz; +} +static inline void simcall_file_tell__set__result(smx_simcall_t simcall, sg_size_t result){ + simcall->result.sgsz = result; +} + +static inline smx_file_t simcall_file_seek__get__fd(smx_simcall_t simcall) { return (smx_file_t) simcall->args[0].dp; } -static inline void simcall_file_seek__set__fd(smx_simcall_t simcall, void* arg){ +static inline void simcall_file_seek__set__fd(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline sg_offset_t simcall_file_seek__get__offset(smx_simcall_t simcall){ +static inline sg_offset_t simcall_file_seek__get__offset(smx_simcall_t simcall) { return simcall->args[1].sgoff; } -static inline void simcall_file_seek__set__offset(smx_simcall_t simcall, sg_offset_t arg){ +static inline void simcall_file_seek__set__offset(smx_simcall_t simcall, sg_offset_t arg) { simcall->args[1].sgoff = arg; } -static inline int simcall_file_seek__get__origin(smx_simcall_t simcall){ +static inline int simcall_file_seek__get__origin(smx_simcall_t simcall) { return simcall->args[2].i; } -static inline void simcall_file_seek__set__origin(smx_simcall_t simcall, int arg){ +static inline void simcall_file_seek__set__origin(smx_simcall_t simcall, int arg) { simcall->args[2].i = arg; } -static inline smx_file_t simcall_file_get_info__get__fd(smx_simcall_t simcall){ +static inline int simcall_file_seek__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_file_seek__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_file_t simcall_file_get_info__get__fd(smx_simcall_t simcall) { return (smx_file_t) simcall->args[0].dp; } -static inline void simcall_file_get_info__set__fd(smx_simcall_t simcall, void* arg){ +static inline void simcall_file_get_info__set__fd(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_file_t simcall_file_move__get__fd(smx_simcall_t simcall){ +static inline xbt_dynar_t simcall_file_get_info__get__result(smx_simcall_t simcall){ + return (xbt_dynar_t) simcall->result.dp; +} +static inline void simcall_file_get_info__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_file_t simcall_file_move__get__fd(smx_simcall_t simcall) { return (smx_file_t) simcall->args[0].dp; } -static inline void simcall_file_move__set__fd(smx_simcall_t simcall, void* arg){ +static inline void simcall_file_move__set__fd(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline const char* simcall_file_move__get__fullpath(smx_simcall_t simcall){ +static inline const char* simcall_file_move__get__fullpath(smx_simcall_t simcall) { return simcall->args[1].cc; } -static inline void simcall_file_move__set__fullpath(smx_simcall_t simcall, const char* arg){ +static inline void simcall_file_move__set__fullpath(smx_simcall_t simcall, const char* arg) { simcall->args[1].cc = arg; } -static inline smx_storage_t simcall_storage_get_free_size__get__storage(smx_simcall_t simcall){ +static inline int simcall_file_move__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_file_move__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_storage_t simcall_storage_get_free_size__get__storage(smx_simcall_t simcall) { return (smx_storage_t) simcall->args[0].dp; } -static inline void simcall_storage_get_free_size__set__storage(smx_simcall_t simcall, void* arg){ +static inline void simcall_storage_get_free_size__set__storage(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_storage_t simcall_storage_get_used_size__get__name(smx_simcall_t simcall){ +static inline sg_size_t simcall_storage_get_free_size__get__result(smx_simcall_t simcall){ + return simcall->result.sgsz; +} +static inline void simcall_storage_get_free_size__set__result(smx_simcall_t simcall, sg_size_t result){ + simcall->result.sgsz = result; +} + +static inline smx_storage_t simcall_storage_get_used_size__get__name(smx_simcall_t simcall) { return (smx_storage_t) simcall->args[0].dp; } -static inline void simcall_storage_get_used_size__set__name(smx_simcall_t simcall, void* arg){ +static inline void simcall_storage_get_used_size__set__name(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_storage_t simcall_storage_get_properties__get__storage(smx_simcall_t simcall){ +static inline sg_size_t simcall_storage_get_used_size__get__result(smx_simcall_t simcall){ + return simcall->result.sgsz; +} +static inline void simcall_storage_get_used_size__set__result(smx_simcall_t simcall, sg_size_t result){ + simcall->result.sgsz = result; +} + +static inline smx_storage_t simcall_storage_get_properties__get__storage(smx_simcall_t simcall) { return (smx_storage_t) simcall->args[0].dp; } -static inline void simcall_storage_get_properties__set__storage(smx_simcall_t simcall, void* arg){ +static inline void simcall_storage_get_properties__set__storage(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_storage_t simcall_storage_get_content__get__storage(smx_simcall_t simcall){ +static inline xbt_dict_t simcall_storage_get_properties__get__result(smx_simcall_t simcall){ + return (xbt_dict_t) simcall->result.dp; +} +static inline void simcall_storage_get_properties__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_storage_t simcall_storage_get_content__get__storage(smx_simcall_t simcall) { return (smx_storage_t) simcall->args[0].dp; } -static inline void simcall_storage_get_content__set__storage(smx_simcall_t simcall, void* arg){ +static inline void simcall_storage_get_content__set__storage(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline const char* simcall_asr_get_properties__get__name(smx_simcall_t simcall){ +static inline xbt_dict_t simcall_storage_get_content__get__result(smx_simcall_t simcall){ + return (xbt_dict_t) simcall->result.dp; +} +static inline void simcall_storage_get_content__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline const char* simcall_asr_get_properties__get__name(smx_simcall_t simcall) { return simcall->args[0].cc; } -static inline void simcall_asr_get_properties__set__name(smx_simcall_t simcall, const char* arg){ +static inline void simcall_asr_get_properties__set__name(smx_simcall_t simcall, const char* arg) { simcall->args[0].cc = arg; } +static inline xbt_dict_t simcall_asr_get_properties__get__result(smx_simcall_t simcall){ + return (xbt_dict_t) simcall->result.dp; +} +static inline void simcall_asr_get_properties__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline int simcall_mc_random__get__min(smx_simcall_t simcall) { + return simcall->args[0].i; +} +static inline void simcall_mc_random__set__min(smx_simcall_t simcall, int arg) { + simcall->args[0].i = arg; +} +static inline int simcall_mc_random__get__max(smx_simcall_t simcall) { + return simcall->args[1].i; +} +static inline void simcall_mc_random__set__max(smx_simcall_t simcall, int arg) { + simcall->args[1].i = arg; +} +static inline int simcall_mc_random__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_mc_random__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} #ifdef HAVE_LATENCY_BOUND_TRACKING -static inline smx_action_t simcall_comm_is_latency_bounded__get__comm(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; + +static inline smx_synchro_t simcall_comm_is_latency_bounded__get__comm(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; } -static inline void simcall_comm_is_latency_bounded__set__comm(smx_simcall_t simcall, void* arg){ +static inline void simcall_comm_is_latency_bounded__set__comm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } +static inline int simcall_comm_is_latency_bounded__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_comm_is_latency_bounded__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} #endif #ifdef HAVE_TRACING -static inline smx_action_t simcall_set_category__get__action(smx_simcall_t simcall){ - return (smx_action_t) simcall->args[0].dp; + +static inline smx_synchro_t simcall_set_category__get__synchro(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; } -static inline void simcall_set_category__set__action(smx_simcall_t simcall, void* arg){ +static inline void simcall_set_category__set__synchro(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline const char* simcall_set_category__get__category(smx_simcall_t simcall){ +static inline const char* simcall_set_category__get__category(smx_simcall_t simcall) { return simcall->args[1].cc; } -static inline void simcall_set_category__set__category(smx_simcall_t simcall, const char* arg){ +static inline void simcall_set_category__set__category(smx_simcall_t simcall, const char* arg) { simcall->args[1].cc = arg; } #endif #ifdef HAVE_MC -static inline void* simcall_mc_compare_snapshots__get__s1(smx_simcall_t simcall){ - return simcall->args[0].dp; +static inline mc_snapshot_t simcall_mc_snapshot__get__result(smx_simcall_t simcall){ + return (mc_snapshot_t) simcall->result.dp; } -static inline void simcall_mc_compare_snapshots__set__s1(smx_simcall_t simcall, void* arg){ - simcall->args[0].dp = arg; +static inline void simcall_mc_snapshot__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; } -static inline void* simcall_mc_compare_snapshots__get__s2(smx_simcall_t simcall){ - return simcall->args[1].dp; + +static inline mc_snapshot_t simcall_mc_compare_snapshots__get__s1(smx_simcall_t simcall) { + return (mc_snapshot_t) simcall->args[0].dp; } -static inline void simcall_mc_compare_snapshots__set__s2(smx_simcall_t simcall, void* arg){ - simcall->args[1].dp = arg; +static inline void simcall_mc_compare_snapshots__set__s1(smx_simcall_t simcall, void* arg) { + simcall->args[0].dp = arg; } -static inline int simcall_mc_random__get__min(smx_simcall_t simcall){ - return simcall->args[0].i; +static inline mc_snapshot_t simcall_mc_compare_snapshots__get__s2(smx_simcall_t simcall) { + return (mc_snapshot_t) simcall->args[1].dp; } -static inline void simcall_mc_random__set__min(smx_simcall_t simcall, int arg){ - simcall->args[0].i = arg; +static inline void simcall_mc_compare_snapshots__set__s2(smx_simcall_t simcall, void* arg) { + simcall->args[1].dp = arg; } -static inline int simcall_mc_random__get__max(smx_simcall_t simcall){ - return simcall->args[1].i; +static inline int simcall_mc_compare_snapshots__get__result(smx_simcall_t simcall){ + return simcall->result.i; } -static inline void simcall_mc_random__set__max(smx_simcall_t simcall, int arg){ - simcall->args[1].i = arg; +static inline void simcall_mc_compare_snapshots__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; } #endif + + +/* The prototype of all simcall handlers, automatically generated for you */ + +void simcall_HANDLER_host_off(smx_simcall_t simcall, smx_host_t host); +void simcall_HANDLER_host_execution_wait(smx_simcall_t simcall, smx_synchro_t execution); +void simcall_HANDLER_vm_suspend(smx_simcall_t simcall, smx_host_t ind_vm); +void simcall_HANDLER_vm_resume(smx_simcall_t simcall, smx_host_t ind_vm); +void simcall_HANDLER_vm_shutdown(smx_simcall_t simcall, smx_host_t ind_vm); +void simcall_HANDLER_vm_save(smx_simcall_t simcall, smx_host_t ind_vm); +void simcall_HANDLER_vm_restore(smx_simcall_t simcall, smx_host_t ind_vm); +void simcall_HANDLER_process_create(smx_simcall_t simcall, smx_process_t* process, const char* name, xbt_main_func_t code, void* data, const char* hostname, double kill_time, int argc, char** argv, xbt_dict_t properties, int auto_restart); +void simcall_HANDLER_process_kill(smx_simcall_t simcall, smx_process_t process); +void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid); +void simcall_HANDLER_process_change_host(smx_simcall_t simcall, smx_process_t process, smx_host_t dest); +void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_process_t process); +void simcall_HANDLER_process_resume(smx_simcall_t simcall, smx_process_t process); +void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_process_t process, double timeout); +void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration); +smx_process_t simcall_HANDLER_process_restart(smx_simcall_t simcall, smx_process_t process); +smx_synchro_t simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv, int type, int src, int tag, simix_match_func_t match_fun, void* data); +void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout); +smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, int detached); +void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_rdv_t rdv, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate); +smx_synchro_t simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_rdv_t rdv, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate); +void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, xbt_dynar_t comms); +void simcall_HANDLER_comm_wait(smx_simcall_t simcall, smx_synchro_t comm, double timeout); +void simcall_HANDLER_comm_test(smx_simcall_t simcall, smx_synchro_t comm); +void simcall_HANDLER_comm_testany(smx_simcall_t simcall, xbt_dynar_t comms); +smx_mutex_t simcall_HANDLER_mutex_init(smx_simcall_t simcall); +void simcall_HANDLER_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex); +int simcall_HANDLER_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex); +void simcall_HANDLER_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex); +void simcall_HANDLER_cond_wait(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex); +void simcall_HANDLER_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex, double timeout); +void simcall_HANDLER_sem_release(smx_simcall_t simcall, smx_sem_t sem); +int simcall_HANDLER_sem_would_block(smx_simcall_t simcall, smx_sem_t sem); +void simcall_HANDLER_sem_acquire(smx_simcall_t simcall, smx_sem_t sem); +void simcall_HANDLER_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout); +int simcall_HANDLER_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem); +void simcall_HANDLER_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, smx_host_t host); +void simcall_HANDLER_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, smx_host_t host); +void simcall_HANDLER_file_open(smx_simcall_t simcall, const char* fullpath, smx_host_t host); +void simcall_HANDLER_file_close(smx_simcall_t simcall, smx_file_t fd, smx_host_t host); +sg_size_t simcall_HANDLER_file_get_size(smx_simcall_t simcall, smx_file_t fd); +sg_size_t simcall_HANDLER_file_tell(smx_simcall_t simcall, smx_file_t fd); +int simcall_HANDLER_file_seek(smx_simcall_t simcall, smx_file_t fd, sg_offset_t offset, int origin); +xbt_dynar_t simcall_HANDLER_file_get_info(smx_simcall_t simcall, smx_file_t fd); +int simcall_HANDLER_file_move(smx_simcall_t simcall, smx_file_t fd, const char* fullpath); +sg_size_t simcall_HANDLER_storage_get_free_size(smx_simcall_t simcall, smx_storage_t storage); +sg_size_t simcall_HANDLER_storage_get_used_size(smx_simcall_t simcall, smx_storage_t name); +xbt_dict_t simcall_HANDLER_asr_get_properties(smx_simcall_t simcall, const char* name); +int simcall_HANDLER_mc_random(smx_simcall_t simcall, int min, int max); +#ifdef HAVE_LATENCY_BOUND_TRACKING + +#endif + +#ifdef HAVE_TRACING + +#endif + +#ifdef HAVE_MC +mc_snapshot_t simcall_HANDLER_mc_snapshot(smx_simcall_t simcall); +int simcall_HANDLER_mc_compare_snapshots(smx_simcall_t simcall, mc_snapshot_t s1, mc_snapshot_t s2); +#endif diff --git a/src/simix/simcalls_generated_body.c b/src/simix/popping_bodies.c similarity index 61% rename from src/simix/simcalls_generated_body.c rename to src/simix/popping_bodies.c index 218c72a227..81efa338a2 100644 --- a/src/simix/simcalls_generated_body.c +++ b/src/simix/popping_bodies.c @@ -1,12 +1,29 @@ -/********************************************* - * File Generated by src/simix/simcalls.py * - * from src/simix/simcalls.in * - * Do not modify this file, add new simcalls * - * in src/simix/simcalls.in * - *********************************************/ +/**********************************************************************/ +/* File generated by src/simix/simcalls.py from src/simix/simcalls.in */ +/* */ +/* DO NOT EVER CHANGE THIS FILE */ +/* */ +/* change simcalls specification in src/simix/simcalls.in */ +/**********************************************************************/ - inline static smx_host_t simcall_BODY_host_get_by_name(const char* name) { +/* + * Note that the name comes from http://en.wikipedia.org/wiki/Popping + * Indeed, the control flow is doing a strange dance in there. + * + * That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :) + */ + +#include "smx_private.h" +#include "mc/mc_interface.h" +#include "xbt/ex.h" + +inline static smx_host_t simcall_BODY_host_get_by_name(const char* name) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_by_name(name); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_BY_NAME; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -16,12 +33,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static const char* simcall_BODY_host_get_name(smx_host_t host) { + +inline static const char* simcall_BODY_host_get_name(smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_name(host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_NAME; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -31,12 +54,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.cc; } - inline static void simcall_BODY_host_on(smx_host_t host) { + +inline static void simcall_BODY_host_on(smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_on(host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_ON; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -46,12 +75,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_host_off(smx_host_t host) { + +inline static void simcall_BODY_host_off(smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_host_off(&self->simcall, host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_OFF; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -61,12 +96,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static xbt_dict_t simcall_BODY_host_get_properties(smx_host_t host) { + +inline static xbt_dict_t simcall_BODY_host_get_properties(smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_properties(host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_PROPERTIES; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -76,12 +117,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static int simcall_BODY_host_get_core(smx_host_t host) { + +inline static int simcall_BODY_host_get_core(smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_core(host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_CORE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -91,12 +138,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static xbt_swag_t simcall_BODY_host_get_process_list(smx_host_t host) { + +inline static xbt_swag_t simcall_BODY_host_get_process_list(smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_process_list(host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_PROCESS_LIST; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -106,12 +159,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static double simcall_BODY_host_get_speed(smx_host_t host) { + +inline static double simcall_BODY_host_get_speed(smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_speed(host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_SPEED; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -121,12 +180,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.d; } - inline static double simcall_BODY_host_get_available_speed(smx_host_t host) { + +inline static double simcall_BODY_host_get_available_speed(smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_available_speed(host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_AVAILABLE_SPEED; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -136,12 +201,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.d; } - inline static int simcall_BODY_host_get_state(smx_host_t host) { + +inline static int simcall_BODY_host_get_state(smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_state(host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_STATE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -151,12 +222,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static double simcall_BODY_host_get_current_power_peak(smx_host_t host) { + +inline static double simcall_BODY_host_get_current_power_peak(smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_current_power_peak(host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_CURRENT_POWER_PEAK; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -166,12 +243,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.d; } - inline static double simcall_BODY_host_get_power_peak_at(smx_host_t host, int pstate_index) { + +inline static double simcall_BODY_host_get_power_peak_at(smx_host_t host, int pstate_index) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_power_peak_at(host, pstate_index); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_POWER_PEAK_AT; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -182,12 +265,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.d; } - inline static int simcall_BODY_host_get_nb_pstates(smx_host_t host) { + +inline static int simcall_BODY_host_get_nb_pstates(smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_nb_pstates(host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_NB_PSTATES; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -197,12 +286,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static void simcall_BODY_host_set_power_peak_at(smx_host_t host, int pstate_index) { + +inline static void simcall_BODY_host_set_power_peak_at(smx_host_t host, int pstate_index) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_set_power_peak_at(host, pstate_index); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_SET_POWER_PEAK_AT; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -213,12 +308,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static double simcall_BODY_host_get_consumed_energy(smx_host_t host) { + +inline static double simcall_BODY_host_get_consumed_energy(smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_consumed_energy(host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_CONSUMED_ENERGY; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -228,12 +329,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.d; } - inline static smx_action_t simcall_BODY_host_execute(const char* name, smx_host_t host, double computation_amount, double priority, double bound, unsigned long affinity_mask) { + +inline static smx_synchro_t simcall_BODY_host_execute(const char* name, smx_host_t host, double computation_amount, double priority, double bound, unsigned long affinity_mask) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_execute(name, host, computation_amount, priority, bound, affinity_mask); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_EXECUTE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -248,12 +355,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static smx_action_t simcall_BODY_host_parallel_execute(const char* name, int host_nb, smx_host_t* host_list, double* computation_amount, double* communication_amount, double amount, double rate) { + +inline static smx_synchro_t simcall_BODY_host_parallel_execute(const char* name, int host_nb, smx_host_t* host_list, double* computation_amount, double* communication_amount, double amount, double rate) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_parallel_execute(name, host_nb, host_list, computation_amount, communication_amount, amount, rate); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_PARALLEL_EXECUTE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -269,12 +382,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static void simcall_BODY_host_execution_destroy(smx_action_t execution) { + +inline static void simcall_BODY_host_execution_destroy(smx_synchro_t execution) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_execution_destroy(execution); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_EXECUTION_DESTROY; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -284,12 +403,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_host_execution_cancel(smx_action_t execution) { + +inline static void simcall_BODY_host_execution_cancel(smx_synchro_t execution) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_execution_cancel(execution); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_EXECUTION_CANCEL; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -299,12 +424,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static double simcall_BODY_host_execution_get_remains(smx_action_t execution) { + +inline static double simcall_BODY_host_execution_get_remains(smx_synchro_t execution) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_execution_get_remains(execution); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_EXECUTION_GET_REMAINS; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -314,12 +445,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.d; } - inline static int simcall_BODY_host_execution_get_state(smx_action_t execution) { + +inline static e_smx_state_t simcall_BODY_host_execution_get_state(smx_synchro_t execution) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_execution_get_state(execution); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_EXECUTION_GET_STATE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -329,12 +466,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static void simcall_BODY_host_execution_set_priority(smx_action_t execution, double priority) { + +inline static void simcall_BODY_host_execution_set_priority(smx_synchro_t execution, double priority) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_execution_set_priority(execution, priority); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_EXECUTION_SET_PRIORITY; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -345,12 +488,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_host_execution_set_bound(smx_action_t execution, double bound) { + +inline static void simcall_BODY_host_execution_set_bound(smx_synchro_t execution, double bound) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_execution_set_bound(execution, bound); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_EXECUTION_SET_BOUND; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -361,12 +510,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_host_execution_set_affinity(smx_action_t execution, smx_host_t ws, unsigned long mask) { + +inline static void simcall_BODY_host_execution_set_affinity(smx_synchro_t execution, smx_host_t ws, unsigned long mask) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_execution_set_affinity(execution, ws, mask); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_EXECUTION_SET_AFFINITY; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -378,12 +533,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static int simcall_BODY_host_execution_wait(smx_action_t execution) { + +inline static int simcall_BODY_host_execution_wait(smx_synchro_t execution) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_host_execution_wait(&self->simcall, execution); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_EXECUTION_WAIT; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -393,12 +554,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static xbt_dict_t simcall_BODY_host_get_mounted_storage_list(smx_host_t host) { + +inline static xbt_dict_t simcall_BODY_host_get_mounted_storage_list(smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_mounted_storage_list(host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -408,12 +575,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static xbt_dynar_t simcall_BODY_host_get_attached_storage_list(smx_host_t host) { + +inline static xbt_dynar_t simcall_BODY_host_get_attached_storage_list(smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_attached_storage_list(host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -423,12 +596,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static void simcall_BODY_host_get_params(smx_host_t ind_vm, ws_params_t params) { + +inline static void simcall_BODY_host_get_params(smx_host_t ind_vm, ws_params_t params) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_get_params(ind_vm, params); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_GET_PARAMS; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -439,12 +618,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_host_set_params(smx_host_t ind_vm, ws_params_t params) { + +inline static void simcall_BODY_host_set_params(smx_host_t ind_vm, ws_params_t params) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_host_set_params(ind_vm, params); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_HOST_SET_PARAMS; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -455,12 +640,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void* simcall_BODY_vm_create(const char* name, smx_host_t ind_pm) { + +inline static smx_host_t simcall_BODY_vm_create(const char* name, smx_host_t ind_pm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_vm_create(name, ind_pm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_VM_CREATE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -471,12 +662,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static void simcall_BODY_vm_start(smx_host_t ind_vm) { + +inline static void simcall_BODY_vm_start(smx_host_t ind_vm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_vm_start(ind_vm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_VM_START; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -486,12 +683,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static int simcall_BODY_vm_get_state(smx_host_t ind_vm) { + +inline static int simcall_BODY_vm_get_state(smx_host_t ind_vm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_vm_get_state(ind_vm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_VM_GET_STATE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -501,12 +704,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static void simcall_BODY_vm_migrate(smx_host_t ind_vm, smx_host_t ind_dst_pm) { + +inline static void simcall_BODY_vm_migrate(smx_host_t ind_vm, smx_host_t ind_dst_pm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_vm_migrate(ind_vm, ind_dst_pm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_VM_MIGRATE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -517,12 +726,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void* simcall_BODY_vm_get_pm(smx_host_t ind_vm) { + +inline static void* simcall_BODY_vm_get_pm(smx_host_t ind_vm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_vm_get_pm(ind_vm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_VM_GET_PM; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -532,12 +747,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static void simcall_BODY_vm_set_bound(smx_host_t ind_vm, double bound) { + +inline static void simcall_BODY_vm_set_bound(smx_host_t ind_vm, double bound) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_vm_set_bound(ind_vm, bound); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_VM_SET_BOUND; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -548,12 +769,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_vm_set_affinity(smx_host_t ind_vm, smx_host_t ind_pm, unsigned long mask) { + +inline static void simcall_BODY_vm_set_affinity(smx_host_t ind_vm, smx_host_t ind_pm, unsigned long mask) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_vm_set_affinity(ind_vm, ind_pm, mask); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_VM_SET_AFFINITY; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -565,12 +792,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_vm_destroy(smx_host_t ind_vm) { + +inline static void simcall_BODY_vm_destroy(smx_host_t ind_vm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_vm_destroy(ind_vm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_VM_DESTROY; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -580,12 +813,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_vm_suspend(smx_host_t ind_vm) { + +inline static void simcall_BODY_vm_suspend(smx_host_t ind_vm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_vm_suspend(&self->simcall, ind_vm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_VM_SUSPEND; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -595,12 +834,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_vm_resume(smx_host_t ind_vm) { + +inline static void simcall_BODY_vm_resume(smx_host_t ind_vm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_vm_resume(&self->simcall, ind_vm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_VM_RESUME; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -610,12 +855,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_vm_shutdown(smx_host_t ind_vm) { + +inline static void simcall_BODY_vm_shutdown(smx_host_t ind_vm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_vm_shutdown(&self->simcall, ind_vm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_VM_SHUTDOWN; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -625,12 +876,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_vm_save(smx_host_t ind_vm) { + +inline static void simcall_BODY_vm_save(smx_host_t ind_vm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_vm_save(&self->simcall, ind_vm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_VM_SAVE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -640,12 +897,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_vm_restore(smx_host_t ind_vm) { + +inline static void simcall_BODY_vm_restore(smx_host_t ind_vm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_vm_restore(&self->simcall, ind_vm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_VM_RESTORE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -655,12 +918,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_process_create(smx_process_t* process, const char* name, xbt_main_func_t code, void* data, const char* hostname, double kill_time, int argc, char** argv, xbt_dict_t properties, int auto_restart) { + +inline static void simcall_BODY_process_create(smx_process_t* process, const char* name, xbt_main_func_t code, void* data, const char* hostname, double kill_time, int argc, char** argv, xbt_dict_t properties, int auto_restart) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_process_create(&self->simcall, process, name, code, data, hostname, kill_time, argc, argv, properties, auto_restart); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_CREATE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -679,12 +948,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_process_kill(smx_process_t process) { + +inline static void simcall_BODY_process_kill(smx_process_t process) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_process_kill(&self->simcall, process); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_KILL; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -694,12 +969,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_process_killall(int reset_pid) { + +inline static void simcall_BODY_process_killall(int reset_pid) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_process_killall(&self->simcall, reset_pid); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_KILLALL; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -709,12 +990,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_process_cleanup(smx_process_t process) { + +inline static void simcall_BODY_process_cleanup(smx_process_t process) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_cleanup(process); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_CLEANUP; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -724,12 +1011,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_process_change_host(smx_process_t process, smx_host_t dest) { + +inline static void simcall_BODY_process_change_host(smx_process_t process, smx_host_t dest) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_process_change_host(&self->simcall, process, dest); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_CHANGE_HOST; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -740,12 +1033,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_process_suspend(smx_process_t process) { + +inline static void simcall_BODY_process_suspend(smx_process_t process) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_process_suspend(&self->simcall, process); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_SUSPEND; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -755,12 +1054,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_process_resume(smx_process_t process) { + +inline static void simcall_BODY_process_resume(smx_process_t process) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_process_resume(&self->simcall, process); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_RESUME; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -770,12 +1075,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static int simcall_BODY_process_count() { + +inline static int simcall_BODY_process_count() { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_count(); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_COUNT; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -785,12 +1096,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static int simcall_BODY_process_get_PID(smx_process_t process) { + +inline static int simcall_BODY_process_get_PID(smx_process_t process) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_get_PID(process); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_GET_PID; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -800,12 +1117,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static int simcall_BODY_process_get_PPID(smx_process_t process) { + +inline static int simcall_BODY_process_get_PPID(smx_process_t process) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_get_PPID(process); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_GET_PPID; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -815,12 +1138,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static void* simcall_BODY_process_get_data(smx_process_t process) { + +inline static void* simcall_BODY_process_get_data(smx_process_t process) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_get_data(process); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_GET_DATA; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -830,12 +1159,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static void simcall_BODY_process_set_data(smx_process_t process, void* data) { + +inline static void simcall_BODY_process_set_data(smx_process_t process, void* data) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_set_data(process, data); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_SET_DATA; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -846,12 +1181,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static smx_host_t simcall_BODY_process_get_host(smx_process_t process) { + +inline static smx_host_t simcall_BODY_process_get_host(smx_process_t process) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_get_host(process); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_GET_HOST; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -861,12 +1202,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static const char* simcall_BODY_process_get_name(smx_process_t process) { + +inline static const char* simcall_BODY_process_get_name(smx_process_t process) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_get_name(process); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_GET_NAME; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -876,12 +1223,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.cc; } - inline static int simcall_BODY_process_is_suspended(smx_process_t process) { + +inline static int simcall_BODY_process_is_suspended(smx_process_t process) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_is_suspended(process); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_IS_SUSPENDED; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -891,12 +1244,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static xbt_dict_t simcall_BODY_process_get_properties(smx_process_t process) { + +inline static xbt_dict_t simcall_BODY_process_get_properties(smx_process_t process) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_get_properties(process); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_GET_PROPERTIES; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -906,12 +1265,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static int simcall_BODY_process_join(smx_process_t process, double timeout) { + +inline static int simcall_BODY_process_join(smx_process_t process, double timeout) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_process_join(&self->simcall, process, timeout); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_JOIN; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -922,12 +1287,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static int simcall_BODY_process_sleep(double duration) { + +inline static int simcall_BODY_process_sleep(double duration) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_process_sleep(&self->simcall, duration); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_SLEEP; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -937,12 +1308,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static void simcall_BODY_process_on_exit(smx_process_t process, int_f_pvoid_pvoid_t fun, void* data) { + +inline static void simcall_BODY_process_on_exit(smx_process_t process, int_f_pvoid_pvoid_t fun, void* data) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_on_exit(process, fun, data); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_ON_EXIT; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -954,12 +1331,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_process_auto_restart_set(smx_process_t process, int auto_restart) { + +inline static void simcall_BODY_process_auto_restart_set(smx_process_t process, int auto_restart) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_auto_restart_set(process, auto_restart); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_AUTO_RESTART_SET; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -970,12 +1353,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static smx_process_t simcall_BODY_process_restart(smx_process_t process) { + +inline static smx_process_t simcall_BODY_process_restart(smx_process_t process) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_process_restart(&self->simcall, process); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_PROCESS_RESTART; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -985,12 +1374,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static smx_rdv_t simcall_BODY_rdv_create(const char* name) { + +inline static smx_rdv_t simcall_BODY_rdv_create(const char* name) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_rdv_create(name); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_RDV_CREATE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1000,12 +1395,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static void simcall_BODY_rdv_destroy(smx_rdv_t rdv) { + +inline static void simcall_BODY_rdv_destroy(smx_rdv_t rdv) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_rdv_destroy(rdv); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_RDV_DESTROY; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1015,12 +1416,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static unsigned int simcall_BODY_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host) { + +inline static unsigned int simcall_BODY_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_rdv_comm_count_by_host(rdv, host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_RDV_COMM_COUNT_BY_HOST; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1031,12 +1438,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.ui; } - inline static smx_action_t simcall_BODY_rdv_get_head(smx_rdv_t rdv) { + +inline static smx_synchro_t simcall_BODY_rdv_get_head(smx_rdv_t rdv) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_rdv_get_head(rdv); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_RDV_GET_HEAD; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1046,12 +1459,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static void simcall_BODY_rdv_set_receiver(smx_rdv_t rdv, smx_process_t receiver) { + +inline static void simcall_BODY_rdv_set_receiver(smx_rdv_t rdv, smx_process_t receiver) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_rdv_set_receiver(rdv, receiver); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_RDV_SET_RECEIVER; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1062,12 +1481,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static smx_process_t simcall_BODY_rdv_get_receiver(smx_rdv_t rdv) { + +inline static smx_process_t simcall_BODY_rdv_get_receiver(smx_rdv_t rdv) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_rdv_get_receiver(rdv); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_RDV_GET_RECEIVER; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1077,12 +1502,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static smx_action_t simcall_BODY_comm_iprobe(smx_rdv_t rdv, int type, int src, int tag, simix_match_func_t match_fun, void* data) { + +inline static smx_synchro_t simcall_BODY_comm_iprobe(smx_rdv_t rdv, int type, int src, int tag, simix_match_func_t match_fun, void* data) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_comm_iprobe(&self->simcall, rdv, type, src, tag, match_fun, data); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_IPROBE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1097,12 +1528,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static void simcall_BODY_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout) { + +inline static void simcall_BODY_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_comm_send(&self->simcall, src, rdv, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_SEND; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1121,12 +1558,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static smx_action_t simcall_BODY_comm_isend(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, int detached) { + +inline static smx_synchro_t simcall_BODY_comm_isend(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, int detached) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_comm_isend(&self->simcall, src, rdv, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_ISEND; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1146,12 +1589,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static void simcall_BODY_comm_recv(smx_rdv_t rdv, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate) { + +inline static void simcall_BODY_comm_recv(smx_rdv_t rdv, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_comm_recv(&self->simcall, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_RECV; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1168,12 +1617,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static smx_action_t simcall_BODY_comm_irecv(smx_rdv_t rdv, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate) { + +inline static smx_synchro_t simcall_BODY_comm_irecv(smx_rdv_t rdv, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_comm_irecv(&self->simcall, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_IRECV; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1189,12 +1644,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static void simcall_BODY_comm_cancel(smx_action_t comm) { + +inline static void simcall_BODY_comm_cancel(smx_synchro_t comm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_comm_cancel(comm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_CANCEL; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1204,12 +1665,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static int simcall_BODY_comm_waitany(xbt_dynar_t comms) { + +inline static int simcall_BODY_comm_waitany(xbt_dynar_t comms) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_comm_waitany(&self->simcall, comms); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_WAITANY; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1219,12 +1686,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static void simcall_BODY_comm_wait(smx_action_t comm, double timeout) { + +inline static void simcall_BODY_comm_wait(smx_synchro_t comm, double timeout) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_comm_wait(&self->simcall, comm, timeout); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_WAIT; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1235,12 +1708,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static int simcall_BODY_comm_test(smx_action_t comm) { + +inline static int simcall_BODY_comm_test(smx_synchro_t comm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_comm_test(&self->simcall, comm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_TEST; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1250,12 +1729,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static int simcall_BODY_comm_testany(xbt_dynar_t comms) { + +inline static int simcall_BODY_comm_testany(xbt_dynar_t comms) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_comm_testany(&self->simcall, comms); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_TESTANY; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1265,12 +1750,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static double simcall_BODY_comm_get_remains(smx_action_t comm) { + +inline static double simcall_BODY_comm_get_remains(smx_synchro_t comm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_comm_get_remains(comm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_GET_REMAINS; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1280,12 +1771,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.d; } - inline static int simcall_BODY_comm_get_state(smx_action_t comm) { + +inline static e_smx_state_t simcall_BODY_comm_get_state(smx_synchro_t comm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_comm_get_state(comm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_GET_STATE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1295,12 +1792,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static void* simcall_BODY_comm_get_src_data(smx_action_t comm) { + +inline static void* simcall_BODY_comm_get_src_data(smx_synchro_t comm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_comm_get_src_data(comm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_GET_SRC_DATA; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1310,12 +1813,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static void* simcall_BODY_comm_get_dst_data(smx_action_t comm) { + +inline static void* simcall_BODY_comm_get_dst_data(smx_synchro_t comm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_comm_get_dst_data(comm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_GET_DST_DATA; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1325,12 +1834,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static smx_process_t simcall_BODY_comm_get_src_proc(smx_action_t comm) { + +inline static smx_process_t simcall_BODY_comm_get_src_proc(smx_synchro_t comm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_comm_get_src_proc(comm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_GET_SRC_PROC; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1340,12 +1855,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static smx_process_t simcall_BODY_comm_get_dst_proc(smx_action_t comm) { + +inline static smx_process_t simcall_BODY_comm_get_dst_proc(smx_synchro_t comm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_comm_get_dst_proc(comm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_GET_DST_PROC; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1355,12 +1876,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static smx_mutex_t simcall_BODY_mutex_init() { + +inline static smx_mutex_t simcall_BODY_mutex_init() { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_mutex_init(&self->simcall); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_MUTEX_INIT; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1370,12 +1897,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static void simcall_BODY_mutex_destroy(smx_mutex_t mutex) { + +inline static void simcall_BODY_mutex_destroy(smx_mutex_t mutex) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_mutex_destroy(mutex); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_MUTEX_DESTROY; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1385,12 +1918,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_mutex_lock(smx_mutex_t mutex) { + +inline static void simcall_BODY_mutex_lock(smx_mutex_t mutex) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_mutex_lock(&self->simcall, mutex); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_MUTEX_LOCK; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1400,12 +1939,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static int simcall_BODY_mutex_trylock(smx_mutex_t mutex) { + +inline static int simcall_BODY_mutex_trylock(smx_mutex_t mutex) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_mutex_trylock(&self->simcall, mutex); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_MUTEX_TRYLOCK; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1415,12 +1960,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static void simcall_BODY_mutex_unlock(smx_mutex_t mutex) { + +inline static void simcall_BODY_mutex_unlock(smx_mutex_t mutex) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_mutex_unlock(&self->simcall, mutex); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_MUTEX_UNLOCK; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1430,12 +1981,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static smx_cond_t simcall_BODY_cond_init() { + +inline static smx_cond_t simcall_BODY_cond_init() { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_cond_init(); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COND_INIT; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1445,12 +2002,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static void simcall_BODY_cond_destroy(smx_cond_t cond) { + +inline static void simcall_BODY_cond_destroy(smx_cond_t cond) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_cond_destroy(cond); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COND_DESTROY; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1460,12 +2023,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_cond_signal(smx_cond_t cond) { + +inline static void simcall_BODY_cond_signal(smx_cond_t cond) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_cond_signal(cond); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COND_SIGNAL; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1475,12 +2044,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_cond_wait(smx_cond_t cond, smx_mutex_t mutex) { + +inline static void simcall_BODY_cond_wait(smx_cond_t cond, smx_mutex_t mutex) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_cond_wait(&self->simcall, cond, mutex); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COND_WAIT; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1491,12 +2066,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout) { + +inline static void simcall_BODY_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_cond_wait_timeout(&self->simcall, cond, mutex, timeout); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COND_WAIT_TIMEOUT; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1508,12 +2089,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_cond_broadcast(smx_cond_t cond) { + +inline static void simcall_BODY_cond_broadcast(smx_cond_t cond) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_cond_broadcast(cond); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COND_BROADCAST; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1523,27 +2110,39 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static smx_sem_t simcall_BODY_sem_init(int capacity) { + +inline static smx_sem_t simcall_BODY_sem_init(unsigned int capacity) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_sem_init(capacity); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_SEM_INIT; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].i = (int) capacity; + self->simcall.args[0].ui = (unsigned int) capacity; if (self != simix_global->maestro_process) { XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static void simcall_BODY_sem_destroy(smx_sem_t sem) { + +inline static void simcall_BODY_sem_destroy(smx_sem_t sem) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_sem_destroy(sem); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_SEM_DESTROY; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1553,12 +2152,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_sem_release(smx_sem_t sem) { + +inline static void simcall_BODY_sem_release(smx_sem_t sem) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_sem_release(&self->simcall, sem); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_SEM_RELEASE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1568,12 +2173,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static int simcall_BODY_sem_would_block(smx_sem_t sem) { + +inline static int simcall_BODY_sem_would_block(smx_sem_t sem) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_sem_would_block(&self->simcall, sem); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_SEM_WOULD_BLOCK; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1583,12 +2194,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static void simcall_BODY_sem_acquire(smx_sem_t sem) { + +inline static void simcall_BODY_sem_acquire(smx_sem_t sem) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_sem_acquire(&self->simcall, sem); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_SEM_ACQUIRE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1598,12 +2215,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static void simcall_BODY_sem_acquire_timeout(smx_sem_t sem, double timeout) { + +inline static void simcall_BODY_sem_acquire_timeout(smx_sem_t sem, double timeout) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_sem_acquire_timeout(&self->simcall, sem, timeout); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_SEM_ACQUIRE_TIMEOUT; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1614,12 +2237,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } - inline static int simcall_BODY_sem_get_capacity(smx_sem_t sem) { + +inline static int simcall_BODY_sem_get_capacity(smx_sem_t sem) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_sem_get_capacity(&self->simcall, sem); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_SEM_GET_CAPACITY; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1629,12 +2258,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static sg_size_t simcall_BODY_file_read(smx_file_t fd, sg_size_t size, smx_host_t host) { + +inline static sg_size_t simcall_BODY_file_read(smx_file_t fd, sg_size_t size, smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_file_read(&self->simcall, fd, size, host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_FILE_READ; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1646,12 +2281,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.sgsz; } - inline static sg_size_t simcall_BODY_file_write(smx_file_t fd, sg_size_t size, smx_host_t host) { + +inline static sg_size_t simcall_BODY_file_write(smx_file_t fd, sg_size_t size, smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_file_write(&self->simcall, fd, size, host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_FILE_WRITE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1663,12 +2304,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.sgsz; } - inline static smx_file_t simcall_BODY_file_open(const char* fullpath, smx_host_t host) { + +inline static smx_file_t simcall_BODY_file_open(const char* fullpath, smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_file_open(&self->simcall, fullpath, host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_FILE_OPEN; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1679,12 +2326,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static int simcall_BODY_file_close(smx_file_t fd, smx_host_t host) { + +inline static int simcall_BODY_file_close(smx_file_t fd, smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_file_close(&self->simcall, fd, host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_FILE_CLOSE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1695,12 +2348,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static int simcall_BODY_file_unlink(smx_file_t fd, smx_host_t host) { + +inline static int simcall_BODY_file_unlink(smx_file_t fd, smx_host_t host) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_file_unlink(fd, host); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_FILE_UNLINK; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1711,12 +2370,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static sg_size_t simcall_BODY_file_get_size(smx_file_t fd) { + +inline static sg_size_t simcall_BODY_file_get_size(smx_file_t fd) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_file_get_size(&self->simcall, fd); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_FILE_GET_SIZE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1726,12 +2391,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.sgsz; } - inline static sg_size_t simcall_BODY_file_tell(smx_file_t fd) { + +inline static sg_size_t simcall_BODY_file_tell(smx_file_t fd) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_file_tell(&self->simcall, fd); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_FILE_TELL; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1741,12 +2412,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.sgsz; } - inline static int simcall_BODY_file_seek(smx_file_t fd, sg_offset_t offset, int origin) { + +inline static int simcall_BODY_file_seek(smx_file_t fd, sg_offset_t offset, int origin) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_file_seek(&self->simcall, fd, offset, origin); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_FILE_SEEK; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1758,12 +2435,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static xbt_dynar_t simcall_BODY_file_get_info(smx_file_t fd) { + +inline static xbt_dynar_t simcall_BODY_file_get_info(smx_file_t fd) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_file_get_info(&self->simcall, fd); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_FILE_GET_INFO; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1773,12 +2456,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static int simcall_BODY_file_move(smx_file_t fd, const char* fullpath) { + +inline static int simcall_BODY_file_move(smx_file_t fd, const char* fullpath) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_file_move(&self->simcall, fd, fullpath); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_FILE_MOVE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1789,12 +2478,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } - inline static sg_size_t simcall_BODY_storage_get_free_size(smx_storage_t storage) { + +inline static sg_size_t simcall_BODY_storage_get_free_size(smx_storage_t storage) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_storage_get_free_size(&self->simcall, storage); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_STORAGE_GET_FREE_SIZE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1804,12 +2499,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.sgsz; } - inline static sg_size_t simcall_BODY_storage_get_used_size(smx_storage_t name) { + +inline static sg_size_t simcall_BODY_storage_get_used_size(smx_storage_t name) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_storage_get_used_size(&self->simcall, name); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_STORAGE_GET_USED_SIZE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1819,12 +2520,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.sgsz; } - inline static xbt_dict_t simcall_BODY_storage_get_properties(smx_storage_t storage) { + +inline static xbt_dict_t simcall_BODY_storage_get_properties(smx_storage_t storage) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_storage_get_properties(storage); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_STORAGE_GET_PROPERTIES; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1834,12 +2541,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static xbt_dict_t simcall_BODY_storage_get_content(smx_storage_t storage) { + +inline static xbt_dict_t simcall_BODY_storage_get_content(smx_storage_t storage) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_storage_get_content(storage); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_STORAGE_GET_CONTENT; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1849,12 +2562,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static xbt_dict_t simcall_BODY_asr_get_properties(const char* name) { + +inline static xbt_dict_t simcall_BODY_asr_get_properties(const char* name) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_asr_get_properties(&self->simcall, name); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_ASR_GET_PROPERTIES; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1864,13 +2583,41 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } + +inline static int simcall_BODY_mc_random(int min, int max) { + smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_mc_random(&self->simcall, min, max); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + + self->simcall.call = SIMCALL_MC_RANDOM; + memset(&self->simcall.result, 0, sizeof(self->simcall.result)); + memset(self->simcall.args, 0, sizeof(self->simcall.args)); + self->simcall.args[0].i = (int) min; + self->simcall.args[1].i = (int) max; + if (self != simix_global->maestro_process) { + XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, + SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); + SIMIX_process_yield(self); + } else { + SIMIX_simcall_handle(&self->simcall, 0); + } + return self->simcall.result.i; + } #ifdef HAVE_LATENCY_BOUND_TRACKING - inline static int simcall_BODY_comm_is_latency_bounded(smx_action_t comm) { + +inline static int simcall_BODY_comm_is_latency_bounded(smx_synchro_t comm) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_comm_is_latency_bounded(comm); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_COMM_IS_LATENCY_BOUNDED; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1880,34 +2627,46 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } #endif #ifdef HAVE_TRACING - inline static void simcall_BODY_set_category(smx_action_t action, const char* category) { + +inline static void simcall_BODY_set_category(smx_synchro_t synchro, const char* category) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_set_category(synchro, category); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_SET_CATEGORY; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) action; + self->simcall.args[0].dp = (void*) synchro; self->simcall.args[1].cc = (const char*) category; if (self != simix_global->maestro_process) { XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } } #endif #ifdef HAVE_MC - inline static void* simcall_BODY_mc_snapshot() { + +inline static mc_snapshot_t simcall_BODY_mc_snapshot() { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_mc_snapshot(&self->simcall); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_MC_SNAPSHOT; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1917,12 +2676,18 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.dp; } - inline static int simcall_BODY_mc_compare_snapshots(void* s1, void* s2) { + +inline static int simcall_BODY_mc_compare_snapshots(mc_snapshot_t s1, mc_snapshot_t s2) { smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_mc_compare_snapshots(&self->simcall, s1, s2); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + self->simcall.call = SIMCALL_MC_COMPARE_SNAPSHOTS; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); @@ -1933,23 +2698,7 @@ SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { - SIMIX_simcall_pre(&self->simcall, 0); - } - return self->simcall.result.i; - } - inline static int simcall_BODY_mc_random(int min, int max) { - smx_process_t self = SIMIX_process_self(); - self->simcall.call = SIMCALL_MC_RANDOM; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].i = (int) min; - self->simcall.args[1].i = (int) max; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_pre(&self->simcall, 0); + SIMIX_simcall_handle(&self->simcall, 0); } return self->simcall.result.i; } diff --git a/src/simix/popping_enum.h b/src/simix/popping_enum.h new file mode 100644 index 0000000000..634f03957a --- /dev/null +++ b/src/simix/popping_enum.h @@ -0,0 +1,153 @@ +/**********************************************************************/ +/* File generated by src/simix/simcalls.py from src/simix/simcalls.in */ +/* */ +/* DO NOT EVER CHANGE THIS FILE */ +/* */ +/* change simcalls specification in src/simix/simcalls.in */ +/**********************************************************************/ + +/* + * Note that the name comes from http://en.wikipedia.org/wiki/Popping + * Indeed, the control flow is doing a strange dance in there. + * + * That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :) + */ + +/** + * @brief All possible simcalls. + */ +typedef enum { + SIMCALL_NONE, + SIMCALL_HOST_GET_BY_NAME, + SIMCALL_HOST_GET_NAME, + SIMCALL_HOST_ON, + SIMCALL_HOST_OFF, + SIMCALL_HOST_GET_PROPERTIES, + SIMCALL_HOST_GET_CORE, + SIMCALL_HOST_GET_PROCESS_LIST, + SIMCALL_HOST_GET_SPEED, + SIMCALL_HOST_GET_AVAILABLE_SPEED, + SIMCALL_HOST_GET_STATE, + SIMCALL_HOST_GET_CURRENT_POWER_PEAK, + SIMCALL_HOST_GET_POWER_PEAK_AT, + SIMCALL_HOST_GET_NB_PSTATES, + SIMCALL_HOST_SET_POWER_PEAK_AT, + SIMCALL_HOST_GET_CONSUMED_ENERGY, + SIMCALL_HOST_EXECUTE, + SIMCALL_HOST_PARALLEL_EXECUTE, + SIMCALL_HOST_EXECUTION_DESTROY, + SIMCALL_HOST_EXECUTION_CANCEL, + SIMCALL_HOST_EXECUTION_GET_REMAINS, + SIMCALL_HOST_EXECUTION_GET_STATE, + SIMCALL_HOST_EXECUTION_SET_PRIORITY, + SIMCALL_HOST_EXECUTION_SET_BOUND, + SIMCALL_HOST_EXECUTION_SET_AFFINITY, + SIMCALL_HOST_EXECUTION_WAIT, + SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST, + SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST, + SIMCALL_HOST_GET_PARAMS, + SIMCALL_HOST_SET_PARAMS, + SIMCALL_VM_CREATE, + SIMCALL_VM_START, + SIMCALL_VM_GET_STATE, + SIMCALL_VM_MIGRATE, + SIMCALL_VM_GET_PM, + SIMCALL_VM_SET_BOUND, + SIMCALL_VM_SET_AFFINITY, + SIMCALL_VM_DESTROY, + SIMCALL_VM_SUSPEND, + SIMCALL_VM_RESUME, + SIMCALL_VM_SHUTDOWN, + SIMCALL_VM_SAVE, + SIMCALL_VM_RESTORE, + SIMCALL_PROCESS_CREATE, + SIMCALL_PROCESS_KILL, + SIMCALL_PROCESS_KILLALL, + SIMCALL_PROCESS_CLEANUP, + SIMCALL_PROCESS_CHANGE_HOST, + SIMCALL_PROCESS_SUSPEND, + SIMCALL_PROCESS_RESUME, + SIMCALL_PROCESS_COUNT, + SIMCALL_PROCESS_GET_PID, + SIMCALL_PROCESS_GET_PPID, + SIMCALL_PROCESS_GET_DATA, + SIMCALL_PROCESS_SET_DATA, + SIMCALL_PROCESS_GET_HOST, + SIMCALL_PROCESS_GET_NAME, + SIMCALL_PROCESS_IS_SUSPENDED, + SIMCALL_PROCESS_GET_PROPERTIES, + SIMCALL_PROCESS_JOIN, + SIMCALL_PROCESS_SLEEP, + SIMCALL_PROCESS_ON_EXIT, + SIMCALL_PROCESS_AUTO_RESTART_SET, + SIMCALL_PROCESS_RESTART, + SIMCALL_RDV_CREATE, + SIMCALL_RDV_DESTROY, + SIMCALL_RDV_COMM_COUNT_BY_HOST, + SIMCALL_RDV_GET_HEAD, + SIMCALL_RDV_SET_RECEIVER, + SIMCALL_RDV_GET_RECEIVER, + SIMCALL_COMM_IPROBE, + SIMCALL_COMM_SEND, + SIMCALL_COMM_ISEND, + SIMCALL_COMM_RECV, + SIMCALL_COMM_IRECV, + SIMCALL_COMM_CANCEL, + SIMCALL_COMM_WAITANY, + SIMCALL_COMM_WAIT, + SIMCALL_COMM_TEST, + SIMCALL_COMM_TESTANY, + SIMCALL_COMM_GET_REMAINS, + SIMCALL_COMM_GET_STATE, + SIMCALL_COMM_GET_SRC_DATA, + SIMCALL_COMM_GET_DST_DATA, + SIMCALL_COMM_GET_SRC_PROC, + SIMCALL_COMM_GET_DST_PROC, + SIMCALL_MUTEX_INIT, + SIMCALL_MUTEX_DESTROY, + SIMCALL_MUTEX_LOCK, + SIMCALL_MUTEX_TRYLOCK, + SIMCALL_MUTEX_UNLOCK, + SIMCALL_COND_INIT, + SIMCALL_COND_DESTROY, + SIMCALL_COND_SIGNAL, + SIMCALL_COND_WAIT, + SIMCALL_COND_WAIT_TIMEOUT, + SIMCALL_COND_BROADCAST, + SIMCALL_SEM_INIT, + SIMCALL_SEM_DESTROY, + SIMCALL_SEM_RELEASE, + SIMCALL_SEM_WOULD_BLOCK, + SIMCALL_SEM_ACQUIRE, + SIMCALL_SEM_ACQUIRE_TIMEOUT, + SIMCALL_SEM_GET_CAPACITY, + SIMCALL_FILE_READ, + SIMCALL_FILE_WRITE, + SIMCALL_FILE_OPEN, + SIMCALL_FILE_CLOSE, + SIMCALL_FILE_UNLINK, + SIMCALL_FILE_GET_SIZE, + SIMCALL_FILE_TELL, + SIMCALL_FILE_SEEK, + SIMCALL_FILE_GET_INFO, + SIMCALL_FILE_MOVE, + SIMCALL_STORAGE_GET_FREE_SIZE, + SIMCALL_STORAGE_GET_USED_SIZE, + SIMCALL_STORAGE_GET_PROPERTIES, + SIMCALL_STORAGE_GET_CONTENT, + SIMCALL_ASR_GET_PROPERTIES, + SIMCALL_MC_RANDOM, +#ifdef HAVE_LATENCY_BOUND_TRACKING + SIMCALL_COMM_IS_LATENCY_BOUNDED, +#endif + +#ifdef HAVE_TRACING + SIMCALL_SET_CATEGORY, +#endif + +#ifdef HAVE_MC + SIMCALL_MC_SNAPSHOT, + SIMCALL_MC_COMPARE_SNAPSHOTS, +#endif + NUM_SIMCALLS +} e_smx_simcall_t; diff --git a/src/simix/popping_generated.c b/src/simix/popping_generated.c new file mode 100644 index 0000000000..b339a4a1a0 --- /dev/null +++ b/src/simix/popping_generated.c @@ -0,0 +1,783 @@ +/**********************************************************************/ +/* File generated by src/simix/simcalls.py from src/simix/simcalls.in */ +/* */ +/* DO NOT EVER CHANGE THIS FILE */ +/* */ +/* change simcalls specification in src/simix/simcalls.in */ +/**********************************************************************/ + +/* + * Note that the name comes from http://en.wikipedia.org/wiki/Popping + * Indeed, the control flow is doing a strange dance in there. + * + * That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :) + */ + +#include "smx_private.h" +#ifdef HAVE_MC +#endif + +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping); + +/** @brief Simcalls' names (generated from src/simix/simcalls.in) */ +const char* simcall_names[] = { + [SIMCALL_HOST_GET_BY_NAME] = "SIMCALL_HOST_GET_BY_NAME", + [SIMCALL_HOST_GET_NAME] = "SIMCALL_HOST_GET_NAME", + [SIMCALL_HOST_ON] = "SIMCALL_HOST_ON", + [SIMCALL_HOST_OFF] = "SIMCALL_HOST_OFF", + [SIMCALL_HOST_GET_PROPERTIES] = "SIMCALL_HOST_GET_PROPERTIES", + [SIMCALL_HOST_GET_CORE] = "SIMCALL_HOST_GET_CORE", + [SIMCALL_HOST_GET_PROCESS_LIST] = "SIMCALL_HOST_GET_PROCESS_LIST", + [SIMCALL_HOST_GET_SPEED] = "SIMCALL_HOST_GET_SPEED", + [SIMCALL_HOST_GET_AVAILABLE_SPEED] = "SIMCALL_HOST_GET_AVAILABLE_SPEED", + [SIMCALL_HOST_GET_STATE] = "SIMCALL_HOST_GET_STATE", + [SIMCALL_HOST_GET_CURRENT_POWER_PEAK] = "SIMCALL_HOST_GET_CURRENT_POWER_PEAK", + [SIMCALL_HOST_GET_POWER_PEAK_AT] = "SIMCALL_HOST_GET_POWER_PEAK_AT", + [SIMCALL_HOST_GET_NB_PSTATES] = "SIMCALL_HOST_GET_NB_PSTATES", + [SIMCALL_HOST_SET_POWER_PEAK_AT] = "SIMCALL_HOST_SET_POWER_PEAK_AT", + [SIMCALL_HOST_GET_CONSUMED_ENERGY] = "SIMCALL_HOST_GET_CONSUMED_ENERGY", + [SIMCALL_HOST_EXECUTE] = "SIMCALL_HOST_EXECUTE", + [SIMCALL_HOST_PARALLEL_EXECUTE] = "SIMCALL_HOST_PARALLEL_EXECUTE", + [SIMCALL_HOST_EXECUTION_DESTROY] = "SIMCALL_HOST_EXECUTION_DESTROY", + [SIMCALL_HOST_EXECUTION_CANCEL] = "SIMCALL_HOST_EXECUTION_CANCEL", + [SIMCALL_HOST_EXECUTION_GET_REMAINS] = "SIMCALL_HOST_EXECUTION_GET_REMAINS", + [SIMCALL_HOST_EXECUTION_GET_STATE] = "SIMCALL_HOST_EXECUTION_GET_STATE", + [SIMCALL_HOST_EXECUTION_SET_PRIORITY] = "SIMCALL_HOST_EXECUTION_SET_PRIORITY", + [SIMCALL_HOST_EXECUTION_SET_BOUND] = "SIMCALL_HOST_EXECUTION_SET_BOUND", + [SIMCALL_HOST_EXECUTION_SET_AFFINITY] = "SIMCALL_HOST_EXECUTION_SET_AFFINITY", + [SIMCALL_HOST_EXECUTION_WAIT] = "SIMCALL_HOST_EXECUTION_WAIT", + [SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST] = "SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST", + [SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST] = "SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST", + [SIMCALL_HOST_GET_PARAMS] = "SIMCALL_HOST_GET_PARAMS", + [SIMCALL_HOST_SET_PARAMS] = "SIMCALL_HOST_SET_PARAMS", + [SIMCALL_VM_CREATE] = "SIMCALL_VM_CREATE", + [SIMCALL_VM_START] = "SIMCALL_VM_START", + [SIMCALL_VM_GET_STATE] = "SIMCALL_VM_GET_STATE", + [SIMCALL_VM_MIGRATE] = "SIMCALL_VM_MIGRATE", + [SIMCALL_VM_GET_PM] = "SIMCALL_VM_GET_PM", + [SIMCALL_VM_SET_BOUND] = "SIMCALL_VM_SET_BOUND", + [SIMCALL_VM_SET_AFFINITY] = "SIMCALL_VM_SET_AFFINITY", + [SIMCALL_VM_DESTROY] = "SIMCALL_VM_DESTROY", + [SIMCALL_VM_SUSPEND] = "SIMCALL_VM_SUSPEND", + [SIMCALL_VM_RESUME] = "SIMCALL_VM_RESUME", + [SIMCALL_VM_SHUTDOWN] = "SIMCALL_VM_SHUTDOWN", + [SIMCALL_VM_SAVE] = "SIMCALL_VM_SAVE", + [SIMCALL_VM_RESTORE] = "SIMCALL_VM_RESTORE", + [SIMCALL_PROCESS_CREATE] = "SIMCALL_PROCESS_CREATE", + [SIMCALL_PROCESS_KILL] = "SIMCALL_PROCESS_KILL", + [SIMCALL_PROCESS_KILLALL] = "SIMCALL_PROCESS_KILLALL", + [SIMCALL_PROCESS_CLEANUP] = "SIMCALL_PROCESS_CLEANUP", + [SIMCALL_PROCESS_CHANGE_HOST] = "SIMCALL_PROCESS_CHANGE_HOST", + [SIMCALL_PROCESS_SUSPEND] = "SIMCALL_PROCESS_SUSPEND", + [SIMCALL_PROCESS_RESUME] = "SIMCALL_PROCESS_RESUME", + [SIMCALL_PROCESS_COUNT] = "SIMCALL_PROCESS_COUNT", + [SIMCALL_PROCESS_GET_PID] = "SIMCALL_PROCESS_GET_PID", + [SIMCALL_PROCESS_GET_PPID] = "SIMCALL_PROCESS_GET_PPID", + [SIMCALL_PROCESS_GET_DATA] = "SIMCALL_PROCESS_GET_DATA", + [SIMCALL_PROCESS_SET_DATA] = "SIMCALL_PROCESS_SET_DATA", + [SIMCALL_PROCESS_GET_HOST] = "SIMCALL_PROCESS_GET_HOST", + [SIMCALL_PROCESS_GET_NAME] = "SIMCALL_PROCESS_GET_NAME", + [SIMCALL_PROCESS_IS_SUSPENDED] = "SIMCALL_PROCESS_IS_SUSPENDED", + [SIMCALL_PROCESS_GET_PROPERTIES] = "SIMCALL_PROCESS_GET_PROPERTIES", + [SIMCALL_PROCESS_JOIN] = "SIMCALL_PROCESS_JOIN", + [SIMCALL_PROCESS_SLEEP] = "SIMCALL_PROCESS_SLEEP", + [SIMCALL_PROCESS_ON_EXIT] = "SIMCALL_PROCESS_ON_EXIT", + [SIMCALL_PROCESS_AUTO_RESTART_SET] = "SIMCALL_PROCESS_AUTO_RESTART_SET", + [SIMCALL_PROCESS_RESTART] = "SIMCALL_PROCESS_RESTART", + [SIMCALL_RDV_CREATE] = "SIMCALL_RDV_CREATE", + [SIMCALL_RDV_DESTROY] = "SIMCALL_RDV_DESTROY", + [SIMCALL_RDV_COMM_COUNT_BY_HOST] = "SIMCALL_RDV_COMM_COUNT_BY_HOST", + [SIMCALL_RDV_GET_HEAD] = "SIMCALL_RDV_GET_HEAD", + [SIMCALL_RDV_SET_RECEIVER] = "SIMCALL_RDV_SET_RECEIVER", + [SIMCALL_RDV_GET_RECEIVER] = "SIMCALL_RDV_GET_RECEIVER", + [SIMCALL_COMM_IPROBE] = "SIMCALL_COMM_IPROBE", + [SIMCALL_COMM_SEND] = "SIMCALL_COMM_SEND", + [SIMCALL_COMM_ISEND] = "SIMCALL_COMM_ISEND", + [SIMCALL_COMM_RECV] = "SIMCALL_COMM_RECV", + [SIMCALL_COMM_IRECV] = "SIMCALL_COMM_IRECV", + [SIMCALL_COMM_CANCEL] = "SIMCALL_COMM_CANCEL", + [SIMCALL_COMM_WAITANY] = "SIMCALL_COMM_WAITANY", + [SIMCALL_COMM_WAIT] = "SIMCALL_COMM_WAIT", + [SIMCALL_COMM_TEST] = "SIMCALL_COMM_TEST", + [SIMCALL_COMM_TESTANY] = "SIMCALL_COMM_TESTANY", + [SIMCALL_COMM_GET_REMAINS] = "SIMCALL_COMM_GET_REMAINS", + [SIMCALL_COMM_GET_STATE] = "SIMCALL_COMM_GET_STATE", + [SIMCALL_COMM_GET_SRC_DATA] = "SIMCALL_COMM_GET_SRC_DATA", + [SIMCALL_COMM_GET_DST_DATA] = "SIMCALL_COMM_GET_DST_DATA", + [SIMCALL_COMM_GET_SRC_PROC] = "SIMCALL_COMM_GET_SRC_PROC", + [SIMCALL_COMM_GET_DST_PROC] = "SIMCALL_COMM_GET_DST_PROC", + [SIMCALL_MUTEX_INIT] = "SIMCALL_MUTEX_INIT", + [SIMCALL_MUTEX_DESTROY] = "SIMCALL_MUTEX_DESTROY", + [SIMCALL_MUTEX_LOCK] = "SIMCALL_MUTEX_LOCK", + [SIMCALL_MUTEX_TRYLOCK] = "SIMCALL_MUTEX_TRYLOCK", + [SIMCALL_MUTEX_UNLOCK] = "SIMCALL_MUTEX_UNLOCK", + [SIMCALL_COND_INIT] = "SIMCALL_COND_INIT", + [SIMCALL_COND_DESTROY] = "SIMCALL_COND_DESTROY", + [SIMCALL_COND_SIGNAL] = "SIMCALL_COND_SIGNAL", + [SIMCALL_COND_WAIT] = "SIMCALL_COND_WAIT", + [SIMCALL_COND_WAIT_TIMEOUT] = "SIMCALL_COND_WAIT_TIMEOUT", + [SIMCALL_COND_BROADCAST] = "SIMCALL_COND_BROADCAST", + [SIMCALL_SEM_INIT] = "SIMCALL_SEM_INIT", + [SIMCALL_SEM_DESTROY] = "SIMCALL_SEM_DESTROY", + [SIMCALL_SEM_RELEASE] = "SIMCALL_SEM_RELEASE", + [SIMCALL_SEM_WOULD_BLOCK] = "SIMCALL_SEM_WOULD_BLOCK", + [SIMCALL_SEM_ACQUIRE] = "SIMCALL_SEM_ACQUIRE", + [SIMCALL_SEM_ACQUIRE_TIMEOUT] = "SIMCALL_SEM_ACQUIRE_TIMEOUT", + [SIMCALL_SEM_GET_CAPACITY] = "SIMCALL_SEM_GET_CAPACITY", + [SIMCALL_FILE_READ] = "SIMCALL_FILE_READ", + [SIMCALL_FILE_WRITE] = "SIMCALL_FILE_WRITE", + [SIMCALL_FILE_OPEN] = "SIMCALL_FILE_OPEN", + [SIMCALL_FILE_CLOSE] = "SIMCALL_FILE_CLOSE", + [SIMCALL_FILE_UNLINK] = "SIMCALL_FILE_UNLINK", + [SIMCALL_FILE_GET_SIZE] = "SIMCALL_FILE_GET_SIZE", + [SIMCALL_FILE_TELL] = "SIMCALL_FILE_TELL", + [SIMCALL_FILE_SEEK] = "SIMCALL_FILE_SEEK", + [SIMCALL_FILE_GET_INFO] = "SIMCALL_FILE_GET_INFO", + [SIMCALL_FILE_MOVE] = "SIMCALL_FILE_MOVE", + [SIMCALL_STORAGE_GET_FREE_SIZE] = "SIMCALL_STORAGE_GET_FREE_SIZE", + [SIMCALL_STORAGE_GET_USED_SIZE] = "SIMCALL_STORAGE_GET_USED_SIZE", + [SIMCALL_STORAGE_GET_PROPERTIES] = "SIMCALL_STORAGE_GET_PROPERTIES", + [SIMCALL_STORAGE_GET_CONTENT] = "SIMCALL_STORAGE_GET_CONTENT", + [SIMCALL_ASR_GET_PROPERTIES] = "SIMCALL_ASR_GET_PROPERTIES", + [SIMCALL_MC_RANDOM] = "SIMCALL_MC_RANDOM", +#ifdef HAVE_LATENCY_BOUND_TRACKING + [SIMCALL_COMM_IS_LATENCY_BOUNDED] = "SIMCALL_COMM_IS_LATENCY_BOUNDED", +#endif + +#ifdef HAVE_TRACING + [SIMCALL_SET_CATEGORY] = "SIMCALL_SET_CATEGORY", +#endif + +#ifdef HAVE_MC + [SIMCALL_MC_SNAPSHOT] = "SIMCALL_MC_SNAPSHOT", + [SIMCALL_MC_COMPARE_SNAPSHOTS] = "SIMCALL_MC_COMPARE_SNAPSHOTS", +#endif +[SIMCALL_NONE] = "NONE" +}; + +/** + * @brief (in kernel mode) unpack the simcall and activate the handler + * + * This function is generated from src/simix/simcalls.in + */ +void SIMIX_simcall_handle(smx_simcall_t simcall, int value) { + XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call)); + SIMCALL_SET_MC_VALUE(simcall, value); + if (simcall->issuer->context->iwannadie && simcall->call != SIMCALL_PROCESS_CLEANUP) + return; + switch (simcall->call) { +case SIMCALL_HOST_GET_BY_NAME: + simcall->result.dp = SIMIX_host_get_by_name( simcall->args[0].cc); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_GET_NAME: + simcall->result.cc = SIMIX_host_get_name((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_ON: + SIMIX_host_on((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_OFF: + simcall_HANDLER_host_off(simcall , (smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_GET_PROPERTIES: + simcall->result.dp = SIMIX_host_get_properties((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_GET_CORE: + simcall->result.i = SIMIX_host_get_core((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_GET_PROCESS_LIST: + simcall->result.dp = SIMIX_host_get_process_list((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_GET_SPEED: + simcall->result.d = SIMIX_host_get_speed((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_GET_AVAILABLE_SPEED: + simcall->result.d = SIMIX_host_get_available_speed((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_GET_STATE: + simcall->result.i = SIMIX_host_get_state((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_GET_CURRENT_POWER_PEAK: + simcall->result.d = SIMIX_host_get_current_power_peak((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_GET_POWER_PEAK_AT: + simcall->result.d = SIMIX_host_get_power_peak_at((smx_host_t) simcall->args[0].dp, simcall->args[1].i); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_GET_NB_PSTATES: + simcall->result.i = SIMIX_host_get_nb_pstates((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_SET_POWER_PEAK_AT: + SIMIX_host_set_power_peak_at((smx_host_t) simcall->args[0].dp, simcall->args[1].i); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_GET_CONSUMED_ENERGY: + simcall->result.d = SIMIX_host_get_consumed_energy((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_EXECUTE: + simcall->result.dp = SIMIX_host_execute( simcall->args[0].cc,(smx_host_t) simcall->args[1].dp, simcall->args[2].d, simcall->args[3].d, simcall->args[4].d, simcall->args[5].ul); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_PARALLEL_EXECUTE: + simcall->result.dp = SIMIX_host_parallel_execute( simcall->args[0].cc, simcall->args[1].i,(smx_host_t*) simcall->args[2].dp,(double*) simcall->args[3].dp,(double*) simcall->args[4].dp, simcall->args[5].d, simcall->args[6].d); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_EXECUTION_DESTROY: + SIMIX_host_execution_destroy((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_EXECUTION_CANCEL: + SIMIX_host_execution_cancel((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_EXECUTION_GET_REMAINS: + simcall->result.d = SIMIX_host_execution_get_remains((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_EXECUTION_GET_STATE: + simcall->result.i = SIMIX_host_execution_get_state((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_EXECUTION_SET_PRIORITY: + SIMIX_host_execution_set_priority((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_EXECUTION_SET_BOUND: + SIMIX_host_execution_set_bound((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_EXECUTION_SET_AFFINITY: + SIMIX_host_execution_set_affinity((smx_synchro_t) simcall->args[0].dp,(smx_host_t) simcall->args[1].dp, simcall->args[2].ul); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_EXECUTION_WAIT: + simcall_HANDLER_host_execution_wait(simcall , (smx_synchro_t) simcall->args[0].dp); + break; + +case SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST: + simcall->result.dp = SIMIX_host_get_mounted_storage_list((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST: + simcall->result.dp = SIMIX_host_get_attached_storage_list((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_GET_PARAMS: + SIMIX_host_get_params((smx_host_t) simcall->args[0].dp,(ws_params_t) simcall->args[1].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_HOST_SET_PARAMS: + SIMIX_host_set_params((smx_host_t) simcall->args[0].dp,(ws_params_t) simcall->args[1].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_VM_CREATE: + simcall->result.dp = SIMIX_vm_create( simcall->args[0].cc,(smx_host_t) simcall->args[1].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_VM_START: + SIMIX_vm_start((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_VM_GET_STATE: + simcall->result.i = SIMIX_vm_get_state((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_VM_MIGRATE: + SIMIX_vm_migrate((smx_host_t) simcall->args[0].dp,(smx_host_t) simcall->args[1].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_VM_GET_PM: + simcall->result.dp = SIMIX_vm_get_pm((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_VM_SET_BOUND: + SIMIX_vm_set_bound((smx_host_t) simcall->args[0].dp, simcall->args[1].d); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_VM_SET_AFFINITY: + SIMIX_vm_set_affinity((smx_host_t) simcall->args[0].dp,(smx_host_t) simcall->args[1].dp, simcall->args[2].ul); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_VM_DESTROY: + SIMIX_vm_destroy((smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_VM_SUSPEND: + simcall_HANDLER_vm_suspend(simcall , (smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_VM_RESUME: + simcall_HANDLER_vm_resume(simcall , (smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_VM_SHUTDOWN: + simcall_HANDLER_vm_shutdown(simcall , (smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_VM_SAVE: + simcall_HANDLER_vm_save(simcall , (smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_VM_RESTORE: + simcall_HANDLER_vm_restore(simcall , (smx_host_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_CREATE: + simcall_HANDLER_process_create(simcall , (smx_process_t*) simcall->args[0].dp, simcall->args[1].cc, (xbt_main_func_t) simcall->args[2].fp, simcall->args[3].dp, simcall->args[4].cc, simcall->args[5].d, simcall->args[6].i, (char**) simcall->args[7].dp, (xbt_dict_t) simcall->args[8].dp, simcall->args[9].i); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_KILL: + simcall_HANDLER_process_kill(simcall , (smx_process_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_KILLALL: + simcall_HANDLER_process_killall(simcall , simcall->args[0].i); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_CLEANUP: + SIMIX_process_cleanup((smx_process_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_CHANGE_HOST: + simcall_HANDLER_process_change_host(simcall , (smx_process_t) simcall->args[0].dp, (smx_host_t) simcall->args[1].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_SUSPEND: + simcall_HANDLER_process_suspend(simcall , (smx_process_t) simcall->args[0].dp); + break; + +case SIMCALL_PROCESS_RESUME: + simcall_HANDLER_process_resume(simcall , (smx_process_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_COUNT: + simcall->result.i = SIMIX_process_count(); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_GET_PID: + simcall->result.i = SIMIX_process_get_PID((smx_process_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_GET_PPID: + simcall->result.i = SIMIX_process_get_PPID((smx_process_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_GET_DATA: + simcall->result.dp = SIMIX_process_get_data((smx_process_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_SET_DATA: + SIMIX_process_set_data((smx_process_t) simcall->args[0].dp, simcall->args[1].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_GET_HOST: + simcall->result.dp = SIMIX_process_get_host((smx_process_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_GET_NAME: + simcall->result.cc = SIMIX_process_get_name((smx_process_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_IS_SUSPENDED: + simcall->result.i = SIMIX_process_is_suspended((smx_process_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_GET_PROPERTIES: + simcall->result.dp = SIMIX_process_get_properties((smx_process_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_JOIN: + simcall_HANDLER_process_join(simcall , (smx_process_t) simcall->args[0].dp, simcall->args[1].d); + break; + +case SIMCALL_PROCESS_SLEEP: + simcall_HANDLER_process_sleep(simcall , simcall->args[0].d); + break; + +case SIMCALL_PROCESS_ON_EXIT: + SIMIX_process_on_exit((smx_process_t) simcall->args[0].dp,(int_f_pvoid_pvoid_t) simcall->args[1].fp, simcall->args[2].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_AUTO_RESTART_SET: + SIMIX_process_auto_restart_set((smx_process_t) simcall->args[0].dp, simcall->args[1].i); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_RESTART: + simcall->result.dp = simcall_HANDLER_process_restart(simcall , (smx_process_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_RDV_CREATE: + simcall->result.dp = SIMIX_rdv_create( simcall->args[0].cc); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_RDV_DESTROY: + SIMIX_rdv_destroy((smx_rdv_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_RDV_COMM_COUNT_BY_HOST: + simcall->result.ui = SIMIX_rdv_comm_count_by_host((smx_rdv_t) simcall->args[0].dp,(smx_host_t) simcall->args[1].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_RDV_GET_HEAD: + simcall->result.dp = SIMIX_rdv_get_head((smx_rdv_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_RDV_SET_RECEIVER: + SIMIX_rdv_set_receiver((smx_rdv_t) simcall->args[0].dp,(smx_process_t) simcall->args[1].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_RDV_GET_RECEIVER: + simcall->result.dp = SIMIX_rdv_get_receiver((smx_rdv_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_COMM_IPROBE: + simcall->result.dp = simcall_HANDLER_comm_iprobe(simcall , (smx_rdv_t) simcall->args[0].dp, simcall->args[1].i, simcall->args[2].i, simcall->args[3].i, (simix_match_func_t) simcall->args[4].fp, simcall->args[5].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_COMM_SEND: + simcall_HANDLER_comm_send(simcall , (smx_process_t) simcall->args[0].dp, (smx_rdv_t) simcall->args[1].dp, simcall->args[2].d, simcall->args[3].d, simcall->args[4].dp, simcall->args[5].sz, (simix_match_func_t) simcall->args[6].fp, (simix_copy_data_func_t) simcall->args[7].fp, simcall->args[8].dp, simcall->args[9].d); + break; + +case SIMCALL_COMM_ISEND: + simcall->result.dp = simcall_HANDLER_comm_isend(simcall , (smx_process_t) simcall->args[0].dp, (smx_rdv_t) simcall->args[1].dp, simcall->args[2].d, simcall->args[3].d, simcall->args[4].dp, simcall->args[5].sz, (simix_match_func_t) simcall->args[6].fp, (simix_clean_func_t) simcall->args[7].fp, (simix_copy_data_func_t) simcall->args[8].fp, simcall->args[9].dp, simcall->args[10].i); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_COMM_RECV: + simcall_HANDLER_comm_recv(simcall , (smx_rdv_t) simcall->args[0].dp, simcall->args[1].dp, (size_t*) simcall->args[2].dp, (simix_match_func_t) simcall->args[3].fp, (simix_copy_data_func_t) simcall->args[4].fp, simcall->args[5].dp, simcall->args[6].d, simcall->args[7].d); + break; + +case SIMCALL_COMM_IRECV: + simcall->result.dp = simcall_HANDLER_comm_irecv(simcall , (smx_rdv_t) simcall->args[0].dp, simcall->args[1].dp, (size_t*) simcall->args[2].dp, (simix_match_func_t) simcall->args[3].fp, (simix_copy_data_func_t) simcall->args[4].fp, simcall->args[5].dp, simcall->args[6].d); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_COMM_CANCEL: + SIMIX_comm_cancel((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_COMM_WAITANY: + simcall_HANDLER_comm_waitany(simcall , (xbt_dynar_t) simcall->args[0].dp); + break; + +case SIMCALL_COMM_WAIT: + simcall_HANDLER_comm_wait(simcall , (smx_synchro_t) simcall->args[0].dp, simcall->args[1].d); + break; + +case SIMCALL_COMM_TEST: + simcall_HANDLER_comm_test(simcall , (smx_synchro_t) simcall->args[0].dp); + break; + +case SIMCALL_COMM_TESTANY: + simcall_HANDLER_comm_testany(simcall , (xbt_dynar_t) simcall->args[0].dp); + break; + +case SIMCALL_COMM_GET_REMAINS: + simcall->result.d = SIMIX_comm_get_remains((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_COMM_GET_STATE: + simcall->result.i = SIMIX_comm_get_state((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_COMM_GET_SRC_DATA: + simcall->result.dp = SIMIX_comm_get_src_data((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_COMM_GET_DST_DATA: + simcall->result.dp = SIMIX_comm_get_dst_data((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_COMM_GET_SRC_PROC: + simcall->result.dp = SIMIX_comm_get_src_proc((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_COMM_GET_DST_PROC: + simcall->result.dp = SIMIX_comm_get_dst_proc((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_MUTEX_INIT: + simcall->result.dp = simcall_HANDLER_mutex_init(simcall ); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_MUTEX_DESTROY: + SIMIX_mutex_destroy((smx_mutex_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_MUTEX_LOCK: + simcall_HANDLER_mutex_lock(simcall , (smx_mutex_t) simcall->args[0].dp); + break; + +case SIMCALL_MUTEX_TRYLOCK: + simcall->result.i = simcall_HANDLER_mutex_trylock(simcall , (smx_mutex_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_MUTEX_UNLOCK: + simcall_HANDLER_mutex_unlock(simcall , (smx_mutex_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_COND_INIT: + simcall->result.dp = SIMIX_cond_init(); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_COND_DESTROY: + SIMIX_cond_destroy((smx_cond_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_COND_SIGNAL: + SIMIX_cond_signal((smx_cond_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_COND_WAIT: + simcall_HANDLER_cond_wait(simcall , (smx_cond_t) simcall->args[0].dp, (smx_mutex_t) simcall->args[1].dp); + break; + +case SIMCALL_COND_WAIT_TIMEOUT: + simcall_HANDLER_cond_wait_timeout(simcall , (smx_cond_t) simcall->args[0].dp, (smx_mutex_t) simcall->args[1].dp, simcall->args[2].d); + break; + +case SIMCALL_COND_BROADCAST: + SIMIX_cond_broadcast((smx_cond_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_SEM_INIT: + simcall->result.dp = SIMIX_sem_init( simcall->args[0].ui); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_SEM_DESTROY: + SIMIX_sem_destroy((smx_sem_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_SEM_RELEASE: + simcall_HANDLER_sem_release(simcall , (smx_sem_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_SEM_WOULD_BLOCK: + simcall->result.i = simcall_HANDLER_sem_would_block(simcall , (smx_sem_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_SEM_ACQUIRE: + simcall_HANDLER_sem_acquire(simcall , (smx_sem_t) simcall->args[0].dp); + break; + +case SIMCALL_SEM_ACQUIRE_TIMEOUT: + simcall_HANDLER_sem_acquire_timeout(simcall , (smx_sem_t) simcall->args[0].dp, simcall->args[1].d); + break; + +case SIMCALL_SEM_GET_CAPACITY: + simcall->result.i = simcall_HANDLER_sem_get_capacity(simcall , (smx_sem_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_FILE_READ: + simcall_HANDLER_file_read(simcall , (smx_file_t) simcall->args[0].dp, simcall->args[1].sgsz, (smx_host_t) simcall->args[2].dp); + break; + +case SIMCALL_FILE_WRITE: + simcall_HANDLER_file_write(simcall , (smx_file_t) simcall->args[0].dp, simcall->args[1].sgsz, (smx_host_t) simcall->args[2].dp); + break; + +case SIMCALL_FILE_OPEN: + simcall_HANDLER_file_open(simcall , simcall->args[0].cc, (smx_host_t) simcall->args[1].dp); + break; + +case SIMCALL_FILE_CLOSE: + simcall_HANDLER_file_close(simcall , (smx_file_t) simcall->args[0].dp, (smx_host_t) simcall->args[1].dp); + break; + +case SIMCALL_FILE_UNLINK: + simcall->result.i = SIMIX_file_unlink((smx_file_t) simcall->args[0].dp,(smx_host_t) simcall->args[1].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_FILE_GET_SIZE: + simcall->result.sgsz = simcall_HANDLER_file_get_size(simcall , (smx_file_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_FILE_TELL: + simcall->result.sgsz = simcall_HANDLER_file_tell(simcall , (smx_file_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_FILE_SEEK: + simcall->result.i = simcall_HANDLER_file_seek(simcall , (smx_file_t) simcall->args[0].dp, simcall->args[1].sgoff, simcall->args[2].i); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_FILE_GET_INFO: + simcall->result.dp = simcall_HANDLER_file_get_info(simcall , (smx_file_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_FILE_MOVE: + simcall->result.i = simcall_HANDLER_file_move(simcall , (smx_file_t) simcall->args[0].dp, simcall->args[1].cc); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_STORAGE_GET_FREE_SIZE: + simcall->result.sgsz = simcall_HANDLER_storage_get_free_size(simcall , (smx_storage_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_STORAGE_GET_USED_SIZE: + simcall->result.sgsz = simcall_HANDLER_storage_get_used_size(simcall , (smx_storage_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_STORAGE_GET_PROPERTIES: + simcall->result.dp = SIMIX_storage_get_properties((smx_storage_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_STORAGE_GET_CONTENT: + simcall->result.dp = SIMIX_storage_get_content((smx_storage_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_ASR_GET_PROPERTIES: + simcall->result.dp = simcall_HANDLER_asr_get_properties(simcall , simcall->args[0].cc); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_MC_RANDOM: + simcall->result.i = simcall_HANDLER_mc_random(simcall , simcall->args[0].i, simcall->args[1].i); + SIMIX_simcall_answer(simcall); + break; + +#ifdef HAVE_LATENCY_BOUND_TRACKING +case SIMCALL_COMM_IS_LATENCY_BOUNDED: + simcall->result.i = SIMIX_comm_is_latency_bounded((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +#endif + +#ifdef HAVE_TRACING +case SIMCALL_SET_CATEGORY: + SIMIX_set_category((smx_synchro_t) simcall->args[0].dp, simcall->args[1].cc); + SIMIX_simcall_answer(simcall); + break; + +#endif + +#ifdef HAVE_MC +case SIMCALL_MC_SNAPSHOT: + simcall->result.dp = simcall_HANDLER_mc_snapshot(simcall ); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_MC_COMPARE_SNAPSHOTS: + simcall->result.i = simcall_HANDLER_mc_compare_snapshots(simcall , (mc_snapshot_t) simcall->args[0].dp, (mc_snapshot_t) simcall->args[1].dp); + SIMIX_simcall_answer(simcall); + break; + +#endif + case NUM_SIMCALLS: + break; + case SIMCALL_NONE: + THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s", + SIMIX_process_get_name(simcall->issuer), + SIMIX_host_get_name(SIMIX_process_get_host(simcall->issuer)) + ); + break; + + } +} diff --git a/src/simix/smx_smurf_private.h b/src/simix/popping_private.h similarity index 50% rename from src/simix/smx_smurf_private.h rename to src/simix/popping_private.h index dcd3402aaf..8eefe725ac 100644 --- a/src/simix/smx_smurf_private.h +++ b/src/simix/popping_private.h @@ -4,32 +4,19 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#ifndef _SIMIX_SMURF_PRIVATE_H -#define _SIMIX_SMURF_PRIVATE_H +#ifndef _POPPING_PRIVATE_H +#define _POPPING_PRIVATE_H SG_BEGIN_DECL() /********************************* Simcalls *********************************/ +XBT_PUBLIC(const char*) simcall_names[]; /* Name of each simcall */ -/* we want to build the e_smx_simcall_t enumeration, the table of the - * corresponding simcalls string names, and the simcall handlers table - * automatically, using macros. - * To add a new simcall follow the following syntax: - * - * */ +#include "popping_enum.h" /* Definition of e_smx_simcall_t, with one value per simcall */ +#include "mc/mc_interface.h" /* Definition of mc_snapshot_t, used by one simcall */ -/** - * \brief All possible simcalls. - */ -typedef enum { -SIMCALL_NONE, -#include "simcalls_generated_enum.h" -SIMCALL_NEW_API_INIT, -NUM_SIMCALLS -} e_smx_simcall_t; - -typedef int (*simix_match_func_t)(void *, void *, smx_action_t); -typedef void (*simix_copy_data_func_t)(smx_action_t, void*, size_t); +typedef int (*simix_match_func_t)(void *, void *, smx_synchro_t); +typedef void (*simix_copy_data_func_t)(smx_synchro_t, void*, size_t); typedef void (*simix_clean_func_t)(void *); typedef void (*FPtr)(void); // Hide the ugliness @@ -60,50 +47,22 @@ union u_smx_scalar { typedef struct s_smx_simcall { e_smx_simcall_t call; smx_process_t issuer; -#ifdef HAVE_MC int mc_value; -#endif union u_smx_scalar args[11]; union u_smx_scalar result; - //FIXME: union u_smx_scalar retval; - union { - struct { - const char* param1; - double param2; - int result; - } new_api; - - }; } s_smx_simcall_t, *smx_simcall_t; -#if HAVE_MC #define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall)->mc_value = (value)) #define SIMCALL_GET_MC_VALUE(simcall) ((simcall)->mc_value) -#else -#define SIMCALL_SET_MC_VALUE(simcall, value) ((void)0) -#define SIMCALL_GET_MC_VALUE(simcall) 0 -#endif -#include "simcalls_generated_res_getter_setter.h" -#include "simcalls_generated_args_getter_setter.h" +#include "popping_accessors.h" /******************************** General *************************************/ -void SIMIX_simcall_push(smx_process_t self); void SIMIX_simcall_answer(smx_simcall_t); -void SIMIX_simcall_pre(smx_simcall_t, int); -void SIMIX_simcall_post(smx_action_t); -smx_simcall_t SIMIX_simcall_mine(void); +void SIMIX_simcall_handle(smx_simcall_t, int); +void SIMIX_simcall_exit(smx_synchro_t); const char *SIMIX_simcall_name(e_smx_simcall_t kind); -//TOFIX put it in a better place -xbt_dict_t SIMIX_pre_asr_get_properties(smx_simcall_t simcall, const char *name); - -/*************************** New simcall interface ****************************/ - -typedef smx_action_t (*simcall_handler_t)(u_smx_scalar_t *); - -extern const char *simcall_types[]; -extern simcall_handler_t simcall_table[]; SG_END_DECL() diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index cdd02a8592..22578fd5e2 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -1,134 +1,168 @@ -# Copyright (c) 2014. The SimGrid Team. -# All rights reserved. +# Copyright (c) 2014. The SimGrid Team. All rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the license (GNU LGPL) which comes with this package. -# name has_answer (restype,rescast) (arg0name,arg0type,arg0cast) (arg1name,arg1type,arg1cast) -host_get_by_name True (void*, smx_host_t) (name, const char*) -host_get_name True (const char*) (host, void*, smx_host_t) -host_on True (void) (host, void*, smx_host_t) -host_off True (void) (host, void*, smx_host_t) -host_get_properties True (void*, xbt_dict_t) (host, void*, smx_host_t) -host_get_core True (int) (host, void*, smx_host_t) -host_get_process_list True (void*, xbt_swag_t) (host, void*, smx_host_t) -host_get_speed True (double) (host, void*, smx_host_t) -host_get_available_speed True (double) (host, void*, smx_host_t) -host_get_state True (int) (host, void*, smx_host_t) -host_get_current_power_peak True (double) (host, void*, smx_host_t) -host_get_power_peak_at True (double) (host, void*, smx_host_t) (pstate_index, int) -host_get_nb_pstates True (int) (host, void*, smx_host_t) -host_set_power_peak_at True (void) (host, void*, smx_host_t) (pstate_index, int) -host_get_consumed_energy True (double) (host, void*, smx_host_t) -host_execute True (void*, smx_action_t) (name, const char*) (host, void*, smx_host_t) (computation_amount, double) (priority, double) (bound, double) (affinity_mask, unsigned long) -host_parallel_execute True (void*, smx_action_t) (name, const char*) (host_nb, int) (host_list, void*, smx_host_t*) (computation_amount, void*, double*) (communication_amount, void*, double*) (amount, double) (rate, double) -host_execution_destroy True (void) (execution, void*, smx_action_t) -host_execution_cancel True (void) (execution, void*, smx_action_t) -host_execution_get_remains True (double) (execution, void*, smx_action_t) -host_execution_get_state True (int) (execution, void*, smx_action_t) -host_execution_set_priority True (void) (execution, void*, smx_action_t) (priority, double) -host_execution_set_bound True (void) (execution, void*, smx_action_t) (bound, double) -host_execution_set_affinity True (void) (execution, void*, smx_action_t) (ws, void*, smx_host_t) (mask, unsigned long) -host_execution_wait False (int) (execution, void*, smx_action_t) -host_get_mounted_storage_list True (void*, xbt_dict_t) (host, void*, smx_host_t) -host_get_attached_storage_list True (void*, xbt_dynar_t) (host, void*, smx_host_t) -host_get_params True (void) (ind_vm, void*, smx_host_t) (params, void*, ws_params_t) -host_set_params True (void) (ind_vm, void*, smx_host_t) (params, void*, ws_params_t) -vm_create True (void*) (name, const char*) (ind_pm, void*, smx_host_t) -vm_start True (void) (ind_vm, void*, smx_host_t) -vm_get_state True (int) (ind_vm, void*, smx_host_t) -vm_migrate True (void) (ind_vm, void*, smx_host_t) (ind_dst_pm, void*, smx_host_t) -vm_get_pm True (void*) (ind_vm, void*, smx_host_t) -vm_set_bound True (void) (ind_vm, void*, smx_host_t) (bound, double) -vm_set_affinity True (void) (ind_vm, void*, smx_host_t) (ind_pm, void*, smx_host_t) (mask, unsigned long) -vm_destroy True (void) (ind_vm, void*, smx_host_t) -vm_suspend True (void) (ind_vm, void*, smx_host_t) -vm_resume True (void) (ind_vm, void*, smx_host_t) -vm_shutdown True (void) (ind_vm, void*, smx_host_t) -vm_save True (void) (ind_vm, void*, smx_host_t) -vm_restore True (void) (ind_vm, void*, smx_host_t) -process_create True (void) (process, void*, smx_process_t*) (name, const char*) (code, FPtr, xbt_main_func_t) (data, void*) (hostname, const char*) (kill_time, double) (argc, int) (argv, void*, char**) (properties, void*, xbt_dict_t) (auto_restart, int) -process_kill True (void) (process, void*, smx_process_t) -process_killall True (void) (reset_pid, int) -process_cleanup True (void) (process, void*, smx_process_t) -process_change_host True (void) (process, void*, smx_process_t) (dest, void*, smx_host_t) -process_suspend False (void) (process, void*, smx_process_t) -process_resume True (void) (process, void*, smx_process_t) -process_count True (int) -process_get_PID True (int) (process, void*, smx_process_t) -process_get_PPID True (int) (process, void*, smx_process_t) -process_get_data True (void*) (process, void*, smx_process_t) -process_set_data True (void) (process, void*, smx_process_t) (data, void*) -process_get_host True (void*, smx_host_t) (process, void*, smx_process_t) -process_get_name True (const char*) (process, void*, smx_process_t) -process_is_suspended True (int) (process, void*, smx_process_t) -process_get_properties True (void*, xbt_dict_t) (process, void*, smx_process_t) -process_join False (int) (process, void*, smx_process_t) (timeout, double) -process_sleep False (int) (duration, double) -process_on_exit True (void) (process, void*, smx_process_t) (fun, FPtr, int_f_pvoid_pvoid_t) (data, void*) -process_auto_restart_set True (void) (process, void*, smx_process_t) (auto_restart, int) -process_restart True (void*, smx_process_t) (process, void*, smx_process_t) -rdv_create True (void*, smx_rdv_t) (name, const char*) -rdv_destroy True (void) (rdv, void*, smx_rdv_t) -#rdv_get_by_name True (void*, smx_host_t) (name, const char*) -rdv_comm_count_by_host True (unsigned int) (rdv, void*, smx_rdv_t) (host, void*, smx_host_t) -rdv_get_head True (void*, smx_action_t) (rdv, void*, smx_rdv_t) -rdv_set_receiver True (void) (rdv, void*, smx_rdv_t) (receiver, void*, smx_process_t) -rdv_get_receiver True (void*, smx_process_t) (rdv, void*, smx_rdv_t) -comm_iprobe True (void*, smx_action_t) (rdv, void*, smx_rdv_t) (type, int) (src, int) (tag, int) (match_fun, FPtr, simix_match_func_t) (data, void*) -comm_send False (void) (src, void*, smx_process_t) (rdv, void*, smx_rdv_t) (task_size, double) (rate, double) (src_buff, void*) (src_buff_size, size_t) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (timeout, double) -comm_isend True (void*, smx_action_t) (src, void*, smx_process_t) (rdv, void*, smx_rdv_t) (task_size, double) (rate, double) (src_buff, void*) (src_buff_size, size_t) (match_fun, FPtr, simix_match_func_t) (clean_fun, FPtr, simix_clean_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (detached, int) -comm_recv False (void) (rdv, void*, smx_rdv_t) (dst_buff, void*) (dst_buff_size, void*, size_t*) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (timeout, double) (rate, double) -comm_irecv True (void*, smx_action_t) (rdv, void*, smx_rdv_t) (dst_buff, void*) (dst_buff_size, void*, size_t*) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (rate, double) -comm_cancel True (void) (comm, void*, smx_action_t) -comm_waitany False (int) (comms, void*, xbt_dynar_t) -comm_wait False (void) (comm, void*, smx_action_t) (timeout, double) -comm_test False (int) (comm, void*, smx_action_t) -comm_testany False (int) (comms, void*, xbt_dynar_t) -comm_get_remains True (double) (comm, void*, smx_action_t) -comm_get_state True (int) (comm, void*, smx_action_t) -comm_get_src_data True (void*) (comm, void*, smx_action_t) -comm_get_dst_data True (void*) (comm, void*, smx_action_t) -comm_get_src_proc True (void*, smx_process_t) (comm, void*, smx_action_t) -comm_get_dst_proc True (void*, smx_process_t) (comm, void*, smx_action_t) -mutex_init True (void*, smx_mutex_t) -mutex_destroy True (void) (mutex, void*, smx_mutex_t) -mutex_lock False (void) (mutex, void*, smx_mutex_t) -mutex_trylock True (int) (mutex, void*, smx_mutex_t) -mutex_unlock True (void) (mutex, void*, smx_mutex_t) -cond_init True (void*, smx_cond_t) -cond_destroy True (void) (cond, void*, smx_cond_t) -cond_signal True (void) (cond, void*, smx_cond_t) -cond_wait False (void) (cond, void*, smx_cond_t) (mutex, void*, smx_mutex_t) -cond_wait_timeout False (void) (cond, void*, smx_cond_t) (mutex, void*, smx_mutex_t) (timeout, double) -cond_broadcast True (void) (cond, void*, smx_cond_t) -sem_init True (void*, smx_sem_t) (capacity, int) -sem_destroy True (void) (sem, void*, smx_sem_t) -sem_release True (void) (sem, void*, smx_sem_t) -sem_would_block True (int) (sem, void*, smx_sem_t) -sem_acquire False (void) (sem, void*, smx_sem_t) -sem_acquire_timeout False (void) (sem, void*, smx_sem_t) (timeout, double) -sem_get_capacity True (int) (sem, void*, smx_sem_t) -file_read False (sg_size_t) (fd, void*, smx_file_t) (size, sg_size_t) (host, void*, smx_host_t) -file_write False (sg_size_t) (fd, void*, smx_file_t) (size, sg_size_t) (host, void*, smx_host_t) -file_open False (void*, smx_file_t) (fullpath, const char*) (host, void*, smx_host_t) -file_close False (int) (fd, void*, smx_file_t) (host, void*, smx_host_t) -file_unlink True (int) (fd, void*, smx_file_t) (host, void*, smx_host_t) -file_get_size True (sg_size_t) (fd, void*, smx_file_t) -file_tell True (sg_size_t) (fd, void*, smx_file_t) -file_seek True (int) (fd, void*, smx_file_t) (offset, sg_offset_t) (origin, int) -file_get_info True (void*, xbt_dynar_t) (fd, void*, smx_file_t) -file_move True (int) (fd, void*, smx_file_t) (fullpath, const char*) -storage_get_free_size True (sg_size_t) (storage, void*, smx_storage_t) -storage_get_used_size True (sg_size_t) (name, void*, smx_storage_t) -storage_get_properties True (void*, xbt_dict_t) (storage, void*, smx_storage_t) -storage_get_content True (void*, xbt_dict_t) (storage, void*, smx_storage_t) -asr_get_properties True (void*, xbt_dict_t) (name, const char*) +# CallType handler? name (resulttype,resultcast) (arg0name,arg0type,arg0cast) (arg1name,arg1type,arg1cast) + +# CallType must be one of the three: +# +# - Func: returning a value immediately (within the same scheduling round) +# examples: all getters that only retrieve informations with no side effect +# +# - Proc: not returning any value (but doing so immediately) +# examples: all setters, *_cancel +# +# - Blck: Blocking call that does not return in the same scheduling round. +# The answer requires some interaction with SURF, even if this can +# still occure at the same timestamp under some circonstances (eg +# if the surf_action cannot start because of resources that are down) +# examples: things that last some time (communicate, execute, mutex_lock) +# +# In a perfect world, these answers would also be handled by the +# script, but we are not there yet. Instead, the answer is manually +# generated in one of the SIMIX_post_*() functions, that are called +# when we unpack the done and failed actions returned by surf after +# a surf simulation round. Weird things happen if you forget to +# answer a given simcall in there... + + + +# Handler? is either "H" if we need to generate a handler or "-" if we should go without handlers + +# I wish we could completely remove the handlers as their only use is +# to adapt the interface between the exported symbol that is visible +# by the user applications and the internal symbol that is implemented +# by the kernel. +# The only remaining use of that mechanism is to add the caller +# identity as a parameter of internal call, but that could be +# automatized too (eg by having a special parameter type called "self") + +Func - host_get_by_name (void*, smx_host_t) (name, const char*) +Func - host_get_name (const char*) (host, void*, smx_host_t) +Proc - host_on (void) (host, void*, smx_host_t) +Proc H host_off (void) (host, void*, smx_host_t) +Func - host_get_properties (void*, xbt_dict_t) (host, void*, smx_host_t) +Func - host_get_core (int) (host, void*, smx_host_t) +Func - host_get_process_list (void*, xbt_swag_t) (host, void*, smx_host_t) +Func - host_get_speed (double) (host, void*, smx_host_t) +Func - host_get_available_speed (double) (host, void*, smx_host_t) +Func - host_get_state (int) (host, void*, smx_host_t) +Func - host_get_current_power_peak (double) (host, void*, smx_host_t) +Func - host_get_power_peak_at (double) (host, void*, smx_host_t) (pstate_index, int) +Func - host_get_nb_pstates (int) (host, void*, smx_host_t) +Proc - host_set_power_peak_at (void) (host, void*, smx_host_t) (pstate_index, int) +Func - host_get_consumed_energy (double) (host, void*, smx_host_t) + +Func - host_execute (void*, smx_synchro_t) (name, const char*) (host, void*, smx_host_t) (computation_amount, double) (priority, double) (bound, double) (affinity_mask, unsigned long) +Func - host_parallel_execute (void*, smx_synchro_t) (name, const char*) (host_nb, int) (host_list, void*, smx_host_t*) (computation_amount, void*, double*) (communication_amount, void*, double*) (amount, double) (rate, double) +Proc - host_execution_destroy (void) (execution, void*, smx_synchro_t) +Proc - host_execution_cancel (void) (execution, void*, smx_synchro_t) +Func - host_execution_get_remains (double) (execution, void*, smx_synchro_t) +Func - host_execution_get_state (int, e_smx_state_t) (execution, void*, smx_synchro_t) +Proc - host_execution_set_priority (void) (execution, void*, smx_synchro_t) (priority, double) +Proc - host_execution_set_bound (void) (execution, void*, smx_synchro_t) (bound, double) +Proc - host_execution_set_affinity (void) (execution, void*, smx_synchro_t) (ws, void*, smx_host_t) (mask, unsigned long) +Blck H host_execution_wait (int) (execution, void*, smx_synchro_t) +Func - host_get_mounted_storage_list (void*, xbt_dict_t) (host, void*, smx_host_t) +Func - host_get_attached_storage_list (void*, xbt_dynar_t) (host, void*, smx_host_t) +Proc - host_get_params (void) (ind_vm, void*, smx_host_t) (params, void*, ws_params_t) +Proc - host_set_params (void) (ind_vm, void*, smx_host_t) (params, void*, ws_params_t) +Func - vm_create (void*, smx_host_t) (name, const char*) (ind_pm, void*, smx_host_t) +Proc - vm_start (void) (ind_vm, void*, smx_host_t) +Func - vm_get_state (int) (ind_vm, void*, smx_host_t) +Proc - vm_migrate (void) (ind_vm, void*, smx_host_t) (ind_dst_pm, void*, smx_host_t) +Func - vm_get_pm (void*) (ind_vm, void*, smx_host_t) +Proc - vm_set_bound (void) (ind_vm, void*, smx_host_t) (bound, double) +Proc - vm_set_affinity (void) (ind_vm, void*, smx_host_t) (ind_pm, void*, smx_host_t) (mask, unsigned long) +Proc - vm_destroy (void) (ind_vm, void*, smx_host_t) +Proc H vm_suspend (void) (ind_vm, void*, smx_host_t) +Proc H vm_resume (void) (ind_vm, void*, smx_host_t) +Proc H vm_shutdown (void) (ind_vm, void*, smx_host_t) +Proc H vm_save (void) (ind_vm, void*, smx_host_t) +Proc H vm_restore (void) (ind_vm, void*, smx_host_t) +Proc H process_create (void) (process, void*, smx_process_t*) (name, const char*) (code, FPtr, xbt_main_func_t) (data, void*) (hostname, const char*) (kill_time, double) (argc, int) (argv, void*, char**) (properties, void*, xbt_dict_t) (auto_restart, int) +Proc H process_kill (void) (process, void*, smx_process_t) +Proc H process_killall (void) (reset_pid, int) +Proc - process_cleanup (void) (process, void*, smx_process_t) +Proc H process_change_host (void) (process, void*, smx_process_t) (dest, void*, smx_host_t) +Blck H process_suspend (void) (process, void*, smx_process_t) +Proc H process_resume (void) (process, void*, smx_process_t) +Func - process_count (int) +Func - process_get_PID (int) (process, void*, smx_process_t) +Func - process_get_PPID (int) (process, void*, smx_process_t) +Func - process_get_data (void*) (process, void*, smx_process_t) +Proc - process_set_data (void) (process, void*, smx_process_t) (data, void*) +Func - process_get_host (void*, smx_host_t) (process, void*, smx_process_t) +Func - process_get_name (const char*) (process, void*, smx_process_t) +Func - process_is_suspended (int) (process, void*, smx_process_t) +Func - process_get_properties (void*, xbt_dict_t) (process, void*, smx_process_t) +Blck H process_join (int) (process, void*, smx_process_t) (timeout, double) +Blck H process_sleep (int) (duration, double) +Proc - process_on_exit (void) (process, void*, smx_process_t) (fun, FPtr, int_f_pvoid_pvoid_t) (data, void*) +Proc - process_auto_restart_set (void) (process, void*, smx_process_t) (auto_restart, int) +Func H process_restart (void*, smx_process_t) (process, void*, smx_process_t) + +Func - rdv_create (void*, smx_rdv_t) (name, const char*) +Proc - rdv_destroy (void) (rdv, void*, smx_rdv_t) +Func - rdv_comm_count_by_host (unsigned int) (rdv, void*, smx_rdv_t) (host, void*, smx_host_t) +Func - rdv_get_head (void*, smx_synchro_t) (rdv, void*, smx_rdv_t) +Proc - rdv_set_receiver (void) (rdv, void*, smx_rdv_t) (receiver, void*, smx_process_t) +Func - rdv_get_receiver (void*, smx_process_t) (rdv, void*, smx_rdv_t) +Func H comm_iprobe (void*, smx_synchro_t) (rdv, void*, smx_rdv_t) (type, int) (src, int) (tag, int) (match_fun, FPtr, simix_match_func_t) (data, void*) +Blck H comm_send (void) (src, void*, smx_process_t) (rdv, void*, smx_rdv_t) (task_size, double) (rate, double) (src_buff, void*) (src_buff_size, size_t) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (timeout, double) +Func H comm_isend (void*, smx_synchro_t) (src, void*, smx_process_t) (rdv, void*, smx_rdv_t) (task_size, double) (rate, double) (src_buff, void*) (src_buff_size, size_t) (match_fun, FPtr, simix_match_func_t) (clean_fun, FPtr, simix_clean_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (detached, int) +Blck H comm_recv (void) (rdv, void*, smx_rdv_t) (dst_buff, void*) (dst_buff_size, void*, size_t*) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (timeout, double) (rate, double) +Func H comm_irecv (void*, smx_synchro_t) (rdv, void*, smx_rdv_t) (dst_buff, void*) (dst_buff_size, void*, size_t*) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (rate, double) +Proc - comm_cancel (void) (comm, void*, smx_synchro_t) +Blck H comm_waitany (int) (comms, void*, xbt_dynar_t) +Blck H comm_wait (void) (comm, void*, smx_synchro_t) (timeout, double) +Blck H comm_test (int) (comm, void*, smx_synchro_t) +Blck H comm_testany (int) (comms, void*, xbt_dynar_t) +Func - comm_get_remains (double) (comm, void*, smx_synchro_t) +Func - comm_get_state (int, e_smx_state_t) (comm, void*, smx_synchro_t) +Func - comm_get_src_data (void*) (comm, void*, smx_synchro_t) +Func - comm_get_dst_data (void*) (comm, void*, smx_synchro_t) +Func - comm_get_src_proc (void*, smx_process_t) (comm, void*, smx_synchro_t) +Func - comm_get_dst_proc (void*, smx_process_t) (comm, void*, smx_synchro_t) +Func H mutex_init (void*, smx_mutex_t) +Proc - mutex_destroy (void) (mutex, void*, smx_mutex_t) +Blck H mutex_lock (void) (mutex, void*, smx_mutex_t) +Func H mutex_trylock (int) (mutex, void*, smx_mutex_t) +Proc H mutex_unlock (void) (mutex, void*, smx_mutex_t) +Func - cond_init (void*, smx_cond_t) +Proc - cond_destroy (void) (cond, void*, smx_cond_t) +Proc - cond_signal (void) (cond, void*, smx_cond_t) +Blck H cond_wait (void) (cond, void*, smx_cond_t) (mutex, void*, smx_mutex_t) +Blck H cond_wait_timeout (void) (cond, void*, smx_cond_t) (mutex, void*, smx_mutex_t) (timeout, double) +Proc - cond_broadcast (void) (cond, void*, smx_cond_t) +Func - sem_init (void*, smx_sem_t) (capacity, unsigned int) +Proc - sem_destroy (void) (sem, void*, smx_sem_t) +Proc H sem_release (void) (sem, void*, smx_sem_t) +Func H sem_would_block (int) (sem, void*, smx_sem_t) +Blck H sem_acquire (void) (sem, void*, smx_sem_t) +Blck H sem_acquire_timeout (void) (sem, void*, smx_sem_t) (timeout, double) +Func H sem_get_capacity (int) (sem, void*, smx_sem_t) +Blck H file_read (sg_size_t) (fd, void*, smx_file_t) (size, sg_size_t) (host, void*, smx_host_t) +Blck H file_write (sg_size_t) (fd, void*, smx_file_t) (size, sg_size_t) (host, void*, smx_host_t) +Blck H file_open (void*, smx_file_t) (fullpath, const char*) (host, void*, smx_host_t) +Blck H file_close (int) (fd, void*, smx_file_t) (host, void*, smx_host_t) +Func - file_unlink (int) (fd, void*, smx_file_t) (host, void*, smx_host_t) +Func H file_get_size (sg_size_t) (fd, void*, smx_file_t) +Func H file_tell (sg_size_t) (fd, void*, smx_file_t) +Func H file_seek (int) (fd, void*, smx_file_t) (offset, sg_offset_t) (origin, int) +Func H file_get_info (void*, xbt_dynar_t) (fd, void*, smx_file_t) +Func H file_move (int) (fd, void*, smx_file_t) (fullpath, const char*) +Func H storage_get_free_size (sg_size_t) (storage, void*, smx_storage_t) +Func H storage_get_used_size (sg_size_t) (name, void*, smx_storage_t) +Func - storage_get_properties (void*, xbt_dict_t) (storage, void*, smx_storage_t) +Func - storage_get_content (void*, xbt_dict_t) (storage, void*, smx_storage_t) +Func H asr_get_properties (void*, xbt_dict_t) (name, const char*) +Func H mc_random (int) (min, int) (max, int) ## HAVE_LATENCY_BOUND_TRACKING -comm_is_latency_bounded True (int) (comm, void*, smx_action_t) +Func - comm_is_latency_bounded (int) (comm, void*, smx_synchro_t) ## HAVE_TRACING -set_category True (void) (action, void*, smx_action_t) (category, const char*) +Proc - set_category (void) (synchro, void*, smx_synchro_t) (category, const char*) ## HAVE_MC -mc_snapshot True (void*) -mc_compare_snapshots True (int) (s1, void*) (s2, void*) -mc_random True (int) (min, int) (max, int) +Func H mc_snapshot (void*, mc_snapshot_t) +Func H mc_compare_snapshots (int) (s1, void*, mc_snapshot_t) (s2, void*, mc_snapshot_t) diff --git a/src/simix/simcalls.py b/src/simix/simcalls.py index 570815e057..41bd69d13a 100755 --- a/src/simix/simcalls.py +++ b/src/simix/simcalls.py @@ -1,8 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (c) 2014. The SimGrid Team. -# All rights reserved. +# Copyright (c) 2014. The SimGrid Team. All rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the license (GNU LGPL) which comes with this package. @@ -40,7 +39,7 @@ class Arg(object): def field(self): return self.simcall_types[self.type] - def ret(self): + def rettype(self): return '%s'%self.casted if self.casted else self.type def cast(self): @@ -49,166 +48,192 @@ class Arg(object): class Simcall(object): simcalls_BODY = None simcalls_PRE = None - def __init__(self, name, res, args, has_answer=True): + def __init__(self, name, handler, res, args, call_kind): self.name = name self.res = res self.args = args - self.has_answer = has_answer + self.need_handler = handler + self.call_kind = call_kind def check(self): - # smx_user.c simcall_BODY_ - # smx_*.c void SIMIX_pre_host_on(smx_simcall_t simcall, smx_host_t h) - self.check_body() - self.check_pre() - - def check_body(self): - if self.simcalls_BODY is None: - f = open('smx_user.c') - self.simcalls_BODY = set(re.findall('simcall_BODY_(.*?)\(', f.read())) - f.close() - if self.name not in self.simcalls_BODY: - print '# ERROR: No function calling simcall_BODY_%s'%self.name - print '# Add something like this to smx_user.c:' - print '''%s simcall_%s(%s) -{ - return simcall_BODY_%s(%s); -}\n'''%(self.res.ret() - ,self.name - ,', '.join('%s %s'%(arg.ret(), arg.name) - for arg in self.args) - ,self.name - ,', '.join(arg.name for arg in self.args)) - return False - return True - - def check_pre(self): - if self.simcalls_PRE is None: - self.simcalls_PRE = set() - for fn in glob.glob('smx_*') + glob.glob('../mc/*'): - f = open(fn) - self.simcalls_PRE |= set(re.findall('SIMIX_pre_(.*?)\(', f.read())) - f.close() - if self.name not in self.simcalls_PRE: - print '# ERROR: No function called SIMIX_pre_%s'%self.name - print '# Add something like this to smx_.*.c:' - print '''%s SIMIX_pre_%s(smx_simcall_t simcall%s) -{ - // Your code handling the simcall -}\n'''%(self.res.ret() - ,self.name - ,''.join(', %s %s'%(arg.ret(), arg.name) - for arg in self.args)) - return False - return True + # libsmx.c simcall_BODY_ + if self.simcalls_BODY is None: + f = open('libsmx.c') + self.simcalls_BODY = set(re.findall('simcall_BODY_(.*?)\(', f.read())) + f.close() + if self.name not in self.simcalls_BODY: + print '# ERROR: No function calling simcall_BODY_%s'%self.name + print '# Add something like this to libsmx.c:' + print '%s simcall_%s(%s) {'%(self.res.rettype() ,self.name ,', '.join('%s %s'%(arg.rettype(), arg.name) for arg in self.args)) + print ' return simcall_BODY_%s(%s);'%(self.name) + print '}' + return False + + # smx_*.c void simcall_HANDLER_host_on(smx_simcall_t simcall, smx_host_t h) + if self.simcalls_PRE is None: + self.simcalls_PRE = set() + for fn in glob.glob('smx_*') + glob.glob('../mc/*'): + f = open(fn) + self.simcalls_PRE |= set(re.findall('simcall_HANDLER_(.*?)\(', f.read())) + f.close() + if self.need_handler: + if (self.name not in self.simcalls_PRE): + print '# ERROR: No function called simcall_HANDLER_%s'%self.name + print '# Add something like this to the relevant C file (like smx_io.c if it\'s an IO call):' + print '%s simcall_HANDLER_%s(smx_simcall_t simcall%s) {'%(self.res.rettype() + ,self.name + ,''.join(', %s %s'%(arg.rettype(), arg.name) + for arg in self.args)) + print ' // Your code handling the simcall' + print '}' + return False + else: + if (self.name in self.simcalls_PRE): + print '# ERROR: You have a function called simcall_HANDLER_%s, but that simcall is not using any handler'%self.name + print '# Either change your simcall definition, or kill that function' + return False + return True def enum(self): - return 'SIMCALL_%s,'%(self.name.upper()) + return ' SIMCALL_%s,'%(self.name.upper()) def string(self): - return '[SIMCALL_%s] = "SIMCALL_%s",'%(self.name.upper(), self.name.upper()) - - def result_getter_setter(self): - return '%s\n%s'%(self.result_getter(), self.result_setter()) - - def result_getter(self): - return '' if self.res.type == 'void' else '''static inline %s simcall_%s__get__result(smx_simcall_t simcall){ - return %s simcall->result.%s; -}'''%(self.res.ret(), self.name, self.res.cast(), self.res.field()) - - def result_setter(self): - return '' if self.res.type == 'void' else '''static inline void simcall_%s__set__result(smx_simcall_t simcall, %s result){ - simcall->result.%s = result; -}'''%(self.name, self.res.type, self.res.field()) + return ' [SIMCALL_%s] = "SIMCALL_%s",'%(self.name.upper(), self.name.upper()) - def args_getter_setter(self): + def accessors(self): res = [] + res.append('') + # Arguments getter/setters for i in range(len(self.args)): - res.append(self.arg_getter(i)) - res.append(self.arg_setter(i)) + arg = self.args[i] + res.append('static inline %s simcall_%s__get__%s(smx_simcall_t simcall) {'%(arg.rettype(), self.name, arg.name)) + res.append(' return %s simcall->args[%i].%s;'%(arg.cast(), i, arg.field())) + res.append('}') + res.append('static inline void simcall_%s__set__%s(smx_simcall_t simcall, %s arg) {'%(self.name, arg.name, arg.type)) + res.append(' simcall->args[%i].%s = arg;'%(i, arg.field())) + res.append('}') + + # Return value getter/setters + if self.res.type != 'void': + res.append('static inline %s simcall_%s__get__result(smx_simcall_t simcall){'%(self.res.rettype(), self.name)) + res.append(' return %s simcall->result.%s;'%(self.res.cast(), self.res.field())) + res.append('}') + res.append('static inline void simcall_%s__set__result(smx_simcall_t simcall, %s result){'%(self.name, self.res.type,)) + res.append(' simcall->result.%s = result;'%(self.res.field())) + res.append('}') return '\n'.join(res) - def arg_getter(self, i): - arg = self.args[i] - return '''static inline %s simcall_%s__get__%s(smx_simcall_t simcall){ - return %s simcall->args[%i].%s; -}'''%(arg.ret(), self.name, arg.name, arg.cast(), i, arg.field()) - - def arg_setter(self, i): - arg = self.args[i] - return '''static inline void simcall_%s__set__%s(smx_simcall_t simcall, %s arg){ - simcall->args[%i].%s = arg; -}'''%(self.name, arg.name, arg.type, i, arg.field()) - def case(self): - return '''case SIMCALL_%s: - %sSIMIX_pre_%s(simcall %s); - %sbreak; -'''%(self.name.upper(), - 'simcall->result.%s = '%self.res.field() if self.res.type != 'void' and self.has_answer else ' ', - self.name, - ''.join(', %s simcall->args[%d].%s'%(arg.cast(), i, arg.field()) - for i, arg in enumerate(self.args)), - 'SIMIX_simcall_answer(simcall);\n ' if self.has_answer else ' ') + res = [] + res.append('case SIMCALL_%s:'%(self.name.upper())) + if self.need_handler: + res.append(' %ssimcall_HANDLER_%s(simcall %s);'%('simcall->result.%s = '%self.res.field() if self.call_kind == 'Func' else ' ', + self.name, + ''.join(', %s simcall->args[%d].%s'%(arg.cast(), i, arg.field()) + for i, arg in enumerate(self.args)))) + else: + res.append(' %sSIMIX_%s(%s);'%('simcall->result.%s = '%self.res.field() if self.call_kind == 'Func' else ' ', + self.name, + ','.join('%s simcall->args[%d].%s'%(arg.cast(), i, arg.field()) + for i, arg in enumerate(self.args)))) + res.append(' %sbreak; \n'%('SIMIX_simcall_answer(simcall);\n ' if self.call_kind != 'Blck' else ' ')) + return '\n'.join(res) def body(self): - return ''' inline static %s simcall_BODY_%s(%s) { - smx_process_t self = SIMIX_process_self(); - self->simcall.call = SIMCALL_%s; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); -%s - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%%s' on simcall %%s (%%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_pre(&self->simcall, 0); - } - %s - }'''%(self.res.ret() - ,self.name - ,', '.join('%s %s'%(arg.ret(), arg.name) - for arg in self.args) - ,self.name.upper() - ,'\n'.join(' self->simcall.args[%d].%s = (%s) %s;'%(i, arg.field(), arg.type, arg.name) - for i, arg in enumerate(self.args)) - ,'' if self.res.type == 'void' else 'return self->simcall.result.%s;'%self.res.field()) + res = [' '] + res.append('inline static %s simcall_BODY_%s(%s) {'%(self.res.rettype(), + self.name, + ', '.join('%s %s'%(arg.rettype(), arg.name) for arg in self.args))) + res.append(' smx_process_t self = SIMIX_process_self();') + res.append('') + res.append(' /* Go to that function to follow the code flow through the simcall barrier */') + if self.need_handler: + res.append(' if (0) simcall_HANDLER_%s(%s);'%(self.name, + ', '.join(["&self->simcall"]+ [arg.name for arg in self.args]))) + else: + res.append(' if (0) SIMIX_%s(%s);'%(self.name, + ', '.join(arg.name for arg in self.args))) + res.append(' /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */') + res.append('') + res.append(' self->simcall.call = SIMCALL_%s;'%(self.name.upper())) + res.append(' memset(&self->simcall.result, 0, sizeof(self->simcall.result));') + res.append(' memset(self->simcall.args, 0, sizeof(self->simcall.args));') + res.append('\n'.join(' self->simcall.args[%d].%s = (%s) %s;'%(i, arg.field(), arg.type, arg.name) + for i, arg in enumerate(self.args))) + res.append(' if (self != simix_global->maestro_process) {') + res.append(' XBT_DEBUG("Yield process \'%s\' on simcall %s (%d)", self->name,') + res.append(' SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);') + res.append(' SIMIX_process_yield(self);') + res.append(' } else {') + res.append(' SIMIX_simcall_handle(&self->simcall, 0);') + res.append(' } ') + if self.res.type != 'void': + res.append(' return self->simcall.result.%s;'%self.res.field()) + else: + res.append(' ') + res.append(' }') + return '\n'.join(res) + + + def handler_prototype(self): + if self.need_handler: + return "%s simcall_HANDLER_%s(smx_simcall_t simcall%s);"%(self.res.rettype() if self.call_kind == 'Func' else 'void', + self.name, + ''.join(', %s %s'%(arg.rettype(), arg.name) + for i, arg in enumerate(self.args))) + else: + return "" def parse(fn): - res = [] + simcalls = [] resdi = None - resd = {} + simcalls_guarded = {} for line in open(fn).read().split('\n'): if line.startswith('##'): resdi = [] - resd[re.search(r'## *(.*)', line).group(1)] = resdi + simcalls_guarded[re.search(r'## *(.*)', line).group(1)] = resdi if line.startswith('#') or not line: continue - match = re.match(r'(\S*?) *(\S*?) *\((.*?)(?:, *(.*?))?\) *(.*)', line) + match = re.match(r'(\S*?) *(\S*?) *(\S*?) *\((.*?)(?:, *(.*?))?\) *(.*)', line) assert match, line - name, ans, rest, resc, args = match.groups() + ans, handler, name, rest, resc, args = match.groups() + assert (ans == 'Proc' or ans == 'Func' or ans == 'Blck'),"Invalid call type: '%s'. Faulty line:\n%s\n"%(ans,line) + assert (handler == 'H' or handler == '-'),"Invalid need_handler indication: '%s'. Faulty line:\n%s\n"%(handler,line) sargs = [] for n,t,c in re.findall(r'\((.*?), *(.*?)(?:, *(.*?))?\)', args): sargs.append(Arg(n,t,c)) - sim = Simcall(name, Arg('result', rest, resc), sargs, ans == 'True') + sim = Simcall(name, handler=='H', Arg('result', rest, resc), sargs, ans) if resdi is None: - res.append(sim) + simcalls.append(sim) else: resdi.append(sim) - return res, resd - -def write(fn, func, scs, scd): - f = open(fn, 'w') - f.write('/*********************************************\n') - f.write(' * File Generated by src/simix/simcalls.py *\n') - f.write(' * from src/simix/simcalls.in *\n') - f.write(' * Do not modify this file, add new simcalls *\n') - f.write(' * in src/simix/simcalls.in *\n') - f.write(' *********************************************/\n\n') - f.write('\n'.join(func(sc) for sc in scs)) - for k, v in scd.items(): - f.write('\n#ifdef %s\n%s\n#endif\n'%(k, '\n'.join(func(sc) for sc in v))) - f.close() + return simcalls, simcalls_guarded + +def header(name): + fd = open(name, 'w') + fd.write('/**********************************************************************/\n') + fd.write('/* File generated by src/simix/simcalls.py from src/simix/simcalls.in */\n') + fd.write('/* */\n') + fd.write('/* DO NOT EVER CHANGE THIS FILE */\n') + fd.write('/* */\n') + fd.write('/* change simcalls specification in src/simix/simcalls.in */\n') + fd.write('/**********************************************************************/\n\n') + fd.write('/*\n') + fd.write(' * Note that the name comes from http://en.wikipedia.org/wiki/Popping\n') + fd.write(' * Indeed, the control flow is doing a strange dance in there.\n') + fd.write(' *\n') + fd.write(' * That\'s not about http://en.wikipedia.org/wiki/Poop, despite the odor :)\n') + fd.write(' */\n\n') + return fd + +def handle(fd,func, simcalls, guarded_simcalls): + def nonempty(e): return e != '' + fd.write('\n'.join( filter(nonempty, (func(simcall) for simcall in simcalls)))) + + for guard, list in guarded_simcalls.items(): + fd.write('\n#ifdef %s\n'%(guard)) + fd.write('\n'.join(func(simcall) for simcall in list)) + fd.write('\n#endif\n') if __name__=='__main__': import sys @@ -218,12 +243,92 @@ if __name__=='__main__': ok &= all(map(Simcall.check, simcalls)) for k,v in simcalls_dict.items(): ok &= all(map(Simcall.check, v)) + # FIXME: we should not hide it #if not ok: + # print ("Some checks fail!") # sys.exit(1) - write('simcalls_generated_enum.h', Simcall.enum, simcalls, simcalls_dict) - write('simcalls_generated_string.c', Simcall.string, simcalls, simcalls_dict) - write('simcalls_generated_res_getter_setter.h', Simcall.result_getter_setter, simcalls, simcalls_dict) - write('simcalls_generated_args_getter_setter.h', Simcall.args_getter_setter, simcalls, simcalls_dict) - write('simcalls_generated_case.c', Simcall.case, simcalls, simcalls_dict) - write('simcalls_generated_body.c', Simcall.body, simcalls, simcalls_dict) + ### + ### smx_popping_accessors.c + ### + fd = header('popping_accessors.h') + handle(fd, Simcall.accessors, simcalls, simcalls_dict) + fd.write("\n\n/* The prototype of all simcall handlers, automatically generated for you */\n\n") + handle(fd, Simcall.handler_prototype, simcalls, simcalls_dict) + fd.close() + + ### + ### smx_popping_enum.c + ### + fd = header("popping_enum.h") + fd.write('/**\n') + fd.write(' * @brief All possible simcalls.\n') + fd.write(' */\n') + fd.write('typedef enum {\n') + fd.write(' SIMCALL_NONE,\n') + + handle(fd, Simcall.enum, simcalls, simcalls_dict) + + fd.write(' NUM_SIMCALLS\n') + fd.write('} e_smx_simcall_t;\n') + fd.close() + + ### + ### smx_popping_generated.c + ### + + fd = header("popping_generated.c") + + fd.write('#include "smx_private.h"\n'); + fd.write('#ifdef HAVE_MC\n'); + # fd.write('#include "mc/mc_private.h"\n'); + fd.write('#endif\n'); + fd.write('\n'); + fd.write('XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);\n\n'); + + fd.write('/** @brief Simcalls\' names (generated from src/simix/simcalls.in) */\n') + fd.write('const char* simcall_names[] = {\n') + + handle(fd, Simcall.string, simcalls, simcalls_dict) + + fd.write('[SIMCALL_NONE] = "NONE"\n') + fd.write('};\n\n') + + + fd.write('/**\n'); + fd.write(' * @brief (in kernel mode) unpack the simcall and activate the handler\n'); + fd.write(' * \n') + fd.write(' * This function is generated from src/simix/simcalls.in\n') + fd.write(' */\n'); + fd.write('void SIMIX_simcall_handle(smx_simcall_t simcall, int value) {\n'); + fd.write(' XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call));\n'); + fd.write(' SIMCALL_SET_MC_VALUE(simcall, value);\n'); + fd.write(' if (simcall->issuer->context->iwannadie && simcall->call != SIMCALL_PROCESS_CLEANUP)\n'); + fd.write(' return;\n'); + fd.write(' switch (simcall->call) {\n'); + + handle(fd, Simcall.case, simcalls, simcalls_dict) + + fd.write(' case NUM_SIMCALLS:\n'); + fd.write(' break;\n'); + fd.write(' case SIMCALL_NONE:\n'); + fd.write(' THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s",\n'); + fd.write(' SIMIX_process_get_name(simcall->issuer),\n'); + fd.write(' SIMIX_host_get_name(SIMIX_process_get_host(simcall->issuer))\n'); + fd.write(' );\n'); + fd.write(' break;\n'); + fd.write('\n'); + fd.write(' }\n'); + fd.write('}\n'); + + fd.close() + + ### + ### smx_popping_bodies.c + ### + fd = header('popping_bodies.c') + fd.write('#include "smx_private.h"\n') + fd.write('#include "mc/mc_interface.h"\n') + fd.write('#include "xbt/ex.h"\n') + handle(fd, Simcall.body, simcalls, simcalls_dict) + fd.close() diff --git a/src/simix/simcalls_generated_case.c b/src/simix/simcalls_generated_case.c deleted file mode 100644 index 57e9938945..0000000000 --- a/src/simix/simcalls_generated_case.c +++ /dev/null @@ -1,611 +0,0 @@ -/********************************************* - * File Generated by src/simix/simcalls.py * - * from src/simix/simcalls.in * - * Do not modify this file, add new simcalls * - * in src/simix/simcalls.in * - *********************************************/ - -case SIMCALL_HOST_GET_BY_NAME: - simcall->result.dp = SIMIX_pre_host_get_by_name(simcall , simcall->args[0].cc); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_GET_NAME: - simcall->result.cc = SIMIX_pre_host_get_name(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_ON: - SIMIX_pre_host_on(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_OFF: - SIMIX_pre_host_off(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_GET_PROPERTIES: - simcall->result.dp = SIMIX_pre_host_get_properties(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_GET_CORE: - simcall->result.i = SIMIX_pre_host_get_core(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_GET_PROCESS_LIST: - simcall->result.dp = SIMIX_pre_host_get_process_list(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_GET_SPEED: - simcall->result.d = SIMIX_pre_host_get_speed(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_GET_AVAILABLE_SPEED: - simcall->result.d = SIMIX_pre_host_get_available_speed(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_GET_STATE: - simcall->result.i = SIMIX_pre_host_get_state(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_GET_CURRENT_POWER_PEAK: - simcall->result.d = SIMIX_pre_host_get_current_power_peak(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_GET_POWER_PEAK_AT: - simcall->result.d = SIMIX_pre_host_get_power_peak_at(simcall , (smx_host_t) simcall->args[0].dp, simcall->args[1].i); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_GET_NB_PSTATES: - simcall->result.i = SIMIX_pre_host_get_nb_pstates(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_SET_POWER_PEAK_AT: - SIMIX_pre_host_set_power_peak_at(simcall , (smx_host_t) simcall->args[0].dp, simcall->args[1].i); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_GET_CONSUMED_ENERGY: - simcall->result.d = SIMIX_pre_host_get_consumed_energy(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_EXECUTE: - simcall->result.dp = SIMIX_pre_host_execute(simcall , simcall->args[0].cc, (smx_host_t) simcall->args[1].dp, simcall->args[2].d, simcall->args[3].d, simcall->args[4].d, simcall->args[5].ul); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_PARALLEL_EXECUTE: - simcall->result.dp = SIMIX_pre_host_parallel_execute(simcall , simcall->args[0].cc, simcall->args[1].i, (smx_host_t*) simcall->args[2].dp, (double*) simcall->args[3].dp, (double*) simcall->args[4].dp, simcall->args[5].d, simcall->args[6].d); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_EXECUTION_DESTROY: - SIMIX_pre_host_execution_destroy(simcall , (smx_action_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_EXECUTION_CANCEL: - SIMIX_pre_host_execution_cancel(simcall , (smx_action_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_EXECUTION_GET_REMAINS: - simcall->result.d = SIMIX_pre_host_execution_get_remains(simcall , (smx_action_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_EXECUTION_GET_STATE: - simcall->result.i = SIMIX_pre_host_execution_get_state(simcall , (smx_action_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_EXECUTION_SET_PRIORITY: - SIMIX_pre_host_execution_set_priority(simcall , (smx_action_t) simcall->args[0].dp, simcall->args[1].d); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_EXECUTION_SET_BOUND: - SIMIX_pre_host_execution_set_bound(simcall , (smx_action_t) simcall->args[0].dp, simcall->args[1].d); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_EXECUTION_SET_AFFINITY: - SIMIX_pre_host_execution_set_affinity(simcall , (smx_action_t) simcall->args[0].dp, (smx_host_t) simcall->args[1].dp, simcall->args[2].ul); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_EXECUTION_WAIT: - SIMIX_pre_host_execution_wait(simcall , (smx_action_t) simcall->args[0].dp); - break; - -case SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST: - simcall->result.dp = SIMIX_pre_host_get_mounted_storage_list(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST: - simcall->result.dp = SIMIX_pre_host_get_attached_storage_list(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_GET_PARAMS: - SIMIX_pre_host_get_params(simcall , (smx_host_t) simcall->args[0].dp, (ws_params_t) simcall->args[1].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_HOST_SET_PARAMS: - SIMIX_pre_host_set_params(simcall , (smx_host_t) simcall->args[0].dp, (ws_params_t) simcall->args[1].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_VM_CREATE: - simcall->result.dp = SIMIX_pre_vm_create(simcall , simcall->args[0].cc, (smx_host_t) simcall->args[1].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_VM_START: - SIMIX_pre_vm_start(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_VM_GET_STATE: - simcall->result.i = SIMIX_pre_vm_get_state(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_VM_MIGRATE: - SIMIX_pre_vm_migrate(simcall , (smx_host_t) simcall->args[0].dp, (smx_host_t) simcall->args[1].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_VM_GET_PM: - simcall->result.dp = SIMIX_pre_vm_get_pm(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_VM_SET_BOUND: - SIMIX_pre_vm_set_bound(simcall , (smx_host_t) simcall->args[0].dp, simcall->args[1].d); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_VM_SET_AFFINITY: - SIMIX_pre_vm_set_affinity(simcall , (smx_host_t) simcall->args[0].dp, (smx_host_t) simcall->args[1].dp, simcall->args[2].ul); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_VM_DESTROY: - SIMIX_pre_vm_destroy(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_VM_SUSPEND: - SIMIX_pre_vm_suspend(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_VM_RESUME: - SIMIX_pre_vm_resume(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_VM_SHUTDOWN: - SIMIX_pre_vm_shutdown(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_VM_SAVE: - SIMIX_pre_vm_save(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_VM_RESTORE: - SIMIX_pre_vm_restore(simcall , (smx_host_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_CREATE: - SIMIX_pre_process_create(simcall , (smx_process_t*) simcall->args[0].dp, simcall->args[1].cc, (xbt_main_func_t) simcall->args[2].fp, simcall->args[3].dp, simcall->args[4].cc, simcall->args[5].d, simcall->args[6].i, (char**) simcall->args[7].dp, (xbt_dict_t) simcall->args[8].dp, simcall->args[9].i); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_KILL: - SIMIX_pre_process_kill(simcall , (smx_process_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_KILLALL: - SIMIX_pre_process_killall(simcall , simcall->args[0].i); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_CLEANUP: - SIMIX_pre_process_cleanup(simcall , (smx_process_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_CHANGE_HOST: - SIMIX_pre_process_change_host(simcall , (smx_process_t) simcall->args[0].dp, (smx_host_t) simcall->args[1].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_SUSPEND: - SIMIX_pre_process_suspend(simcall , (smx_process_t) simcall->args[0].dp); - break; - -case SIMCALL_PROCESS_RESUME: - SIMIX_pre_process_resume(simcall , (smx_process_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_COUNT: - simcall->result.i = SIMIX_pre_process_count(simcall ); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_GET_PID: - simcall->result.i = SIMIX_pre_process_get_PID(simcall , (smx_process_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_GET_PPID: - simcall->result.i = SIMIX_pre_process_get_PPID(simcall , (smx_process_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_GET_DATA: - simcall->result.dp = SIMIX_pre_process_get_data(simcall , (smx_process_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_SET_DATA: - SIMIX_pre_process_set_data(simcall , (smx_process_t) simcall->args[0].dp, simcall->args[1].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_GET_HOST: - simcall->result.dp = SIMIX_pre_process_get_host(simcall , (smx_process_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_GET_NAME: - simcall->result.cc = SIMIX_pre_process_get_name(simcall , (smx_process_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_IS_SUSPENDED: - simcall->result.i = SIMIX_pre_process_is_suspended(simcall , (smx_process_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_GET_PROPERTIES: - simcall->result.dp = SIMIX_pre_process_get_properties(simcall , (smx_process_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_JOIN: - SIMIX_pre_process_join(simcall , (smx_process_t) simcall->args[0].dp, simcall->args[1].d); - break; - -case SIMCALL_PROCESS_SLEEP: - SIMIX_pre_process_sleep(simcall , simcall->args[0].d); - break; - -case SIMCALL_PROCESS_ON_EXIT: - SIMIX_pre_process_on_exit(simcall , (smx_process_t) simcall->args[0].dp, (int_f_pvoid_pvoid_t) simcall->args[1].fp, simcall->args[2].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_AUTO_RESTART_SET: - SIMIX_pre_process_auto_restart_set(simcall , (smx_process_t) simcall->args[0].dp, simcall->args[1].i); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_RESTART: - simcall->result.dp = SIMIX_pre_process_restart(simcall , (smx_process_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_RDV_CREATE: - simcall->result.dp = SIMIX_pre_rdv_create(simcall , simcall->args[0].cc); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_RDV_DESTROY: - SIMIX_pre_rdv_destroy(simcall , (smx_rdv_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_RDV_COMM_COUNT_BY_HOST: - simcall->result.ui = SIMIX_pre_rdv_comm_count_by_host(simcall , (smx_rdv_t) simcall->args[0].dp, (smx_host_t) simcall->args[1].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_RDV_GET_HEAD: - simcall->result.dp = SIMIX_pre_rdv_get_head(simcall , (smx_rdv_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_RDV_SET_RECEIVER: - SIMIX_pre_rdv_set_receiver(simcall , (smx_rdv_t) simcall->args[0].dp, (smx_process_t) simcall->args[1].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_RDV_GET_RECEIVER: - simcall->result.dp = SIMIX_pre_rdv_get_receiver(simcall , (smx_rdv_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_IPROBE: - simcall->result.dp = SIMIX_pre_comm_iprobe(simcall , (smx_rdv_t) simcall->args[0].dp, simcall->args[1].i, simcall->args[2].i, simcall->args[3].i, (simix_match_func_t) simcall->args[4].fp, simcall->args[5].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_SEND: - SIMIX_pre_comm_send(simcall , (smx_process_t) simcall->args[0].dp, (smx_rdv_t) simcall->args[1].dp, simcall->args[2].d, simcall->args[3].d, simcall->args[4].dp, simcall->args[5].sz, (simix_match_func_t) simcall->args[6].fp, (simix_copy_data_func_t) simcall->args[7].fp, simcall->args[8].dp, simcall->args[9].d); - break; - -case SIMCALL_COMM_ISEND: - simcall->result.dp = SIMIX_pre_comm_isend(simcall , (smx_process_t) simcall->args[0].dp, (smx_rdv_t) simcall->args[1].dp, simcall->args[2].d, simcall->args[3].d, simcall->args[4].dp, simcall->args[5].sz, (simix_match_func_t) simcall->args[6].fp, (simix_clean_func_t) simcall->args[7].fp, (simix_copy_data_func_t) simcall->args[8].fp, simcall->args[9].dp, simcall->args[10].i); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_RECV: - SIMIX_pre_comm_recv(simcall , (smx_rdv_t) simcall->args[0].dp, simcall->args[1].dp, (size_t*) simcall->args[2].dp, (simix_match_func_t) simcall->args[3].fp, (simix_copy_data_func_t) simcall->args[4].fp, simcall->args[5].dp, simcall->args[6].d, simcall->args[7].d); - break; - -case SIMCALL_COMM_IRECV: - simcall->result.dp = SIMIX_pre_comm_irecv(simcall , (smx_rdv_t) simcall->args[0].dp, simcall->args[1].dp, (size_t*) simcall->args[2].dp, (simix_match_func_t) simcall->args[3].fp, (simix_copy_data_func_t) simcall->args[4].fp, simcall->args[5].dp, simcall->args[6].d); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_CANCEL: - SIMIX_pre_comm_cancel(simcall , (smx_action_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_WAITANY: - SIMIX_pre_comm_waitany(simcall , (xbt_dynar_t) simcall->args[0].dp); - break; - -case SIMCALL_COMM_WAIT: - SIMIX_pre_comm_wait(simcall , (smx_action_t) simcall->args[0].dp, simcall->args[1].d); - break; - -case SIMCALL_COMM_TEST: - SIMIX_pre_comm_test(simcall , (smx_action_t) simcall->args[0].dp); - break; - -case SIMCALL_COMM_TESTANY: - SIMIX_pre_comm_testany(simcall , (xbt_dynar_t) simcall->args[0].dp); - break; - -case SIMCALL_COMM_GET_REMAINS: - simcall->result.d = SIMIX_pre_comm_get_remains(simcall , (smx_action_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_GET_STATE: - simcall->result.i = SIMIX_pre_comm_get_state(simcall , (smx_action_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_GET_SRC_DATA: - simcall->result.dp = SIMIX_pre_comm_get_src_data(simcall , (smx_action_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_GET_DST_DATA: - simcall->result.dp = SIMIX_pre_comm_get_dst_data(simcall , (smx_action_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_GET_SRC_PROC: - simcall->result.dp = SIMIX_pre_comm_get_src_proc(simcall , (smx_action_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_GET_DST_PROC: - simcall->result.dp = SIMIX_pre_comm_get_dst_proc(simcall , (smx_action_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_MUTEX_INIT: - simcall->result.dp = SIMIX_pre_mutex_init(simcall ); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_MUTEX_DESTROY: - SIMIX_pre_mutex_destroy(simcall , (smx_mutex_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_MUTEX_LOCK: - SIMIX_pre_mutex_lock(simcall , (smx_mutex_t) simcall->args[0].dp); - break; - -case SIMCALL_MUTEX_TRYLOCK: - simcall->result.i = SIMIX_pre_mutex_trylock(simcall , (smx_mutex_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_MUTEX_UNLOCK: - SIMIX_pre_mutex_unlock(simcall , (smx_mutex_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COND_INIT: - simcall->result.dp = SIMIX_pre_cond_init(simcall ); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COND_DESTROY: - SIMIX_pre_cond_destroy(simcall , (smx_cond_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COND_SIGNAL: - SIMIX_pre_cond_signal(simcall , (smx_cond_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COND_WAIT: - SIMIX_pre_cond_wait(simcall , (smx_cond_t) simcall->args[0].dp, (smx_mutex_t) simcall->args[1].dp); - break; - -case SIMCALL_COND_WAIT_TIMEOUT: - SIMIX_pre_cond_wait_timeout(simcall , (smx_cond_t) simcall->args[0].dp, (smx_mutex_t) simcall->args[1].dp, simcall->args[2].d); - break; - -case SIMCALL_COND_BROADCAST: - SIMIX_pre_cond_broadcast(simcall , (smx_cond_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_SEM_INIT: - simcall->result.dp = SIMIX_pre_sem_init(simcall , simcall->args[0].i); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_SEM_DESTROY: - SIMIX_pre_sem_destroy(simcall , (smx_sem_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_SEM_RELEASE: - SIMIX_pre_sem_release(simcall , (smx_sem_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_SEM_WOULD_BLOCK: - simcall->result.i = SIMIX_pre_sem_would_block(simcall , (smx_sem_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_SEM_ACQUIRE: - SIMIX_pre_sem_acquire(simcall , (smx_sem_t) simcall->args[0].dp); - break; - -case SIMCALL_SEM_ACQUIRE_TIMEOUT: - SIMIX_pre_sem_acquire_timeout(simcall , (smx_sem_t) simcall->args[0].dp, simcall->args[1].d); - break; - -case SIMCALL_SEM_GET_CAPACITY: - simcall->result.i = SIMIX_pre_sem_get_capacity(simcall , (smx_sem_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_FILE_READ: - SIMIX_pre_file_read(simcall , (smx_file_t) simcall->args[0].dp, simcall->args[1].sgsz, (smx_host_t) simcall->args[2].dp); - break; - -case SIMCALL_FILE_WRITE: - SIMIX_pre_file_write(simcall , (smx_file_t) simcall->args[0].dp, simcall->args[1].sgsz, (smx_host_t) simcall->args[2].dp); - break; - -case SIMCALL_FILE_OPEN: - SIMIX_pre_file_open(simcall , simcall->args[0].cc, (smx_host_t) simcall->args[1].dp); - break; - -case SIMCALL_FILE_CLOSE: - SIMIX_pre_file_close(simcall , (smx_file_t) simcall->args[0].dp, (smx_host_t) simcall->args[1].dp); - break; - -case SIMCALL_FILE_UNLINK: - simcall->result.i = SIMIX_pre_file_unlink(simcall , (smx_file_t) simcall->args[0].dp, (smx_host_t) simcall->args[1].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_FILE_GET_SIZE: - simcall->result.sgsz = SIMIX_pre_file_get_size(simcall , (smx_file_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_FILE_TELL: - simcall->result.sgsz = SIMIX_pre_file_tell(simcall , (smx_file_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_FILE_SEEK: - simcall->result.i = SIMIX_pre_file_seek(simcall , (smx_file_t) simcall->args[0].dp, simcall->args[1].sgoff, simcall->args[2].i); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_FILE_GET_INFO: - simcall->result.dp = SIMIX_pre_file_get_info(simcall , (smx_file_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_FILE_MOVE: - simcall->result.i = SIMIX_pre_file_move(simcall , (smx_file_t) simcall->args[0].dp, simcall->args[1].cc); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_STORAGE_GET_FREE_SIZE: - simcall->result.sgsz = SIMIX_pre_storage_get_free_size(simcall , (smx_storage_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_STORAGE_GET_USED_SIZE: - simcall->result.sgsz = SIMIX_pre_storage_get_used_size(simcall , (smx_storage_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_STORAGE_GET_PROPERTIES: - simcall->result.dp = SIMIX_pre_storage_get_properties(simcall , (smx_storage_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_STORAGE_GET_CONTENT: - simcall->result.dp = SIMIX_pre_storage_get_content(simcall , (smx_storage_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_ASR_GET_PROPERTIES: - simcall->result.dp = SIMIX_pre_asr_get_properties(simcall , simcall->args[0].cc); - SIMIX_simcall_answer(simcall); - break; - -#ifdef HAVE_LATENCY_BOUND_TRACKING -case SIMCALL_COMM_IS_LATENCY_BOUNDED: - simcall->result.i = SIMIX_pre_comm_is_latency_bounded(simcall , (smx_action_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -#endif - -#ifdef HAVE_TRACING -case SIMCALL_SET_CATEGORY: - SIMIX_pre_set_category(simcall , (smx_action_t) simcall->args[0].dp, simcall->args[1].cc); - SIMIX_simcall_answer(simcall); - break; - -#endif - -#ifdef HAVE_MC -case SIMCALL_MC_SNAPSHOT: - simcall->result.dp = SIMIX_pre_mc_snapshot(simcall ); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_MC_COMPARE_SNAPSHOTS: - simcall->result.i = SIMIX_pre_mc_compare_snapshots(simcall , simcall->args[0].dp, simcall->args[1].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_MC_RANDOM: - simcall->result.i = SIMIX_pre_mc_random(simcall , simcall->args[0].i, simcall->args[1].i); - SIMIX_simcall_answer(simcall); - break; - -#endif diff --git a/src/simix/simcalls_generated_enum.h b/src/simix/simcalls_generated_enum.h deleted file mode 100644 index c2e7fe9b53..0000000000 --- a/src/simix/simcalls_generated_enum.h +++ /dev/null @@ -1,138 +0,0 @@ -/********************************************* - * File Generated by src/simix/simcalls.py * - * from src/simix/simcalls.in * - * Do not modify this file, add new simcalls * - * in src/simix/simcalls.in * - *********************************************/ - -SIMCALL_HOST_GET_BY_NAME, -SIMCALL_HOST_GET_NAME, -SIMCALL_HOST_ON, -SIMCALL_HOST_OFF, -SIMCALL_HOST_GET_PROPERTIES, -SIMCALL_HOST_GET_CORE, -SIMCALL_HOST_GET_PROCESS_LIST, -SIMCALL_HOST_GET_SPEED, -SIMCALL_HOST_GET_AVAILABLE_SPEED, -SIMCALL_HOST_GET_STATE, -SIMCALL_HOST_GET_CURRENT_POWER_PEAK, -SIMCALL_HOST_GET_POWER_PEAK_AT, -SIMCALL_HOST_GET_NB_PSTATES, -SIMCALL_HOST_SET_POWER_PEAK_AT, -SIMCALL_HOST_GET_CONSUMED_ENERGY, -SIMCALL_HOST_EXECUTE, -SIMCALL_HOST_PARALLEL_EXECUTE, -SIMCALL_HOST_EXECUTION_DESTROY, -SIMCALL_HOST_EXECUTION_CANCEL, -SIMCALL_HOST_EXECUTION_GET_REMAINS, -SIMCALL_HOST_EXECUTION_GET_STATE, -SIMCALL_HOST_EXECUTION_SET_PRIORITY, -SIMCALL_HOST_EXECUTION_SET_BOUND, -SIMCALL_HOST_EXECUTION_SET_AFFINITY, -SIMCALL_HOST_EXECUTION_WAIT, -SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST, -SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST, -SIMCALL_HOST_GET_PARAMS, -SIMCALL_HOST_SET_PARAMS, -SIMCALL_VM_CREATE, -SIMCALL_VM_START, -SIMCALL_VM_GET_STATE, -SIMCALL_VM_MIGRATE, -SIMCALL_VM_GET_PM, -SIMCALL_VM_SET_BOUND, -SIMCALL_VM_SET_AFFINITY, -SIMCALL_VM_DESTROY, -SIMCALL_VM_SUSPEND, -SIMCALL_VM_RESUME, -SIMCALL_VM_SHUTDOWN, -SIMCALL_VM_SAVE, -SIMCALL_VM_RESTORE, -SIMCALL_PROCESS_CREATE, -SIMCALL_PROCESS_KILL, -SIMCALL_PROCESS_KILLALL, -SIMCALL_PROCESS_CLEANUP, -SIMCALL_PROCESS_CHANGE_HOST, -SIMCALL_PROCESS_SUSPEND, -SIMCALL_PROCESS_RESUME, -SIMCALL_PROCESS_COUNT, -SIMCALL_PROCESS_GET_PID, -SIMCALL_PROCESS_GET_PPID, -SIMCALL_PROCESS_GET_DATA, -SIMCALL_PROCESS_SET_DATA, -SIMCALL_PROCESS_GET_HOST, -SIMCALL_PROCESS_GET_NAME, -SIMCALL_PROCESS_IS_SUSPENDED, -SIMCALL_PROCESS_GET_PROPERTIES, -SIMCALL_PROCESS_JOIN, -SIMCALL_PROCESS_SLEEP, -SIMCALL_PROCESS_ON_EXIT, -SIMCALL_PROCESS_AUTO_RESTART_SET, -SIMCALL_PROCESS_RESTART, -SIMCALL_RDV_CREATE, -SIMCALL_RDV_DESTROY, -SIMCALL_RDV_COMM_COUNT_BY_HOST, -SIMCALL_RDV_GET_HEAD, -SIMCALL_RDV_SET_RECEIVER, -SIMCALL_RDV_GET_RECEIVER, -SIMCALL_COMM_IPROBE, -SIMCALL_COMM_SEND, -SIMCALL_COMM_ISEND, -SIMCALL_COMM_RECV, -SIMCALL_COMM_IRECV, -SIMCALL_COMM_CANCEL, -SIMCALL_COMM_WAITANY, -SIMCALL_COMM_WAIT, -SIMCALL_COMM_TEST, -SIMCALL_COMM_TESTANY, -SIMCALL_COMM_GET_REMAINS, -SIMCALL_COMM_GET_STATE, -SIMCALL_COMM_GET_SRC_DATA, -SIMCALL_COMM_GET_DST_DATA, -SIMCALL_COMM_GET_SRC_PROC, -SIMCALL_COMM_GET_DST_PROC, -SIMCALL_MUTEX_INIT, -SIMCALL_MUTEX_DESTROY, -SIMCALL_MUTEX_LOCK, -SIMCALL_MUTEX_TRYLOCK, -SIMCALL_MUTEX_UNLOCK, -SIMCALL_COND_INIT, -SIMCALL_COND_DESTROY, -SIMCALL_COND_SIGNAL, -SIMCALL_COND_WAIT, -SIMCALL_COND_WAIT_TIMEOUT, -SIMCALL_COND_BROADCAST, -SIMCALL_SEM_INIT, -SIMCALL_SEM_DESTROY, -SIMCALL_SEM_RELEASE, -SIMCALL_SEM_WOULD_BLOCK, -SIMCALL_SEM_ACQUIRE, -SIMCALL_SEM_ACQUIRE_TIMEOUT, -SIMCALL_SEM_GET_CAPACITY, -SIMCALL_FILE_READ, -SIMCALL_FILE_WRITE, -SIMCALL_FILE_OPEN, -SIMCALL_FILE_CLOSE, -SIMCALL_FILE_UNLINK, -SIMCALL_FILE_GET_SIZE, -SIMCALL_FILE_TELL, -SIMCALL_FILE_SEEK, -SIMCALL_FILE_GET_INFO, -SIMCALL_FILE_MOVE, -SIMCALL_STORAGE_GET_FREE_SIZE, -SIMCALL_STORAGE_GET_USED_SIZE, -SIMCALL_STORAGE_GET_PROPERTIES, -SIMCALL_STORAGE_GET_CONTENT, -SIMCALL_ASR_GET_PROPERTIES, -#ifdef HAVE_LATENCY_BOUND_TRACKING -SIMCALL_COMM_IS_LATENCY_BOUNDED, -#endif - -#ifdef HAVE_TRACING -SIMCALL_SET_CATEGORY, -#endif - -#ifdef HAVE_MC -SIMCALL_MC_SNAPSHOT, -SIMCALL_MC_COMPARE_SNAPSHOTS, -SIMCALL_MC_RANDOM, -#endif diff --git a/src/simix/simcalls_generated_res_getter_setter.h b/src/simix/simcalls_generated_res_getter_setter.h deleted file mode 100644 index 6afe222ab6..0000000000 --- a/src/simix/simcalls_generated_res_getter_setter.h +++ /dev/null @@ -1,557 +0,0 @@ -/********************************************* - * File Generated by src/simix/simcalls.py * - * from src/simix/simcalls.in * - * Do not modify this file, add new simcalls * - * in src/simix/simcalls.in * - *********************************************/ - -static inline smx_host_t simcall_host_get_by_name__get__result(smx_simcall_t simcall){ - return (smx_host_t) simcall->result.dp; -} -static inline void simcall_host_get_by_name__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline const char* simcall_host_get_name__get__result(smx_simcall_t simcall){ - return simcall->result.cc; -} -static inline void simcall_host_get_name__set__result(smx_simcall_t simcall, const char* result){ - simcall->result.cc = result; -} - - - - -static inline xbt_dict_t simcall_host_get_properties__get__result(smx_simcall_t simcall){ - return (xbt_dict_t) simcall->result.dp; -} -static inline void simcall_host_get_properties__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline int simcall_host_get_core__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_host_get_core__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline xbt_swag_t simcall_host_get_process_list__get__result(smx_simcall_t simcall){ - return (xbt_swag_t) simcall->result.dp; -} -static inline void simcall_host_get_process_list__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline double simcall_host_get_speed__get__result(smx_simcall_t simcall){ - return simcall->result.d; -} -static inline void simcall_host_get_speed__set__result(smx_simcall_t simcall, double result){ - simcall->result.d = result; -} -static inline double simcall_host_get_available_speed__get__result(smx_simcall_t simcall){ - return simcall->result.d; -} -static inline void simcall_host_get_available_speed__set__result(smx_simcall_t simcall, double result){ - simcall->result.d = result; -} -static inline int simcall_host_get_state__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_host_get_state__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline double simcall_host_get_current_power_peak__get__result(smx_simcall_t simcall){ - return simcall->result.d; -} -static inline void simcall_host_get_current_power_peak__set__result(smx_simcall_t simcall, double result){ - simcall->result.d = result; -} -static inline double simcall_host_get_power_peak_at__get__result(smx_simcall_t simcall){ - return simcall->result.d; -} -static inline void simcall_host_get_power_peak_at__set__result(smx_simcall_t simcall, double result){ - simcall->result.d = result; -} -static inline int simcall_host_get_nb_pstates__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_host_get_nb_pstates__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} - - -static inline double simcall_host_get_consumed_energy__get__result(smx_simcall_t simcall){ - return simcall->result.d; -} -static inline void simcall_host_get_consumed_energy__set__result(smx_simcall_t simcall, double result){ - simcall->result.d = result; -} -static inline smx_action_t simcall_host_execute__get__result(smx_simcall_t simcall){ - return (smx_action_t) simcall->result.dp; -} -static inline void simcall_host_execute__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline smx_action_t simcall_host_parallel_execute__get__result(smx_simcall_t simcall){ - return (smx_action_t) simcall->result.dp; -} -static inline void simcall_host_parallel_execute__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - - - - -static inline double simcall_host_execution_get_remains__get__result(smx_simcall_t simcall){ - return simcall->result.d; -} -static inline void simcall_host_execution_get_remains__set__result(smx_simcall_t simcall, double result){ - simcall->result.d = result; -} -static inline int simcall_host_execution_get_state__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_host_execution_get_state__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} - - - - - - -static inline int simcall_host_execution_wait__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_host_execution_wait__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline xbt_dict_t simcall_host_get_mounted_storage_list__get__result(smx_simcall_t simcall){ - return (xbt_dict_t) simcall->result.dp; -} -static inline void simcall_host_get_mounted_storage_list__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline xbt_dynar_t simcall_host_get_attached_storage_list__get__result(smx_simcall_t simcall){ - return (xbt_dynar_t) simcall->result.dp; -} -static inline void simcall_host_get_attached_storage_list__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - - - - -static inline void* simcall_vm_create__get__result(smx_simcall_t simcall){ - return simcall->result.dp; -} -static inline void simcall_vm_create__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - - -static inline int simcall_vm_get_state__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_vm_get_state__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} - - -static inline void* simcall_vm_get_pm__get__result(smx_simcall_t simcall){ - return simcall->result.dp; -} -static inline void simcall_vm_get_pm__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -static inline int simcall_process_count__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_process_count__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline int simcall_process_get_PID__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_process_get_PID__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline int simcall_process_get_PPID__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_process_get_PPID__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline void* simcall_process_get_data__get__result(smx_simcall_t simcall){ - return simcall->result.dp; -} -static inline void simcall_process_get_data__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - - -static inline smx_host_t simcall_process_get_host__get__result(smx_simcall_t simcall){ - return (smx_host_t) simcall->result.dp; -} -static inline void simcall_process_get_host__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline const char* simcall_process_get_name__get__result(smx_simcall_t simcall){ - return simcall->result.cc; -} -static inline void simcall_process_get_name__set__result(smx_simcall_t simcall, const char* result){ - simcall->result.cc = result; -} -static inline int simcall_process_is_suspended__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_process_is_suspended__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline xbt_dict_t simcall_process_get_properties__get__result(smx_simcall_t simcall){ - return (xbt_dict_t) simcall->result.dp; -} -static inline void simcall_process_get_properties__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline int simcall_process_join__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_process_join__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline int simcall_process_sleep__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_process_sleep__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} - - - - -static inline smx_process_t simcall_process_restart__get__result(smx_simcall_t simcall){ - return (smx_process_t) simcall->result.dp; -} -static inline void simcall_process_restart__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline smx_rdv_t simcall_rdv_create__get__result(smx_simcall_t simcall){ - return (smx_rdv_t) simcall->result.dp; -} -static inline void simcall_rdv_create__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - - -static inline unsigned int simcall_rdv_comm_count_by_host__get__result(smx_simcall_t simcall){ - return simcall->result.ui; -} -static inline void simcall_rdv_comm_count_by_host__set__result(smx_simcall_t simcall, unsigned int result){ - simcall->result.ui = result; -} -static inline smx_action_t simcall_rdv_get_head__get__result(smx_simcall_t simcall){ - return (smx_action_t) simcall->result.dp; -} -static inline void simcall_rdv_get_head__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - - -static inline smx_process_t simcall_rdv_get_receiver__get__result(smx_simcall_t simcall){ - return (smx_process_t) simcall->result.dp; -} -static inline void simcall_rdv_get_receiver__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline smx_action_t simcall_comm_iprobe__get__result(smx_simcall_t simcall){ - return (smx_action_t) simcall->result.dp; -} -static inline void simcall_comm_iprobe__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - - -static inline smx_action_t simcall_comm_isend__get__result(smx_simcall_t simcall){ - return (smx_action_t) simcall->result.dp; -} -static inline void simcall_comm_isend__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - - -static inline smx_action_t simcall_comm_irecv__get__result(smx_simcall_t simcall){ - return (smx_action_t) simcall->result.dp; -} -static inline void simcall_comm_irecv__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - - -static inline int simcall_comm_waitany__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_comm_waitany__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} - - -static inline int simcall_comm_test__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_comm_test__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline int simcall_comm_testany__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_comm_testany__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline double simcall_comm_get_remains__get__result(smx_simcall_t simcall){ - return simcall->result.d; -} -static inline void simcall_comm_get_remains__set__result(smx_simcall_t simcall, double result){ - simcall->result.d = result; -} -static inline int simcall_comm_get_state__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_comm_get_state__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline void* simcall_comm_get_src_data__get__result(smx_simcall_t simcall){ - return simcall->result.dp; -} -static inline void simcall_comm_get_src_data__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline void* simcall_comm_get_dst_data__get__result(smx_simcall_t simcall){ - return simcall->result.dp; -} -static inline void simcall_comm_get_dst_data__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline smx_process_t simcall_comm_get_src_proc__get__result(smx_simcall_t simcall){ - return (smx_process_t) simcall->result.dp; -} -static inline void simcall_comm_get_src_proc__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline smx_process_t simcall_comm_get_dst_proc__get__result(smx_simcall_t simcall){ - return (smx_process_t) simcall->result.dp; -} -static inline void simcall_comm_get_dst_proc__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline smx_mutex_t simcall_mutex_init__get__result(smx_simcall_t simcall){ - return (smx_mutex_t) simcall->result.dp; -} -static inline void simcall_mutex_init__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - - - - -static inline int simcall_mutex_trylock__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_mutex_trylock__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} - - -static inline smx_cond_t simcall_cond_init__get__result(smx_simcall_t simcall){ - return (smx_cond_t) simcall->result.dp; -} -static inline void simcall_cond_init__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - - - - - - - - - - -static inline smx_sem_t simcall_sem_init__get__result(smx_simcall_t simcall){ - return (smx_sem_t) simcall->result.dp; -} -static inline void simcall_sem_init__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - - - - -static inline int simcall_sem_would_block__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_sem_would_block__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} - - - - -static inline int simcall_sem_get_capacity__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_sem_get_capacity__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline sg_size_t simcall_file_read__get__result(smx_simcall_t simcall){ - return simcall->result.sgsz; -} -static inline void simcall_file_read__set__result(smx_simcall_t simcall, sg_size_t result){ - simcall->result.sgsz = result; -} -static inline sg_size_t simcall_file_write__get__result(smx_simcall_t simcall){ - return simcall->result.sgsz; -} -static inline void simcall_file_write__set__result(smx_simcall_t simcall, sg_size_t result){ - simcall->result.sgsz = result; -} -static inline smx_file_t simcall_file_open__get__result(smx_simcall_t simcall){ - return (smx_file_t) simcall->result.dp; -} -static inline void simcall_file_open__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline int simcall_file_close__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_file_close__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline int simcall_file_unlink__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_file_unlink__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline sg_size_t simcall_file_get_size__get__result(smx_simcall_t simcall){ - return simcall->result.sgsz; -} -static inline void simcall_file_get_size__set__result(smx_simcall_t simcall, sg_size_t result){ - simcall->result.sgsz = result; -} -static inline sg_size_t simcall_file_tell__get__result(smx_simcall_t simcall){ - return simcall->result.sgsz; -} -static inline void simcall_file_tell__set__result(smx_simcall_t simcall, sg_size_t result){ - simcall->result.sgsz = result; -} -static inline int simcall_file_seek__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_file_seek__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline xbt_dynar_t simcall_file_get_info__get__result(smx_simcall_t simcall){ - return (xbt_dynar_t) simcall->result.dp; -} -static inline void simcall_file_get_info__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline int simcall_file_move__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_file_move__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline sg_size_t simcall_storage_get_free_size__get__result(smx_simcall_t simcall){ - return simcall->result.sgsz; -} -static inline void simcall_storage_get_free_size__set__result(smx_simcall_t simcall, sg_size_t result){ - simcall->result.sgsz = result; -} -static inline sg_size_t simcall_storage_get_used_size__get__result(smx_simcall_t simcall){ - return simcall->result.sgsz; -} -static inline void simcall_storage_get_used_size__set__result(smx_simcall_t simcall, sg_size_t result){ - simcall->result.sgsz = result; -} -static inline xbt_dict_t simcall_storage_get_properties__get__result(smx_simcall_t simcall){ - return (xbt_dict_t) simcall->result.dp; -} -static inline void simcall_storage_get_properties__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline xbt_dict_t simcall_storage_get_content__get__result(smx_simcall_t simcall){ - return (xbt_dict_t) simcall->result.dp; -} -static inline void simcall_storage_get_content__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline xbt_dict_t simcall_asr_get_properties__get__result(smx_simcall_t simcall){ - return (xbt_dict_t) simcall->result.dp; -} -static inline void simcall_asr_get_properties__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -#ifdef HAVE_LATENCY_BOUND_TRACKING -static inline int simcall_comm_is_latency_bounded__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_comm_is_latency_bounded__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -#endif - -#ifdef HAVE_TRACING - - -#endif - -#ifdef HAVE_MC -static inline void* simcall_mc_snapshot__get__result(smx_simcall_t simcall){ - return simcall->result.dp; -} -static inline void simcall_mc_snapshot__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} -static inline int simcall_mc_compare_snapshots__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_mc_compare_snapshots__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -static inline int simcall_mc_random__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_mc_random__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} -#endif diff --git a/src/simix/simcalls_generated_string.c b/src/simix/simcalls_generated_string.c deleted file mode 100644 index 8269d30282..0000000000 --- a/src/simix/simcalls_generated_string.c +++ /dev/null @@ -1,138 +0,0 @@ -/********************************************* - * File Generated by src/simix/simcalls.py * - * from src/simix/simcalls.in * - * Do not modify this file, add new simcalls * - * in src/simix/simcalls.in * - *********************************************/ - -[SIMCALL_HOST_GET_BY_NAME] = "SIMCALL_HOST_GET_BY_NAME", -[SIMCALL_HOST_GET_NAME] = "SIMCALL_HOST_GET_NAME", -[SIMCALL_HOST_ON] = "SIMCALL_HOST_ON", -[SIMCALL_HOST_OFF] = "SIMCALL_HOST_OFF", -[SIMCALL_HOST_GET_PROPERTIES] = "SIMCALL_HOST_GET_PROPERTIES", -[SIMCALL_HOST_GET_CORE] = "SIMCALL_HOST_GET_CORE", -[SIMCALL_HOST_GET_PROCESS_LIST] = "SIMCALL_HOST_GET_PROCESS_LIST", -[SIMCALL_HOST_GET_SPEED] = "SIMCALL_HOST_GET_SPEED", -[SIMCALL_HOST_GET_AVAILABLE_SPEED] = "SIMCALL_HOST_GET_AVAILABLE_SPEED", -[SIMCALL_HOST_GET_STATE] = "SIMCALL_HOST_GET_STATE", -[SIMCALL_HOST_GET_CURRENT_POWER_PEAK] = "SIMCALL_HOST_GET_CURRENT_POWER_PEAK", -[SIMCALL_HOST_GET_POWER_PEAK_AT] = "SIMCALL_HOST_GET_POWER_PEAK_AT", -[SIMCALL_HOST_GET_NB_PSTATES] = "SIMCALL_HOST_GET_NB_PSTATES", -[SIMCALL_HOST_SET_POWER_PEAK_AT] = "SIMCALL_HOST_SET_POWER_PEAK_AT", -[SIMCALL_HOST_GET_CONSUMED_ENERGY] = "SIMCALL_HOST_GET_CONSUMED_ENERGY", -[SIMCALL_HOST_EXECUTE] = "SIMCALL_HOST_EXECUTE", -[SIMCALL_HOST_PARALLEL_EXECUTE] = "SIMCALL_HOST_PARALLEL_EXECUTE", -[SIMCALL_HOST_EXECUTION_DESTROY] = "SIMCALL_HOST_EXECUTION_DESTROY", -[SIMCALL_HOST_EXECUTION_CANCEL] = "SIMCALL_HOST_EXECUTION_CANCEL", -[SIMCALL_HOST_EXECUTION_GET_REMAINS] = "SIMCALL_HOST_EXECUTION_GET_REMAINS", -[SIMCALL_HOST_EXECUTION_GET_STATE] = "SIMCALL_HOST_EXECUTION_GET_STATE", -[SIMCALL_HOST_EXECUTION_SET_PRIORITY] = "SIMCALL_HOST_EXECUTION_SET_PRIORITY", -[SIMCALL_HOST_EXECUTION_SET_BOUND] = "SIMCALL_HOST_EXECUTION_SET_BOUND", -[SIMCALL_HOST_EXECUTION_SET_AFFINITY] = "SIMCALL_HOST_EXECUTION_SET_AFFINITY", -[SIMCALL_HOST_EXECUTION_WAIT] = "SIMCALL_HOST_EXECUTION_WAIT", -[SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST] = "SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST", -[SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST] = "SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST", -[SIMCALL_HOST_GET_PARAMS] = "SIMCALL_HOST_GET_PARAMS", -[SIMCALL_HOST_SET_PARAMS] = "SIMCALL_HOST_SET_PARAMS", -[SIMCALL_VM_CREATE] = "SIMCALL_VM_CREATE", -[SIMCALL_VM_START] = "SIMCALL_VM_START", -[SIMCALL_VM_GET_STATE] = "SIMCALL_VM_GET_STATE", -[SIMCALL_VM_MIGRATE] = "SIMCALL_VM_MIGRATE", -[SIMCALL_VM_GET_PM] = "SIMCALL_VM_GET_PM", -[SIMCALL_VM_SET_BOUND] = "SIMCALL_VM_SET_BOUND", -[SIMCALL_VM_SET_AFFINITY] = "SIMCALL_VM_SET_AFFINITY", -[SIMCALL_VM_DESTROY] = "SIMCALL_VM_DESTROY", -[SIMCALL_VM_SUSPEND] = "SIMCALL_VM_SUSPEND", -[SIMCALL_VM_RESUME] = "SIMCALL_VM_RESUME", -[SIMCALL_VM_SHUTDOWN] = "SIMCALL_VM_SHUTDOWN", -[SIMCALL_VM_SAVE] = "SIMCALL_VM_SAVE", -[SIMCALL_VM_RESTORE] = "SIMCALL_VM_RESTORE", -[SIMCALL_PROCESS_CREATE] = "SIMCALL_PROCESS_CREATE", -[SIMCALL_PROCESS_KILL] = "SIMCALL_PROCESS_KILL", -[SIMCALL_PROCESS_KILLALL] = "SIMCALL_PROCESS_KILLALL", -[SIMCALL_PROCESS_CLEANUP] = "SIMCALL_PROCESS_CLEANUP", -[SIMCALL_PROCESS_CHANGE_HOST] = "SIMCALL_PROCESS_CHANGE_HOST", -[SIMCALL_PROCESS_SUSPEND] = "SIMCALL_PROCESS_SUSPEND", -[SIMCALL_PROCESS_RESUME] = "SIMCALL_PROCESS_RESUME", -[SIMCALL_PROCESS_COUNT] = "SIMCALL_PROCESS_COUNT", -[SIMCALL_PROCESS_GET_PID] = "SIMCALL_PROCESS_GET_PID", -[SIMCALL_PROCESS_GET_PPID] = "SIMCALL_PROCESS_GET_PPID", -[SIMCALL_PROCESS_GET_DATA] = "SIMCALL_PROCESS_GET_DATA", -[SIMCALL_PROCESS_SET_DATA] = "SIMCALL_PROCESS_SET_DATA", -[SIMCALL_PROCESS_GET_HOST] = "SIMCALL_PROCESS_GET_HOST", -[SIMCALL_PROCESS_GET_NAME] = "SIMCALL_PROCESS_GET_NAME", -[SIMCALL_PROCESS_IS_SUSPENDED] = "SIMCALL_PROCESS_IS_SUSPENDED", -[SIMCALL_PROCESS_GET_PROPERTIES] = "SIMCALL_PROCESS_GET_PROPERTIES", -[SIMCALL_PROCESS_JOIN] = "SIMCALL_PROCESS_JOIN", -[SIMCALL_PROCESS_SLEEP] = "SIMCALL_PROCESS_SLEEP", -[SIMCALL_PROCESS_ON_EXIT] = "SIMCALL_PROCESS_ON_EXIT", -[SIMCALL_PROCESS_AUTO_RESTART_SET] = "SIMCALL_PROCESS_AUTO_RESTART_SET", -[SIMCALL_PROCESS_RESTART] = "SIMCALL_PROCESS_RESTART", -[SIMCALL_RDV_CREATE] = "SIMCALL_RDV_CREATE", -[SIMCALL_RDV_DESTROY] = "SIMCALL_RDV_DESTROY", -[SIMCALL_RDV_COMM_COUNT_BY_HOST] = "SIMCALL_RDV_COMM_COUNT_BY_HOST", -[SIMCALL_RDV_GET_HEAD] = "SIMCALL_RDV_GET_HEAD", -[SIMCALL_RDV_SET_RECEIVER] = "SIMCALL_RDV_SET_RECEIVER", -[SIMCALL_RDV_GET_RECEIVER] = "SIMCALL_RDV_GET_RECEIVER", -[SIMCALL_COMM_IPROBE] = "SIMCALL_COMM_IPROBE", -[SIMCALL_COMM_SEND] = "SIMCALL_COMM_SEND", -[SIMCALL_COMM_ISEND] = "SIMCALL_COMM_ISEND", -[SIMCALL_COMM_RECV] = "SIMCALL_COMM_RECV", -[SIMCALL_COMM_IRECV] = "SIMCALL_COMM_IRECV", -[SIMCALL_COMM_CANCEL] = "SIMCALL_COMM_CANCEL", -[SIMCALL_COMM_WAITANY] = "SIMCALL_COMM_WAITANY", -[SIMCALL_COMM_WAIT] = "SIMCALL_COMM_WAIT", -[SIMCALL_COMM_TEST] = "SIMCALL_COMM_TEST", -[SIMCALL_COMM_TESTANY] = "SIMCALL_COMM_TESTANY", -[SIMCALL_COMM_GET_REMAINS] = "SIMCALL_COMM_GET_REMAINS", -[SIMCALL_COMM_GET_STATE] = "SIMCALL_COMM_GET_STATE", -[SIMCALL_COMM_GET_SRC_DATA] = "SIMCALL_COMM_GET_SRC_DATA", -[SIMCALL_COMM_GET_DST_DATA] = "SIMCALL_COMM_GET_DST_DATA", -[SIMCALL_COMM_GET_SRC_PROC] = "SIMCALL_COMM_GET_SRC_PROC", -[SIMCALL_COMM_GET_DST_PROC] = "SIMCALL_COMM_GET_DST_PROC", -[SIMCALL_MUTEX_INIT] = "SIMCALL_MUTEX_INIT", -[SIMCALL_MUTEX_DESTROY] = "SIMCALL_MUTEX_DESTROY", -[SIMCALL_MUTEX_LOCK] = "SIMCALL_MUTEX_LOCK", -[SIMCALL_MUTEX_TRYLOCK] = "SIMCALL_MUTEX_TRYLOCK", -[SIMCALL_MUTEX_UNLOCK] = "SIMCALL_MUTEX_UNLOCK", -[SIMCALL_COND_INIT] = "SIMCALL_COND_INIT", -[SIMCALL_COND_DESTROY] = "SIMCALL_COND_DESTROY", -[SIMCALL_COND_SIGNAL] = "SIMCALL_COND_SIGNAL", -[SIMCALL_COND_WAIT] = "SIMCALL_COND_WAIT", -[SIMCALL_COND_WAIT_TIMEOUT] = "SIMCALL_COND_WAIT_TIMEOUT", -[SIMCALL_COND_BROADCAST] = "SIMCALL_COND_BROADCAST", -[SIMCALL_SEM_INIT] = "SIMCALL_SEM_INIT", -[SIMCALL_SEM_DESTROY] = "SIMCALL_SEM_DESTROY", -[SIMCALL_SEM_RELEASE] = "SIMCALL_SEM_RELEASE", -[SIMCALL_SEM_WOULD_BLOCK] = "SIMCALL_SEM_WOULD_BLOCK", -[SIMCALL_SEM_ACQUIRE] = "SIMCALL_SEM_ACQUIRE", -[SIMCALL_SEM_ACQUIRE_TIMEOUT] = "SIMCALL_SEM_ACQUIRE_TIMEOUT", -[SIMCALL_SEM_GET_CAPACITY] = "SIMCALL_SEM_GET_CAPACITY", -[SIMCALL_FILE_READ] = "SIMCALL_FILE_READ", -[SIMCALL_FILE_WRITE] = "SIMCALL_FILE_WRITE", -[SIMCALL_FILE_OPEN] = "SIMCALL_FILE_OPEN", -[SIMCALL_FILE_CLOSE] = "SIMCALL_FILE_CLOSE", -[SIMCALL_FILE_UNLINK] = "SIMCALL_FILE_UNLINK", -[SIMCALL_FILE_GET_SIZE] = "SIMCALL_FILE_GET_SIZE", -[SIMCALL_FILE_TELL] = "SIMCALL_FILE_TELL", -[SIMCALL_FILE_SEEK] = "SIMCALL_FILE_SEEK", -[SIMCALL_FILE_GET_INFO] = "SIMCALL_FILE_GET_INFO", -[SIMCALL_FILE_MOVE] = "SIMCALL_FILE_MOVE", -[SIMCALL_STORAGE_GET_FREE_SIZE] = "SIMCALL_STORAGE_GET_FREE_SIZE", -[SIMCALL_STORAGE_GET_USED_SIZE] = "SIMCALL_STORAGE_GET_USED_SIZE", -[SIMCALL_STORAGE_GET_PROPERTIES] = "SIMCALL_STORAGE_GET_PROPERTIES", -[SIMCALL_STORAGE_GET_CONTENT] = "SIMCALL_STORAGE_GET_CONTENT", -[SIMCALL_ASR_GET_PROPERTIES] = "SIMCALL_ASR_GET_PROPERTIES", -#ifdef HAVE_LATENCY_BOUND_TRACKING -[SIMCALL_COMM_IS_LATENCY_BOUNDED] = "SIMCALL_COMM_IS_LATENCY_BOUNDED", -#endif - -#ifdef HAVE_TRACING -[SIMCALL_SET_CATEGORY] = "SIMCALL_SET_CATEGORY", -#endif - -#ifdef HAVE_MC -[SIMCALL_MC_SNAPSHOT] = "SIMCALL_MC_SNAPSHOT", -[SIMCALL_MC_COMPARE_SNAPSHOTS] = "SIMCALL_MC_COMPARE_SNAPSHOTS", -[SIMCALL_MC_RANDOM] = "SIMCALL_MC_RANDOM", -#endif diff --git a/src/simix/smx_context_raw.c b/src/simix/smx_context_raw.c index 23b08dfd5e..3b0a76be09 100644 --- a/src/simix/smx_context_raw.c +++ b/src/simix/smx_context_raw.c @@ -5,6 +5,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include #include "smx_private.h" #include "xbt/parmap.h" #include "xbt/dynar.h" @@ -27,21 +28,27 @@ static xbt_parmap_t raw_parmap; static smx_ctx_raw_t* raw_workers_context; /* space to save the worker context in each thread */ static unsigned long raw_threads_working; /* number of threads that have started their work */ static xbt_os_thread_key_t raw_worker_id_key; /* thread-specific storage for the thread id */ -#endif - +#endif #ifdef ADAPTIVE_THRESHOLD #define SCHED_ROUND_LIMIT 5 xbt_os_timer_t round_time; double par_time,seq_time; double par_ratio,seq_ratio; +int reached_seq_limit, reached_par_limit; static unsigned int par_proc_that_ran = 0,seq_proc_that_ran = 0; /* Counters of processes that have run in SCHED_ROUND_LIMIT scheduling rounds */ -static unsigned int seq_sched_round, par_sched_round; /* Amount of SR that ran serial/parallel*/ +static unsigned int seq_sched_round=0, par_sched_round=0; /* Amount of SR that ran serial/parallel*/ +/*Varables used to calculate running variance and mean*/ +double prev_avg_par_proc=0,prev_avg_seq_proc=0; +double delta=0; +double s_par_proc=0,s_seq_proc=0; /*Standard deviation of number of processes computed in par/seq during the current simulation*/ +double avg_par_proc=0,sd_par_proc=0; +double avg_seq_proc=0,sd_seq_proc=0; +long long par_window=(long long)HUGE_VAL,seq_window=0; #endif static unsigned long raw_process_index = 0; /* index of the next process to run in the * list of runnable processes */ static smx_ctx_raw_t raw_maestro_context; - extern raw_stack_t raw_makecontext(char* malloced_stack, int stack_size, rawctx_entry_point_t entry_point, void* arg); extern void raw_swapcontext(raw_stack_t* old, raw_stack_t new); @@ -216,10 +223,6 @@ static unsigned int sr_count = 0; static xbt_os_timer_t timer; #endif -#ifdef ADAPTIVE_THRESHOLD -int reached_seq_limit, reached_par_limit; -#endif - static void smx_ctx_raw_wrapper(smx_ctx_raw_t context); static int smx_ctx_raw_factory_finalize(smx_context_factory_t *factory); static smx_context_t smx_ctx_raw_create_context(xbt_main_func_t code, int argc, @@ -604,52 +607,76 @@ static void smx_ctx_raw_runall_parallel(void) static void smx_ctx_raw_runall(void) { unsigned long nb_processes = xbt_dynar_length(simix_global->process_to_run); + unsigned long threshold = SIMIX_context_get_parallel_threshold(); reached_seq_limit = (seq_sched_round % SCHED_ROUND_LIMIT == 0); reached_par_limit = (par_sched_round % SCHED_ROUND_LIMIT == 0); - if(reached_par_limit){ - par_sched_round = 0; + if(reached_seq_limit && reached_par_limit){ par_ratio = (par_proc_that_ran != 0) ? (par_time / (double)par_proc_that_ran) : 0; - par_time = 0; par_proc_that_ran = 0; - } - - if(reached_seq_limit){ - seq_sched_round = 0; seq_ratio = (seq_proc_that_ran != 0) ? (seq_time / (double)seq_proc_that_ran) : 0; - seq_time = 0; seq_proc_that_ran = 0; - } - - if(reached_seq_limit && reached_par_limit){ if(seq_ratio > par_ratio){ - SIMIX_context_set_parallel_threshold(SIMIX_context_get_parallel_threshold() - 1); + if(nb_processes < avg_par_proc) { + threshold = (threshold>2) ? threshold - 1 : threshold ; + SIMIX_context_set_parallel_threshold(threshold); + } } else { - SIMIX_context_set_parallel_threshold(SIMIX_context_get_parallel_threshold() + 1); + if(nb_processes > avg_seq_proc){ + SIMIX_context_set_parallel_threshold(threshold+1); + } } } - XBT_CRITICAL("Adaptive Algorithm. Parallel Threshold is: %d. Processes: %d", SIMIX_context_get_parallel_threshold(), nb_processes); + //XBT_CRITICAL("Thresh: %d", SIMIX_context_get_parallel_threshold()); if (nb_processes >= SIMIX_context_get_parallel_threshold()) { - XBT_DEBUG("Runall // %lu", nb_processes); simix_global->context_factory->suspend = smx_ctx_raw_suspend_parallel; - xbt_os_cputimer_start(round_time); - smx_ctx_raw_runall_parallel(); - xbt_os_cputimer_stop(round_time); - par_time += xbt_os_timer_elapsed(round_time); - par_proc_that_ran += nb_processes; - par_sched_round++; + if(nb_processes < par_window){ + par_sched_round++; + xbt_os_walltimer_start(round_time); + smx_ctx_raw_runall_parallel(); + xbt_os_walltimer_stop(round_time); + par_time += xbt_os_timer_elapsed(round_time); + + prev_avg_par_proc = avg_par_proc; + delta = nb_processes - avg_par_proc; + avg_par_proc = (par_sched_round==1) ? nb_processes : avg_par_proc + delta / (double) par_sched_round; + + if(par_sched_round>=2){ + s_par_proc = s_par_proc + (nb_processes - prev_avg_par_proc) * delta; + sd_par_proc = sqrt(s_par_proc / (par_sched_round-1)); + par_window = (int) (avg_par_proc + sd_par_proc); + }else{ + sd_par_proc = 0; + } + + par_proc_that_ran += nb_processes; + } else{ + smx_ctx_raw_runall_parallel(); + } } else { - XBT_DEBUG("Runall serial %lu", nb_processes); simix_global->context_factory->suspend = smx_ctx_raw_suspend_serial; - xbt_os_cputimer_start(round_time); -#ifdef TIME_BENCH_PER_SR - smx_ctx_raw_runall_serial(simix_global->process_to_run); -#else - smx_ctx_raw_runall_serial(); -#endif - xbt_os_cputimer_stop(round_time); - seq_time += xbt_os_timer_elapsed(round_time); - seq_proc_that_ran += nb_processes; - seq_sched_round++; + if(nb_processes > seq_window){ + seq_sched_round++; + xbt_os_walltimer_start(round_time); + smx_ctx_raw_runall_serial(); + xbt_os_walltimer_stop(round_time); + seq_time += xbt_os_timer_elapsed(round_time); + + prev_avg_seq_proc = avg_seq_proc; + delta = (nb_processes-avg_seq_proc); + avg_seq_proc = (seq_sched_round==1) ? nb_processes : avg_seq_proc + delta / (double) seq_sched_round; + + if(seq_sched_round>=2){ + s_seq_proc = s_seq_proc + (nb_processes - prev_avg_seq_proc)*delta; + sd_seq_proc = sqrt(s_seq_proc / (seq_sched_round-1)); + seq_window = (int) (avg_seq_proc - sd_seq_proc); + } else { + sd_seq_proc = 0; + } + + seq_proc_that_ran += nb_processes; + } else { + smx_ctx_raw_runall_serial(); + } } } @@ -668,13 +695,13 @@ static void smx_ctx_raw_runall(void) simix_global->context_factory->suspend = smx_ctx_raw_suspend_parallel; #ifdef TIME_BENCH_ENTIRE_SRS - xbt_os_cputimer_start(timer); + xbt_os_walltimer_start(timer); #endif smx_ctx_raw_runall_parallel(); #ifdef TIME_BENCH_ENTIRE_SRS - xbt_os_cputimer_stop(timer); + xbt_os_walltimer_stop(timer); elapsed = xbt_os_timer_elapsed(timer); #endif } else { @@ -686,13 +713,13 @@ static void smx_ctx_raw_runall(void) #else #ifdef TIME_BENCH_ENTIRE_SRS - xbt_os_cputimer_start(timer); + xbt_os_walltimer_start(timer); #endif smx_ctx_raw_runall_serial(); #ifdef TIME_BENCH_ENTIRE_SRS - xbt_os_cputimer_stop(timer); + xbt_os_walltimer_stop(timer); elapsed = xbt_os_timer_elapsed(timer); #endif #endif diff --git a/src/simix/smx_environment.c b/src/simix/smx_environment.c index 7317c366c8..4754e715bb 100644 --- a/src/simix/smx_environment.c +++ b/src/simix/smx_environment.c @@ -33,11 +33,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_environment, simix, */ void SIMIX_create_environment(const char *file) { - double start, end; - - start = xbt_os_time(); + double start = 0, end = 0; + if(XBT_LOG_ISENABLED(simix_environment, xbt_log_priority_debug)) + start = xbt_os_time(); parse_platform_file(file); - end = xbt_os_time(); + if(XBT_LOG_ISENABLED(simix_environment, xbt_log_priority_debug)) + end = xbt_os_time(); XBT_DEBUG("PARSE TIME: %g", (end - start)); } diff --git a/src/simix/smx_global.c b/src/simix/smx_global.c index 3bb6bff54a..ecd64f0502 100644 --- a/src/simix/smx_global.c +++ b/src/simix/smx_global.c @@ -16,6 +16,7 @@ #ifdef HAVE_MC #include "mc/mc_private.h" #endif +#include "mc/mc_record.h" #ifdef HAVE_SMPI #include "smpi/private.h" @@ -28,9 +29,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_kernel, simix, smx_global_t simix_global = NULL; static xbt_heap_t simix_timers = NULL; -static void* SIMIX_action_mallocator_new_f(void); -static void SIMIX_action_mallocator_free_f(void* action); -static void SIMIX_action_mallocator_reset_f(void* action); +static void* SIMIX_synchro_mallocator_new_f(void); +static void SIMIX_synchro_mallocator_free_f(void* synchro); +static void SIMIX_synchro_mallocator_reset_f(void* synchro); /* FIXME: Yeah, I'll do it in a portable maner one day [Mt] */ #include @@ -168,9 +169,9 @@ void SIMIX_global_init(int *argc, char **argv) simix_global->create_process_function = SIMIX_process_create; simix_global->kill_process_function = SIMIX_process_kill; simix_global->cleanup_process_function = SIMIX_process_cleanup; - simix_global->action_mallocator = xbt_mallocator_new(65536, - SIMIX_action_mallocator_new_f, SIMIX_action_mallocator_free_f, - SIMIX_action_mallocator_reset_f); + simix_global->synchro_mallocator = xbt_mallocator_new(65536, + SIMIX_synchro_mallocator_new_f, SIMIX_synchro_mallocator_free_f, + SIMIX_synchro_mallocator_reset_f); simix_global->autorestart = SIMIX_host_restart_processes; surf_init(argc, argv); /* Initialize SURF structures */ @@ -264,7 +265,7 @@ void SIMIX_clean(void) xbt_os_timer_free(simix_global->timer_par); #endif - xbt_mallocator_free(simix_global->action_mallocator); + xbt_mallocator_free(simix_global->synchro_mallocator); xbt_free(simix_global); simix_global = NULL; @@ -280,7 +281,7 @@ void SIMIX_clean(void) */ XBT_INLINE double SIMIX_get_clock(void) { - if(MC_is_active()){ + if(MC_is_active() || MC_record_replay_is_active()){ return MC_process_clock_get(SIMIX_process_self()); }else{ return surf_get_clock(); @@ -306,6 +307,12 @@ static int process_syscall_color(void *p) */ void SIMIX_run(void) { + if(MC_record_path) { + MC_record_replay_init(); + MC_record_replay_from_string(MC_record_path); + return; + } + double time = 0; smx_process_t process; surf_action_t action; @@ -334,7 +341,7 @@ void SIMIX_run(void) xbt_os_cputimer_resume(simix_global->timer_seq); #endif - /* Move all killing processes to the end of the list, because killing a process that have an ongoing simcall is a bad idea */ + /* Move all killer processes to the end of the list, because killing a process that have an ongoing simcall is a bad idea */ xbt_dynar_three_way_partition(simix_global->process_that_ran, process_syscall_color); /* answer sequentially and in a fixed arbitrary order all the simcalls that were issued during that sub-round */ @@ -367,16 +374,16 @@ void SIMIX_run(void) * - because the communication failed or were canceled after startup. In this case, it's called from the function * we are in, by the chunk: * set = model->states.failed_action_set; - * while ((action = xbt_swag_extract(set))) - * SIMIX_simcall_post((smx_action_t) action->data); + * while ((synchro = xbt_swag_extract(set))) + * SIMIX_simcall_post((smx_synchro_t) synchro->data); * This order is also fixed because it depends of the order in which the surf actions were * added to the system, and only maestro can add stuff this way, through simcalls. - * We thus use the inductive hypothesis once again to conclude that the order in which actions are + * We thus use the inductive hypothesis once again to conclude that the order in which synchros are * poped out of the swag does not depend on the user code's execution order. - * - because the communication terminated. In this case, actions are served in the order given by + * - because the communication terminated. In this case, synchros are served in the order given by * set = model->states.done_action_set; - * while ((action = xbt_swag_extract(set))) - * SIMIX_simcall_post((smx_action_t) action->data); + * while ((synchro = xbt_swag_extract(set))) + * SIMIX_simcall_post((smx_synchro_t) synchro->data); * and the argument is very similar to the previous one. * So, in any case, the orders of calls to SIMIX_comm_finish() do not depend on the order in which user processes are executed. * So, in any cases, the orders of processes within process_to_run do not depend on the order in which user processes were executed previously. @@ -394,7 +401,7 @@ void SIMIX_run(void) xbt_dynar_foreach(simix_global->process_that_ran, iter, process) { if (process->simcall.call != SIMCALL_NONE) { - SIMIX_simcall_pre(&process->simcall, 0); + SIMIX_simcall_handle(&process->simcall, 0); } } } @@ -420,13 +427,13 @@ void SIMIX_run(void) /* Wake up all processes waiting for a Surf action to finish */ xbt_dynar_foreach(model_list, iter, model) { while ((action = surf_model_extract_failed_action_set(model))) - SIMIX_simcall_post((smx_action_t) surf_action_get_data(action)); + SIMIX_simcall_exit((smx_synchro_t) surf_action_get_data(action)); while ((action = surf_model_extract_done_action_set(model))) if (surf_action_get_data(action) == NULL) XBT_DEBUG("probably vcpu's action %p, skip", action); else - SIMIX_simcall_post((smx_action_t) surf_action_get_data(action)); + SIMIX_simcall_exit((smx_synchro_t) surf_action_get_data(action)); } /* Autorestart all process */ @@ -444,8 +451,6 @@ void SIMIX_run(void) XBT_DEBUG("### time %f, empty %d", time, xbt_dynar_is_empty(simix_global->process_to_run)); - // !(time == -1.0 && xbt_dynar_is_empty()) - } while (time != -1.0 || !xbt_dynar_is_empty(simix_global->process_to_run)); @@ -538,50 +543,43 @@ void SIMIX_display_process_status(void) ("Legend of the following listing: \"Process (@): \""); xbt_swag_foreach(process, simix_global->process_list) { - if (process->waiting_action) { + if (process->waiting_synchro) { - const char* action_description = "unknown"; - switch (process->waiting_action->type) { + const char* synchro_description = "unknown"; + switch (process->waiting_synchro->type) { - case SIMIX_ACTION_EXECUTE: - action_description = "execution"; + case SIMIX_SYNC_EXECUTE: + synchro_description = "execution"; break; - case SIMIX_ACTION_PARALLEL_EXECUTE: - action_description = "parallel execution"; + case SIMIX_SYNC_PARALLEL_EXECUTE: + synchro_description = "parallel execution"; break; - case SIMIX_ACTION_COMMUNICATE: - action_description = "communication"; + case SIMIX_SYNC_COMMUNICATE: + synchro_description = "communication"; break; - case SIMIX_ACTION_SLEEP: - action_description = "sleeping"; + case SIMIX_SYNC_SLEEP: + synchro_description = "sleeping"; break; - case SIMIX_ACTION_JOIN: - action_description = "joining"; + case SIMIX_SYNC_JOIN: + synchro_description = "joining"; break; - case SIMIX_ACTION_SYNCHRO: - action_description = "synchronization"; + case SIMIX_SYNC_SYNCHRO: + synchro_description = "synchronization"; break; - case SIMIX_ACTION_IO: - action_description = "I/O"; - break; - /* **************************************/ - /* TUTORIAL: New API */ - case SIMIX_ACTION_NEW_API: - action_description = "NEW API"; - /* **************************************/ - + case SIMIX_SYNC_IO: + synchro_description = "I/O"; break; } - XBT_INFO("Process %lu (%s@%s): waiting for %s action %p (%s) in state %d to finish", + XBT_INFO("Process %lu (%s@%s): waiting for %s synchro %p (%s) in state %d to finish", process->pid, process->name, sg_host_name(process->smx_host), - action_description, process->waiting_action, - process->waiting_action->name, (int)process->waiting_action->state); + synchro_description, process->waiting_synchro, + process->waiting_synchro->name, (int)process->waiting_synchro->state); } else { XBT_INFO("Process %lu (%s@%s)", process->pid, process->name, sg_host_name(process->smx_host)); @@ -589,31 +587,30 @@ void SIMIX_display_process_status(void) } } -static void* SIMIX_action_mallocator_new_f(void) { - smx_action_t action = xbt_new(s_smx_action_t, 1); - action->simcalls = xbt_fifo_new(); - return action; +static void* SIMIX_synchro_mallocator_new_f(void) { + smx_synchro_t synchro = xbt_new(s_smx_synchro_t, 1); + synchro->simcalls = xbt_fifo_new(); + return synchro; } -static void SIMIX_action_mallocator_free_f(void* action) { - xbt_fifo_free(((smx_action_t) action)->simcalls); - xbt_free(action); +static void SIMIX_synchro_mallocator_free_f(void* synchro) { + xbt_fifo_free(((smx_synchro_t) synchro)->simcalls); + xbt_free(synchro); } -static void SIMIX_action_mallocator_reset_f(void* action) { +static void SIMIX_synchro_mallocator_reset_f(void* synchro) { // we also recycle the simcall list - xbt_fifo_t fifo = ((smx_action_t) action)->simcalls; + xbt_fifo_t fifo = ((smx_synchro_t) synchro)->simcalls; xbt_fifo_reset(fifo); - memset(action, 0, sizeof(s_smx_action_t)); - ((smx_action_t) action)->simcalls = fifo; + memset(synchro, 0, sizeof(s_smx_synchro_t)); + ((smx_synchro_t) synchro)->simcalls = fifo; } -xbt_dict_t SIMIX_pre_asr_get_properties(smx_simcall_t simcall, const char *name){ +xbt_dict_t simcall_HANDLER_asr_get_properties(smx_simcall_t simcall, const char *name){ return SIMIX_asr_get_properties(name); } xbt_dict_t SIMIX_asr_get_properties(const char *name) { return xbt_lib_get_or_null(as_router_lib, name, ROUTING_PROP_ASR_LEVEL); } - diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index 534e331e0f..d05a6be7b3 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -11,9 +11,9 @@ #include "mc/mc.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_host, simix, - "Logging specific to SIMIX (hosts)"); + "SIMIX hosts"); -static void SIMIX_execution_finish(smx_action_t action); +static void SIMIX_execution_finish(smx_synchro_t synchro); /** * \brief Internal function to create a SIMIX host. @@ -37,11 +37,6 @@ smx_host_t SIMIX_host_create(const char *name, return xbt_lib_get_elm_or_null(host_lib, name); } -void SIMIX_pre_host_on(smx_simcall_t simcall, smx_host_t h) -{ - SIMIX_host_on(h); -} - /** * \brief Start the host if it is off * @@ -93,9 +88,9 @@ void SIMIX_host_on(smx_host_t h) } } -void SIMIX_pre_host_off(smx_simcall_t simcall, smx_host_t h) +void simcall_HANDLER_host_off(smx_simcall_t simcall, smx_host_t h) { - SIMIX_host_off(h, simcall->issuer); + SIMIX_host_off(h, simcall->issuer); } /** @@ -116,18 +111,10 @@ void SIMIX_host_off(smx_host_t h, smx_process_t issuer) smx_process_t process = NULL; xbt_swag_foreach(process, host->process_list) { SIMIX_process_kill(process, issuer); - XBT_DEBUG("Killing %s on %s by %s", process->name, sg_host_name(process->smx_host), issuer->name); + XBT_DEBUG("Killing %s on %s by %s", process->name, sg_host_name(process->smx_host), issuer->name); } } } - /*xbt_dynar_t vms = surf_workstation_get_vms(h); - unsigned int cpt; - smx_host_t vm; - xbt_dynar_foreach(vms, cpt, vm) { - SIMIX_vm_shutdown(vm, issuer); - SIMIX_vm_destroy(vm); - } - xbt_dynar_free(&vms);*/ } /** @@ -164,27 +151,6 @@ void SIMIX_host_destroy(void *h) return; } -///** -// * \brief Returns a dict of all hosts. -// * -// * \return List of all hosts (as a #xbt_dict_t) -// */ -//xbt_dict_t SIMIX_host_get_dict(void) -//{ -// xbt_dict_t host_dict = xbt_dict_new_homogeneous(NULL); -// xbt_lib_cursor_t cursor = NULL; -// char *name = NULL; -// void **host = NULL; -// -// xbt_lib_foreach(host_lib, cursor, name, host){ -// if(host[SIMIX_HOST_LEVEL]) -// xbt_dict_set(host_dict,name,host[SIMIX_HOST_LEVEL], NULL); -// } -// return host_dict; -//} -smx_host_t SIMIX_pre_host_get_by_name(smx_simcall_t simcall, const char *name){ - return SIMIX_host_get_by_name(name); -} smx_host_t SIMIX_host_get_by_name(const char *name){ xbt_assert(((simix_global != NULL) && (host_lib != NULL)), @@ -199,9 +165,6 @@ smx_host_t SIMIX_host_self(void) return (process == NULL) ? NULL : SIMIX_process_get_host(process); } -const char* SIMIX_pre_host_self_get_name(smx_simcall_t simcall){ - return SIMIX_host_self_get_name(); -} /* needs to be public and without simcall because it is called by exceptions and logging events */ const char* SIMIX_host_self_get_name(void) @@ -213,45 +176,29 @@ const char* SIMIX_host_self_get_name(void) return SIMIX_host_get_name(host); } -const char* SIMIX_pre_host_get_name(smx_simcall_t simcall, smx_host_t host){ - return SIMIX_host_get_name(host); -} const char* SIMIX_host_get_name(smx_host_t host){ xbt_assert((host != NULL), "Invalid parameters"); return sg_host_name(host); } -xbt_dict_t SIMIX_pre_host_get_properties(smx_simcall_t simcall, smx_host_t host){ - return SIMIX_host_get_properties(host); -} xbt_dict_t SIMIX_host_get_properties(smx_host_t host){ xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); return surf_resource_get_properties(surf_workstation_resource_priv(host)); } -double SIMIX_pre_host_get_speed(smx_simcall_t simcall, smx_host_t host){ - return SIMIX_host_get_speed(host); -} double SIMIX_host_get_speed(smx_host_t host){ xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); return surf_workstation_get_speed(host, 1.0); } -int SIMIX_pre_host_get_core(smx_simcall_t simcall, smx_host_t host){ - return SIMIX_host_get_core(host); -} int SIMIX_host_get_core(smx_host_t host){ xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); return surf_workstation_get_core(host); } -xbt_swag_t SIMIX_pre_host_get_process_list(smx_simcall_t simcall, smx_host_t host){ - return SIMIX_host_get_process_list(host); -} - xbt_swag_t SIMIX_host_get_process_list(smx_host_t host){ xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); smx_host_priv_t host_priv = SIMIX_host_priv(host); @@ -260,35 +207,23 @@ xbt_swag_t SIMIX_host_get_process_list(smx_host_t host){ } -double SIMIX_pre_host_get_available_speed(smx_simcall_t simcall, smx_host_t host){ - return SIMIX_host_get_available_speed(host); -} double SIMIX_host_get_available_speed(smx_host_t host){ xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); return surf_workstation_get_available_speed(host); } -double SIMIX_pre_host_get_current_power_peak(smx_simcall_t simcall, smx_host_t host){ - return SIMIX_host_get_current_power_peak(host); -} double SIMIX_host_get_current_power_peak(smx_host_t host) { xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); return surf_workstation_get_current_power_peak(host); } -double SIMIX_pre_host_get_power_peak_at(smx_simcall_t simcall, smx_host_t host, int pstate_index){ - return SIMIX_host_get_power_peak_at(host, pstate_index); -} double SIMIX_host_get_power_peak_at(smx_host_t host, int pstate_index) { xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); return surf_workstation_get_power_peak_at(host, pstate_index); } -int SIMIX_pre_host_get_nb_pstates(smx_simcall_t simcall, smx_host_t host){ - return SIMIX_host_get_nb_pstates(host); -} int SIMIX_host_get_nb_pstates(smx_host_t host) { xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); @@ -296,26 +231,17 @@ int SIMIX_host_get_nb_pstates(smx_host_t host) { } -void SIMIX_pre_host_set_power_peak_at(smx_simcall_t simcall, smx_host_t host, int pstate_index){ - SIMIX_host_set_power_peak_at(host, pstate_index); -} void SIMIX_host_set_power_peak_at(smx_host_t host, int pstate_index) { xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); surf_workstation_set_power_peak_at(host, pstate_index); } -double SIMIX_pre_host_get_consumed_energy(smx_simcall_t simcall, smx_host_t host){ - return SIMIX_host_get_consumed_energy(host); -} double SIMIX_host_get_consumed_energy(smx_host_t host) { xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); return surf_workstation_get_consumed_energy(host); } -int SIMIX_pre_host_get_state(smx_simcall_t simcall, smx_host_t host){ - return SIMIX_host_get_state(host); -} int SIMIX_host_get_state(smx_host_t host){ xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); @@ -436,59 +362,48 @@ void SIMIX_host_autorestart(smx_host_t host) xbt_die("No function for simix_global->autorestart"); } -smx_action_t SIMIX_pre_host_execute(smx_simcall_t simcall,const char *name, - smx_host_t host, double computation_amount, double priority, double bound, unsigned long affinity_mask){ - return SIMIX_host_execute(name, host, computation_amount, priority, bound, affinity_mask); -} -smx_action_t SIMIX_host_execute(const char *name, +smx_synchro_t SIMIX_host_execute(const char *name, smx_host_t host, double computation_amount, double priority, double bound, unsigned long affinity_mask){ /* alloc structures and initialize */ - smx_action_t action = xbt_mallocator_get(simix_global->action_mallocator); - action->type = SIMIX_ACTION_EXECUTE; - action->name = xbt_strdup(name); - action->state = SIMIX_RUNNING; - action->execution.host = host; + smx_synchro_t synchro = xbt_mallocator_get(simix_global->synchro_mallocator); + synchro->type = SIMIX_SYNC_EXECUTE; + synchro->name = xbt_strdup(name); + synchro->state = SIMIX_RUNNING; + synchro->execution.host = host; #ifdef HAVE_TRACING - action->category = NULL; + synchro->category = NULL; #endif /* set surf's action */ - if (!MC_is_active()) { + if (!MC_is_active() && !MC_record_replay_is_active()) { - action->execution.surf_exec = surf_workstation_execute(host, computation_amount); - surf_action_set_data(action->execution.surf_exec, action); - surf_action_set_priority(action->execution.surf_exec, priority); + synchro->execution.surf_exec = surf_workstation_execute(host, computation_amount); + surf_action_set_data(synchro->execution.surf_exec, synchro); + surf_action_set_priority(synchro->execution.surf_exec, priority); /* Note (hypervisor): for multicore, the bound value being passed to the * surf layer should not be zero (i.e., unlimited). It should be the * capacity of a CPU core. */ if (bound == 0) - surf_cpu_action_set_bound(action->execution.surf_exec, SIMIX_host_get_speed(host)); + surf_cpu_action_set_bound(synchro->execution.surf_exec, SIMIX_host_get_speed(host)); else - surf_cpu_action_set_bound(action->execution.surf_exec, bound); + surf_cpu_action_set_bound(synchro->execution.surf_exec, bound); if (affinity_mask != 0) { /* just a double check to confirm that this host is the host where this task is running. */ - xbt_assert(action->execution.host == host); - surf_cpu_action_set_affinity(action->execution.surf_exec, host, affinity_mask); + xbt_assert(synchro->execution.host == host); + surf_cpu_action_set_affinity(synchro->execution.surf_exec, host, affinity_mask); } } - XBT_DEBUG("Create execute action %p: %s", action, action->name); + XBT_DEBUG("Create execute synchro %p: %s", synchro, synchro->name); - return action; + return synchro; } -smx_action_t SIMIX_pre_host_parallel_execute(smx_simcall_t simcall, const char *name, - int host_nb, smx_host_t *host_list, - double *computation_amount, double *communication_amount, - double amount, double rate){ - return SIMIX_host_parallel_execute(name, host_nb, host_list, computation_amount, - communication_amount, amount, rate); -} -smx_action_t SIMIX_host_parallel_execute(const char *name, +smx_synchro_t SIMIX_host_parallel_execute(const char *name, int host_nb, smx_host_t *host_list, double *computation_amount, double *communication_amount, double amount, double rate){ @@ -497,17 +412,17 @@ smx_action_t SIMIX_host_parallel_execute(const char *name, int i; /* alloc structures and initialize */ - smx_action_t action = xbt_mallocator_get(simix_global->action_mallocator); - action->type = SIMIX_ACTION_PARALLEL_EXECUTE; - action->name = xbt_strdup(name); - action->state = SIMIX_RUNNING; - action->execution.host = NULL; /* FIXME: do we need the list of hosts? */ + smx_synchro_t synchro = xbt_mallocator_get(simix_global->synchro_mallocator); + synchro->type = SIMIX_SYNC_PARALLEL_EXECUTE; + synchro->name = xbt_strdup(name); + synchro->state = SIMIX_RUNNING; + synchro->execution.host = NULL; /* FIXME: do we need the list of hosts? */ #ifdef HAVE_TRACING - action->category = NULL; + synchro->category = NULL; #endif - /* set surf's action */ + /* set surf's synchro */ workstation_list = xbt_new0(void *, host_nb); for (i = 0; i < host_nb; i++) workstation_list[i] = surf_workstation_resource_priv(host_list[i]); @@ -525,140 +440,116 @@ smx_action_t SIMIX_host_parallel_execute(const char *name, } } - /* set surf's action */ - if (!MC_is_active()) { - action->execution.surf_exec = + /* set surf's synchro */ + if (!MC_is_active() && !MC_record_replay_is_active()) { + synchro->execution.surf_exec = surf_workstation_model_execute_parallel_task((surf_workstation_model_t)surf_workstation_model, host_nb, workstation_list, computation_amount, communication_amount, rate); - surf_action_set_data(action->execution.surf_exec, action); + surf_action_set_data(synchro->execution.surf_exec, synchro); } - XBT_DEBUG("Create parallel execute action %p", action); + XBT_DEBUG("Create parallel execute synchro %p", synchro); - return action; + return synchro; } -void SIMIX_pre_host_execution_destroy(smx_simcall_t simcall, smx_action_t action){ - SIMIX_host_execution_destroy(action); -} -void SIMIX_host_execution_destroy(smx_action_t action){ - XBT_DEBUG("Destroy action %p", action); +void SIMIX_host_execution_destroy(smx_synchro_t synchro){ + XBT_DEBUG("Destroy synchro %p", synchro); - if (action->execution.surf_exec) { - surf_action_unref(action->execution.surf_exec); - action->execution.surf_exec = NULL; + if (synchro->execution.surf_exec) { + surf_action_unref(synchro->execution.surf_exec); + synchro->execution.surf_exec = NULL; } - xbt_free(action->name); - xbt_mallocator_release(simix_global->action_mallocator, action); + xbt_free(synchro->name); + xbt_mallocator_release(simix_global->synchro_mallocator, synchro); } -void SIMIX_pre_host_execution_cancel(smx_simcall_t simcall, smx_action_t action){ - SIMIX_host_execution_cancel(action); -} -void SIMIX_host_execution_cancel(smx_action_t action){ - XBT_DEBUG("Cancel action %p", action); +void SIMIX_host_execution_cancel(smx_synchro_t synchro){ + XBT_DEBUG("Cancel synchro %p", synchro); - if (action->execution.surf_exec) - surf_action_cancel(action->execution.surf_exec); + if (synchro->execution.surf_exec) + surf_action_cancel(synchro->execution.surf_exec); } -double SIMIX_pre_host_execution_get_remains(smx_simcall_t simcall, smx_action_t action){ - return SIMIX_host_execution_get_remains(action); -} -double SIMIX_host_execution_get_remains(smx_action_t action){ +double SIMIX_host_execution_get_remains(smx_synchro_t synchro){ double result = 0.0; - if (action->state == SIMIX_RUNNING) - result = surf_action_get_remains(action->execution.surf_exec); + if (synchro->state == SIMIX_RUNNING) + result = surf_action_get_remains(synchro->execution.surf_exec); return result; } -e_smx_state_t SIMIX_pre_host_execution_get_state(smx_simcall_t simcall, smx_action_t action){ - return SIMIX_host_execution_get_state(action); -} -e_smx_state_t SIMIX_host_execution_get_state(smx_action_t action){ - return action->state; +e_smx_state_t SIMIX_host_execution_get_state(smx_synchro_t synchro){ + return synchro->state; } -void SIMIX_pre_host_execution_set_priority(smx_simcall_t simcall, smx_action_t action, - double priority){ - SIMIX_host_execution_set_priority(action, priority); -} -void SIMIX_host_execution_set_priority(smx_action_t action, double priority){ +void SIMIX_host_execution_set_priority(smx_synchro_t synchro, double priority){ - if(action->execution.surf_exec) - surf_action_set_priority(action->execution.surf_exec, priority); + if(synchro->execution.surf_exec) + surf_action_set_priority(synchro->execution.surf_exec, priority); } -void SIMIX_pre_host_execution_set_bound(smx_simcall_t simcall, smx_action_t action, - double bound){ - SIMIX_host_execution_set_bound(action, bound); -} -void SIMIX_host_execution_set_bound(smx_action_t action, double bound){ +void SIMIX_host_execution_set_bound(smx_synchro_t synchro, double bound){ - if(action->execution.surf_exec) - surf_cpu_action_set_bound(action->execution.surf_exec, bound); + if(synchro->execution.surf_exec) + surf_cpu_action_set_bound(synchro->execution.surf_exec, bound); } -void SIMIX_pre_host_execution_set_affinity(smx_simcall_t simcall, - smx_action_t action, smx_host_t host, unsigned long mask){ - SIMIX_host_execution_set_affinity(action, host, mask); -} -void SIMIX_host_execution_set_affinity(smx_action_t action, smx_host_t host, unsigned long mask){ - xbt_assert(action->type == SIMIX_ACTION_EXECUTE); +void SIMIX_host_execution_set_affinity(smx_synchro_t synchro, smx_host_t host, unsigned long mask){ + xbt_assert(synchro->type == SIMIX_SYNC_EXECUTE); - if (action->execution.surf_exec) { + if (synchro->execution.surf_exec) { /* just a double check to confirm that this host is the host where this task is running. */ - xbt_assert(action->execution.host == host); - surf_cpu_action_set_affinity(action->execution.surf_exec, host, mask); + xbt_assert(synchro->execution.host == host); + surf_cpu_action_set_affinity(synchro->execution.surf_exec, host, mask); } } -void SIMIX_pre_host_execution_wait(smx_simcall_t simcall, smx_action_t action){ +void simcall_HANDLER_host_execution_wait(smx_simcall_t simcall, smx_synchro_t synchro){ - XBT_DEBUG("Wait for execution of action %p, state %d", action, (int)action->state); + XBT_DEBUG("Wait for execution of synchro %p, state %d", synchro, (int)synchro->state); - /* Associate this simcall to the action */ - xbt_fifo_push(action->simcalls, simcall); - simcall->issuer->waiting_action = action; + /* Associate this simcall to the synchro */ + xbt_fifo_push(synchro->simcalls, simcall); + simcall->issuer->waiting_synchro = synchro; - /* set surf's action */ - if (MC_is_active()) { - action->state = SIMIX_DONE; - SIMIX_execution_finish(action); + /* set surf's synchro */ + if (MC_is_active() || MC_record_replay_is_active()) { + synchro->state = SIMIX_DONE; + SIMIX_execution_finish(synchro); return; } - /* If the action is already finished then perform the error handling */ - if (action->state != SIMIX_RUNNING) - SIMIX_execution_finish(action); + /* If the synchro is already finished then perform the error handling */ + if (synchro->state != SIMIX_RUNNING) + SIMIX_execution_finish(synchro); } -void SIMIX_host_execution_suspend(smx_action_t action) +void SIMIX_host_execution_suspend(smx_synchro_t synchro) { - if(action->execution.surf_exec) - surf_action_suspend(action->execution.surf_exec); + if(synchro->execution.surf_exec) + surf_action_suspend(synchro->execution.surf_exec); } -void SIMIX_host_execution_resume(smx_action_t action) +void SIMIX_host_execution_resume(smx_synchro_t synchro) { - if(action->execution.surf_exec) - surf_action_resume(action->execution.surf_exec); + if(synchro->execution.surf_exec) + surf_action_resume(synchro->execution.surf_exec); } -void SIMIX_execution_finish(smx_action_t action) +void SIMIX_execution_finish(smx_synchro_t synchro) { xbt_fifo_item_t item; smx_simcall_t simcall; - xbt_fifo_foreach(action->simcalls, item, simcall, smx_simcall_t) { + xbt_fifo_foreach(synchro->simcalls, item, simcall, smx_simcall_t) { - switch (action->state) { + switch (synchro->state) { case SIMIX_DONE: - /* do nothing, action done */ - XBT_DEBUG("SIMIX_execution_finished: execution successful"); + /* do nothing, synchro done */ + XBT_DEBUG("SIMIX_execution_finished: execution successful"); break; case SIMIX_FAILED: @@ -673,64 +564,60 @@ void SIMIX_execution_finish(smx_action_t action) break; default: - xbt_die("Internal error in SIMIX_execution_finish: unexpected action state %d", - (int)action->state); + xbt_die("Internal error in SIMIX_execution_finish: unexpected synchro state %d", + (int)synchro->state); } /* check if the host is down */ if (surf_resource_get_state(surf_workstation_resource_priv(simcall->issuer->smx_host)) != SURF_RESOURCE_ON) { simcall->issuer->context->iwannadie = 1; } - simcall->issuer->waiting_action = NULL; - simcall_host_execution_wait__set__result(simcall, action->state); + simcall->issuer->waiting_synchro = NULL; + simcall_host_execution_wait__set__result(simcall, synchro->state); SIMIX_simcall_answer(simcall); } /* We no longer need it */ - SIMIX_host_execution_destroy(action); + SIMIX_host_execution_destroy(synchro); } -void SIMIX_post_host_execute(smx_action_t action) +void SIMIX_post_host_execute(smx_synchro_t synchro) { - if (action->type == SIMIX_ACTION_EXECUTE && /* FIMXE: handle resource failure + if (synchro->type == SIMIX_SYNC_EXECUTE && /* FIMXE: handle resource failure * for parallel tasks too */ - surf_resource_get_state(surf_workstation_resource_priv(action->execution.host)) == SURF_RESOURCE_OFF) { - /* If the host running the action failed, notice it so that the asking + surf_resource_get_state(surf_workstation_resource_priv(synchro->execution.host)) == SURF_RESOURCE_OFF) { + /* If the host running the synchro failed, notice it so that the asking * process can be killed if it runs on that host itself */ - action->state = SIMIX_FAILED; - } else if (surf_action_get_state(action->execution.surf_exec) == SURF_ACTION_FAILED) { - /* If the host running the action didn't fail, then the action was + synchro->state = SIMIX_FAILED; + } else if (surf_action_get_state(synchro->execution.surf_exec) == SURF_ACTION_FAILED) { + /* If the host running the synchro didn't fail, then the synchro was * canceled */ - action->state = SIMIX_CANCELED; + synchro->state = SIMIX_CANCELED; } else { - action->state = SIMIX_DONE; + synchro->state = SIMIX_DONE; } - if (action->execution.surf_exec) { - surf_action_unref(action->execution.surf_exec); - action->execution.surf_exec = NULL; + if (synchro->execution.surf_exec) { + surf_action_unref(synchro->execution.surf_exec); + synchro->execution.surf_exec = NULL; } - /* If there are simcalls associated with the action, then answer them */ - if (xbt_fifo_size(action->simcalls)) { - SIMIX_execution_finish(action); + /* If there are simcalls associated with the synchro, then answer them */ + if (xbt_fifo_size(synchro->simcalls)) { + SIMIX_execution_finish(synchro); } } #ifdef HAVE_TRACING -void SIMIX_pre_set_category(smx_simcall_t simcall, smx_action_t action, - const char *category){ - SIMIX_set_category(action, category); -} -void SIMIX_set_category(smx_action_t action, const char *category) +void SIMIX_set_category(smx_synchro_t synchro, const char *category) { - if (action->state != SIMIX_RUNNING) return; - if (action->type == SIMIX_ACTION_EXECUTE){ - surf_action_set_category(action->execution.surf_exec, category); - }else if (action->type == SIMIX_ACTION_COMMUNICATE){ - surf_action_set_category(action->comm.surf_comm, category); + if (synchro->state != SIMIX_RUNNING) return; + if (synchro->type == SIMIX_SYNC_EXECUTE){ + surf_action_set_category(synchro->execution.surf_exec, category); + }else if (synchro->type == SIMIX_SYNC_COMMUNICATE){ + surf_action_set_category(synchro->comm.surf_comm, category); } } #endif @@ -747,36 +634,18 @@ void SIMIX_host_get_params(smx_host_t ind_vm, ws_params_t params) surf_workstation_get_params(ind_vm, params); } -void SIMIX_pre_host_get_params(smx_simcall_t simcall, smx_host_t ind_vm, ws_params_t params) -{ - SIMIX_host_get_params(ind_vm, params); -} - void SIMIX_host_set_params(smx_host_t ind_vm, ws_params_t params) { /* jump to ws_set_params(). */ surf_workstation_set_params(ind_vm, params); } -void SIMIX_pre_host_set_params(smx_simcall_t simcall, smx_host_t ind_vm, ws_params_t params) -{ - SIMIX_host_set_params(ind_vm, params); -} - -xbt_dict_t SIMIX_pre_host_get_mounted_storage_list(smx_simcall_t simcall, smx_host_t host){ - return SIMIX_host_get_mounted_storage_list(host); -} - xbt_dict_t SIMIX_host_get_mounted_storage_list(smx_host_t host){ xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); return surf_workstation_get_mounted_storage_list(host); } -xbt_dynar_t SIMIX_pre_host_get_attached_storage_list(smx_simcall_t simcall, smx_host_t host){ - return SIMIX_host_get_attached_storage_list(host); -} - xbt_dynar_t SIMIX_host_get_attached_storage_list(smx_host_t host){ xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); diff --git a/src/simix/smx_host_private.h b/src/simix/smx_host_private.h index 2e17bcf1cc..33316bd61d 100644 --- a/src/simix/smx_host_private.h +++ b/src/simix/smx_host_private.h @@ -8,7 +8,7 @@ #define _SIMIX_HOST_PRIVATE_H #include "simgrid/simix.h" -#include "smx_smurf_private.h" +#include "popping_private.h" SG_BEGIN_DECL() @@ -52,108 +52,60 @@ double SIMIX_host_get_power_peak_at(smx_host_t host, int pstate_index); int SIMIX_host_get_nb_pstates(smx_host_t host); double SIMIX_host_get_consumed_energy(smx_host_t host); void SIMIX_host_set_power_peak_at(smx_host_t host, int pstate_index); -smx_action_t SIMIX_host_execute(const char *name, +smx_synchro_t SIMIX_host_execute(const char *name, smx_host_t host, double computation_amount, double priority, double bound, unsigned long affinity_mask); -smx_action_t SIMIX_host_parallel_execute(const char *name, +smx_synchro_t SIMIX_host_parallel_execute(const char *name, int host_nb, smx_host_t *host_list, double *computation_amount, double *communication_amount, double amount, double rate); -void SIMIX_host_execution_destroy(smx_action_t action); -void SIMIX_host_execution_cancel(smx_action_t action); -double SIMIX_host_execution_get_remains(smx_action_t action); -e_smx_state_t SIMIX_host_execution_get_state(smx_action_t action); -void SIMIX_host_execution_set_priority(smx_action_t action, double priority); -void SIMIX_host_execution_set_bound(smx_action_t action, double bound); -void SIMIX_host_execution_set_affinity(smx_action_t action, smx_host_t host, unsigned long mask); -void SIMIX_pre_host_execution_wait(smx_simcall_t simcall, smx_action_t action); +void SIMIX_host_execution_destroy(smx_synchro_t synchro); +void SIMIX_host_execution_cancel(smx_synchro_t synchro); +double SIMIX_host_execution_get_remains(smx_synchro_t synchro); +e_smx_state_t SIMIX_host_execution_get_state(smx_synchro_t synchro); +void SIMIX_host_execution_set_priority(smx_synchro_t synchro, double priority); +void SIMIX_host_execution_set_bound(smx_synchro_t synchro, double bound); +void SIMIX_host_execution_set_affinity(smx_synchro_t synchro, smx_host_t host, unsigned long mask); xbt_dict_t SIMIX_host_get_mounted_storage_list(smx_host_t host); xbt_dynar_t SIMIX_host_get_attached_storage_list(smx_host_t host); -// pre prototypes -smx_host_t SIMIX_pre_host_get_by_name(smx_simcall_t, const char*); -const char* SIMIX_pre_host_self_get_name(smx_simcall_t); -const char* SIMIX_pre_host_get_name(smx_simcall_t, smx_host_t); -void SIMIX_pre_host_on(smx_simcall_t, smx_host_t host); -void SIMIX_pre_host_off(smx_simcall_t, smx_host_t host); -xbt_dict_t SIMIX_pre_host_get_properties(smx_simcall_t, smx_host_t); -int SIMIX_pre_host_get_core(smx_simcall_t, smx_host_t); -xbt_swag_t SIMIX_pre_host_get_process_list(smx_simcall_t, smx_host_t host); -double SIMIX_pre_host_get_speed(smx_simcall_t, smx_host_t); -double SIMIX_pre_host_get_available_speed(smx_simcall_t, smx_host_t); -int SIMIX_pre_host_get_state(smx_simcall_t, smx_host_t); -double SIMIX_pre_host_get_current_power_peak(smx_simcall_t, smx_host_t); -double SIMIX_pre_host_get_power_peak_at(smx_simcall_t, smx_host_t host, int pstate_index); -int SIMIX_pre_host_get_nb_pstates(smx_simcall_t, smx_host_t host); -void SIMIX_pre_host_set_power_peak_at(smx_simcall_t, smx_host_t host, int pstate_index); -double SIMIX_pre_host_get_consumed_energy(smx_simcall_t, smx_host_t); -void* SIMIX_pre_host_self_get_data(smx_simcall_t); -smx_action_t SIMIX_pre_host_execute(smx_simcall_t, const char*, smx_host_t, double, double, double, unsigned long); -smx_action_t SIMIX_pre_host_parallel_execute(smx_simcall_t, const char*, int, smx_host_t*, - double*, double*, double, double); -void SIMIX_pre_host_execution_destroy(smx_simcall_t, smx_action_t); -void SIMIX_pre_host_execution_cancel(smx_simcall_t, smx_action_t); -double SIMIX_pre_host_execution_get_remains(smx_simcall_t, smx_action_t); -e_smx_state_t SIMIX_pre_host_execution_get_state(smx_simcall_t, smx_action_t); -void SIMIX_pre_host_execution_set_priority(smx_simcall_t, smx_action_t, double); -void SIMIX_pre_host_execution_set_bound(smx_simcall_t simcall, smx_action_t action, double bound); -void SIMIX_pre_host_execution_set_affinity(smx_simcall_t simcall, smx_action_t action, smx_host_t host, unsigned long mask); - -void SIMIX_host_execution_suspend(smx_action_t action); -void SIMIX_host_execution_resume(smx_action_t action); - -void SIMIX_post_host_execute(smx_action_t action); -xbt_dict_t SIMIX_pre_host_get_mounted_storage_list(smx_simcall_t, smx_host_t); -xbt_dynar_t SIMIX_pre_host_get_attached_storage_list(smx_simcall_t, smx_host_t); + +void SIMIX_host_execution_suspend(smx_synchro_t synchro); +void SIMIX_host_execution_resume(smx_synchro_t synchro); + +void SIMIX_post_host_execute(smx_synchro_t synchro); #ifdef HAVE_TRACING -void SIMIX_pre_set_category(smx_simcall_t simcall, smx_action_t action, - const char *category); -void SIMIX_set_category(smx_action_t action, const char *category); +void SIMIX_set_category(smx_synchro_t synchro, const char *category); #endif /* vm related stuff */ smx_host_t SIMIX_vm_create(const char *name, smx_host_t ind_phys_host); -smx_host_t SIMIX_pre_vm_create(smx_simcall_t simcall, const char *name, smx_host_t ind_phys_host); void SIMIX_vm_destroy(smx_host_t ind_vm); -void SIMIX_pre_vm_destroy(smx_simcall_t simcall, smx_host_t ind_vm); // -- void SIMIX_vm_resume(smx_host_t ind_vm, smx_process_t issuer); -void SIMIX_pre_vm_resume(smx_simcall_t simcall, smx_host_t ind_vm); void SIMIX_vm_suspend(smx_host_t ind_vm, smx_process_t issuer); -void SIMIX_pre_vm_suspend(smx_simcall_t simcall, smx_host_t ind_vm); // -- void SIMIX_vm_save(smx_host_t ind_vm, smx_process_t issuer); -void SIMIX_pre_vm_save(smx_simcall_t simcall, smx_host_t ind_vm); void SIMIX_vm_restore(smx_host_t ind_vm, smx_process_t issuer); -void SIMIX_pre_vm_restore(smx_simcall_t simcall, smx_host_t ind_vm); // -- void SIMIX_vm_start(smx_host_t ind_vm); -void SIMIX_pre_vm_start(smx_simcall_t simcall, smx_host_t ind_vm); void SIMIX_vm_shutdown(smx_host_t ind_vm, smx_process_t issuer); -void SIMIX_pre_vm_shutdown(smx_simcall_t simcall, smx_host_t ind_vm); // -- int SIMIX_vm_get_state(smx_host_t ind_vm); -int SIMIX_pre_vm_get_state(smx_simcall_t simcall, smx_host_t ind_vm); // -- void SIMIX_vm_migrate(smx_host_t ind_vm, smx_host_t ind_dst_pm); -void SIMIX_pre_vm_migrate(smx_simcall_t simcall, smx_host_t ind_vm, smx_host_t ind_dst_pm); void *SIMIX_vm_get_pm(smx_host_t ind_vm); -void *SIMIX_pre_vm_get_pm(smx_simcall_t simcall, smx_host_t ind_vm); void SIMIX_vm_set_bound(smx_host_t ind_vm, double bound); -void SIMIX_pre_vm_set_bound(smx_simcall_t simcall, smx_host_t ind_vm, double bound); void SIMIX_vm_set_affinity(smx_host_t ind_vm, smx_host_t ind_pm, unsigned long mask); -void SIMIX_pre_vm_set_affinity(smx_simcall_t simcall, smx_host_t ind_vm, smx_host_t ind_pm, unsigned long mask); void SIMIX_host_get_params(smx_host_t ind_vm, ws_params_t params); -void SIMIX_pre_host_get_params(smx_simcall_t simcall, smx_host_t ind_vm, ws_params_t params); void SIMIX_host_set_params(smx_host_t ind_vm, ws_params_t params); -void SIMIX_pre_host_set_params(smx_simcall_t simcall, smx_host_t ind_vm, ws_params_t params); SG_END_DECL() diff --git a/src/simix/smx_io.c b/src/simix/smx_io.c index 97b1fc4255..be6a6539a8 100644 --- a/src/simix/smx_io.c +++ b/src/simix/smx_io.c @@ -50,16 +50,16 @@ void SIMIX_storage_destroy(void *s) } //SIMIX FILE READ -void SIMIX_pre_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, smx_host_t host) +void simcall_HANDLER_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, smx_host_t host) { - smx_action_t action = SIMIX_file_read(simcall->issuer, fd, size, host); - xbt_fifo_push(action->simcalls, simcall); - simcall->issuer->waiting_action = action; + smx_synchro_t synchro = SIMIX_file_read(fd, size, host); + xbt_fifo_push(synchro->simcalls, simcall); + simcall->issuer->waiting_synchro = synchro; } -smx_action_t SIMIX_file_read(smx_process_t process, smx_file_t fd, sg_size_t size, smx_host_t host) +smx_synchro_t SIMIX_file_read(smx_file_t fd, sg_size_t size, smx_host_t host) { - smx_action_t action; + smx_synchro_t synchro; /* check if the host is active */ if (surf_resource_get_state(surf_workstation_resource_priv(host)) != SURF_RESOURCE_ON) { @@ -67,33 +67,33 @@ smx_action_t SIMIX_file_read(smx_process_t process, smx_file_t fd, sg_size_t siz sg_host_name(host)); } - action = xbt_mallocator_get(simix_global->action_mallocator); - action->type = SIMIX_ACTION_IO; - action->name = NULL; + synchro = xbt_mallocator_get(simix_global->synchro_mallocator); + synchro->type = SIMIX_SYNC_IO; + synchro->name = NULL; #ifdef HAVE_TRACING - action->category = NULL; + synchro->category = NULL; #endif - action->io.host = host; - action->io.surf_io = surf_workstation_read(host, fd->surf_file, size); + synchro->io.host = host; + synchro->io.surf_io = surf_workstation_read(host, fd->surf_file, size); - surf_action_set_data(action->io.surf_io, action); - XBT_DEBUG("Create io action %p", action); + surf_action_set_data(synchro->io.surf_io, synchro); + XBT_DEBUG("Create io synchro %p", synchro); - return action; + return synchro; } //SIMIX FILE WRITE -void SIMIX_pre_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, smx_host_t host) +void simcall_HANDLER_file_write(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, smx_host_t host) { - smx_action_t action = SIMIX_file_write(simcall->issuer, fd, size, host); - xbt_fifo_push(action->simcalls, simcall); - simcall->issuer->waiting_action = action; + smx_synchro_t synchro = SIMIX_file_write(fd, size, host); + xbt_fifo_push(synchro->simcalls, simcall); + simcall->issuer->waiting_synchro = synchro; } -smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_size_t size, smx_host_t host) +smx_synchro_t SIMIX_file_write(smx_file_t fd, sg_size_t size, smx_host_t host) { - smx_action_t action; + smx_synchro_t synchro; /* check if the host is active */ if (surf_resource_get_state(surf_workstation_resource_priv(host)) != SURF_RESOURCE_ON) { @@ -101,33 +101,33 @@ smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_size_t si sg_host_name(host)); } - action = xbt_mallocator_get(simix_global->action_mallocator); - action->type = SIMIX_ACTION_IO; - action->name = NULL; + synchro = xbt_mallocator_get(simix_global->synchro_mallocator); + synchro->type = SIMIX_SYNC_IO; + synchro->name = NULL; #ifdef HAVE_TRACING - action->category = NULL; + synchro->category = NULL; #endif - action->io.host = host; - action->io.surf_io = surf_workstation_write(host, fd->surf_file, size); + synchro->io.host = host; + synchro->io.surf_io = surf_workstation_write(host, fd->surf_file, size); - surf_action_set_data(action->io.surf_io, action); - XBT_DEBUG("Create io action %p", action); + surf_action_set_data(synchro->io.surf_io, synchro); + XBT_DEBUG("Create io synchro %p", synchro); - return action; + return synchro; } //SIMIX FILE OPEN -void SIMIX_pre_file_open(smx_simcall_t simcall, const char* fullpath, smx_host_t host) +void simcall_HANDLER_file_open(smx_simcall_t simcall, const char* fullpath, smx_host_t host) { - smx_action_t action = SIMIX_file_open(simcall->issuer, fullpath, host); - xbt_fifo_push(action->simcalls, simcall); - simcall->issuer->waiting_action = action; + smx_synchro_t synchro = SIMIX_file_open(fullpath, host); + xbt_fifo_push(synchro->simcalls, simcall); + simcall->issuer->waiting_synchro = synchro; } -smx_action_t SIMIX_file_open(smx_process_t process, const char* fullpath, smx_host_t host) +smx_synchro_t SIMIX_file_open(const char* fullpath, smx_host_t host) { - smx_action_t action; + smx_synchro_t synchro; /* check if the host is active */ if (surf_resource_get_state(surf_workstation_resource_priv(host)) != SURF_RESOURCE_ON) { @@ -135,33 +135,33 @@ smx_action_t SIMIX_file_open(smx_process_t process, const char* fullpath, smx_ho sg_host_name(host)); } - action = xbt_mallocator_get(simix_global->action_mallocator); - action->type = SIMIX_ACTION_IO; - action->name = NULL; + synchro = xbt_mallocator_get(simix_global->synchro_mallocator); + synchro->type = SIMIX_SYNC_IO; + synchro->name = NULL; #ifdef HAVE_TRACING - action->category = NULL; + synchro->category = NULL; #endif - action->io.host = host; - action->io.surf_io = surf_workstation_open(host, fullpath); + synchro->io.host = host; + synchro->io.surf_io = surf_workstation_open(host, fullpath); - surf_action_set_data(action->io.surf_io, action); - XBT_DEBUG("Create io action %p", action); + surf_action_set_data(synchro->io.surf_io, synchro); + XBT_DEBUG("Create io synchro %p", synchro); - return action; + return synchro; } //SIMIX FILE CLOSE -void SIMIX_pre_file_close(smx_simcall_t simcall, smx_file_t fd, smx_host_t host) +void simcall_HANDLER_file_close(smx_simcall_t simcall, smx_file_t fd, smx_host_t host) { - smx_action_t action = SIMIX_file_close(simcall->issuer, fd, host); - xbt_fifo_push(action->simcalls, simcall); - simcall->issuer->waiting_action = action; + smx_synchro_t synchro = SIMIX_file_close(fd, host); + xbt_fifo_push(synchro->simcalls, simcall); + simcall->issuer->waiting_synchro = synchro; } -smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t fd, smx_host_t host) +smx_synchro_t SIMIX_file_close(smx_file_t fd, smx_host_t host) { - smx_action_t action; + smx_synchro_t synchro; /* check if the host is active */ if (surf_resource_get_state(surf_workstation_resource_priv(host)) != SURF_RESOURCE_ON) { @@ -169,30 +169,25 @@ smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t fd, smx_host_t h sg_host_name(host)); } - action = xbt_mallocator_get(simix_global->action_mallocator); - action->type = SIMIX_ACTION_IO; - action->name = NULL; + synchro = xbt_mallocator_get(simix_global->synchro_mallocator); + synchro->type = SIMIX_SYNC_IO; + synchro->name = NULL; #ifdef HAVE_TRACING - action->category = NULL; + synchro->category = NULL; #endif - action->io.host = host; - action->io.surf_io = surf_workstation_close(host, fd->surf_file); + synchro->io.host = host; + synchro->io.surf_io = surf_workstation_close(host, fd->surf_file); - surf_action_set_data(action->io.surf_io, action); - XBT_DEBUG("Create io action %p", action); + surf_action_set_data(synchro->io.surf_io, synchro); + XBT_DEBUG("Create io synchro %p", synchro); - return action; + return synchro; } //SIMIX FILE UNLINK -int SIMIX_pre_file_unlink(smx_simcall_t simcall, smx_file_t fd, smx_host_t host) -{ - return SIMIX_file_unlink(simcall->issuer, fd, host); -} - -int SIMIX_file_unlink(smx_process_t process, smx_file_t fd, smx_host_t host) +int SIMIX_file_unlink(smx_file_t fd, smx_host_t host) { /* check if the host is active */ if (surf_resource_get_state(surf_workstation_resource_priv(host)) != SURF_RESOURCE_ON) { @@ -205,7 +200,7 @@ int SIMIX_file_unlink(smx_process_t process, smx_file_t fd, smx_host_t host) return !!res; } -sg_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd) +sg_size_t simcall_HANDLER_file_get_size(smx_simcall_t simcall, smx_file_t fd) { return SIMIX_file_get_size(simcall->issuer, fd); } @@ -216,7 +211,7 @@ sg_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd) return surf_workstation_get_size(host, fd->surf_file); } -sg_size_t SIMIX_pre_file_tell(smx_simcall_t simcall, smx_file_t fd) +sg_size_t simcall_HANDLER_file_tell(smx_simcall_t simcall, smx_file_t fd) { return SIMIX_file_tell(simcall->issuer, fd); } @@ -228,7 +223,7 @@ sg_size_t SIMIX_file_tell(smx_process_t process, smx_file_t fd) } -xbt_dynar_t SIMIX_pre_file_get_info(smx_simcall_t simcall, smx_file_t fd) +xbt_dynar_t simcall_HANDLER_file_get_info(smx_simcall_t simcall, smx_file_t fd) { return SIMIX_file_get_info(simcall->issuer, fd); } @@ -239,7 +234,7 @@ xbt_dynar_t SIMIX_file_get_info(smx_process_t process, smx_file_t fd) return surf_workstation_get_info(host, fd->surf_file); } -int SIMIX_pre_file_seek(smx_simcall_t simcall, smx_file_t fd, sg_offset_t offset, int origin) +int simcall_HANDLER_file_seek(smx_simcall_t simcall, smx_file_t fd, sg_offset_t offset, int origin) { return SIMIX_file_seek(simcall->issuer, fd, offset, origin); } @@ -250,7 +245,7 @@ int SIMIX_file_seek(smx_process_t process, smx_file_t fd, sg_offset_t offset, in return surf_workstation_file_seek(host, fd->surf_file, offset, origin); } -int SIMIX_pre_file_move(smx_simcall_t simcall, smx_file_t file, const char* fullpath) +int simcall_HANDLER_file_move(smx_simcall_t simcall, smx_file_t file, const char* fullpath) { return SIMIX_file_move(simcall->issuer, file, fullpath); } @@ -266,7 +261,7 @@ sg_size_t SIMIX_storage_get_size(smx_storage_t storage){ return surf_storage_get_size(storage); } -sg_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, smx_storage_t storage) +sg_size_t simcall_HANDLER_storage_get_free_size(smx_simcall_t simcall, smx_storage_t storage) { return SIMIX_storage_get_free_size(simcall->issuer, storage); } @@ -276,7 +271,7 @@ sg_size_t SIMIX_storage_get_free_size(smx_process_t process, smx_storage_t stora return surf_storage_get_free_size(storage); } -sg_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall, smx_storage_t storage) +sg_size_t simcall_HANDLER_storage_get_used_size(smx_simcall_t simcall, smx_storage_t storage) { return SIMIX_storage_get_used_size(simcall->issuer, storage); } @@ -286,51 +281,36 @@ sg_size_t SIMIX_storage_get_used_size(smx_process_t process, smx_storage_t stora return surf_storage_get_used_size(storage); } -xbt_dict_t SIMIX_pre_storage_get_properties(smx_simcall_t simcall, smx_storage_t storage){ - return SIMIX_storage_get_properties(storage); -} xbt_dict_t SIMIX_storage_get_properties(smx_storage_t storage){ xbt_assert((storage != NULL), "Invalid parameters (simix storage is NULL)"); return surf_resource_get_properties(surf_storage_resource_priv(storage)); } -const char* SIMIX_pre_storage_get_name(smx_simcall_t simcall, smx_storage_t storage){ - return SIMIX_storage_get_name(storage); -} - const char* SIMIX_storage_get_name(smx_storage_t storage){ xbt_assert((storage != NULL), "Invalid parameters"); return sg_storage_name(storage); } -xbt_dict_t SIMIX_pre_storage_get_content(smx_simcall_t simcall, smx_storage_t storage){ - return SIMIX_storage_get_content(storage); -} - xbt_dict_t SIMIX_storage_get_content(smx_storage_t storage){ xbt_assert((storage != NULL), "Invalid parameters (simix storage is NULL)"); return surf_storage_get_content(storage); } -const char* SIMIX_pre_storage_get_host(smx_simcall_t simcall, smx_storage_t storage){ - return SIMIX_storage_get_host(storage); -} - const char* SIMIX_storage_get_host(smx_storage_t storage){ xbt_assert((storage != NULL), "Invalid parameters"); return surf_storage_get_host(storage); } -void SIMIX_post_io(smx_action_t action) +void SIMIX_post_io(smx_synchro_t synchro) { xbt_fifo_item_t i; smx_simcall_t simcall; - xbt_fifo_foreach(action->simcalls,i,simcall,smx_simcall_t) { + xbt_fifo_foreach(synchro->simcalls,i,simcall,smx_simcall_t) { switch (simcall->call) { case SIMCALL_FILE_OPEN: { smx_file_t tmp = xbt_new(s_smx_file_t,1); - tmp->surf_file = surf_storage_action_get_file(action->io.surf_io); + tmp->surf_file = surf_storage_action_get_file(synchro->io.surf_io); simcall_file_open__set__result(simcall, tmp); break; } @@ -339,11 +319,11 @@ void SIMIX_post_io(smx_action_t action) simcall_file_close__set__result(simcall, 0); break; case SIMCALL_FILE_WRITE: - simcall_file_write__set__result(simcall, surf_action_get_cost(action->io.surf_io)); + simcall_file_write__set__result(simcall, surf_action_get_cost(synchro->io.surf_io)); break; case SIMCALL_FILE_READ: - simcall_file_read__set__result(simcall, surf_action_get_cost(action->io.surf_io)); + simcall_file_read__set__result(simcall, surf_action_get_cost(synchro->io.surf_io)); break; default: @@ -351,14 +331,14 @@ void SIMIX_post_io(smx_action_t action) } } - switch (surf_action_get_state(action->io.surf_io)) { + switch (surf_action_get_state(synchro->io.surf_io)) { case SURF_ACTION_FAILED: - action->state = SIMIX_FAILED; + synchro->state = SIMIX_FAILED; break; case SURF_ACTION_DONE: - action->state = SIMIX_DONE; + synchro->state = SIMIX_DONE; break; default: @@ -366,28 +346,28 @@ void SIMIX_post_io(smx_action_t action) break; } - SIMIX_io_finish(action); + SIMIX_io_finish(synchro); } -void SIMIX_io_destroy(smx_action_t action) +void SIMIX_io_destroy(smx_synchro_t synchro) { - XBT_DEBUG("Destroy action %p", action); - if (action->io.surf_io) - surf_action_unref(action->io.surf_io); - xbt_mallocator_release(simix_global->action_mallocator, action); + XBT_DEBUG("Destroy synchro %p", synchro); + if (synchro->io.surf_io) + surf_action_unref(synchro->io.surf_io); + xbt_mallocator_release(simix_global->synchro_mallocator, synchro); } -void SIMIX_io_finish(smx_action_t action) +void SIMIX_io_finish(smx_synchro_t synchro) { xbt_fifo_item_t item; smx_simcall_t simcall; - xbt_fifo_foreach(action->simcalls, item, simcall, smx_simcall_t) { + xbt_fifo_foreach(synchro->simcalls, item, simcall, smx_simcall_t) { - switch (action->state) { + switch (synchro->state) { case SIMIX_DONE: - /* do nothing, action done */ + /* do nothing, synchro done */ break; case SIMIX_FAILED: @@ -399,18 +379,18 @@ void SIMIX_io_finish(smx_action_t action) break; default: - xbt_die("Internal error in SIMIX_io_finish: unexpected action state %d", - (int)action->state); + xbt_die("Internal error in SIMIX_io_finish: unexpected synchro state %d", + (int)synchro->state); } if (surf_resource_get_state(surf_workstation_resource_priv(simcall->issuer->smx_host)) != SURF_RESOURCE_ON) { simcall->issuer->context->iwannadie = 1; } - simcall->issuer->waiting_action = NULL; + simcall->issuer->waiting_synchro = NULL; SIMIX_simcall_answer(simcall); } /* We no longer need it */ - SIMIX_io_destroy(action); + SIMIX_io_destroy(synchro); } diff --git a/src/simix/smx_io_private.h b/src/simix/smx_io_private.h index 9750c403a3..1cc843d10c 100644 --- a/src/simix/smx_io_private.h +++ b/src/simix/smx_io_private.h @@ -8,7 +8,7 @@ #define _SIMIX_IO_PRIVATE_H #include "simgrid/simix.h" -#include "smx_smurf_private.h" +#include "popping_private.h" /** @brief Storage datatype */ typedef struct s_smx_storage_priv { @@ -22,45 +22,26 @@ static inline smx_storage_priv_t SIMIX_storage_priv(smx_storage_t storage){ smx_storage_t SIMIX_storage_create(const char *name, void *storage, void *data); void SIMIX_storage_destroy(void *s); -void SIMIX_pre_file_read(smx_simcall_t simcall, smx_file_t fd, sg_size_t size, smx_host_t host); -void SIMIX_pre_file_write(smx_simcall_t simcall,smx_file_t fd, sg_size_t size, smx_host_t host); -void SIMIX_pre_file_open(smx_simcall_t simcall, const char* fullpath, smx_host_t host); -void SIMIX_pre_file_close(smx_simcall_t simcall, smx_file_t fd, smx_host_t host); -int SIMIX_pre_file_unlink(smx_simcall_t simcall, smx_file_t fd, smx_host_t host); -sg_size_t SIMIX_pre_file_get_size(smx_simcall_t simcall, smx_file_t fd); -sg_size_t SIMIX_pre_file_tell(smx_simcall_t simcall, smx_file_t fd); -xbt_dynar_t SIMIX_pre_file_get_info(smx_simcall_t simcall, smx_file_t fd); -int SIMIX_pre_file_seek(smx_simcall_t simcall, smx_file_t fd, sg_offset_t offset, int origin); -int SIMIX_pre_file_move(smx_simcall_t simcall, smx_file_t fd, const char* fullpath); -smx_action_t SIMIX_file_read(smx_process_t process, smx_file_t fd, sg_size_t size, smx_host_t host); -smx_action_t SIMIX_file_write(smx_process_t process, smx_file_t fd, sg_size_t size, smx_host_t host); -smx_action_t SIMIX_file_open(smx_process_t process, const char* fullpath, smx_host_t host); -smx_action_t SIMIX_file_close(smx_process_t process, smx_file_t fd, smx_host_t host); -int SIMIX_file_unlink(smx_process_t process, smx_file_t fd, smx_host_t host); +smx_synchro_t SIMIX_file_read(smx_file_t fd, sg_size_t size, smx_host_t host); +smx_synchro_t SIMIX_file_write(smx_file_t fd, sg_size_t size, smx_host_t host); +smx_synchro_t SIMIX_file_open(const char* fullpath, smx_host_t host); +smx_synchro_t SIMIX_file_close(smx_file_t fd, smx_host_t host); +int SIMIX_file_unlink(smx_file_t fd, smx_host_t host); sg_size_t SIMIX_file_get_size(smx_process_t process, smx_file_t fd); sg_size_t SIMIX_file_tell(smx_process_t process, smx_file_t fd); xbt_dynar_t SIMIX_file_get_info(smx_process_t process, smx_file_t fd); int SIMIX_file_seek(smx_process_t process, smx_file_t fd, sg_offset_t offset, int origin); int SIMIX_file_move(smx_process_t process, smx_file_t fd, const char* fullpath); -sg_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall,smx_storage_t storage); -sg_size_t SIMIX_storage_get_free_size(smx_process_t process,smx_storage_t storage); - -sg_size_t SIMIX_pre_storage_get_used_size(smx_simcall_t simcall,smx_storage_t storage); -sg_size_t SIMIX_storage_get_used_size(smx_process_t process,smx_storage_t storage); +sg_size_t SIMIX_storage_get_free_size(smx_process_t process, smx_storage_t storage); +sg_size_t SIMIX_storage_get_used_size(smx_process_t process, smx_storage_t storage); xbt_dict_t SIMIX_storage_get_properties(smx_storage_t storage); -xbt_dict_t SIMIX_pre_storage_get_properties(smx_simcall_t, smx_storage_t); -xbt_dict_t SIMIX_pre_storage_get_content(smx_simcall_t simcall, smx_storage_t storage); xbt_dict_t SIMIX_storage_get_content(smx_storage_t storage); -const char* SIMIX_pre_storage_get_name(smx_simcall_t simcall, smx_storage_t storage); -const char* SIMIX_pre_storage_get_host(smx_simcall_t simcall, smx_storage_t storage); -void SIMIX_post_io(smx_action_t action); -void SIMIX_io_destroy(smx_action_t action); -void SIMIX_io_finish(smx_action_t action); - -// pre prototypes +void SIMIX_post_io(smx_synchro_t synchro); +void SIMIX_io_destroy(smx_synchro_t synchro); +void SIMIX_io_finish(smx_synchro_t synchro); #endif diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index de52181c77..9f47c97395 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -12,23 +12,23 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_network, simix, - "Logging specific to SIMIX (network)"); + "SIMIX network-related synchronization"); static xbt_dict_t rdv_points = NULL; XBT_EXPORT_NO_IMPORT(unsigned long int) smx_total_comms = 0; static void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall); -static void SIMIX_comm_copy_data(smx_action_t comm); -static smx_action_t SIMIX_comm_new(e_smx_comm_type_t type); -static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_action_t comm); -static smx_action_t SIMIX_fifo_probe_comm(xbt_fifo_t fifo, e_smx_comm_type_t type, - int (*match_fun)(void *, void *,smx_action_t), - void *user_data, smx_action_t my_action); -static smx_action_t SIMIX_fifo_get_comm(xbt_fifo_t fifo, e_smx_comm_type_t type, - int (*match_fun)(void *, void *,smx_action_t), - void *user_data, smx_action_t my_action); +static void SIMIX_comm_copy_data(smx_synchro_t comm); +static smx_synchro_t SIMIX_comm_new(e_smx_comm_type_t type); +static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_synchro_t comm); +static smx_synchro_t SIMIX_fifo_probe_comm(xbt_fifo_t fifo, e_smx_comm_type_t type, + int (*match_fun)(void *, void *,smx_synchro_t), + void *user_data, smx_synchro_t my_synchro); +static smx_synchro_t SIMIX_fifo_get_comm(xbt_fifo_t fifo, e_smx_comm_type_t type, + int (*match_fun)(void *, void *,smx_synchro_t), + void *user_data, smx_synchro_t my_synchro); static void SIMIX_rdv_free(void *data); -static void SIMIX_comm_start(smx_action_t action); +static void SIMIX_comm_start(smx_synchro_t synchro); void SIMIX_network_init(void) { @@ -44,9 +44,6 @@ void SIMIX_network_exit(void) /* Rendez-Vous Points */ /******************************************************************************/ -smx_rdv_t SIMIX_pre_rdv_create(smx_simcall_t simcall, const char *name){ - return SIMIX_rdv_create(name); -} smx_rdv_t SIMIX_rdv_create(const char *name) { /* two processes may have pushed the same rdv_create simcall at the same time */ @@ -67,9 +64,6 @@ smx_rdv_t SIMIX_rdv_create(const char *name) return rdv; } -void SIMIX_pre_rdv_destroy(smx_simcall_t simcall, smx_rdv_t rdv){ - return SIMIX_rdv_destroy(rdv); -} void SIMIX_rdv_destroy(smx_rdv_t rdv) { if (rdv->name) @@ -92,24 +86,18 @@ xbt_dict_t SIMIX_get_rdv_points() return rdv_points; } -smx_rdv_t SIMIX_pre_rdv_get_by_name(smx_simcall_t simcall, const char *name){ - return SIMIX_rdv_get_by_name(name); -} smx_rdv_t SIMIX_rdv_get_by_name(const char *name) { return xbt_dict_get_or_null(rdv_points, name); } -int SIMIX_pre_rdv_comm_count_by_host(smx_simcall_t simcall, smx_rdv_t rdv, smx_host_t host){ - return SIMIX_rdv_comm_count_by_host(rdv, host); -} int SIMIX_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host) { - smx_action_t comm = NULL; + smx_synchro_t comm = NULL; xbt_fifo_item_t item = NULL; int count = 0; - xbt_fifo_foreach(rdv->comm_fifo, item, comm, smx_action_t) { + xbt_fifo_foreach(rdv->comm_fifo, item, comm, smx_synchro_t) { if (comm->comm.src_proc->smx_host == host) count++; } @@ -117,17 +105,11 @@ int SIMIX_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host) return count; } -smx_action_t SIMIX_pre_rdv_get_head(smx_simcall_t simcall, smx_rdv_t rdv){ - return SIMIX_rdv_get_head(rdv); -} -smx_action_t SIMIX_rdv_get_head(smx_rdv_t rdv) +smx_synchro_t SIMIX_rdv_get_head(smx_rdv_t rdv) { return xbt_fifo_get_item_content(xbt_fifo_get_first_item(rdv->comm_fifo)); } -smx_process_t SIMIX_pre_rdv_get_receiver(smx_simcall_t simcall, smx_rdv_t rdv){ - return SIMIX_rdv_get_receiver(rdv); -} /** * \brief get the receiver (process associated to the mailbox) * \param rdv The rendez-vous point @@ -138,10 +120,6 @@ smx_process_t SIMIX_rdv_get_receiver(smx_rdv_t rdv) return rdv->permanent_receiver; } -void SIMIX_pre_rdv_set_receiver(smx_simcall_t simcall, smx_rdv_t rdv, - smx_process_t process){ - SIMIX_rdv_set_receiver(rdv, process); -} /** * \brief set the receiver of the rendez vous point to allow eager sends * \param rdv The rendez-vous point @@ -153,339 +131,339 @@ void SIMIX_rdv_set_receiver(smx_rdv_t rdv, smx_process_t process) } /** - * \brief Pushes a communication action into a rendez-vous point + * \brief Pushes a communication synchro into a rendez-vous point * \param rdv The rendez-vous point - * \param comm The communication action + * \param comm The communication synchro */ -static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_action_t comm) +static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_synchro_t comm) { xbt_fifo_push(rdv->comm_fifo, comm); comm->comm.rdv = rdv; } /** - * \brief Removes a communication action from a rendez-vous point + * \brief Removes a communication synchro from a rendez-vous point * \param rdv The rendez-vous point - * \param comm The communication action + * \param comm The communication synchro */ -XBT_INLINE void SIMIX_rdv_remove(smx_rdv_t rdv, smx_action_t comm) +XBT_INLINE void SIMIX_rdv_remove(smx_rdv_t rdv, smx_synchro_t comm) { xbt_fifo_remove(rdv->comm_fifo, comm); comm->comm.rdv = NULL; } /** - * \brief Checks if there is a communication action queued in a fifo matching our needs + * \brief Checks if there is a communication synchro queued in a fifo matching our needs * \param type The type of communication we are looking for (comm_send, comm_recv) - * \return The communication action if found, NULL otherwise + * \return The communication synchro if found, NULL otherwise */ -smx_action_t SIMIX_fifo_get_comm(xbt_fifo_t fifo, e_smx_comm_type_t type, - int (*match_fun)(void *, void *,smx_action_t), - void *this_user_data, smx_action_t my_action) +smx_synchro_t SIMIX_fifo_get_comm(xbt_fifo_t fifo, e_smx_comm_type_t type, + int (*match_fun)(void *, void *,smx_synchro_t), + void *this_user_data, smx_synchro_t my_synchro) { - smx_action_t action; + smx_synchro_t synchro; xbt_fifo_item_t item; void* other_user_data = NULL; - xbt_fifo_foreach(fifo, item, action, smx_action_t) { - if (action->comm.type == SIMIX_COMM_SEND) { - other_user_data = action->comm.src_data; - } else if (action->comm.type == SIMIX_COMM_RECEIVE) { - other_user_data = action->comm.dst_data; + xbt_fifo_foreach(fifo, item, synchro, smx_synchro_t) { + if (synchro->comm.type == SIMIX_COMM_SEND) { + other_user_data = synchro->comm.src_data; + } else if (synchro->comm.type == SIMIX_COMM_RECEIVE) { + other_user_data = synchro->comm.dst_data; } - if (action->comm.type == type && - (!match_fun || match_fun(this_user_data, other_user_data, action)) && - (!action->comm.match_fun || action->comm.match_fun(other_user_data, this_user_data, my_action))) { - XBT_DEBUG("Found a matching communication action %p", action); + if (synchro->comm.type == type && + (!match_fun || match_fun(this_user_data, other_user_data, synchro)) && + (!synchro->comm.match_fun || synchro->comm.match_fun(other_user_data, this_user_data, my_synchro))) { + XBT_DEBUG("Found a matching communication synchro %p", synchro); xbt_fifo_remove_item(fifo, item); xbt_fifo_free_item(item); - action->comm.refcount++; + synchro->comm.refcount++; #ifdef HAVE_MC - action->comm.rdv_cpy = action->comm.rdv; + synchro->comm.rdv_cpy = synchro->comm.rdv; #endif - action->comm.rdv = NULL; - return action; + synchro->comm.rdv = NULL; + return synchro; } - XBT_DEBUG("Sorry, communication action %p does not match our needs:" + XBT_DEBUG("Sorry, communication synchro %p does not match our needs:" " its type is %d but we are looking for a comm of type %d (or maybe the filtering didn't match)", - action, (int)action->comm.type, (int)type); + synchro, (int)synchro->comm.type, (int)type); } - XBT_DEBUG("No matching communication action found"); + XBT_DEBUG("No matching communication synchro found"); return NULL; } /** - * \brief Checks if there is a communication action queued in a fifo matching our needs, but leave it there + * \brief Checks if there is a communication synchro queued in a fifo matching our needs, but leave it there * \param type The type of communication we are looking for (comm_send, comm_recv) - * \return The communication action if found, NULL otherwise + * \return The communication synchro if found, NULL otherwise */ -smx_action_t SIMIX_fifo_probe_comm(xbt_fifo_t fifo, e_smx_comm_type_t type, - int (*match_fun)(void *, void *,smx_action_t), - void *this_user_data, smx_action_t my_action) +smx_synchro_t SIMIX_fifo_probe_comm(xbt_fifo_t fifo, e_smx_comm_type_t type, + int (*match_fun)(void *, void *,smx_synchro_t), + void *this_user_data, smx_synchro_t my_synchro) { - smx_action_t action; + smx_synchro_t synchro; xbt_fifo_item_t item; void* other_user_data = NULL; - xbt_fifo_foreach(fifo, item, action, smx_action_t) { - if (action->comm.type == SIMIX_COMM_SEND) { - other_user_data = action->comm.src_data; - } else if (action->comm.type == SIMIX_COMM_RECEIVE) { - other_user_data = action->comm.dst_data; + xbt_fifo_foreach(fifo, item, synchro, smx_synchro_t) { + if (synchro->comm.type == SIMIX_COMM_SEND) { + other_user_data = synchro->comm.src_data; + } else if (synchro->comm.type == SIMIX_COMM_RECEIVE) { + other_user_data = synchro->comm.dst_data; } - if (action->comm.type == type && - (!match_fun || match_fun(this_user_data, other_user_data, action)) && - (!action->comm.match_fun || action->comm.match_fun(other_user_data, this_user_data, my_action))) { - XBT_DEBUG("Found a matching communication action %p", action); - action->comm.refcount++; + if (synchro->comm.type == type && + (!match_fun || match_fun(this_user_data, other_user_data, synchro)) && + (!synchro->comm.match_fun || synchro->comm.match_fun(other_user_data, this_user_data, my_synchro))) { + XBT_DEBUG("Found a matching communication synchro %p", synchro); + synchro->comm.refcount++; - return action; + return synchro; } - XBT_DEBUG("Sorry, communication action %p does not match our needs:" + XBT_DEBUG("Sorry, communication synchro %p does not match our needs:" " its type is %d but we are looking for a comm of type %d (or maybe the filtering didn't match)", - action, (int)action->comm.type, (int)type); + synchro, (int)synchro->comm.type, (int)type); } - XBT_DEBUG("No matching communication action found"); + XBT_DEBUG("No matching communication synchro found"); return NULL; } /******************************************************************************/ -/* Communication Actions */ +/* Communication synchros */ /******************************************************************************/ /** - * \brief Creates a new communicate action + * \brief Creates a new communicate synchro * \param type The direction of communication (comm_send, comm_recv) - * \return The new communicate action + * \return The new communicate synchro */ -smx_action_t SIMIX_comm_new(e_smx_comm_type_t type) +smx_synchro_t SIMIX_comm_new(e_smx_comm_type_t type) { - smx_action_t act; + smx_synchro_t synchro; /* alloc structures */ - act = xbt_mallocator_get(simix_global->action_mallocator); + synchro = xbt_mallocator_get(simix_global->synchro_mallocator); - act->type = SIMIX_ACTION_COMMUNICATE; - act->state = SIMIX_WAITING; + synchro->type = SIMIX_SYNC_COMMUNICATE; + synchro->state = SIMIX_WAITING; /* set communication */ - act->comm.type = type; - act->comm.refcount = 1; - act->comm.src_data=NULL; - act->comm.dst_data=NULL; + synchro->comm.type = type; + synchro->comm.refcount = 1; + synchro->comm.src_data=NULL; + synchro->comm.dst_data=NULL; #ifdef HAVE_LATENCY_BOUND_TRACKING //initialize with unknown value - act->latency_limited = -1; + synchro->latency_limited = -1; #endif #ifdef HAVE_TRACING - act->category = NULL; + synchro->category = NULL; #endif - XBT_DEBUG("Create communicate action %p", act); + XBT_DEBUG("Create communicate synchro %p", synchro); ++smx_total_comms; - return act; + return synchro; } /** - * \brief Destroy a communicate action - * \param action The communicate action to be destroyed + * \brief Destroy a communicate synchro + * \param synchro The communicate synchro to be destroyed */ -void SIMIX_comm_destroy(smx_action_t action) +void SIMIX_comm_destroy(smx_synchro_t synchro) { - XBT_DEBUG("Destroy action %p (refcount: %d), state: %d", - action, action->comm.refcount, (int)action->state); + XBT_DEBUG("Destroy synchro %p (refcount: %d), state: %d", + synchro, synchro->comm.refcount, (int)synchro->state); - if (action->comm.refcount <= 0) { + if (synchro->comm.refcount <= 0) { xbt_backtrace_display_current(); xbt_die("The refcount of comm %p is already 0 before decreasing it. " - "That's a bug! If you didn't test and/or wait the same communication twice in your code, then the bug is SimGrid's...", action); + "That's a bug! If you didn't test and/or wait the same communication twice in your code, then the bug is SimGrid's...", synchro); } - action->comm.refcount--; - if (action->comm.refcount > 0) + synchro->comm.refcount--; + if (synchro->comm.refcount > 0) return; - XBT_DEBUG("Really free communication %p; refcount is now %d", action, - action->comm.refcount); + XBT_DEBUG("Really free communication %p; refcount is now %d", synchro, + synchro->comm.refcount); #ifdef HAVE_LATENCY_BOUND_TRACKING - action->latency_limited = SIMIX_comm_is_latency_bounded( action ) ; + synchro->latency_limited = SIMIX_comm_is_latency_bounded( synchro ) ; #endif - xbt_free(action->name); - SIMIX_comm_destroy_internal_actions(action); + xbt_free(synchro->name); + SIMIX_comm_destroy_internal_actions(synchro); - if (action->comm.detached && action->state != SIMIX_DONE) { + if (synchro->comm.detached && synchro->state != SIMIX_DONE) { /* the communication has failed and was detached: * we have to free the buffer */ - if (action->comm.clean_fun) { - action->comm.clean_fun(action->comm.src_buff); + if (synchro->comm.clean_fun) { + synchro->comm.clean_fun(synchro->comm.src_buff); } - action->comm.src_buff = NULL; + synchro->comm.src_buff = NULL; } - if(action->comm.rdv) - SIMIX_rdv_remove(action->comm.rdv, action); + if(synchro->comm.rdv) + SIMIX_rdv_remove(synchro->comm.rdv, synchro); - xbt_mallocator_release(simix_global->action_mallocator, action); + xbt_mallocator_release(simix_global->synchro_mallocator, synchro); } -void SIMIX_comm_destroy_internal_actions(smx_action_t action) +void SIMIX_comm_destroy_internal_actions(smx_synchro_t synchro) { - if (action->comm.surf_comm){ + if (synchro->comm.surf_comm){ #ifdef HAVE_LATENCY_BOUND_TRACKING - action->latency_limited = SIMIX_comm_is_latency_bounded(action); + synchro->latency_limited = SIMIX_comm_is_latency_bounded(synchro); #endif - surf_action_unref(action->comm.surf_comm); - action->comm.surf_comm = NULL; + surf_action_unref(synchro->comm.surf_comm); + synchro->comm.surf_comm = NULL; } - if (action->comm.src_timeout){ - surf_action_unref(action->comm.src_timeout); - action->comm.src_timeout = NULL; + if (synchro->comm.src_timeout){ + surf_action_unref(synchro->comm.src_timeout); + synchro->comm.src_timeout = NULL; } - if (action->comm.dst_timeout){ - surf_action_unref(action->comm.dst_timeout); - action->comm.dst_timeout = NULL; + if (synchro->comm.dst_timeout){ + surf_action_unref(synchro->comm.dst_timeout); + synchro->comm.dst_timeout = NULL; } } -void SIMIX_pre_comm_send(smx_simcall_t simcall, smx_process_t src, smx_rdv_t rdv, +void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void *src_buff, size_t src_buff_size, - int (*match_fun)(void *, void *,smx_action_t), - void (*copy_data_fun)(smx_action_t, void*, size_t), + int (*match_fun)(void *, void *,smx_synchro_t), + void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double timeout){ - smx_action_t comm = SIMIX_comm_isend(src, rdv, task_size, rate, + smx_synchro_t comm = SIMIX_comm_isend(src, rdv, task_size, rate, src_buff, src_buff_size, match_fun, NULL, copy_data_fun, data, 0); SIMCALL_SET_MC_VALUE(simcall, 0); - SIMIX_pre_comm_wait(simcall, comm, timeout); + simcall_HANDLER_comm_wait(simcall, comm, timeout); } -smx_action_t SIMIX_pre_comm_isend(smx_simcall_t simcall, smx_process_t src, smx_rdv_t rdv, +smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void *src_buff, size_t src_buff_size, - int (*match_fun)(void *, void *,smx_action_t), + int (*match_fun)(void *, void *,smx_synchro_t), void (*clean_fun)(void *), - void (*copy_data_fun)(smx_action_t, void*, size_t), + void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, int detached){ return SIMIX_comm_isend(src, rdv, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached); } -smx_action_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv, +smx_synchro_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv, double task_size, double rate, void *src_buff, size_t src_buff_size, - int (*match_fun)(void *, void *,smx_action_t), - void (*clean_fun)(void *), // used to free the action in case of problem after a detached send - void (*copy_data_fun)(smx_action_t, void*, size_t), // used to copy data if not default one + int (*match_fun)(void *, void *,smx_synchro_t), + void (*clean_fun)(void *), // used to free the synchro in case of problem after a detached send + void (*copy_data_fun)(smx_synchro_t, void*, size_t), // used to copy data if not default one void *data, int detached) { XBT_DEBUG("send from %p", rdv); - /* Prepare an action describing us, so that it gets passed to the user-provided filter of other side */ - smx_action_t this_action = SIMIX_comm_new(SIMIX_COMM_SEND); + /* Prepare a synchro describing us, so that it gets passed to the user-provided filter of other side */ + smx_synchro_t this_synchro = SIMIX_comm_new(SIMIX_COMM_SEND); - /* Look for communication action matching our needs. We also provide a description of + /* Look for communication synchro matching our needs. We also provide a description of * ourself so that the other side also gets a chance of choosing if it wants to match with us. * * If it is not found then push our communication into the rendez-vous point */ - smx_action_t other_action = SIMIX_fifo_get_comm(rdv->comm_fifo, SIMIX_COMM_RECEIVE, match_fun, data, this_action); + smx_synchro_t other_synchro = SIMIX_fifo_get_comm(rdv->comm_fifo, SIMIX_COMM_RECEIVE, match_fun, data, this_synchro); - if (!other_action) { - other_action = this_action; + if (!other_synchro) { + other_synchro = this_synchro; if (rdv->permanent_receiver!=NULL){ //this mailbox is for small messages, which have to be sent right now - other_action->state = SIMIX_READY; - other_action->comm.dst_proc=rdv->permanent_receiver; - other_action->comm.refcount++; - xbt_fifo_push(rdv->done_comm_fifo,other_action); - other_action->comm.rdv=rdv; - XBT_DEBUG("pushing a message into the permanent receive fifo %p, comm %p", rdv, &(other_action->comm)); + other_synchro->state = SIMIX_READY; + other_synchro->comm.dst_proc=rdv->permanent_receiver; + other_synchro->comm.refcount++; + xbt_fifo_push(rdv->done_comm_fifo,other_synchro); + other_synchro->comm.rdv=rdv; + XBT_DEBUG("pushing a message into the permanent receive fifo %p, comm %p", rdv, &(other_synchro->comm)); }else{ - SIMIX_rdv_push(rdv, this_action); + SIMIX_rdv_push(rdv, this_synchro); } } else { XBT_DEBUG("Receive already pushed"); - SIMIX_comm_destroy(this_action); + SIMIX_comm_destroy(this_synchro); --smx_total_comms; // this creation was a pure waste - other_action->state = SIMIX_READY; - other_action->comm.type = SIMIX_COMM_READY; + other_synchro->state = SIMIX_READY; + other_synchro->comm.type = SIMIX_COMM_READY; } - xbt_fifo_push(src_proc->comms, other_action); + xbt_fifo_push(src_proc->comms, other_synchro); - /* if the communication action is detached then decrease the refcount + /* if the communication synchro is detached then decrease the refcount * by one, so it will be eliminated by the receiver's destroy call */ if (detached) { - other_action->comm.detached = 1; - other_action->comm.refcount--; - other_action->comm.clean_fun = clean_fun; + other_synchro->comm.detached = 1; + other_synchro->comm.refcount--; + other_synchro->comm.clean_fun = clean_fun; } else { - other_action->comm.clean_fun = NULL; + other_synchro->comm.clean_fun = NULL; } - /* Setup the communication action */ - other_action->comm.src_proc = src_proc; - other_action->comm.task_size = task_size; - other_action->comm.rate = rate; - other_action->comm.src_buff = src_buff; - other_action->comm.src_buff_size = src_buff_size; - other_action->comm.src_data = data; + /* Setup the communication synchro */ + other_synchro->comm.src_proc = src_proc; + other_synchro->comm.task_size = task_size; + other_synchro->comm.rate = rate; + other_synchro->comm.src_buff = src_buff; + other_synchro->comm.src_buff_size = src_buff_size; + other_synchro->comm.src_data = data; - other_action->comm.match_fun = match_fun; - other_action->comm.copy_data_fun = copy_data_fun; + other_synchro->comm.match_fun = match_fun; + other_synchro->comm.copy_data_fun = copy_data_fun; - if (MC_is_active()) { - other_action->state = SIMIX_RUNNING; - return (detached ? NULL : other_action); + if (MC_is_active() || MC_record_replay_is_active()) { + other_synchro->state = SIMIX_RUNNING; + return (detached ? NULL : other_synchro); } - SIMIX_comm_start(other_action); - return (detached ? NULL : other_action); + SIMIX_comm_start(other_synchro); + return (detached ? NULL : other_synchro); } -void SIMIX_pre_comm_recv(smx_simcall_t simcall, smx_rdv_t rdv, +void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_size, - int (*match_fun)(void *, void *, smx_action_t), - void (*copy_data_fun)(smx_action_t, void*, size_t), + int (*match_fun)(void *, void *, smx_synchro_t), + void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double timeout, double rate) { - smx_action_t comm = SIMIX_comm_irecv(simcall->issuer, rdv, dst_buff, + smx_synchro_t comm = SIMIX_comm_irecv(simcall->issuer, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); SIMCALL_SET_MC_VALUE(simcall, 0); - SIMIX_pre_comm_wait(simcall, comm, timeout); + simcall_HANDLER_comm_wait(simcall, comm, timeout); } -smx_action_t SIMIX_pre_comm_irecv(smx_simcall_t simcall, smx_rdv_t rdv, +smx_synchro_t simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_size, - int (*match_fun)(void *, void *, smx_action_t), - void (*copy_data_fun)(smx_action_t, void*, size_t), + int (*match_fun)(void *, void *, smx_synchro_t), + void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double rate) { return SIMIX_comm_irecv(simcall->issuer, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); } -smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv, +smx_synchro_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_size, - int (*match_fun)(void *, void *, smx_action_t), - void (*copy_data_fun)(smx_action_t, void*, size_t), // used to copy data if not default one + int (*match_fun)(void *, void *, smx_synchro_t), + void (*copy_data_fun)(smx_synchro_t, void*, size_t), // used to copy data if not default one void *data, double rate) { XBT_DEBUG("recv from %p %p", rdv, rdv->comm_fifo); - smx_action_t this_action = SIMIX_comm_new(SIMIX_COMM_RECEIVE); + smx_synchro_t this_synchro = SIMIX_comm_new(SIMIX_COMM_RECEIVE); - smx_action_t other_action; + smx_synchro_t other_synchro; //communication already done, get it inside the fifo of completed comms //permanent receive v1 //int already_received=0; @@ -493,239 +471,239 @@ smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv, XBT_DEBUG("We have a comm that has probably already been received, trying to match it, to skip the communication"); //find a match in the already received fifo - other_action = SIMIX_fifo_get_comm(rdv->done_comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_action); + other_synchro = SIMIX_fifo_get_comm(rdv->done_comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_synchro); //if not found, assume the receiver came first, register it to the mailbox in the classical way - if (!other_action) { + if (!other_synchro) { XBT_DEBUG("We have messages in the permanent receive list, but not the one we are looking for, pushing request into fifo"); - other_action = this_action; - SIMIX_rdv_push(rdv, this_action); + other_synchro = this_synchro; + SIMIX_rdv_push(rdv, this_synchro); }else{ - if(other_action->comm.surf_comm && SIMIX_comm_get_remains(other_action)==0.0) + if(other_synchro->comm.surf_comm && SIMIX_comm_get_remains(other_synchro)==0.0) { - XBT_DEBUG("comm %p has been already sent, and is finished, destroy it",&(other_action->comm)); - other_action->state = SIMIX_DONE; - other_action->comm.type = SIMIX_COMM_DONE; - other_action->comm.rdv = NULL; + XBT_DEBUG("comm %p has been already sent, and is finished, destroy it",&(other_synchro->comm)); + other_synchro->state = SIMIX_DONE; + other_synchro->comm.type = SIMIX_COMM_DONE; + other_synchro->comm.rdv = NULL; }/*else{ XBT_DEBUG("Not yet finished, we have to wait %d", xbt_fifo_size(rdv->comm_fifo)); }*/ - other_action->comm.refcount--; - SIMIX_comm_destroy(this_action); + other_synchro->comm.refcount--; + SIMIX_comm_destroy(this_synchro); --smx_total_comms; // this creation was a pure waste } }else{ - /* Prepare an action describing us, so that it gets passed to the user-provided filter of other side */ + /* Prepare a synchro describing us, so that it gets passed to the user-provided filter of other side */ - /* Look for communication action matching our needs. We also provide a description of + /* Look for communication synchro matching our needs. We also provide a description of * ourself so that the other side also gets a chance of choosing if it wants to match with us. * * If it is not found then push our communication into the rendez-vous point */ - other_action = SIMIX_fifo_get_comm(rdv->comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_action); + other_synchro = SIMIX_fifo_get_comm(rdv->comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_synchro); - if (!other_action) { + if (!other_synchro) { XBT_DEBUG("Receive pushed first %d", xbt_fifo_size(rdv->comm_fifo)); - other_action = this_action; - SIMIX_rdv_push(rdv, this_action); + other_synchro = this_synchro; + SIMIX_rdv_push(rdv, this_synchro); } else { - SIMIX_comm_destroy(this_action); + SIMIX_comm_destroy(this_synchro); --smx_total_comms; // this creation was a pure waste - other_action->state = SIMIX_READY; - other_action->comm.type = SIMIX_COMM_READY; - //other_action->comm.refcount--; + other_synchro->state = SIMIX_READY; + other_synchro->comm.type = SIMIX_COMM_READY; + //other_synchro->comm.refcount--; } - xbt_fifo_push(dst_proc->comms, other_action); + xbt_fifo_push(dst_proc->comms, other_synchro); } - /* Setup communication action */ - other_action->comm.dst_proc = dst_proc; - other_action->comm.dst_buff = dst_buff; - other_action->comm.dst_buff_size = dst_buff_size; - other_action->comm.dst_data = data; + /* Setup communication synchro */ + other_synchro->comm.dst_proc = dst_proc; + other_synchro->comm.dst_buff = dst_buff; + other_synchro->comm.dst_buff_size = dst_buff_size; + other_synchro->comm.dst_data = data; if (rate != -1.0 && - (other_action->comm.rate == -1.0 || rate < other_action->comm.rate)) - other_action->comm.rate = rate; + (other_synchro->comm.rate == -1.0 || rate < other_synchro->comm.rate)) + other_synchro->comm.rate = rate; - other_action->comm.match_fun = match_fun; - other_action->comm.copy_data_fun = copy_data_fun; + other_synchro->comm.match_fun = match_fun; + other_synchro->comm.copy_data_fun = copy_data_fun; /*if(already_received)//do the actual copy, because the first one after the comm didn't have all the info - SIMIX_comm_copy_data(other_action);*/ + SIMIX_comm_copy_data(other_synchro);*/ - if (MC_is_active()) { - other_action->state = SIMIX_RUNNING; - return other_action; + if (MC_is_active() || MC_record_replay_is_active()) { + other_synchro->state = SIMIX_RUNNING; + return other_synchro; } - SIMIX_comm_start(other_action); + SIMIX_comm_start(other_synchro); // } - return other_action; + return other_synchro; } -smx_action_t SIMIX_pre_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv, +smx_synchro_t simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv, int type, int src, int tag, - int (*match_fun)(void *, void *, smx_action_t), + int (*match_fun)(void *, void *, smx_synchro_t), void *data){ return SIMIX_comm_iprobe(simcall->issuer, rdv, type, src, tag, match_fun, data); } -smx_action_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int type, int src, - int tag, int (*match_fun)(void *, void *, smx_action_t), void *data) +smx_synchro_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int type, int src, + int tag, int (*match_fun)(void *, void *, smx_synchro_t), void *data) { XBT_DEBUG("iprobe from %p %p", rdv, rdv->comm_fifo); - smx_action_t this_action; + smx_synchro_t this_synchro; int smx_type; if(type == 1){ - this_action=SIMIX_comm_new(SIMIX_COMM_SEND); + this_synchro=SIMIX_comm_new(SIMIX_COMM_SEND); smx_type = SIMIX_COMM_RECEIVE; } else{ - this_action=SIMIX_comm_new(SIMIX_COMM_RECEIVE); + this_synchro=SIMIX_comm_new(SIMIX_COMM_RECEIVE); smx_type = SIMIX_COMM_SEND; } - smx_action_t other_action=NULL; + smx_synchro_t other_synchro=NULL; if(rdv->permanent_receiver && xbt_fifo_size(rdv->done_comm_fifo)!=0){ //find a match in the already received fifo XBT_DEBUG("first try in the perm recv mailbox"); - other_action = SIMIX_fifo_probe_comm(rdv->done_comm_fifo, smx_type, match_fun, data, this_action); + other_synchro = SIMIX_fifo_probe_comm(rdv->done_comm_fifo, smx_type, match_fun, data, this_synchro); } // }else{ - if(!other_action){ + if(!other_synchro){ XBT_DEBUG("try in the normal mailbox"); - other_action = SIMIX_fifo_probe_comm(rdv->comm_fifo, smx_type, match_fun, data, this_action); + other_synchro = SIMIX_fifo_probe_comm(rdv->comm_fifo, smx_type, match_fun, data, this_synchro); } // } - if(other_action)other_action->comm.refcount--; + if(other_synchro)other_synchro->comm.refcount--; - SIMIX_comm_destroy(this_action); + SIMIX_comm_destroy(this_synchro); --smx_total_comms; - return other_action; + return other_synchro; } -void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout) +void simcall_HANDLER_comm_wait(smx_simcall_t simcall, smx_synchro_t synchro, double timeout) { /* the simcall may be a wait, a send or a recv */ surf_action_t sleep; - /* Associate this simcall to the wait action */ - XBT_DEBUG("SIMIX_pre_comm_wait, %p", action); + /* Associate this simcall to the wait synchro */ + XBT_DEBUG("simcall_HANDLER_comm_wait, %p", synchro); - xbt_fifo_push(action->simcalls, simcall); - simcall->issuer->waiting_action = action; + xbt_fifo_push(synchro->simcalls, simcall); + simcall->issuer->waiting_synchro = synchro; - if (MC_is_active()) { + if (MC_is_active() || MC_record_replay_is_active()) { int idx = SIMCALL_GET_MC_VALUE(simcall); if (idx == 0) { - action->state = SIMIX_DONE; + synchro->state = SIMIX_DONE; } else { /* If we reached this point, the wait simcall must have a timeout */ /* Otherwise it shouldn't be enabled and executed by the MC */ if (timeout == -1) THROW_IMPOSSIBLE; - if (action->comm.src_proc == simcall->issuer) - action->state = SIMIX_SRC_TIMEOUT; + if (synchro->comm.src_proc == simcall->issuer) + synchro->state = SIMIX_SRC_TIMEOUT; else - action->state = SIMIX_DST_TIMEOUT; + synchro->state = SIMIX_DST_TIMEOUT; } - SIMIX_comm_finish(action); + SIMIX_comm_finish(synchro); return; } - /* If the action has already finish perform the error handling, */ - /* otherwise set up a waiting timeout on the right side */ - if (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING) { - SIMIX_comm_finish(action); + /* If the synchro has already finish perform the error handling, */ + /* otherwise set up a waiting timeout on the right side */ + if (synchro->state != SIMIX_WAITING && synchro->state != SIMIX_RUNNING) { + SIMIX_comm_finish(synchro); } else { /* if (timeout >= 0) { we need a surf sleep action even when there is no timeout, otherwise surf won't tell us when the host fails */ sleep = surf_workstation_sleep(simcall->issuer->smx_host, timeout); - surf_action_set_data(sleep, action); + surf_action_set_data(sleep, synchro); - if (simcall->issuer == action->comm.src_proc) - action->comm.src_timeout = sleep; + if (simcall->issuer == synchro->comm.src_proc) + synchro->comm.src_timeout = sleep; else - action->comm.dst_timeout = sleep; + synchro->comm.dst_timeout = sleep; } } -void SIMIX_pre_comm_test(smx_simcall_t simcall, smx_action_t action) +void simcall_HANDLER_comm_test(smx_simcall_t simcall, smx_synchro_t synchro) { - if(MC_is_active()){ - simcall_comm_test__set__result(simcall, action->comm.src_proc && action->comm.dst_proc); + if(MC_is_active() || MC_record_replay_is_active()){ + simcall_comm_test__set__result(simcall, synchro->comm.src_proc && synchro->comm.dst_proc); if(simcall_comm_test__get__result(simcall)){ - action->state = SIMIX_DONE; - xbt_fifo_push(action->simcalls, simcall); - SIMIX_comm_finish(action); + synchro->state = SIMIX_DONE; + xbt_fifo_push(synchro->simcalls, simcall); + SIMIX_comm_finish(synchro); }else{ SIMIX_simcall_answer(simcall); } return; } - simcall_comm_test__set__result(simcall, (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING)); + simcall_comm_test__set__result(simcall, (synchro->state != SIMIX_WAITING && synchro->state != SIMIX_RUNNING)); if (simcall_comm_test__get__result(simcall)) { - xbt_fifo_push(action->simcalls, simcall); - SIMIX_comm_finish(action); + xbt_fifo_push(synchro->simcalls, simcall); + SIMIX_comm_finish(synchro); } else { SIMIX_simcall_answer(simcall); } } -void SIMIX_pre_comm_testany(smx_simcall_t simcall, xbt_dynar_t actions) +void simcall_HANDLER_comm_testany(smx_simcall_t simcall, xbt_dynar_t synchros) { unsigned int cursor; - smx_action_t action; + smx_synchro_t synchro; simcall_comm_testany__set__result(simcall, -1); - if (MC_is_active()){ + if (MC_is_active() || MC_record_replay_is_active()){ int idx = SIMCALL_GET_MC_VALUE(simcall); if(idx == -1){ SIMIX_simcall_answer(simcall); }else{ - action = xbt_dynar_get_as(actions, idx, smx_action_t); + synchro = xbt_dynar_get_as(synchros, idx, smx_synchro_t); simcall_comm_testany__set__result(simcall, idx); - xbt_fifo_push(action->simcalls, simcall); - action->state = SIMIX_DONE; - SIMIX_comm_finish(action); + xbt_fifo_push(synchro->simcalls, simcall); + synchro->state = SIMIX_DONE; + SIMIX_comm_finish(synchro); } return; } - xbt_dynar_foreach(simcall_comm_testany__get__comms(simcall), cursor,action) { - if (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING) { + xbt_dynar_foreach(simcall_comm_testany__get__comms(simcall), cursor,synchro) { + if (synchro->state != SIMIX_WAITING && synchro->state != SIMIX_RUNNING) { simcall_comm_testany__set__result(simcall, cursor); - xbt_fifo_push(action->simcalls, simcall); - SIMIX_comm_finish(action); + xbt_fifo_push(synchro->simcalls, simcall); + SIMIX_comm_finish(synchro); return; } } SIMIX_simcall_answer(simcall); } -void SIMIX_pre_comm_waitany(smx_simcall_t simcall, xbt_dynar_t actions) +void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, xbt_dynar_t synchros) { - smx_action_t action; + smx_synchro_t synchro; unsigned int cursor = 0; - if (MC_is_active()){ + if (MC_is_active() || MC_record_replay_is_active()){ int idx = SIMCALL_GET_MC_VALUE(simcall); - action = xbt_dynar_get_as(actions, idx, smx_action_t); - xbt_fifo_push(action->simcalls, simcall); + synchro = xbt_dynar_get_as(synchros, idx, smx_synchro_t); + xbt_fifo_push(synchro->simcalls, simcall); simcall_comm_waitany__set__result(simcall, idx); - action->state = SIMIX_DONE; - SIMIX_comm_finish(action); + synchro->state = SIMIX_DONE; + SIMIX_comm_finish(synchro); return; } - xbt_dynar_foreach(actions, cursor, action){ - /* associate this simcall to the the action */ - xbt_fifo_push(action->simcalls, simcall); + xbt_dynar_foreach(synchros, cursor, synchro){ + /* associate this simcall to the the synchro */ + xbt_fifo_push(synchro->simcalls, simcall); - /* see if the action is already finished */ - if (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING){ - SIMIX_comm_finish(action); + /* see if the synchro is already finished */ + if (synchro->state != SIMIX_WAITING && synchro->state != SIMIX_RUNNING){ + SIMIX_comm_finish(synchro); break; } } @@ -733,102 +711,102 @@ void SIMIX_pre_comm_waitany(smx_simcall_t simcall, xbt_dynar_t actions) void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall) { - smx_action_t action; + smx_synchro_t synchro; unsigned int cursor = 0; - xbt_dynar_t actions = simcall_comm_waitany__get__comms(simcall); + xbt_dynar_t synchros = simcall_comm_waitany__get__comms(simcall); - xbt_dynar_foreach(actions, cursor, action) { - xbt_fifo_remove(action->simcalls, simcall); + xbt_dynar_foreach(synchros, cursor, synchro) { + xbt_fifo_remove(synchro->simcalls, simcall); } } /** - * \brief Starts the simulation of a communication action. - * \param action the communication action + * \brief Starts the simulation of a communication synchro. + * \param synchro the communication synchro */ -static XBT_INLINE void SIMIX_comm_start(smx_action_t action) +static XBT_INLINE void SIMIX_comm_start(smx_synchro_t synchro) { /* If both the sender and the receiver are already there, start the communication */ - if (action->state == SIMIX_READY) { + if (synchro->state == SIMIX_READY) { - smx_host_t sender = action->comm.src_proc->smx_host; - smx_host_t receiver = action->comm.dst_proc->smx_host; + smx_host_t sender = synchro->comm.src_proc->smx_host; + smx_host_t receiver = synchro->comm.dst_proc->smx_host; - XBT_DEBUG("Starting communication %p from '%s' to '%s'", action, + XBT_DEBUG("Starting communication %p from '%s' to '%s'", synchro, SIMIX_host_get_name(sender), SIMIX_host_get_name(receiver)); - action->comm.surf_comm = surf_workstation_model_communicate(surf_workstation_model, + synchro->comm.surf_comm = surf_workstation_model_communicate(surf_workstation_model, sender, receiver, - action->comm.task_size, action->comm.rate); + synchro->comm.task_size, synchro->comm.rate); - surf_action_set_data(action->comm.surf_comm, action); + surf_action_set_data(synchro->comm.surf_comm, synchro); - action->state = SIMIX_RUNNING; + synchro->state = SIMIX_RUNNING; /* If a link is failed, detect it immediately */ - if (surf_action_get_state(action->comm.surf_comm) == SURF_ACTION_FAILED) { + if (surf_action_get_state(synchro->comm.surf_comm) == SURF_ACTION_FAILED) { XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", SIMIX_host_get_name(sender), SIMIX_host_get_name(receiver)); - action->state = SIMIX_LINK_FAILURE; - SIMIX_comm_destroy_internal_actions(action); + synchro->state = SIMIX_LINK_FAILURE; + SIMIX_comm_destroy_internal_actions(synchro); } - /* If any of the process is suspend, create the action but stop its execution, + /* If any of the process is suspend, create the synchro but stop its execution, it will be restarted when the sender process resume */ - if (SIMIX_process_is_suspended(action->comm.src_proc) || - SIMIX_process_is_suspended(action->comm.dst_proc)) { - /* FIXME: check what should happen with the action state */ + if (SIMIX_process_is_suspended(synchro->comm.src_proc) || + SIMIX_process_is_suspended(synchro->comm.dst_proc)) { + /* FIXME: check what should happen with the synchro state */ - if (SIMIX_process_is_suspended(action->comm.src_proc)) + if (SIMIX_process_is_suspended(synchro->comm.src_proc)) XBT_DEBUG("The communication is suspended on startup because src (%s:%s) were suspended since it initiated the communication", - SIMIX_host_get_name(action->comm.src_proc->smx_host), action->comm.src_proc->name); + SIMIX_host_get_name(synchro->comm.src_proc->smx_host), synchro->comm.src_proc->name); else XBT_DEBUG("The communication is suspended on startup because dst (%s:%s) were suspended since it initiated the communication", - SIMIX_host_get_name(action->comm.dst_proc->smx_host), action->comm.dst_proc->name); + SIMIX_host_get_name(synchro->comm.dst_proc->smx_host), synchro->comm.dst_proc->name); - surf_action_suspend(action->comm.surf_comm); + surf_action_suspend(synchro->comm.surf_comm); } } } /** - * \brief Answers the SIMIX simcalls associated to a communication action. - * \param action a finished communication action + * \brief Answers the SIMIX simcalls associated to a communication synchro. + * \param synchro a finished communication synchro */ -void SIMIX_comm_finish(smx_action_t action) +void SIMIX_comm_finish(smx_synchro_t synchro) { unsigned int destroy_count = 0; smx_simcall_t simcall; - while ((simcall = xbt_fifo_shift(action->simcalls))) { + while ((simcall = xbt_fifo_shift(synchro->simcalls))) { - /* If a waitany simcall is waiting for this action to finish, then remove - it from the other actions in the waitany list. Afterwards, get the - position of the actual action in the waitany dynar and + /* If a waitany simcall is waiting for this synchro to finish, then remove + it from the other synchros in the waitany list. Afterwards, get the + position of the actual synchro in the waitany dynar and return it as the result of the simcall */ if (simcall->call == SIMCALL_NONE) //FIXME: maybe a better way to handle this case continue; // if process handling comm is killed if (simcall->call == SIMCALL_COMM_WAITANY) { SIMIX_waitany_remove_simcall_from_actions(simcall); - if (!MC_is_active()) - simcall_comm_waitany__set__result(simcall, xbt_dynar_search(simcall_comm_waitany__get__comms(simcall), &action)); + if (!MC_is_active() && !MC_record_replay_is_active()) + simcall_comm_waitany__set__result(simcall, xbt_dynar_search(simcall_comm_waitany__get__comms(simcall), &synchro)); } - /* If the action is still in a rendez-vous point then remove from it */ - if (action->comm.rdv) - SIMIX_rdv_remove(action->comm.rdv, action); + /* If the synchro is still in a rendez-vous point then remove from it */ + if (synchro->comm.rdv) + SIMIX_rdv_remove(synchro->comm.rdv, synchro); - XBT_DEBUG("SIMIX_comm_finish: action state = %d", (int)action->state); + XBT_DEBUG("SIMIX_comm_finish: synchro state = %d", (int)synchro->state); /* Check out for errors */ - switch (action->state) { + switch (synchro->state) { case SIMIX_DONE: - XBT_DEBUG("Communication %p complete!", action); - SIMIX_comm_copy_data(action); + XBT_DEBUG("Communication %p complete!", synchro); + SIMIX_comm_copy_data(synchro); break; case SIMIX_SRC_TIMEOUT: @@ -842,7 +820,7 @@ void SIMIX_comm_finish(smx_action_t action) break; case SIMIX_SRC_HOST_FAILURE: - if (simcall->issuer == action->comm.src_proc) + if (simcall->issuer == synchro->comm.src_proc) simcall->issuer->context->iwannadie = 1; // SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); else @@ -850,7 +828,7 @@ void SIMIX_comm_finish(smx_action_t action) break; case SIMIX_DST_HOST_FAILURE: - if (simcall->issuer == action->comm.dst_proc) + if (simcall->issuer == synchro->comm.dst_proc) simcall->issuer->context->iwannadie = 1; // SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); else @@ -858,14 +836,14 @@ void SIMIX_comm_finish(smx_action_t action) break; case SIMIX_LINK_FAILURE: - XBT_DEBUG("Link failure in action %p between '%s' and '%s': posting an exception to the issuer: %s (%p) detached:%d", - action, - action->comm.src_proc ? sg_host_name(action->comm.src_proc->smx_host) : NULL, - action->comm.dst_proc ? sg_host_name(action->comm.dst_proc->smx_host) : NULL, - simcall->issuer->name, simcall->issuer, action->comm.detached); - if (action->comm.src_proc == simcall->issuer) { + XBT_DEBUG("Link failure in synchro %p between '%s' and '%s': posting an exception to the issuer: %s (%p) detached:%d", + synchro, + synchro->comm.src_proc ? sg_host_name(synchro->comm.src_proc->smx_host) : NULL, + synchro->comm.dst_proc ? sg_host_name(synchro->comm.dst_proc->smx_host) : NULL, + simcall->issuer->name, simcall->issuer, synchro->comm.detached); + if (synchro->comm.src_proc == simcall->issuer) { XBT_DEBUG("I'm source"); - } else if (action->comm.dst_proc == simcall->issuer) { + } else if (synchro->comm.dst_proc == simcall->issuer) { XBT_DEBUG("I'm dest"); } else { XBT_DEBUG("I'm neither source nor dest"); @@ -874,7 +852,7 @@ void SIMIX_comm_finish(smx_action_t action) break; case SIMIX_CANCELED: - if (simcall->issuer == action->comm.dst_proc) + if (simcall->issuer == synchro->comm.dst_proc) SMX_EXCEPTION(simcall->issuer, cancel_error, 0, "Communication canceled by the sender"); else @@ -883,16 +861,16 @@ void SIMIX_comm_finish(smx_action_t action) break; default: - xbt_die("Unexpected action state in SIMIX_comm_finish: %d", (int)action->state); + xbt_die("Unexpected synchro state in SIMIX_comm_finish: %d", (int)synchro->state); } /* if there is an exception during a waitany or a testany, indicate the position of the failed communication */ if (simcall->issuer->doexception) { if (simcall->call == SIMCALL_COMM_WAITANY) { - simcall->issuer->running_ctx->exception.value = xbt_dynar_search(simcall_comm_waitany__get__comms(simcall), &action); + simcall->issuer->running_ctx->exception.value = xbt_dynar_search(simcall_comm_waitany__get__comms(simcall), &synchro); } else if (simcall->call == SIMCALL_COMM_TESTANY) { - simcall->issuer->running_ctx->exception.value = xbt_dynar_search(simcall_comm_testany__get__comms(simcall), &action); + simcall->issuer->running_ctx->exception.value = xbt_dynar_search(simcall_comm_testany__get__comms(simcall), &synchro); } } @@ -900,16 +878,16 @@ void SIMIX_comm_finish(smx_action_t action) simcall->issuer->context->iwannadie = 1; } - simcall->issuer->waiting_action = NULL; - xbt_fifo_remove(simcall->issuer->comms, action); - if(action->comm.detached){ - if(simcall->issuer == action->comm.src_proc){ - if(action->comm.dst_proc) - xbt_fifo_remove(action->comm.dst_proc->comms, action); + simcall->issuer->waiting_synchro = NULL; + xbt_fifo_remove(simcall->issuer->comms, synchro); + if(synchro->comm.detached){ + if(simcall->issuer == synchro->comm.src_proc){ + if(synchro->comm.dst_proc) + xbt_fifo_remove(synchro->comm.dst_proc->comms, synchro); } - if(simcall->issuer == action->comm.dst_proc){ - if(action->comm.src_proc) - xbt_fifo_remove(action->comm.src_proc->comms, action); + if(simcall->issuer == synchro->comm.dst_proc){ + if(synchro->comm.src_proc) + xbt_fifo_remove(synchro->comm.src_proc->comms, synchro); } } SIMIX_simcall_answer(simcall); @@ -917,103 +895,98 @@ void SIMIX_comm_finish(smx_action_t action) } while (destroy_count-- > 0) - SIMIX_comm_destroy(action); + SIMIX_comm_destroy(synchro); } /** - * \brief This function is called when a Surf communication action is finished. - * \param action the corresponding Simix communication + * \brief This function is called when a Surf communication synchro is finished. + * \param synchro the corresponding Simix communication */ -void SIMIX_post_comm(smx_action_t action) +void SIMIX_post_comm(smx_synchro_t synchro) { - /* Update action state */ - if (action->comm.src_timeout && - surf_action_get_state(action->comm.src_timeout) == SURF_ACTION_DONE) - action->state = SIMIX_SRC_TIMEOUT; - else if (action->comm.dst_timeout && - surf_action_get_state(action->comm.dst_timeout) == SURF_ACTION_DONE) - action->state = SIMIX_DST_TIMEOUT; - else if (action->comm.src_timeout && - surf_action_get_state(action->comm.src_timeout) == SURF_ACTION_FAILED) - action->state = SIMIX_SRC_HOST_FAILURE; - else if (action->comm.dst_timeout && - surf_action_get_state(action->comm.dst_timeout) == SURF_ACTION_FAILED) - action->state = SIMIX_DST_HOST_FAILURE; - else if (action->comm.surf_comm && - surf_action_get_state(action->comm.surf_comm) == SURF_ACTION_FAILED) { + /* Update synchro state */ + if (synchro->comm.src_timeout && + surf_action_get_state(synchro->comm.src_timeout) == SURF_ACTION_DONE) + synchro->state = SIMIX_SRC_TIMEOUT; + else if (synchro->comm.dst_timeout && + surf_action_get_state(synchro->comm.dst_timeout) == SURF_ACTION_DONE) + synchro->state = SIMIX_DST_TIMEOUT; + else if (synchro->comm.src_timeout && + surf_action_get_state(synchro->comm.src_timeout) == SURF_ACTION_FAILED) + synchro->state = SIMIX_SRC_HOST_FAILURE; + else if (synchro->comm.dst_timeout && + surf_action_get_state(synchro->comm.dst_timeout) == SURF_ACTION_FAILED) + synchro->state = SIMIX_DST_HOST_FAILURE; + else if (synchro->comm.surf_comm && + surf_action_get_state(synchro->comm.surf_comm) == SURF_ACTION_FAILED) { XBT_DEBUG("Puta madre. Surf says that the link broke"); - action->state = SIMIX_LINK_FAILURE; + synchro->state = SIMIX_LINK_FAILURE; } else - action->state = SIMIX_DONE; + synchro->state = SIMIX_DONE; XBT_DEBUG("SIMIX_post_comm: comm %p, state %d, src_proc %p, dst_proc %p, detached: %d", - action, (int)action->state, action->comm.src_proc, action->comm.dst_proc, action->comm.detached); + synchro, (int)synchro->state, synchro->comm.src_proc, synchro->comm.dst_proc, synchro->comm.detached); /* destroy the surf actions associated with the Simix communication */ - SIMIX_comm_destroy_internal_actions(action); + SIMIX_comm_destroy_internal_actions(synchro); - /* if there are simcalls associated with the action, then answer them */ - if (xbt_fifo_size(action->simcalls)) { - SIMIX_comm_finish(action); + /* if there are simcalls associated with the synchro, then answer them */ + if (xbt_fifo_size(synchro->simcalls)) { + SIMIX_comm_finish(synchro); } } -void SIMIX_pre_comm_cancel(smx_simcall_t simcall, smx_action_t action){ - SIMIX_comm_cancel(action); -} -void SIMIX_comm_cancel(smx_action_t action) +void SIMIX_comm_cancel(smx_synchro_t synchro) { - /* if the action is a waiting state means that it is still in a rdv */ + /* if the synchro is a waiting state means that it is still in a rdv */ /* so remove from it and delete it */ - if (action->state == SIMIX_WAITING) { - SIMIX_rdv_remove(action->comm.rdv, action); - action->state = SIMIX_CANCELED; + if (synchro->state == SIMIX_WAITING) { + SIMIX_rdv_remove(synchro->comm.rdv, synchro); + synchro->state = SIMIX_CANCELED; } else if (!MC_is_active() /* when running the MC there are no surf actions */ - && (action->state == SIMIX_READY || action->state == SIMIX_RUNNING)) { + && !MC_record_replay_is_active() + && (synchro->state == SIMIX_READY || synchro->state == SIMIX_RUNNING)) { - surf_action_cancel(action->comm.surf_comm); + surf_action_cancel(synchro->comm.surf_comm); } } -void SIMIX_comm_suspend(smx_action_t action) +void SIMIX_comm_suspend(smx_synchro_t synchro) { - /*FIXME: shall we suspend also the timeout actions? */ - if (action->comm.surf_comm) - surf_action_suspend(action->comm.surf_comm); + /*FIXME: shall we suspend also the timeout synchro? */ + if (synchro->comm.surf_comm) + surf_action_suspend(synchro->comm.surf_comm); /* in the other case, the action will be suspended on creation, in SIMIX_comm_start() */ } -void SIMIX_comm_resume(smx_action_t action) +void SIMIX_comm_resume(smx_synchro_t synchro) { /*FIXME: check what happen with the timeouts */ - if (action->comm.surf_comm) - surf_action_resume(action->comm.surf_comm); - /* in the other case, the action were not really suspended yet, see SIMIX_comm_suspend() and SIMIX_comm_start() */ + if (synchro->comm.surf_comm) + surf_action_resume(synchro->comm.surf_comm); + /* in the other case, the synchro were not really suspended yet, see SIMIX_comm_suspend() and SIMIX_comm_start() */ } -/************* Action Getters **************/ +/************* synchro Getters **************/ -double SIMIX_pre_comm_get_remains(smx_simcall_t simcall, smx_action_t action){ - return SIMIX_comm_get_remains(action); -} /** * \brief get the amount remaining from the communication - * \param action The communication + * \param synchro The communication */ -double SIMIX_comm_get_remains(smx_action_t action) +double SIMIX_comm_get_remains(smx_synchro_t synchro) { double remains; - if(!action){ + if(!synchro){ return 0; } - switch (action->state) { + switch (synchro->state) { case SIMIX_RUNNING: - remains = surf_action_get_remains(action->comm.surf_comm); + remains = surf_action_get_remains(synchro->comm.surf_comm); break; case SIMIX_WAITING: @@ -1028,100 +1001,80 @@ double SIMIX_comm_get_remains(smx_action_t action) return remains; } -e_smx_state_t SIMIX_pre_comm_get_state(smx_simcall_t simcall, smx_action_t action){ - return SIMIX_comm_get_state(action); -} -e_smx_state_t SIMIX_comm_get_state(smx_action_t action) +e_smx_state_t SIMIX_comm_get_state(smx_synchro_t synchro) { - return action->state; + return synchro->state; } -void* SIMIX_pre_comm_get_src_data(smx_simcall_t simcall, smx_action_t action){ - return SIMIX_comm_get_src_data(action); -} /** * \brief Return the user data associated to the sender of the communication - * \param action The communication + * \param synchro The communication * \return the user data */ -void* SIMIX_comm_get_src_data(smx_action_t action) +void* SIMIX_comm_get_src_data(smx_synchro_t synchro) { - return action->comm.src_data; + return synchro->comm.src_data; } -void* SIMIX_pre_comm_get_dst_data(smx_simcall_t simcall, smx_action_t action){ - return SIMIX_comm_get_dst_data(action); -} /** * \brief Return the user data associated to the receiver of the communication - * \param action The communication + * \param synchro The communication * \return the user data */ -void* SIMIX_comm_get_dst_data(smx_action_t action) +void* SIMIX_comm_get_dst_data(smx_synchro_t synchro) { - return action->comm.dst_data; + return synchro->comm.dst_data; } -smx_process_t SIMIX_pre_comm_get_src_proc(smx_simcall_t simcall, smx_action_t action){ - return SIMIX_comm_get_src_proc(action); -} -smx_process_t SIMIX_comm_get_src_proc(smx_action_t action) +smx_process_t SIMIX_comm_get_src_proc(smx_synchro_t synchro) { - return action->comm.src_proc; + return synchro->comm.src_proc; } -smx_process_t SIMIX_pre_comm_get_dst_proc(smx_simcall_t simcall, smx_action_t action){ - return SIMIX_comm_get_dst_proc(action); -} -smx_process_t SIMIX_comm_get_dst_proc(smx_action_t action) +smx_process_t SIMIX_comm_get_dst_proc(smx_synchro_t synchro) { - return action->comm.dst_proc; + return synchro->comm.dst_proc; } #ifdef HAVE_LATENCY_BOUND_TRACKING -int SIMIX_pre_comm_is_latency_bounded(smx_simcall_t simcall, smx_action_t action) -{ - return SIMIX_comm_is_latency_bounded(action); -} - /** * \brief verify if communication is latency bounded * \param comm The communication */ -int SIMIX_comm_is_latency_bounded(smx_action_t action) +int SIMIX_comm_is_latency_bounded(smx_synchro_t synchro) { - if(!action){ + if(!synchro){ return 0; } - if (action->comm.surf_comm){ - XBT_DEBUG("Getting latency limited for surf_action (%p)", action->comm.surf_comm); - action->latency_limited = surf_network_action_get_latency_limited(action->comm.surf_comm); - XBT_DEBUG("Action limited is %d", action->latency_limited); + if (synchro->comm.surf_comm){ + XBT_DEBUG("Getting latency limited for surf_action (%p)", synchro->comm.surf_comm); + synchro->latency_limited = surf_network_action_get_latency_limited(synchro->comm.surf_comm); + XBT_DEBUG("synchro limited is %d", synchro->latency_limited); } - return action->latency_limited; + return synchro->latency_limited; } #endif /******************************************************************************/ /* SIMIX_comm_copy_data callbacks */ /******************************************************************************/ -static void (*SIMIX_comm_copy_data_callback) (smx_action_t, void*, size_t) = +static void (*SIMIX_comm_copy_data_callback) (smx_synchro_t, void*, size_t) = &SIMIX_comm_copy_pointer_callback; void -SIMIX_comm_set_copy_data_callback(void (*callback) (smx_action_t, void*, size_t)) +SIMIX_comm_set_copy_data_callback(void (*callback) (smx_synchro_t, void*, size_t)) { SIMIX_comm_copy_data_callback = callback; } -void SIMIX_comm_copy_pointer_callback(smx_action_t comm, void* buff, size_t buff_size) +void SIMIX_comm_copy_pointer_callback(smx_synchro_t comm, void* buff, size_t buff_size) { xbt_assert((buff_size == sizeof(void *)), "Cannot copy %zu bytes: must be sizeof(void*)", buff_size); *(void **) (comm->comm.dst_buff) = buff; } -void SIMIX_comm_copy_buffer_callback(smx_action_t comm, void* buff, size_t buff_size) +void SIMIX_comm_copy_buffer_callback(smx_synchro_t comm, void* buff, size_t buff_size) { XBT_DEBUG("Copy the data over"); memcpy(comm->comm.dst_buff, buff, buff_size); @@ -1136,7 +1089,7 @@ void SIMIX_comm_copy_buffer_callback(smx_action_t comm, void* buff, size_t buff_ * \brief Copy the communication data from the sender's buffer to the receiver's one * \param comm The communication */ -void SIMIX_comm_copy_data(smx_action_t comm) +void SIMIX_comm_copy_data(smx_synchro_t comm) { size_t buff_size = comm->comm.src_buff_size; /* If there is no data to be copy then return */ diff --git a/src/simix/smx_network_private.h b/src/simix/smx_network_private.h index ea3095a790..6ea862d3d3 100644 --- a/src/simix/smx_network_private.h +++ b/src/simix/smx_network_private.h @@ -8,7 +8,7 @@ #define _SIMIX_NETWORK_PRIVATE_H #include "simgrid/simix.h" -#include "smx_smurf_private.h" +#include "popping_private.h" /** @brief Rendez-vous point datatype */ typedef struct s_smx_rvpoint { @@ -23,92 +23,42 @@ void SIMIX_network_init(void); void SIMIX_network_exit(void); #ifdef HAVE_LATENCY_BOUND_TRACKING -XBT_PUBLIC(int) SIMIX_comm_is_latency_bounded(smx_action_t comm); +XBT_PUBLIC(int) SIMIX_comm_is_latency_bounded(smx_synchro_t comm); #endif smx_rdv_t SIMIX_rdv_create(const char *name); void SIMIX_rdv_destroy(smx_rdv_t rdv); smx_rdv_t SIMIX_rdv_get_by_name(const char *name); -void SIMIX_rdv_remove(smx_rdv_t rdv, smx_action_t comm); +void SIMIX_rdv_remove(smx_rdv_t rdv, smx_synchro_t comm); int SIMIX_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host); -smx_action_t SIMIX_rdv_get_head(smx_rdv_t rdv); +smx_synchro_t SIMIX_rdv_get_head(smx_rdv_t rdv); void SIMIX_rdv_set_receiver(smx_rdv_t rdv, smx_process_t proc); smx_process_t SIMIX_rdv_get_receiver(smx_rdv_t rdv); -smx_action_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv, +smx_synchro_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv, double task_size, double rate, void *src_buff, size_t src_buff_size, - int (*match_fun)(void *, void *, smx_action_t), - void (*clean_fun)(void *), // used to free the action in case of problem after a detached send - void (*copy_data_fun)(smx_action_t, void*, size_t), + int (*match_fun)(void *, void *, smx_synchro_t), + void (*clean_fun)(void *), // used to free the synchro in case of problem after a detached send + void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, int detached); -smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv, +smx_synchro_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_size, - int (*)(void *, void *, smx_action_t), - void (*copy_data_fun)(smx_action_t, void*, size_t), + int (*)(void *, void *, smx_synchro_t), + void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double rate); -void SIMIX_comm_destroy(smx_action_t action); -void SIMIX_comm_destroy_internal_actions(smx_action_t action); -smx_action_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int type, int src, - int tag, int (*match_fun)(void *, void *, smx_action_t), void *data); -void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout); -void SIMIX_pre_comm_waitany(smx_simcall_t simcall, xbt_dynar_t actions); -void SIMIX_post_comm(smx_action_t action); -void SIMIX_pre_comm_test(smx_simcall_t simcall, smx_action_t action); -void SIMIX_pre_comm_testany(smx_simcall_t simcall, xbt_dynar_t actions); -void SIMIX_comm_cancel(smx_action_t action); -double SIMIX_comm_get_remains(smx_action_t action); -e_smx_state_t SIMIX_comm_get_state(smx_action_t action); -void SIMIX_comm_suspend(smx_action_t action); -void SIMIX_comm_resume(smx_action_t action); -smx_process_t SIMIX_comm_get_src_proc(smx_action_t action); -smx_process_t SIMIX_comm_get_dst_proc(smx_action_t action); +void SIMIX_comm_destroy(smx_synchro_t synchro); +void SIMIX_comm_destroy_internal_actions(smx_synchro_t synchro); +smx_synchro_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int type, int src, + int tag, int (*match_fun)(void *, void *, smx_synchro_t), void *data); +void SIMIX_post_comm(smx_synchro_t synchro); +void SIMIX_comm_cancel(smx_synchro_t synchro); +double SIMIX_comm_get_remains(smx_synchro_t synchro); +e_smx_state_t SIMIX_comm_get_state(smx_synchro_t synchro); +void SIMIX_comm_suspend(smx_synchro_t synchro); +void SIMIX_comm_resume(smx_synchro_t synchro); +smx_process_t SIMIX_comm_get_src_proc(smx_synchro_t synchro); +smx_process_t SIMIX_comm_get_dst_proc(smx_synchro_t synchro); -// pre prototypes -smx_action_t SIMIX_pre_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv, - int type,int src, int tag, - int (*match_fun)(void *, void *, smx_action_t), - void *data); -smx_rdv_t SIMIX_pre_rdv_create(smx_simcall_t simcall, const char *name); -void SIMIX_pre_rdv_destroy(smx_simcall_t simcall, smx_rdv_t rdv); -smx_rdv_t SIMIX_pre_rdv_get_by_name(smx_simcall_t simcall, const char *name); -int SIMIX_pre_rdv_comm_count_by_host(smx_simcall_t simcall, smx_rdv_t rdv, smx_host_t host); -smx_action_t SIMIX_pre_rdv_get_head(smx_simcall_t simcall, smx_rdv_t rdv); -smx_process_t SIMIX_pre_rdv_get_receiver(smx_simcall_t simcall, smx_rdv_t rdv); -void SIMIX_pre_rdv_set_receiver(smx_simcall_t simcall, smx_rdv_t rdv, - smx_process_t process); -void SIMIX_pre_comm_send(smx_simcall_t simcall, smx_process_t src, smx_rdv_t rdv, - double task_size, double rate, - void *src_buff, size_t src_buff_size, - int (*match_fun)(void *, void *,smx_action_t), - void (*copy_data_fun)(smx_action_t, void*, size_t), - void *data, double timeout); -smx_action_t SIMIX_pre_comm_isend(smx_simcall_t simcall, smx_process_t src, smx_rdv_t rdv, - double task_size, double rate, - void *src_buff, size_t src_buff_size, - int (*match_fun)(void *, void *,smx_action_t), - void (*clean_fun)(void *), - void (*copy_data_fun)(smx_action_t, void*, size_t), - void *data, int detached); -void SIMIX_pre_comm_recv(smx_simcall_t simcall, smx_rdv_t rdv, - void *dst_buff, size_t *dst_buff_size, - int (*match_fun)(void *, void *, smx_action_t), - void (*copy_data_fun)(smx_action_t, void*, size_t), - void *data, double timeout, double rate); -smx_action_t SIMIX_pre_comm_irecv(smx_simcall_t simcall, smx_rdv_t rdv, - void *dst_buff, size_t *dst_buff_size, - int (*match_fun)(void *, void *, smx_action_t), - void (*copy_data_fun)(smx_action_t, void*, size_t), - void *data, double rate); -void SIMIX_pre_comm_cancel(smx_simcall_t simcall, smx_action_t action); -double SIMIX_pre_comm_get_remains(smx_simcall_t simcall, smx_action_t action); -e_smx_state_t SIMIX_pre_comm_get_state(smx_simcall_t simcall, smx_action_t action); -void* SIMIX_pre_comm_get_src_data(smx_simcall_t simcall, smx_action_t action); -void* SIMIX_pre_comm_get_dst_data(smx_simcall_t simcall, smx_action_t action); -smx_process_t SIMIX_pre_comm_get_src_proc(smx_simcall_t simcall, smx_action_t action); -smx_process_t SIMIX_pre_comm_get_dst_proc(smx_simcall_t simcall, smx_action_t action); -#ifdef HAVE_LATENCY_BOUND_TRACKING -int SIMIX_pre_comm_is_latency_bounded(smx_simcall_t simcall, smx_action_t action); -#endif #endif diff --git a/src/simix/smx_new_api.c b/src/simix/smx_new_api.c deleted file mode 100644 index f419842277..0000000000 --- a/src/simix/smx_new_api.c +++ /dev/null @@ -1,135 +0,0 @@ -/* Copyright (c) 2007-2010, 2012-2014. The SimGrid Team. - * All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -/* ****************************************************************************************** */ -/* TUTORIAL: New API */ -/* ****************************************************************************************** */ -#include "smx_private.h" -#include "xbt/sysdep.h" -#include "xbt/log.h" -#include "xbt/dict.h" -#include "mc/mc.h" - -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_new_api, simix, - "Logging specific to SIMIX (new_api)"); - - -//SIMIX NEW MODEL INIT -void SIMIX_pre_new_api_fct(smx_simcall_t simcall) -{ - smx_action_t action = SIMIX_new_api_fct(simcall->issuer, - simcall->new_api.param1, - simcall->new_api.param2); - xbt_fifo_push(action->simcalls, simcall); - simcall->issuer->waiting_action = action; -} - -void SIMIX_post_new_api(smx_action_t action) -{ - xbt_fifo_item_t i; - smx_simcall_t simcall; - - xbt_fifo_foreach(action->simcalls,i,simcall,smx_simcall_t) { - switch (simcall->call) { - case SIMCALL_NEW_API_INIT: - simcall->new_api.result = 0; - break; - - default: - break; - } - } - - switch (surf_action_get_state(action->new_api.surf_new_api)) { - - case SURF_ACTION_FAILED: - action->state = SIMIX_FAILED; - break; - - case SURF_ACTION_DONE: - action->state = SIMIX_DONE; - break; - - default: - THROW_IMPOSSIBLE; - break; - } - - SIMIX_new_api_finish(action); -} - -smx_action_t SIMIX_new_api_fct(smx_process_t process, const char* param1, double param2) -{ - smx_action_t action; - smx_host_t host = process->smx_host; - - /* check if the host is active */ - if (surf_resource_get_state(surf_workstation_resource_priv(host)) != SURF_RESOURCE_ON) { - THROWF(host_error, 0, "Host %s failed, you cannot call this function", - sg_host_name(host)); - } - - action = xbt_mallocator_get(simix_global->action_mallocator); - action->type = SIMIX_ACTION_NEW_API; - action->name = NULL; -#ifdef HAVE_TRACING - action->category = NULL; -#endif - - // Called the function from the new model - //FIXME:CHECK WHAT TO DO action->new_api.surf_new_api = surf_workstation_model->extension.new_model.fct(); - - surf_action_set_data(action->new_api.surf_new_api, action); - XBT_DEBUG("Create NEW MODEL action %p", action); - - return action; -} - -void SIMIX_new_api_destroy(smx_action_t action) -{ - XBT_DEBUG("Destroy action %p", action); - if (action->new_api.surf_new_api) - surf_action_unref(action->new_api.surf_new_api); - xbt_mallocator_release(simix_global->action_mallocator, action); -} - -void SIMIX_new_api_finish(smx_action_t action) -{ - xbt_fifo_item_t item; - smx_simcall_t simcall; - - xbt_fifo_foreach(action->simcalls, item, simcall, smx_simcall_t) { - - switch (action->state) { - - case SIMIX_DONE: - /* do nothing, action done */ - break; - - case SIMIX_FAILED: - SMX_EXCEPTION(simcall->issuer, io_error, 0, "IO failed"); - break; - - case SIMIX_CANCELED: - SMX_EXCEPTION(simcall->issuer, cancel_error, 0, "Canceled"); - break; - - default: - xbt_die("Internal error in SIMIX_NEW_MODEL_finish: unexpected action state %d", - (int)action->state); - } - - if (surf_resource_get_state(surf_workstation_resource_priv(simcall->issuer->smx_host)) != SURF_RESOURCE_ON) { - simcall->issuer->context->iwannadie = 1; - } - - simcall->issuer->waiting_action = NULL; - SIMIX_simcall_answer(simcall); - } - - /* We no longer need it */ - SIMIX_new_api_destroy(action); -} diff --git a/src/simix/smx_new_api_private.h b/src/simix/smx_new_api_private.h deleted file mode 100644 index 2c1f78ffcd..0000000000 --- a/src/simix/smx_new_api_private.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (c) 2007-2010, 2012-2014. The SimGrid Team. - * All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -/* ****************************************************************************************** */ -/* TUTORIAL: New API */ -/* ****************************************************************************************** */ -#ifndef _SIMIX_NEW_API_PRIVATE_H -#define _SIMIX_NEW_API_PRIVATE_H - -#include "simgrid/simix.h" -#include "smx_smurf_private.h" - -void SIMIX_pre_new_api_fct(smx_simcall_t simcall); -smx_action_t SIMIX_new_api_fct(smx_process_t process, const char* param1, double param2); - -void SIMIX_post_new_api(smx_action_t action); -void SIMIX_new_api_destroy(smx_action_t action); -void SIMIX_new_api_finish(smx_action_t action); - -#endif diff --git a/src/simix/smx_private.h b/src/simix/smx_private.h index b061c5da59..74f60d11c9 100644 --- a/src/simix/smx_private.h +++ b/src/simix/smx_private.h @@ -22,12 +22,8 @@ #include "smx_host_private.h" #include "smx_io_private.h" #include "smx_network_private.h" -#include "smx_smurf_private.h" +#include "popping_private.h" #include "smx_synchro_private.h" -/* ****************************************************************************************** */ -/* TUTORIAL: New API */ -/* ****************************************************************************************** */ -#include "smx_new_api_private.h" /* Define only for SimGrid benchmarking purposes */ //#define TIME_BENCH_PER_SR /* this aims at measuring the time spent in each scheduling round per each thread. The code is thus run in sequential to bench separately each SSR */ @@ -50,7 +46,7 @@ typedef struct s_smx_global { smx_creation_func_t create_process_function; void_pfn_smxprocess_t_smxprocess_t kill_process_function; void_pfn_smxprocess_t cleanup_process_function; - xbt_mallocator_t action_mallocator; + xbt_mallocator_t synchro_mallocator; void_pfn_smxhost_t autorestart; #ifdef TIME_BENCH_AMDAHL @@ -59,7 +55,7 @@ typedef struct s_smx_global { #endif } s_smx_global_t, *smx_global_t; -extern smx_global_t simix_global; +XBT_PUBLIC_DATA(smx_global_t) simix_global; extern unsigned long simix_process_maxpid; extern xbt_dict_t watched_hosts_lib; @@ -98,21 +94,17 @@ typedef struct s_smx_timer { void* args; } s_smx_timer_t; -/********************************* Action *************************************/ +/********************************* synchro *************************************/ typedef enum { - SIMIX_ACTION_EXECUTE, - SIMIX_ACTION_PARALLEL_EXECUTE, - SIMIX_ACTION_COMMUNICATE, - SIMIX_ACTION_JOIN, - SIMIX_ACTION_SLEEP, - SIMIX_ACTION_SYNCHRO, - SIMIX_ACTION_IO, - /* ****************************************************************************************** */ - /* TUTORIAL: New API */ - /* ****************************************************************************************** */ - SIMIX_ACTION_NEW_API -} e_smx_action_type_t; + SIMIX_SYNC_EXECUTE, + SIMIX_SYNC_PARALLEL_EXECUTE, + SIMIX_SYNC_COMMUNICATE, + SIMIX_SYNC_JOIN, + SIMIX_SYNC_SLEEP, + SIMIX_SYNC_SYNCHRO, + SIMIX_SYNC_IO, +} e_smx_synchro_type_t; typedef enum { SIMIX_COMM_SEND, @@ -128,15 +120,15 @@ typedef enum { SIMIX_IO_STAT } e_smx_io_type_t; -/** @brief Action datatype */ -typedef struct s_smx_action { +/** @brief synchro datatype */ +typedef struct s_smx_synchro { - e_smx_action_type_t type; /* Type of SIMIX action*/ - e_smx_state_t state; /* State of the action */ - char *name; /* Action name if any */ - xbt_fifo_t simcalls; /* List of simcalls waiting for this action */ + e_smx_synchro_type_t type; /* Type of SIMIX synchro */ + e_smx_state_t state; /* State of the synchro */ + char *name; /* synchro name if any */ + xbt_fifo_t simcalls; /* List of simcalls waiting for this synchro */ - /* Data specific to each action type */ + /* Data specific to each synchro type */ union { struct { @@ -157,10 +149,10 @@ typedef struct s_smx_action { int detached; /* If detached or not */ void (*clean_fun)(void*); /* Function to clean the detached src_buf if something goes wrong */ - int (*match_fun)(void*,void*,smx_action_t); /* Filter function used by the other side. It is used when + int (*match_fun)(void*,void*,smx_synchro_t); /* Filter function used by the other side. It is used when looking if a given communication matches my needs. For that, myself must match the expectations of the other side, too. See */ - void (*copy_data_fun) (smx_action_t, void*, size_t); + void (*copy_data_fun) (smx_synchro_t, void*, size_t); /* Surf action data */ surf_action_t surf_comm; /* The Surf communication action encapsulated */ @@ -195,13 +187,6 @@ typedef struct s_smx_action { smx_host_t host; surf_action_t surf_io; } io; - - /* ****************************************************************************************** */ - /* TUTORIAL: New API */ - /* ****************************************************************************************** */ - struct { - surf_action_t surf_new_api; - } new_api; }; #ifdef HAVE_LATENCY_BOUND_TRACKING @@ -211,7 +196,7 @@ typedef struct s_smx_action { #ifdef HAVE_TRACING char *category; /* simix action category for instrumentation */ #endif -} s_smx_action_t; +} s_smx_synchro_t; void SIMIX_context_mod_init(void); void SIMIX_context_mod_exit(void); diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index adf8d9d4ed..d2e80ba4fe 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -38,54 +38,51 @@ int SIMIX_process_has_pending_comms(smx_process_t process) { return xbt_fifo_size(process->comms) > 0; } -void SIMIX_pre_process_cleanup(smx_simcall_t simcall, smx_process_t process) { - SIMIX_process_cleanup(process); -} /** * \brief Moves a process to the list of processes to destroy. */ void SIMIX_process_cleanup(smx_process_t process) { - XBT_DEBUG("Cleanup process %s (%p), waiting action %p", - process->name, process, process->waiting_action); + XBT_DEBUG("Cleanup process %s (%p), waiting synchro %p", + process->name, process, process->waiting_synchro); SIMIX_process_on_exit_runall(process); /* cancel non-blocking communications */ - smx_action_t action; - while ((action = xbt_fifo_pop(process->comms))) { + smx_synchro_t synchro; + while ((synchro = xbt_fifo_pop(process->comms))) { /* make sure no one will finish the comm after this process is destroyed, * because src_proc or dst_proc would be an invalid pointer */ - SIMIX_comm_cancel(action); + SIMIX_comm_cancel(synchro); - if (action->comm.src_proc == process) { + if (synchro->comm.src_proc == process) { XBT_DEBUG("Found an unfinished send comm %p (detached = %d), state %d, src = %p, dst = %p", - action, action->comm.detached, (int)action->state, action->comm.src_proc, action->comm.dst_proc); - action->comm.src_proc = NULL; + synchro, synchro->comm.detached, (int)synchro->state, synchro->comm.src_proc, synchro->comm.dst_proc); + synchro->comm.src_proc = NULL; /* I'm not supposed to destroy a detached comm from the sender side, */ - if (!action->comm.detached) - SIMIX_comm_destroy(action); + if (!synchro->comm.detached) + SIMIX_comm_destroy(synchro); else XBT_DEBUG("Don't destroy it since it's a detached comm"); } - else if (action->comm.dst_proc == process){ + else if (synchro->comm.dst_proc == process){ XBT_DEBUG("Found an unfinished recv comm %p, state %d, src = %p, dst = %p", - action, (int)action->state, action->comm.src_proc, action->comm.dst_proc); - action->comm.dst_proc = NULL; + synchro, (int)synchro->state, synchro->comm.src_proc, synchro->comm.dst_proc); + synchro->comm.dst_proc = NULL; - if (action->comm.detached && action->comm.refcount == 1 - && action->comm.src_proc != NULL) { + if (synchro->comm.detached && synchro->comm.refcount == 1 + && synchro->comm.src_proc != NULL) { /* the comm will be freed right now, remove it from the sender */ - xbt_fifo_remove(action->comm.src_proc->comms, action); + xbt_fifo_remove(synchro->comm.src_proc->comms, synchro); } - SIMIX_comm_destroy(action); + SIMIX_comm_destroy(synchro); } else { - xbt_die("Communication action %p is in my list but I'm not the sender " - "or the receiver", action); + xbt_die("Communication synchro %p is in my list but I'm not the sender " + "or the receiver", synchro); } } @@ -189,7 +186,7 @@ smx_process_t SIMIX_process_create_from_wrapper(smx_process_arg_t args) { } -void SIMIX_pre_process_create(smx_simcall_t simcall, +void simcall_HANDLER_process_create(smx_simcall_t simcall, smx_process_t *process, const char *name, xbt_main_func_t code, @@ -313,7 +310,7 @@ void SIMIX_process_runall(void) xbt_dynar_reset(simix_global->process_to_run); } -void SIMIX_pre_process_kill(smx_simcall_t simcall, smx_process_t process) { +void simcall_HANDLER_process_kill(smx_simcall_t simcall, smx_process_t process) { SIMIX_process_kill(process, simcall->issuer); } /** @@ -334,45 +331,38 @@ void SIMIX_process_kill(smx_process_t process, smx_process_t issuer) { process->suspended = 0; process->doexception = 0; - /* destroy the blocking action if any */ - if (process->waiting_action) { + /* destroy the blocking synchro if any */ + if (process->waiting_synchro) { - switch (process->waiting_action->type) { + switch (process->waiting_synchro->type) { - case SIMIX_ACTION_EXECUTE: - case SIMIX_ACTION_PARALLEL_EXECUTE: - SIMIX_host_execution_destroy(process->waiting_action); + case SIMIX_SYNC_EXECUTE: + case SIMIX_SYNC_PARALLEL_EXECUTE: + SIMIX_host_execution_destroy(process->waiting_synchro); break; - case SIMIX_ACTION_COMMUNICATE: - xbt_fifo_remove(process->comms, process->waiting_action); - SIMIX_comm_cancel(process->waiting_action); - SIMIX_comm_destroy(process->waiting_action); + case SIMIX_SYNC_COMMUNICATE: + xbt_fifo_remove(process->comms, process->waiting_synchro); + SIMIX_comm_cancel(process->waiting_synchro); + SIMIX_comm_destroy(process->waiting_synchro); break; - case SIMIX_ACTION_SLEEP: - SIMIX_process_sleep_destroy(process->waiting_action); + case SIMIX_SYNC_SLEEP: + SIMIX_process_sleep_destroy(process->waiting_synchro); break; - case SIMIX_ACTION_JOIN: - SIMIX_process_sleep_destroy(process->waiting_action); + case SIMIX_SYNC_JOIN: + SIMIX_process_sleep_destroy(process->waiting_synchro); break; - case SIMIX_ACTION_SYNCHRO: + case SIMIX_SYNC_SYNCHRO: SIMIX_synchro_stop_waiting(process, &process->simcall); - SIMIX_synchro_destroy(process->waiting_action); - break; - - case SIMIX_ACTION_IO: - SIMIX_io_destroy(process->waiting_action); + SIMIX_synchro_destroy(process->waiting_synchro); break; - /* **************************************/ - /* TUTORIAL: New API */ - case SIMIX_ACTION_NEW_API: - SIMIX_new_api_destroy(process->waiting_action); + case SIMIX_SYNC_IO: + SIMIX_io_destroy(process->waiting_synchro); break; - /* **************************************/ } } @@ -394,53 +384,46 @@ void SIMIX_process_throw(smx_process_t process, xbt_errcat_t cat, int value, con if (process->suspended) SIMIX_process_resume(process,SIMIX_process_self()); - /* cancel the blocking action if any */ - if (process->waiting_action) { + /* cancel the blocking synchro if any */ + if (process->waiting_synchro) { - switch (process->waiting_action->type) { + switch (process->waiting_synchro->type) { - case SIMIX_ACTION_EXECUTE: - case SIMIX_ACTION_PARALLEL_EXECUTE: - SIMIX_host_execution_cancel(process->waiting_action); + case SIMIX_SYNC_EXECUTE: + case SIMIX_SYNC_PARALLEL_EXECUTE: + SIMIX_host_execution_cancel(process->waiting_synchro); break; - case SIMIX_ACTION_COMMUNICATE: - xbt_fifo_remove(process->comms, process->waiting_action); - SIMIX_comm_cancel(process->waiting_action); + case SIMIX_SYNC_COMMUNICATE: + xbt_fifo_remove(process->comms, process->waiting_synchro); + SIMIX_comm_cancel(process->waiting_synchro); break; - case SIMIX_ACTION_SLEEP: - SIMIX_process_sleep_destroy(process->waiting_action); + case SIMIX_SYNC_SLEEP: + SIMIX_process_sleep_destroy(process->waiting_synchro); break; - case SIMIX_ACTION_JOIN: - SIMIX_process_sleep_destroy(process->waiting_action); + case SIMIX_SYNC_JOIN: + SIMIX_process_sleep_destroy(process->waiting_synchro); break; - case SIMIX_ACTION_SYNCHRO: + case SIMIX_SYNC_SYNCHRO: SIMIX_synchro_stop_waiting(process, &process->simcall); break; - case SIMIX_ACTION_IO: - SIMIX_io_destroy(process->waiting_action); + case SIMIX_SYNC_IO: + SIMIX_io_destroy(process->waiting_synchro); break; - /* **************************************/ - /* TUTORIAL: New API */ - case SIMIX_ACTION_NEW_API: - SIMIX_new_api_destroy(process->waiting_action); - break; - /* **************************************/ - } } - process->waiting_action = NULL; + process->waiting_synchro = NULL; if (!xbt_dynar_member(simix_global->process_to_run, &(process)) && process != SIMIX_process_self()) xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process); } -void SIMIX_pre_process_killall(smx_simcall_t simcall, int reset_pid) { +void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid) { SIMIX_process_killall(simcall->issuer, reset_pid); } /** @@ -465,7 +448,7 @@ void SIMIX_process_killall(smx_process_t issuer, int reset_pid) SIMIX_process_empty_trash(); } -void SIMIX_pre_process_change_host(smx_simcall_t simcall, smx_process_t process, +void simcall_HANDLER_process_change_host(smx_simcall_t simcall, smx_process_t process, smx_host_t dest) { process->new_host = dest; @@ -480,22 +463,22 @@ void SIMIX_process_change_host(smx_process_t process, } -void SIMIX_pre_process_suspend(smx_simcall_t simcall, smx_process_t process) +void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_process_t process) { - smx_action_t action_suspend = + smx_synchro_t sync_suspend = SIMIX_process_suspend(process, simcall->issuer); if (process != simcall->issuer) { SIMIX_simcall_answer(simcall); } else { - xbt_fifo_push(action_suspend->simcalls, simcall); - process->waiting_action = action_suspend; - SIMIX_host_execution_suspend(process->waiting_action); + xbt_fifo_push(sync_suspend->simcalls, simcall); + process->waiting_synchro = sync_suspend; + SIMIX_host_execution_suspend(process->waiting_synchro); } /* If we are suspending ourselves, then just do not finish the simcall now */ } -smx_action_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer) +smx_synchro_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer) { xbt_assert((process != NULL), "Invalid parameters"); @@ -506,34 +489,34 @@ smx_action_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer) process->suspended = 1; - /* If we are suspending another process, and it is waiting on an action, - suspend its action. */ + /* If we are suspending another process, and it is waiting on a sync, + suspend its synchronization. */ if (process != issuer) { - if (process->waiting_action) { + if (process->waiting_synchro) { - switch (process->waiting_action->type) { + switch (process->waiting_synchro->type) { - case SIMIX_ACTION_EXECUTE: - case SIMIX_ACTION_PARALLEL_EXECUTE: - SIMIX_host_execution_suspend(process->waiting_action); + case SIMIX_SYNC_EXECUTE: + case SIMIX_SYNC_PARALLEL_EXECUTE: + SIMIX_host_execution_suspend(process->waiting_synchro); break; - case SIMIX_ACTION_COMMUNICATE: - SIMIX_comm_suspend(process->waiting_action); + case SIMIX_SYNC_COMMUNICATE: + SIMIX_comm_suspend(process->waiting_synchro); break; - case SIMIX_ACTION_SLEEP: - SIMIX_process_sleep_suspend(process->waiting_action); + case SIMIX_SYNC_SLEEP: + SIMIX_process_sleep_suspend(process->waiting_synchro); break; - case SIMIX_ACTION_SYNCHRO: + case SIMIX_SYNC_SYNCHRO: /* Suspension is delayed to when the process is rescheduled. */ break; default: - xbt_die("Internal error in SIMIX_process_suspend: unexpected action type %d", - (int)process->waiting_action->type); + xbt_die("Internal error in SIMIX_process_suspend: unexpected synchronization type %d", + (int)process->waiting_synchro->type); } return NULL; } else { @@ -546,7 +529,7 @@ smx_action_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer) } } -void SIMIX_pre_process_resume(smx_simcall_t simcall, smx_process_t process){ +void simcall_HANDLER_process_resume(smx_simcall_t simcall, smx_process_t process){ SIMIX_process_resume(process, simcall->issuer); } @@ -562,35 +545,35 @@ void SIMIX_process_resume(smx_process_t process, smx_process_t issuer) if(!process->suspended) return; process->suspended = 0; - /* If we are resuming another process, resume the action it was waiting for + /* If we are resuming another process, resume the synchronization it was waiting for if any. Otherwise add it to the list of process to run in the next round. */ if (process != issuer) { - if (process->waiting_action) { + if (process->waiting_synchro) { - switch (process->waiting_action->type) { + switch (process->waiting_synchro->type) { - case SIMIX_ACTION_EXECUTE: - case SIMIX_ACTION_PARALLEL_EXECUTE: - SIMIX_host_execution_resume(process->waiting_action); + case SIMIX_SYNC_EXECUTE: + case SIMIX_SYNC_PARALLEL_EXECUTE: + SIMIX_host_execution_resume(process->waiting_synchro); break; - case SIMIX_ACTION_COMMUNICATE: - SIMIX_comm_resume(process->waiting_action); + case SIMIX_SYNC_COMMUNICATE: + SIMIX_comm_resume(process->waiting_synchro); break; - case SIMIX_ACTION_SLEEP: - SIMIX_process_sleep_resume(process->waiting_action); + case SIMIX_SYNC_SLEEP: + SIMIX_process_sleep_resume(process->waiting_synchro); break; - case SIMIX_ACTION_SYNCHRO: + case SIMIX_SYNC_SYNCHRO: /* I cannot resume it now. This is delayed to when the process is rescheduled at * the end of the synchro. */ break; default: - xbt_die("Internal error in SIMIX_process_resume: unexpected action type %d", - (int)process->waiting_action->type); + xbt_die("Internal error in SIMIX_process_resume: unexpected synchronization type %d", + (int)process->waiting_synchro->type); } } } else XBT_WARN("Strange. Process %p is trying to resume himself.", issuer); @@ -602,18 +585,11 @@ int SIMIX_process_get_maxpid(void) { return simix_process_maxpid; } -int SIMIX_pre_process_count(smx_simcall_t simcall){ - return SIMIX_process_count(); -} int SIMIX_process_count(void) { return xbt_swag_size(simix_global->process_list); } -int SIMIX_pre_process_get_PID(smx_simcall_t simcall, smx_process_t self){ - return SIMIX_process_get_PID(self); -} - int SIMIX_process_get_PID(smx_process_t self){ if (self == NULL) return 0; @@ -621,10 +597,6 @@ int SIMIX_process_get_PID(smx_process_t self){ return self->pid; } -int SIMIX_pre_process_get_PPID(smx_simcall_t simcall, smx_process_t self){ - return SIMIX_process_get_PPID(self); -} - int SIMIX_process_get_PPID(smx_process_t self){ if (self == NULL) return 0; @@ -632,10 +604,6 @@ int SIMIX_process_get_PPID(smx_process_t self){ return self->ppid; } -void* SIMIX_pre_process_self_get_data(smx_simcall_t simcall, smx_process_t self){ - return SIMIX_process_self_get_data(self); -} - void* SIMIX_process_self_get_data(smx_process_t self) { xbt_assert(self == SIMIX_process_self(), "This is not the current process"); @@ -646,10 +614,6 @@ void* SIMIX_process_self_get_data(smx_process_t self) return SIMIX_process_get_data(self); } -void SIMIX_pre_process_set_data(smx_simcall_t simcall, smx_process_t process, - void *data){ - SIMIX_process_set_data(process, data); -} void SIMIX_process_self_set_data(smx_process_t self, void *data) { xbt_assert(self == SIMIX_process_self(), "This is not the current process"); @@ -657,9 +621,6 @@ void SIMIX_process_self_set_data(smx_process_t self, void *data) SIMIX_process_set_data(self, data); } -void* SIMIX_pre_process_get_data(smx_simcall_t simcall, smx_process_t process){ - return SIMIX_process_get_data(process); -} void* SIMIX_process_get_data(smx_process_t process) { return process->data; @@ -670,9 +631,6 @@ void SIMIX_process_set_data(smx_process_t process, void *data) process->data = data; } -smx_host_t SIMIX_pre_process_get_host(smx_simcall_t simcall, smx_process_t process){ - return SIMIX_process_get_host(process); -} smx_host_t SIMIX_process_get_host(smx_process_t process) { return process->smx_host; @@ -689,9 +647,6 @@ const char* SIMIX_process_self_get_name(void) { return SIMIX_process_get_name(process); } -const char* SIMIX_pre_process_get_name(smx_simcall_t simcall, smx_process_t process) { - return SIMIX_process_get_name(process); -} const char* SIMIX_process_get_name(smx_process_t process) { return process->name; @@ -709,76 +664,70 @@ smx_process_t SIMIX_process_get_by_name(const char* name) return NULL; } -int SIMIX_pre_process_is_suspended(smx_simcall_t simcall, smx_process_t process){ - return SIMIX_process_is_suspended(process); -} int SIMIX_process_is_suspended(smx_process_t process) { return process->suspended; } -xbt_dict_t SIMIX_pre_process_get_properties(smx_simcall_t simcall, smx_process_t process){ - return SIMIX_process_get_properties(process); -} xbt_dict_t SIMIX_process_get_properties(smx_process_t process) { return process->properties; } -void SIMIX_pre_process_join(smx_simcall_t simcall, smx_process_t process, double timeout) +void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_process_t process, double timeout) { - smx_action_t action = SIMIX_process_join(simcall->issuer, process, timeout); - xbt_fifo_push(action->simcalls, simcall); - simcall->issuer->waiting_action = action; + smx_synchro_t sync = SIMIX_process_join(simcall->issuer, process, timeout); + xbt_fifo_push(sync->simcalls, simcall); + simcall->issuer->waiting_synchro = sync; } -static int SIMIX_process_join_finish(smx_process_exit_status_t status, smx_action_t action){ - if (action->sleep.surf_sleep) { - surf_action_cancel(action->sleep.surf_sleep); +static int SIMIX_process_join_finish(smx_process_exit_status_t status, smx_synchro_t sync){ + if (sync->sleep.surf_sleep) { + surf_action_cancel(sync->sleep.surf_sleep); smx_simcall_t simcall; - while ((simcall = xbt_fifo_shift(action->simcalls))) { + while ((simcall = xbt_fifo_shift(sync->simcalls))) { simcall_process_sleep__set__result(simcall, SIMIX_DONE); - simcall->issuer->waiting_action = NULL; + simcall->issuer->waiting_synchro = NULL; if (simcall->issuer->suspended) { XBT_DEBUG("Wait! This process is suspended and can't wake up now."); simcall->issuer->suspended = 0; - SIMIX_pre_process_suspend(simcall, simcall->issuer); + simcall_HANDLER_process_suspend(simcall, simcall->issuer); } else { SIMIX_simcall_answer(simcall); } } - surf_action_unref(action->sleep.surf_sleep); - action->sleep.surf_sleep = NULL; + surf_action_unref(sync->sleep.surf_sleep); + sync->sleep.surf_sleep = NULL; } - xbt_mallocator_release(simix_global->action_mallocator, action); + xbt_mallocator_release(simix_global->synchro_mallocator, sync); return 0; } -smx_action_t SIMIX_process_join(smx_process_t issuer, smx_process_t process, double timeout) +smx_synchro_t SIMIX_process_join(smx_process_t issuer, smx_process_t process, double timeout) { - smx_action_t res = SIMIX_process_sleep(issuer, timeout); - res->type = SIMIX_ACTION_JOIN; + smx_synchro_t res = SIMIX_process_sleep(issuer, timeout); + res->type = SIMIX_SYNC_JOIN; SIMIX_process_on_exit(process, (int_f_pvoid_pvoid_t)SIMIX_process_join_finish, res); return res; } -void SIMIX_pre_process_sleep(smx_simcall_t simcall, double duration) +void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration) { - if (MC_is_active()) { + if (MC_is_active() || MC_record_replay_is_active()) { MC_process_clock_add(simcall->issuer, duration); simcall_process_sleep__set__result(simcall, SIMIX_DONE); SIMIX_simcall_answer(simcall); return; } - smx_action_t action = SIMIX_process_sleep(simcall->issuer, duration); - xbt_fifo_push(action->simcalls, simcall); - simcall->issuer->waiting_action = action; + smx_synchro_t sync = SIMIX_process_sleep(simcall->issuer, duration); + xbt_fifo_push(sync->simcalls, simcall); + simcall->issuer->waiting_synchro = sync; } -smx_action_t SIMIX_process_sleep(smx_process_t process, double duration) +smx_synchro_t SIMIX_process_sleep(smx_process_t process, double duration) { - smx_action_t action; + smx_synchro_t synchro; smx_host_t host = process->smx_host; /* check if the host is active */ @@ -787,32 +736,32 @@ smx_action_t SIMIX_process_sleep(smx_process_t process, double duration) sg_host_name(host)); } - action = xbt_mallocator_get(simix_global->action_mallocator); - action->type = SIMIX_ACTION_SLEEP; - action->name = NULL; + synchro = xbt_mallocator_get(simix_global->synchro_mallocator); + synchro->type = SIMIX_SYNC_SLEEP; + synchro->name = NULL; #ifdef HAVE_TRACING - action->category = NULL; + synchro->category = NULL; #endif - action->sleep.host = host; - action->sleep.surf_sleep = + synchro->sleep.host = host; + synchro->sleep.surf_sleep = surf_workstation_sleep(host, duration); - surf_action_set_data(action->sleep.surf_sleep, action); - XBT_DEBUG("Create sleep action %p", action); + surf_action_set_data(synchro->sleep.surf_sleep, synchro); + XBT_DEBUG("Create sleep synchronization %p", synchro); - return action; + return synchro; } -void SIMIX_post_process_sleep(smx_action_t action) +void SIMIX_post_process_sleep(smx_synchro_t synchro) { smx_simcall_t simcall; e_smx_state_t state; - xbt_assert(action->type == SIMIX_ACTION_SLEEP || action->type == SIMIX_ACTION_JOIN); + xbt_assert(synchro->type == SIMIX_SYNC_SLEEP || synchro->type == SIMIX_SYNC_JOIN); - while ((simcall = xbt_fifo_shift(action->simcalls))) { + while ((simcall = xbt_fifo_shift(synchro->simcalls))) { - switch(surf_action_get_state(action->sleep.surf_sleep)){ + switch(surf_action_get_state(synchro->sleep.surf_sleep)){ case SURF_ACTION_FAILED: simcall->issuer->context->iwannadie = 1; //SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); @@ -831,43 +780,43 @@ void SIMIX_post_process_sleep(smx_action_t action) simcall->issuer->context->iwannadie = 1; } simcall_process_sleep__set__result(simcall, state); - simcall->issuer->waiting_action = NULL; + simcall->issuer->waiting_synchro = NULL; if (simcall->issuer->suspended) { XBT_DEBUG("Wait! This process is suspended and can't wake up now."); simcall->issuer->suspended = 0; - SIMIX_pre_process_suspend(simcall, simcall->issuer); + simcall_HANDLER_process_suspend(simcall, simcall->issuer); } else { SIMIX_simcall_answer(simcall); } } - SIMIX_process_sleep_destroy(action); + SIMIX_process_sleep_destroy(synchro); } -void SIMIX_process_sleep_destroy(smx_action_t action) +void SIMIX_process_sleep_destroy(smx_synchro_t synchro) { - XBT_DEBUG("Destroy action %p", action); - xbt_assert(action->type == SIMIX_ACTION_SLEEP || action->type == SIMIX_ACTION_JOIN); + XBT_DEBUG("Destroy synchro %p", synchro); + xbt_assert(synchro->type == SIMIX_SYNC_SLEEP || synchro->type == SIMIX_SYNC_JOIN); - if (action->sleep.surf_sleep) { - surf_action_unref(action->sleep.surf_sleep); - action->sleep.surf_sleep = NULL; + if (synchro->sleep.surf_sleep) { + surf_action_unref(synchro->sleep.surf_sleep); + synchro->sleep.surf_sleep = NULL; } - if (action->type == SIMIX_ACTION_SLEEP) - xbt_mallocator_release(simix_global->action_mallocator, action); + if (synchro->type == SIMIX_SYNC_SLEEP) + xbt_mallocator_release(simix_global->synchro_mallocator, synchro); } -void SIMIX_process_sleep_suspend(smx_action_t action) +void SIMIX_process_sleep_suspend(smx_synchro_t synchro) { - xbt_assert(action->type == SIMIX_ACTION_SLEEP); - surf_action_suspend(action->sleep.surf_sleep); + xbt_assert(synchro->type == SIMIX_SYNC_SLEEP); + surf_action_suspend(synchro->sleep.surf_sleep); } -void SIMIX_process_sleep_resume(smx_action_t action) +void SIMIX_process_sleep_resume(smx_synchro_t synchro) { - XBT_DEBUG("Action state is %d on process_sleep_resume.", action->state); - xbt_assert(action->type == SIMIX_ACTION_SLEEP); - surf_action_resume(action->sleep.surf_sleep); + XBT_DEBUG("Synchro state is %d on process_sleep_resume.", synchro->state); + xbt_assert(synchro->type == SIMIX_SYNC_SLEEP); + surf_action_resume(synchro->sleep.surf_sleep); } /** @@ -977,11 +926,6 @@ void SIMIX_process_on_exit_runall(smx_process_t process) { } } -void SIMIX_pre_process_on_exit(smx_simcall_t simcall, smx_process_t process, - int_f_pvoid_pvoid_t fun, void *data) { - SIMIX_process_on_exit(process, fun, data); -} - void SIMIX_process_on_exit(smx_process_t process, int_f_pvoid_pvoid_t fun, void *data) { xbt_assert(process, "current process not found: are you in maestro context ?"); @@ -994,10 +938,6 @@ void SIMIX_process_on_exit(smx_process_t process, int_f_pvoid_pvoid_t fun, void xbt_dynar_push_as(process->on_exit,s_smx_process_exit_fun_t,exit_fun); } -void SIMIX_pre_process_auto_restart_set(smx_simcall_t simcall, smx_process_t process, - int auto_restart) { - SIMIX_process_auto_restart_set(process, auto_restart); -} /** * \brief Sets the auto-restart status of the process. * If set to 1, the process will be automatically restarted when its host @@ -1007,7 +947,7 @@ void SIMIX_process_auto_restart_set(smx_process_t process, int auto_restart) { process->auto_restart = auto_restart; } -smx_process_t SIMIX_pre_process_restart(smx_simcall_t simcall, smx_process_t process) { +smx_process_t simcall_HANDLER_process_restart(smx_simcall_t simcall, smx_process_t process) { return SIMIX_process_restart(process, simcall->issuer); } /** diff --git a/src/simix/smx_process_private.h b/src/simix/smx_process_private.h index d49eced5a9..8b4f8ed9ba 100644 --- a/src/simix/smx_process_private.h +++ b/src/simix/smx_process_private.h @@ -8,7 +8,7 @@ #define _SIMIX_PROCESS_PRIVATE_H #include "simgrid/simix.h" -#include "smx_smurf_private.h" +#include "popping_private.h" SG_BEGIN_DECL() @@ -48,8 +48,8 @@ typedef struct s_smx_process { unsigned auto_restart:1; smx_host_t new_host; /* if not null, the host on which the process must migrate to */ - smx_action_t waiting_action; /* the current blocking action if any */ - xbt_fifo_t comms; /* the current non-blocking communication actions */ + smx_synchro_t waiting_synchro; /* the current blocking synchro if any */ + xbt_fifo_t comms; /* the current non-blocking communication synchros */ xbt_dict_t properties; s_smx_simcall_t simcall; void *data; /* kept for compatibility, it should be replaced with moddata */ @@ -84,12 +84,9 @@ void SIMIX_process_empty_trash(void); void SIMIX_process_yield(smx_process_t self); xbt_running_ctx_t *SIMIX_process_get_running_context(void); void SIMIX_process_exception_terminate(xbt_ex_t * e); -void SIMIX_pre_process_change_host(smx_simcall_t, smx_process_t process, - smx_host_t dest); void SIMIX_process_change_host(smx_process_t process, smx_host_t dest); -void SIMIX_pre_process_suspend(smx_simcall_t simcall, smx_process_t process); -smx_action_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer); +smx_synchro_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer); void SIMIX_process_resume(smx_process_t process, smx_process_t issuer); int SIMIX_process_get_PID(smx_process_t self); int SIMIX_process_get_PPID(smx_process_t self); @@ -100,44 +97,16 @@ const char* SIMIX_process_get_name(smx_process_t process); smx_process_t SIMIX_process_get_by_name(const char* name); int SIMIX_process_is_suspended(smx_process_t process); xbt_dict_t SIMIX_process_get_properties(smx_process_t process); -void SIMIX_pre_process_join(smx_simcall_t simcall, smx_process_t process, double timeout); -smx_action_t SIMIX_process_join(smx_process_t issuer, smx_process_t process, double timeout); -void SIMIX_pre_process_sleep(smx_simcall_t simcall, double duration); -smx_action_t SIMIX_process_sleep(smx_process_t process, double duration); -void SIMIX_post_process_sleep(smx_action_t action); - -void SIMIX_process_sleep_suspend(smx_action_t action); -void SIMIX_process_sleep_resume(smx_action_t action); -void SIMIX_process_sleep_destroy(smx_action_t action); +smx_synchro_t SIMIX_process_join(smx_process_t issuer, smx_process_t process, double timeout); +smx_synchro_t SIMIX_process_sleep(smx_process_t process, double duration); +void SIMIX_post_process_sleep(smx_synchro_t synchro); + +void SIMIX_process_sleep_suspend(smx_synchro_t synchro); +void SIMIX_process_sleep_resume(smx_synchro_t synchro); +void SIMIX_process_sleep_destroy(smx_synchro_t synchro); void SIMIX_process_auto_restart_set(smx_process_t process, int auto_restart); smx_process_t SIMIX_process_restart(smx_process_t process, smx_process_t issuer); -// pre prototypes -void SIMIX_pre_process_create(smx_simcall_t simcall, smx_process_t *process, - const char *name, xbt_main_func_t code, void *data, - const char *hostname, double kill_time, int argc, - char **argv, xbt_dict_t properties, int auto_restart); -void SIMIX_pre_process_kill(smx_simcall_t simcall, smx_process_t process); -void SIMIX_pre_process_killall(smx_simcall_t simcall, int reset_pid); -void SIMIX_pre_process_cleanup(smx_simcall_t simcall, smx_process_t process); -void SIMIX_pre_process_resume(smx_simcall_t simcall, smx_process_t process); -int SIMIX_pre_process_count(smx_simcall_t simcall); -void* SIMIX_pre_process_self_get_data(smx_simcall_t simcall, smx_process_t process); -int SIMIX_pre_process_get_PID(smx_simcall_t simcall, smx_process_t self); -int SIMIX_pre_process_get_PPID(smx_simcall_t simcall, smx_process_t self); -void* SIMIX_pre_process_get_data(smx_simcall_t simcall, smx_process_t process); -void SIMIX_pre_process_set_data(smx_simcall_t simcall, smx_process_t process, - void *data); -smx_host_t SIMIX_pre_process_get_host(smx_simcall_t simcall, smx_process_t process); -const char* SIMIX_pre_process_get_name(smx_simcall_t simcall, smx_process_t process); -int SIMIX_pre_process_is_suspended(smx_simcall_t simcall, smx_process_t process); -xbt_dict_t SIMIX_pre_process_get_properties(smx_simcall_t simcall, smx_process_t process); -void SIMIX_pre_process_on_exit(smx_simcall_t simcall, smx_process_t process, - int_f_pvoid_pvoid_t fun, void *data); -void SIMIX_pre_process_auto_restart_set(smx_simcall_t simcall, smx_process_t process, - int auto_restart); -smx_process_t SIMIX_pre_process_restart(smx_simcall_t simcall, smx_process_t process); - SG_END_DECL() #endif diff --git a/src/simix/smx_smurf.c b/src/simix/smx_smurf.c deleted file mode 100644 index e36f6d2065..0000000000 --- a/src/simix/smx_smurf.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Copyright (c) 2010-2014. The SimGrid Team. - * All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#include "smx_private.h" -#include "xbt/fifo.h" -#include "xbt/xbt_os_thread.h" -#ifdef HAVE_MC -#include "mc/mc_private.h" -#endif - -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_smurf, simix, - "Logging specific to SIMIX (SMURF)"); - -XBT_INLINE smx_simcall_t SIMIX_simcall_mine() -{ - smx_process_t issuer = SIMIX_process_self(); - return &issuer->simcall; -} - -/** - * \brief Makes the current process do a simcall to the kernel and yields - * until completion. If the current thread is maestro, we don't yield and - * execute the simcall directly. - * \param self the current process - */ -void SIMIX_simcall_push(smx_process_t self) -{ - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - XBT_DEBUG("I'm the maestro, execute the simcall directly"); - SIMIX_simcall_pre(&self->simcall, 0); - } -} - -void SIMIX_simcall_answer(smx_simcall_t simcall) -{ - if (simcall->issuer != simix_global->maestro_process){ - XBT_DEBUG("Answer simcall %s (%d) issued by %s (%p)", SIMIX_simcall_name(simcall->call), (int)simcall->call, - simcall->issuer->name, simcall->issuer); - simcall->issuer->simcall.call = SIMCALL_NONE; -/* This check should be useless and slows everyone. Reactivate if you see something - * weird in process scheduling. - */ -/* if(!xbt_dynar_member(simix_global->process_to_run, &(simcall->issuer))) */ - xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, simcall->issuer); -/* else DIE_IMPOSSIBLE; */ - } -} - -void SIMIX_simcall_pre(smx_simcall_t simcall, int value) -{ - XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call)); - SIMCALL_SET_MC_VALUE(simcall, value); - if (simcall->issuer->context->iwannadie && simcall->call != SIMCALL_PROCESS_CLEANUP) - return; - switch (simcall->call) { -#include "simcalls_generated_case.c" - case NUM_SIMCALLS: - break; - case SIMCALL_NONE: - THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s", - SIMIX_process_get_name(simcall->issuer), - SIMIX_host_get_name(SIMIX_process_get_host(simcall->issuer)) - ); - break; - - /* ****************************************************************************************** */ - /* TUTORIAL: New API */ - /* ****************************************************************************************** */ - case SIMCALL_NEW_API_INIT: - SIMIX_pre_new_api_fct(simcall); - break; - } -} - -void SIMIX_simcall_post(smx_action_t action) -{ - switch (action->type) { - - case SIMIX_ACTION_EXECUTE: - case SIMIX_ACTION_PARALLEL_EXECUTE: - SIMIX_post_host_execute(action); - break; - - case SIMIX_ACTION_COMMUNICATE: - SIMIX_post_comm(action); - break; - - case SIMIX_ACTION_SLEEP: - SIMIX_post_process_sleep(action); - break; - - case SIMIX_ACTION_JOIN: - SIMIX_post_process_sleep(action); - break; - - case SIMIX_ACTION_SYNCHRO: - SIMIX_post_synchro(action); - break; - - case SIMIX_ACTION_IO: - SIMIX_post_io(action); - break; - - /* ****************************************************************************************** */ - /* TUTORIAL: New API */ - /* ****************************************************************************************** */ - case SIMIX_ACTION_NEW_API: - SIMIX_post_new_api(action); - break; - } -} - -/* New Simcal interface */ - -/* FIXME: add types for every simcall */ -//const char *simcall_types[NUM_SIMCALLS] = { [SIMCALL_HOST_EXECUTE] = "%s%p%f%f%p" }; -/* FIXME find a way to make this work -simcall_handler_t simcall_table[NUM_SIMCALLS] = { -#undef SIMCALL_ENUM_ELEMENT -#define SIMCALL_ENUM_ELEMENT(x,y) &y // generate strings from the enumeration values -SIMCALL_LIST -#undef SIMCALL_ENUM_ELEMENT -};*/ - -/* New Simcal interface */ - -/* FIXME: add types for every simcall */ -//const char *simcall_types[NUM_SIMCALLS] = { [SIMCALL_HOST_EXECUTE] = "%s%p%f%f%p", [SIMCALL_HOST_EXECUTION_WAIT] = "%p%p" }; - - -/*TOFIX find a way to make this work -simcall_handler_t simcall_table[NUM_SIMCALLS] = { -#undef SIMCALL_ENUM_ELEMENT -#define SIMCALL_ENUM_ELEMENT(x,y) &y // generate strings from the enumeration values -SIMCALL_LIST -#undef SIMCALL_ENUM_ELEMENT -};*/ - diff --git a/src/simix/smx_synchro.c b/src/simix/smx_synchro.c index 22e718069d..3f25efe90e 100644 --- a/src/simix/smx_synchro.c +++ b/src/simix/smx_synchro.c @@ -9,31 +9,31 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_synchro, simix, - "Logging specific to SIMIX (synchronization)"); + "SIMIX Synchronization (mutex, semaphores and conditions)"); -static smx_action_t SIMIX_synchro_wait(smx_host_t smx_host, double timeout); -static void SIMIX_synchro_finish(smx_action_t action); +static smx_synchro_t SIMIX_synchro_wait(smx_host_t smx_host, double timeout); +static void SIMIX_synchro_finish(smx_synchro_t synchro); static void _SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex, double timeout, smx_process_t issuer, smx_simcall_t simcall); static void _SIMIX_sem_wait(smx_sem_t sem, double timeout, smx_process_t issuer, smx_simcall_t simcall); -/***************************** Synchro action *********************************/ +/***************************** Raw synchronization *********************************/ -static smx_action_t SIMIX_synchro_wait(smx_host_t smx_host, double timeout) +static smx_synchro_t SIMIX_synchro_wait(smx_host_t smx_host, double timeout) { XBT_IN("(%p, %f)",smx_host,timeout); - smx_action_t action; - action = xbt_mallocator_get(simix_global->action_mallocator); - action->type = SIMIX_ACTION_SYNCHRO; - action->name = xbt_strdup("synchro"); - action->synchro.sleep = + smx_synchro_t sync; + sync = xbt_mallocator_get(simix_global->synchro_mallocator); + sync->type = SIMIX_SYNC_SYNCHRO; + sync->name = xbt_strdup("synchro"); + sync->synchro.sleep = surf_workstation_sleep(smx_host, timeout); - surf_action_set_data(action->synchro.sleep, action); + surf_action_set_data(sync->synchro.sleep, sync); XBT_OUT(); - return action; + return sync; } void SIMIX_synchro_stop_waiting(smx_process_t process, smx_simcall_t simcall) @@ -67,36 +67,36 @@ void SIMIX_synchro_stop_waiting(smx_process_t process, smx_simcall_t simcall) XBT_OUT(); } -void SIMIX_synchro_destroy(smx_action_t action) +void SIMIX_synchro_destroy(smx_synchro_t synchro) { - XBT_IN("(%p)",action); - XBT_DEBUG("Destroying synchro %p", action); - xbt_assert(action->type == SIMIX_ACTION_SYNCHRO); - surf_action_unref(action->synchro.sleep); - xbt_free(action->name); - xbt_mallocator_release(simix_global->action_mallocator, action); + XBT_IN("(%p)",synchro); + XBT_DEBUG("Destroying synchro %p", synchro); + xbt_assert(synchro->type == SIMIX_SYNC_SYNCHRO); + surf_action_unref(synchro->synchro.sleep); + xbt_free(synchro->name); + xbt_mallocator_release(simix_global->synchro_mallocator, synchro); XBT_OUT(); } -void SIMIX_post_synchro(smx_action_t action) +void SIMIX_post_synchro(smx_synchro_t synchro) { - XBT_IN("(%p)",action); - xbt_assert(action->type == SIMIX_ACTION_SYNCHRO); - if (surf_action_get_state(action->synchro.sleep) == SURF_ACTION_FAILED) - action->state = SIMIX_FAILED; - else if(surf_action_get_state(action->synchro.sleep) == SURF_ACTION_DONE) - action->state = SIMIX_SRC_TIMEOUT; - - SIMIX_synchro_finish(action); + XBT_IN("(%p)",synchro); + xbt_assert(synchro->type == SIMIX_SYNC_SYNCHRO); + if (surf_action_get_state(synchro->synchro.sleep) == SURF_ACTION_FAILED) + synchro->state = SIMIX_FAILED; + else if(surf_action_get_state(synchro->synchro.sleep) == SURF_ACTION_DONE) + synchro->state = SIMIX_SRC_TIMEOUT; + + SIMIX_synchro_finish(synchro); XBT_OUT(); } -static void SIMIX_synchro_finish(smx_action_t action) +static void SIMIX_synchro_finish(smx_synchro_t synchro) { - XBT_IN("(%p)",action); - smx_simcall_t simcall = xbt_fifo_shift(action->simcalls); + XBT_IN("(%p)",synchro); + smx_simcall_t simcall = xbt_fifo_shift(synchro->simcalls); - switch (action->state) { + switch (synchro->state) { case SIMIX_SRC_TIMEOUT: SMX_EXCEPTION(simcall->issuer, timeout_error, 0, "Synchro's wait timeout"); @@ -113,14 +113,14 @@ static void SIMIX_synchro_finish(smx_action_t action) } SIMIX_synchro_stop_waiting(simcall->issuer, simcall); - simcall->issuer->waiting_action = NULL; - SIMIX_synchro_destroy(action); + simcall->issuer->waiting_synchro = NULL; + SIMIX_synchro_destroy(synchro); SIMIX_simcall_answer(simcall); XBT_OUT(); } /*********************************** Mutex ************************************/ -smx_mutex_t SIMIX_pre_mutex_init(smx_simcall_t simcall){ +smx_mutex_t simcall_HANDLER_mutex_init(smx_simcall_t simcall){ return SIMIX_mutex_init(); } /** @@ -145,19 +145,19 @@ smx_mutex_t SIMIX_mutex_init(void) * \brief Handles a mutex lock simcall. * \param simcall the simcall */ -void SIMIX_pre_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex) +void simcall_HANDLER_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex) { XBT_IN("(%p)",simcall); /* FIXME: check where to validate the arguments */ - smx_action_t sync_act = NULL; + smx_synchro_t synchro = NULL; smx_process_t process = simcall->issuer; if (mutex->locked) { /* FIXME: check if the host is active ? */ - /* Somebody using the mutex, use a synchro action to get host failures */ - sync_act = SIMIX_synchro_wait(process->smx_host, -1); - xbt_fifo_push(sync_act->simcalls, simcall); - simcall->issuer->waiting_action = sync_act; + /* Somebody using the mutex, use a synchronization to get host failures */ + synchro = SIMIX_synchro_wait(process->smx_host, -1); + xbt_fifo_push(synchro->simcalls, simcall); + simcall->issuer->waiting_synchro = synchro; xbt_swag_insert(simcall->issuer, mutex->sleeping); } else { /* mutex free */ @@ -168,9 +168,9 @@ void SIMIX_pre_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex) XBT_OUT(); } -int SIMIX_pre_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex){ +int simcall_HANDLER_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex){ return SIMIX_mutex_trylock(mutex, simcall->issuer); -} +} /** * \brief Tries to lock a mutex. * @@ -194,7 +194,7 @@ int SIMIX_mutex_trylock(smx_mutex_t mutex, smx_process_t issuer) return 1; } -void SIMIX_pre_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex){ +void simcall_HANDLER_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex){ SIMIX_mutex_unlock(mutex, simcall->issuer); } /** @@ -219,8 +219,8 @@ void SIMIX_mutex_unlock(smx_mutex_t mutex, smx_process_t issuer) if (xbt_swag_size(mutex->sleeping) > 0) { p = xbt_swag_extract(mutex->sleeping); - SIMIX_synchro_destroy(p->waiting_action); - p->waiting_action = NULL; + SIMIX_synchro_destroy(p->waiting_synchro); + p->waiting_synchro = NULL; mutex->owner = p; SIMIX_simcall_answer(&p->simcall); } else { @@ -231,9 +231,6 @@ void SIMIX_mutex_unlock(smx_mutex_t mutex, smx_process_t issuer) XBT_OUT(); } -void SIMIX_pre_mutex_destroy(smx_simcall_t simcall, smx_mutex_t mutex){ - SIMIX_mutex_destroy(mutex); -} /** * \brief Destroys a mutex. * @@ -252,9 +249,6 @@ void SIMIX_mutex_destroy(smx_mutex_t mutex) /********************************* Condition **********************************/ -smx_cond_t SIMIX_pre_cond_init(smx_simcall_t simcall){ - return SIMIX_cond_init(); -} /** * \brief Initialize a condition. * @@ -277,7 +271,7 @@ smx_cond_t SIMIX_cond_init(void) * \brief Handle a condition waiting simcall without timeouts * \param simcall the simcall */ -void SIMIX_pre_cond_wait(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex) +void simcall_HANDLER_cond_wait(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex) { XBT_IN("(%p)",simcall); smx_process_t issuer = simcall->issuer; @@ -290,7 +284,7 @@ void SIMIX_pre_cond_wait(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mut * \brief Handle a condition waiting simcall with timeouts * \param simcall the simcall */ -void SIMIX_pre_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond, +void simcall_HANDLER_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex, double timeout) { XBT_IN("(%p)",simcall); @@ -305,7 +299,7 @@ static void _SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex, double timeout, smx_process_t issuer, smx_simcall_t simcall) { XBT_IN("(%p, %p, %f, %p,%p)",cond,mutex,timeout,issuer,simcall); - smx_action_t sync_act = NULL; + smx_synchro_t synchro = NULL; XBT_DEBUG("Wait condition %p", cond); @@ -316,16 +310,13 @@ static void _SIMIX_cond_wait(smx_cond_t cond, smx_mutex_t mutex, double timeout, SIMIX_mutex_unlock(mutex, issuer); } - sync_act = SIMIX_synchro_wait(issuer->smx_host, timeout); - xbt_fifo_unshift(sync_act->simcalls, simcall); - issuer->waiting_action = sync_act; + synchro = SIMIX_synchro_wait(issuer->smx_host, timeout); + xbt_fifo_unshift(synchro->simcalls, simcall); + issuer->waiting_synchro = synchro; xbt_swag_insert(simcall->issuer, cond->sleeping); XBT_OUT(); } -void SIMIX_pre_cond_signal(smx_simcall_t simcall, smx_cond_t cond){ - SIMIX_cond_signal(cond); -} /** * \brief Signalizes a condition. * @@ -346,9 +337,9 @@ void SIMIX_cond_signal(smx_cond_t cond) to make it acquire the mutex */ if ((proc = xbt_swag_extract(cond->sleeping))) { - /* Destroy waiter's synchro action */ - SIMIX_synchro_destroy(proc->waiting_action); - proc->waiting_action = NULL; + /* Destroy waiter's synchronization */ + SIMIX_synchro_destroy(proc->waiting_synchro); + proc->waiting_synchro = NULL; /* Now transform the cond wait simcall into a mutex lock one */ simcall = &proc->simcall; @@ -358,14 +349,11 @@ void SIMIX_cond_signal(smx_cond_t cond) mutex = simcall_cond_wait_timeout__get__mutex(simcall); simcall->call = SIMCALL_MUTEX_LOCK; - SIMIX_pre_mutex_lock(simcall, mutex); + simcall_HANDLER_mutex_lock(simcall, mutex); } XBT_OUT(); } -void SIMIX_pre_cond_broadcast(smx_simcall_t simcall, smx_cond_t cond){ - SIMIX_cond_broadcast(cond); -} /** * \brief Broadcasts a condition. * @@ -385,11 +373,8 @@ void SIMIX_cond_broadcast(smx_cond_t cond) XBT_OUT(); } -void SIMIX_pre_cond_destroy(smx_simcall_t simcall, smx_cond_t cond){ - SIMIX_cond_destroy(cond); -} /** - * \brief Destroys a contidion. + * \brief Destroys a condition. * * Destroys and frees the condition's memory. * \param cond A condition @@ -411,9 +396,6 @@ void SIMIX_cond_destroy(smx_cond_t cond) /******************************** Semaphores **********************************/ #define SMX_SEM_NOLIMIT 99999 -smx_sem_t SIMIX_pre_sem_init(smx_simcall_t simcall, unsigned int value){ - return SIMIX_sem_init(value); -} /** @brief Initialize a semaphore */ smx_sem_t SIMIX_sem_init(unsigned int value) { @@ -427,9 +409,6 @@ smx_sem_t SIMIX_sem_init(unsigned int value) return sem; } -void SIMIX_pre_sem_destroy(smx_simcall_t simcall, smx_sem_t sem){ - SIMIX_sem_destroy(sem); -} /** @brief Destroys a semaphore */ void SIMIX_sem_destroy(smx_sem_t sem) { @@ -444,7 +423,7 @@ void SIMIX_sem_destroy(smx_sem_t sem) XBT_OUT(); } -void SIMIX_pre_sem_release(smx_simcall_t simcall, smx_sem_t sem){ +void simcall_HANDLER_sem_release(smx_simcall_t simcall, smx_sem_t sem){ SIMIX_sem_release(sem); } /** @brief release the semaphore @@ -459,8 +438,8 @@ void SIMIX_sem_release(smx_sem_t sem) XBT_DEBUG("Sem release semaphore %p", sem); if ((proc = xbt_swag_extract(sem->sleeping))) { - SIMIX_synchro_destroy(proc->waiting_action); - proc->waiting_action = NULL; + SIMIX_synchro_destroy(proc->waiting_synchro); + proc->waiting_synchro = NULL; SIMIX_simcall_answer(&proc->simcall); } else if (sem->value < SMX_SEM_NOLIMIT) { sem->value++; @@ -476,7 +455,7 @@ int SIMIX_sem_would_block(smx_sem_t sem) return (sem->value <= 0); } -int SIMIX_pre_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem){ +int simcall_HANDLER_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem){ return SIMIX_sem_get_capacity(sem); } /** @brief Returns the current capacity of the semaphore */ @@ -491,13 +470,13 @@ static void _SIMIX_sem_wait(smx_sem_t sem, double timeout, smx_process_t issuer, smx_simcall_t simcall) { XBT_IN("(%p, %f, %p, %p)",sem,timeout,issuer,simcall); - smx_action_t sync_act = NULL; + smx_synchro_t synchro = NULL; XBT_DEBUG("Wait semaphore %p (timeout:%f)", sem, timeout); if (sem->value <= 0) { - sync_act = SIMIX_synchro_wait(issuer->smx_host, timeout); - xbt_fifo_unshift(sync_act->simcalls, simcall); - issuer->waiting_action = sync_act; + synchro = SIMIX_synchro_wait(issuer->smx_host, timeout); + xbt_fifo_unshift(synchro->simcalls, simcall); + issuer->waiting_synchro = synchro; xbt_swag_insert(issuer, sem->sleeping); } else { sem->value--; @@ -510,7 +489,7 @@ static void _SIMIX_sem_wait(smx_sem_t sem, double timeout, smx_process_t issuer, * \brief Handles a sem acquire simcall without timeout. * \param simcall the simcall */ -void SIMIX_pre_sem_acquire(smx_simcall_t simcall, smx_sem_t sem) +void simcall_HANDLER_sem_acquire(smx_simcall_t simcall, smx_sem_t sem) { XBT_IN("(%p)",simcall); _SIMIX_sem_wait(sem, -1, simcall->issuer, simcall); @@ -521,9 +500,12 @@ void SIMIX_pre_sem_acquire(smx_simcall_t simcall, smx_sem_t sem) * \brief Handles a sem acquire simcall with timeout. * \param simcall the simcall */ -void SIMIX_pre_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout) +void simcall_HANDLER_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout) { XBT_IN("(%p)",simcall); _SIMIX_sem_wait(sem, timeout, simcall->issuer, simcall); XBT_OUT(); } +int simcall_HANDLER_sem_would_block(smx_simcall_t simcall, smx_sem_t sem) { + return SIMIX_sem_would_block(sem); +} diff --git a/src/simix/smx_synchro_private.h b/src/simix/smx_synchro_private.h index ad411fdf73..9907e4176c 100644 --- a/src/simix/smx_synchro_private.h +++ b/src/simix/smx_synchro_private.h @@ -26,48 +26,24 @@ typedef struct s_smx_sem { xbt_swag_t sleeping; /* list of sleeping process */ } s_smx_sem_t; -void SIMIX_post_synchro(smx_action_t action); +void SIMIX_post_synchro(smx_synchro_t synchro); void SIMIX_synchro_stop_waiting(smx_process_t process, smx_simcall_t simcall); -void SIMIX_synchro_destroy(smx_action_t action); +void SIMIX_synchro_destroy(smx_synchro_t synchro); smx_mutex_t SIMIX_mutex_init(void); void SIMIX_mutex_destroy(smx_mutex_t mutex); -void SIMIX_pre_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex); int SIMIX_mutex_trylock(smx_mutex_t mutex, smx_process_t issuer); void SIMIX_mutex_unlock(smx_mutex_t mutex, smx_process_t issuer); smx_cond_t SIMIX_cond_init(void); void SIMIX_cond_destroy(smx_cond_t cond); void SIMIX_cond_signal(smx_cond_t cond); -void SIMIX_pre_cond_wait(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex); -void SIMIX_pre_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond, - smx_mutex_t mutex, double timeout); void SIMIX_cond_broadcast(smx_cond_t cond); smx_sem_t SIMIX_sem_init(unsigned int value); void SIMIX_sem_destroy(smx_sem_t sem); void SIMIX_sem_release(smx_sem_t sem); int SIMIX_sem_would_block(smx_sem_t sem); -void SIMIX_pre_sem_acquire(smx_simcall_t simcall, smx_sem_t sem); -void SIMIX_pre_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout); int SIMIX_sem_get_capacity(smx_sem_t sem); -// pre prototypes -smx_mutex_t SIMIX_pre_mutex_init(smx_simcall_t simcall); -void SIMIX_pre_mutex_destroy(smx_simcall_t simcall, smx_mutex_t mutex); -int SIMIX_pre_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex); -void SIMIX_pre_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex); -smx_cond_t SIMIX_pre_cond_init(smx_simcall_t simcall); -void SIMIX_pre_cond_destroy(smx_simcall_t simcall, smx_cond_t cond); -void SIMIX_pre_cond_signal(smx_simcall_t simcall, smx_cond_t cond); -void SIMIX_pre_cond_broadcast(smx_simcall_t simcall, smx_cond_t cond); -smx_sem_t SIMIX_pre_sem_init(smx_simcall_t simcall, unsigned int value); -void SIMIX_pre_sem_destroy(smx_simcall_t simcall, smx_sem_t sem); -void SIMIX_pre_sem_release(smx_simcall_t simcall, smx_sem_t sem); -static XBT_INLINE int SIMIX_pre_sem_would_block(smx_simcall_t simcall, - smx_sem_t sem) -{ - return SIMIX_sem_would_block(sem); -} -int SIMIX_pre_sem_get_capacity(smx_simcall_t simcall, smx_sem_t sem); #endif diff --git a/src/simix/smx_vm.c b/src/simix/smx_vm.c index d91b857b7d..d2eab043aa 100644 --- a/src/simix/smx_vm.c +++ b/src/simix/smx_vm.c @@ -34,12 +34,6 @@ smx_host_t SIMIX_vm_create(const char *name, smx_host_t ind_phys_host) } -smx_host_t SIMIX_pre_vm_create(smx_simcall_t simcall, const char *name, smx_host_t ind_phys_host) -{ - return SIMIX_vm_create(name, ind_phys_host); -} - - /* works for VMs and PMs */ static long host_get_ramsize(smx_host_t vm, int *overcommit) { @@ -103,23 +97,11 @@ void SIMIX_vm_start(smx_host_t ind_vm) } - -void SIMIX_pre_vm_start(smx_simcall_t simcall, smx_host_t ind_vm) -{ - SIMIX_vm_start(ind_vm); -} - int SIMIX_vm_get_state(smx_host_t ind_vm) { return surf_resource_get_state(surf_workstation_resource_priv(ind_vm)); } -int SIMIX_pre_vm_get_state(smx_simcall_t simcall, smx_host_t ind_vm) -{ - return SIMIX_vm_get_state(ind_vm); -} - - /** * \brief Function to migrate a SIMIX VM host. * @@ -134,12 +116,6 @@ void SIMIX_vm_migrate(smx_host_t ind_vm, smx_host_t ind_dst_pm) surf_vm_workstation_migrate(ind_vm, ind_dst_pm); } -void SIMIX_pre_vm_migrate(smx_simcall_t simcall, smx_host_t ind_vm, smx_host_t ind_dst_pm) -{ - SIMIX_vm_migrate(ind_vm, ind_dst_pm); -} - - /** * \brief Function to get the physical host of the given SIMIX VM host. * @@ -151,12 +127,6 @@ void *SIMIX_vm_get_pm(smx_host_t ind_vm) return surf_vm_workstation_get_pm(ind_vm); } -void *SIMIX_pre_vm_get_pm(smx_simcall_t simcall, smx_host_t ind_vm) -{ - return SIMIX_vm_get_pm(ind_vm); -} - - /** * \brief Function to set the CPU bound of the given SIMIX VM host. * @@ -169,12 +139,6 @@ void SIMIX_vm_set_bound(smx_host_t ind_vm, double bound) surf_vm_workstation_set_bound(ind_vm, bound); } -void SIMIX_pre_vm_set_bound(smx_simcall_t simcall, smx_host_t ind_vm, double bound) -{ - SIMIX_vm_set_bound(ind_vm, bound); -} - - /** * \brief Function to set the CPU affinity of the given SIMIX VM host. * @@ -191,11 +155,6 @@ void SIMIX_vm_set_affinity(smx_host_t ind_vm, smx_host_t ind_pm, unsigned long m surf_vm_workstation_set_affinity(ind_vm, ind_pm, mask); } -void SIMIX_pre_vm_set_affinity(smx_simcall_t simcall, smx_host_t ind_vm, smx_host_t ind_pm, unsigned long mask) -{ - SIMIX_vm_set_affinity(ind_vm, ind_pm, mask); -} - /** * \brief Function to suspend a SIMIX VM host. This function stops the execution of the @@ -225,7 +184,7 @@ void SIMIX_vm_suspend(smx_host_t ind_vm, smx_process_t issuer) XBT_DEBUG("suspend all processes on the VM done done"); } -void SIMIX_pre_vm_suspend(smx_simcall_t simcall, smx_host_t ind_vm) +void simcall_HANDLER_vm_suspend(smx_simcall_t simcall, smx_host_t ind_vm) { if (simcall->issuer->smx_host == ind_vm) { XBT_ERROR("cannot suspend the VM where I run"); @@ -234,7 +193,7 @@ void SIMIX_pre_vm_suspend(smx_simcall_t simcall, smx_host_t ind_vm) SIMIX_vm_suspend(ind_vm, simcall->issuer); - XBT_DEBUG("SIMIX_pre_vm_suspend done"); + XBT_DEBUG("simcall_HANDLER_vm_suspend done"); } @@ -263,7 +222,7 @@ void SIMIX_vm_resume(smx_host_t ind_vm, smx_process_t issuer) } } -void SIMIX_pre_vm_resume(smx_simcall_t simcall, smx_host_t ind_vm) +void simcall_HANDLER_vm_resume(smx_simcall_t simcall, smx_host_t ind_vm) { SIMIX_vm_resume(ind_vm, simcall->issuer); } @@ -296,7 +255,7 @@ void SIMIX_vm_save(smx_host_t ind_vm, smx_process_t issuer) } } -void SIMIX_pre_vm_save(smx_simcall_t simcall, smx_host_t ind_vm) +void simcall_HANDLER_vm_save(smx_simcall_t simcall, smx_host_t ind_vm) { SIMIX_vm_save(ind_vm, simcall->issuer); } @@ -327,7 +286,7 @@ void SIMIX_vm_restore(smx_host_t ind_vm, smx_process_t issuer) } } -void SIMIX_pre_vm_restore(smx_simcall_t simcall, smx_host_t ind_vm) +void simcall_HANDLER_vm_restore(smx_simcall_t simcall, smx_host_t ind_vm) { SIMIX_vm_restore(ind_vm, simcall->issuer); } @@ -361,7 +320,7 @@ void SIMIX_vm_shutdown(smx_host_t ind_vm, smx_process_t issuer) (int)SURF_VM_STATE_CREATED); } -void SIMIX_pre_vm_shutdown(smx_simcall_t simcall, smx_host_t ind_vm) +void simcall_HANDLER_vm_shutdown(smx_simcall_t simcall, smx_host_t ind_vm) { SIMIX_vm_shutdown(ind_vm, simcall->issuer); } @@ -387,8 +346,3 @@ void SIMIX_vm_destroy(smx_host_t ind_vm) /* jump to vm_ws_destroy(). The surf level resource will be freed. */ surf_vm_workstation_destroy(ind_vm); } - -void SIMIX_pre_vm_destroy(smx_simcall_t simcall, smx_host_t ind_vm) -{ - SIMIX_vm_destroy(ind_vm); -} diff --git a/src/smpi/colls/allgatherv-mpich-rdb.c b/src/smpi/colls/allgatherv-mpich-rdb.c index 58195e814d..e4edda955e 100644 --- a/src/smpi/colls/allgatherv-mpich-rdb.c +++ b/src/smpi/colls/allgatherv-mpich-rdb.c @@ -21,7 +21,7 @@ int smpi_coll_tuned_allgatherv_mpich_rdb ( MPI_Status status; MPI_Aint recvtype_extent, recvtype_true_extent, recvtype_true_lb; int curr_cnt, dst, total_count; - void *tmp_buf; + void *tmp_buf, *tmp_buf_rl; int mask, dst_tree_root, my_tree_root, position, send_offset, recv_offset, last_recv_cnt=0, nprocs_completed, k, offset, tmp_mask, tree_root; @@ -42,10 +42,10 @@ int smpi_coll_tuned_allgatherv_mpich_rdb ( smpi_datatype_extent(recvtype, &recvtype_true_lb, &recvtype_true_extent); - tmp_buf= (void*)smpi_get_tmp_sendbuffer(total_count*(max(recvtype_true_extent,recvtype_extent))); + tmp_buf_rl= (void*)smpi_get_tmp_sendbuffer(total_count*(max(recvtype_true_extent,recvtype_extent))); /* adjust for potential negative lower bound in datatype */ - tmp_buf = (void *)((char*)tmp_buf - recvtype_true_lb); + tmp_buf = (void *)((char*)tmp_buf_rl - recvtype_true_lb); /* copy local data into right location in tmp_buf */ position = 0; @@ -209,6 +209,6 @@ int smpi_coll_tuned_allgatherv_mpich_rdb ( position += recvcounts[j]; } - smpi_free_tmp_buffer(tmp_buf); + smpi_free_tmp_buffer(tmp_buf_rl); return MPI_SUCCESS; } diff --git a/src/smpi/instr_smpi.c b/src/smpi/instr_smpi.c index d067768a2f..1560ae5d07 100644 --- a/src/smpi/instr_smpi.c +++ b/src/smpi/instr_smpi.c @@ -49,6 +49,15 @@ static const char *smpi_colors[] ={ "init", "0 1 0", "finalize", "0 1 0", + + "put", "0.3 1 0", + "get", "0 1 0.3", + "accumulate", "1 0.3 0", + "win_fence", "1 0 0.3", + "win_post", "1 0 0.8", + "win_wait", "1 0.8 0", + "win_start", "0.8 0 1", + "win_complete", "0.8 1 0", NULL, NULL, }; diff --git a/src/smpi/private.h b/src/smpi/private.h index 659424dd38..7c5be9dac5 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -102,7 +102,7 @@ typedef struct s_smpi_mpi_request { int truncated; size_t real_size; MPI_Comm comm; - smx_action_t action; + smx_synchro_t action; unsigned flags; int detached; MPI_Request detached_sender; @@ -126,6 +126,12 @@ typedef struct s_smpi_mpi_type_key_elem { } s_smpi_mpi_type_key_elem_t; typedef struct s_smpi_mpi_type_key_elem *smpi_type_key_elem; +typedef struct s_smpi_mpi_info { + xbt_dict_t info_dict; + int refcount; +} s_smpi_mpi_info_t; + + void smpi_process_destroy(void); void smpi_process_finalize(void); int smpi_process_finalized(void); @@ -174,6 +180,8 @@ smx_rdv_t smpi_process_mailbox(void); smx_rdv_t smpi_process_remote_mailbox(int index); smx_rdv_t smpi_process_mailbox_small(void); smx_rdv_t smpi_process_remote_mailbox_small(int index); +xbt_mutex_t smpi_process_mailboxes_mutex(void); +xbt_mutex_t smpi_process_remote_mailboxes_mutex(int index); xbt_os_timer_t smpi_process_timer(void); void smpi_process_simulated_start(void); double smpi_process_simulated_elapsed(void); @@ -185,10 +193,10 @@ int smpi_process_get_replaying(void); void smpi_deployment_register_process(const char* instance_id, int rank, int index, MPI_Comm**, xbt_bar_t*); void smpi_deployment_cleanup_instances(void); -void smpi_comm_copy_buffer_callback(smx_action_t comm, +void smpi_comm_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t buff_size); -void smpi_comm_null_copy_buffer_callback(smx_action_t comm, +void smpi_comm_null_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t buff_size); void print_request(const char *message, MPI_Request request); @@ -235,6 +243,9 @@ void smpi_datatype_create(MPI_Datatype* new_type, int size,int lb, int ub, int h void smpi_datatype_free(MPI_Datatype* type); void smpi_datatype_commit(MPI_Datatype* datatype); +int smpi_mpi_unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm); +int smpi_mpi_pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm); + void smpi_empty_status(MPI_Status * status); MPI_Op smpi_op_new(MPI_User_function * function, int commute); int smpi_op_is_commute(MPI_Op op); @@ -288,6 +299,8 @@ int smpi_op_c2f(MPI_Op op); MPI_Op smpi_op_f2c(int op); int smpi_win_c2f(MPI_Win win); MPI_Win smpi_win_f2c(int win); +int smpi_info_c2f(MPI_Info info); +MPI_Info smpi_info_f2c(int info); MPI_Request smpi_mpi_send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm); @@ -387,6 +400,11 @@ void smpi_mpi_win_set_name(MPI_Win win, char* name); int smpi_mpi_win_fence( int assert, MPI_Win win); +int smpi_mpi_win_post(MPI_Group group, int assert, MPI_Win win); +int smpi_mpi_win_start(MPI_Group group, int assert, MPI_Win win); +int smpi_mpi_win_complete(MPI_Win win); +int smpi_mpi_win_wait(MPI_Win win); + int smpi_mpi_get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win); int smpi_mpi_put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, @@ -435,7 +453,10 @@ extern char* start_data_exe; //start of the data+bss segment of the executable extern int size_data_exe; //size of the data+bss segment of the executable -void smpi_switch_data_segment(int); +void smpi_switch_data_segment(int dest); +void smpi_really_switch_data_segment(int dest); +int smpi_is_privatisation_file(char* file); + void smpi_get_executable_global_size(void); void smpi_initialize_global_memory_segments(void); void smpi_destroy_global_memory_segments(void); @@ -544,8 +565,12 @@ void mpi_win_free_( int* win, int* ierr); void mpi_win_create_( int *base, MPI_Aint* size, int* disp_unit, int* info, int* comm, int *win, int* ierr); void mpi_win_set_name_ (int* win, char * name, int* ierr, int size); void mpi_win_get_name_ (int* win, char * name, int* len, int* ierr); +void mpi_win_post_(int* group, int assert, int* win, int* ierr); +void mpi_win_start_(int* group, int assert, int* win, int* ierr); +void mpi_win_complete_(int* win, int* ierr); +void mpi_win_wait_(int* win, int* ierr); void mpi_info_create_( int *info, int* ierr); -void mpi_info_set_( int *info, char *key, char *value, int* ierr); +void mpi_info_set_( int *info, char *key, char *value, int* ierr, unsigned int keylen, unsigned int valuelen); void mpi_info_free_(int* info, int* ierr); void mpi_get_( int *origin_addr, int* origin_count, int* origin_datatype, int* target_rank, MPI_Aint* target_disp, int* target_count, int* target_datatype, int* win, int* ierr); @@ -681,17 +706,17 @@ void mpi_comm_dup_with_info_ (int* comm, int* info, int* newcomm, int* ierr); void mpi_comm_split_type_ (int* comm, int* split_type, int* key, int* info, int*newcomm, int* ierr); void mpi_comm_set_info_ (int* comm, int* info, int* ierr); void mpi_comm_get_info_ (int* comm, int* info, int* ierr); -void mpi_info_get_ (int* info,char *key,int* valuelen, char *value, int *flag, int* ierr); +void mpi_info_get_ (int* info,char *key,int* valuelen, char *value, int *flag, int* ierr, unsigned int keylen); void mpi_comm_create_errhandler_ ( void *function, void *errhandler, int* ierr); void mpi_add_error_class_ ( int *errorclass, int* ierr); void mpi_add_error_code_ ( int* errorclass, int *errorcode, int* ierr); void mpi_add_error_string_ ( int* errorcode, char *string, int* ierr); void mpi_comm_call_errhandler_ (int* comm,int* errorcode, int* ierr); void mpi_info_dup_ (int* info, int* newinfo, int* ierr); -void mpi_info_get_valuelen_ ( int* info, char *key, int *valuelen, int *flag, int* ierr); -void mpi_info_delete_ (int* info, char *key, int* ierr); +void mpi_info_get_valuelen_ ( int* info, char *key, int *valuelen, int *flag, int* ierr, unsigned int keylen); +void mpi_info_delete_ (int* info, char *key, int* ierr, unsigned int keylen); void mpi_info_get_nkeys_ ( int* info, int *nkeys, int* ierr); -void mpi_info_get_nthkey_ ( int* info, int* n, char *key, int* ierr); +void mpi_info_get_nthkey_ ( int* info, int* n, char *key, int* ierr, unsigned int keylen); void mpi_get_version_ (int *version,int *subversion, int* ierr); void mpi_get_library_version_ (char *version,int *len, int* ierr); void mpi_request_get_status_ ( int* request, int *flag, MPI_Status* status, int* ierr); @@ -738,7 +763,7 @@ void TRACE_smpi_init(int rank); void TRACE_smpi_finalize(int rank); #endif -const char* encode_datatype(MPI_Datatype datatype); +const char* encode_datatype(MPI_Datatype datatype, int* known); // TODO, make this static and expose it more cleanly diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index dacdaf01a4..768b13b8b5 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -17,7 +17,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_base, smpi, "Logging specific to SMPI (base)"); -static int match_recv(void* a, void* b, smx_action_t ignored) { +static int match_recv(void* a, void* b, smx_synchro_t ignored) { MPI_Request ref = (MPI_Request)a; MPI_Request req = (MPI_Request)b; XBT_DEBUG("Trying to match a recv of src %d against %d, tag %d against %d",ref->src,req->src, ref->tag, req->tag); @@ -39,7 +39,7 @@ static int match_recv(void* a, void* b, smx_action_t ignored) { }else return 0; } -static int match_send(void* a, void* b,smx_action_t ignored) { +static int match_send(void* a, void* b,smx_synchro_t ignored) { MPI_Request ref = (MPI_Request)a; MPI_Request req = (MPI_Request)b; XBT_DEBUG("Trying to match a send of src %d against %d, tag %d against %d",ref->src,req->src, ref->tag, req->tag); @@ -344,19 +344,22 @@ void smpi_mpi_start(MPI_Request request) if (request->flags & RECV) { print_request("New recv", request); + + xbt_mutex_t mut=smpi_process_mailboxes_mutex(); + xbt_mutex_acquire(mut); if (request->flags & RMA || request->size < sg_cfg_get_int("smpi/async_small_thres")){ //We have to check both mailboxes (because SSEND messages are sent to the large mbox). begin with the more appropriate one : the small one. mailbox = smpi_process_mailbox_small(); - XBT_DEBUG("Is there a corresponding send already posted the small mailbox %p (in case of SSEND)?", mailbox); - smx_action_t action = simcall_comm_iprobe(mailbox, 0, request->src,request->tag, &match_recv, (void*)request); + XBT_DEBUG("Is there a corresponding send already posted in the small mailbox %p (in case of SSEND)?", mailbox); + smx_synchro_t action = simcall_comm_iprobe(mailbox, 0, request->src,request->tag, &match_recv, (void*)request); if(action ==NULL){ mailbox = smpi_process_mailbox(); XBT_DEBUG("No, nothing in the small mailbox test the other one : %p", mailbox); action = simcall_comm_iprobe(mailbox, 0, request->src,request->tag, &match_recv, (void*)request); if(action ==NULL){ - XBT_DEBUG("Still notching, switch back to the small mailbox : %p", mailbox); + XBT_DEBUG("Still nothing, switch back to the small mailbox : %p", mailbox); mailbox = smpi_process_mailbox_small(); } }else{ @@ -365,7 +368,7 @@ void smpi_mpi_start(MPI_Request request) }else{ mailbox = smpi_process_mailbox_small(); XBT_DEBUG("Is there a corresponding send already posted the small mailbox?"); - smx_action_t action = simcall_comm_iprobe(mailbox, 0, request->src,request->tag, &match_recv, (void*)request); + smx_synchro_t action = simcall_comm_iprobe(mailbox, 0, request->src,request->tag, &match_recv, (void*)request); if(action ==NULL){ XBT_DEBUG("No, nothing in the permanent receive mailbox"); @@ -393,7 +396,7 @@ void smpi_mpi_start(MPI_Request request) request, -1.0); XBT_DEBUG("recv simcall posted"); - + xbt_mutex_release(mut); } else { @@ -419,10 +422,13 @@ void smpi_mpi_start(MPI_Request request) XBT_DEBUG("sending size of %zu : sleep %f ", request->size, smpi_os(request->size)); } + xbt_mutex_t mut=smpi_process_remote_mailboxes_mutex(receiver); + xbt_mutex_acquire(mut); + if (request->flags & RMA || request->size < sg_cfg_get_int("smpi/async_small_thres")) { // eager mode mailbox = smpi_process_remote_mailbox(receiver); XBT_DEBUG("Is there a corresponding recv already posted in the large mailbox %p?", mailbox); - smx_action_t action = simcall_comm_iprobe(mailbox, 1,request->dst, request->tag, &match_send, (void*)request); + smx_synchro_t action = simcall_comm_iprobe(mailbox, 1,request->dst, request->tag, &match_send, (void*)request); if(action ==NULL){ if (! (request->flags & SSEND)){ mailbox = smpi_process_remote_mailbox_small(receiver); @@ -490,7 +496,7 @@ void smpi_mpi_start(MPI_Request request) simcall_set_category(request->action, TRACE_internal_smpi_get_category()); #endif - + xbt_mutex_release(mut); } } @@ -776,7 +782,7 @@ int smpi_mpi_testany(int count, MPI_Request requests[], int *index, *index = MPI_UNDEFINED; flag = 0; - comms = xbt_dynar_new(sizeof(smx_action_t), NULL); + comms = xbt_dynar_new(sizeof(smx_synchro_t), NULL); map = xbt_new(int, count); size = 0; for(i = 0; i < count; i++) { @@ -905,10 +911,9 @@ void smpi_mpi_wait(MPI_Request * request, MPI_Status * status) if ((*request)->action != NULL) { // this is not a detached send simcall_comm_wait((*request)->action, -1.0); -#ifdef HAVE_MC - if(MC_is_active() && (*request)->action) + + if((MC_is_active() || MC_record_replay_is_active()) && (*request)->action) (*request)->action->comm.dst_data = NULL; // dangling pointer : dst_data is freed with a wait, need to set it to NULL for system state comparison -#endif } finish_wait(request, status); @@ -927,7 +932,7 @@ int smpi_mpi_waitany(int count, MPI_Request requests[], index = MPI_UNDEFINED; if(count > 0) { // Wait for a request to complete - comms = xbt_dynar_new(sizeof(smx_action_t), NULL); + comms = xbt_dynar_new(sizeof(smx_synchro_t), NULL); map = xbt_new(int, count); size = 0; XBT_DEBUG("Wait for one of %d", count); @@ -993,7 +998,7 @@ int smpi_mpi_waitall(int count, MPI_Request requests[], } for(c = 0; c < count; c++) { - if (MC_is_active()) { + if (MC_is_active() || MC_record_replay_is_active()) { smpi_mpi_wait(&requests[c], pstat); index = c; } else { @@ -1587,4 +1592,3 @@ void smpi_mpi_exscan(void *sendbuf, void *recvbuf, int count, xbt_free(tmpbufs); xbt_free(requests); } - diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index f7b0c26c86..26f7c542ee 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -153,7 +153,7 @@ void smpi_execute_(double *duration) } void smpi_execute_flops(double flops) { - smx_action_t action; + smx_synchro_t action; smx_host_t host; host = SIMIX_host_self(); XBT_DEBUG("Handle real computation time: %f flops", flops); @@ -195,7 +195,7 @@ void smpi_bench_begin(void) { smpi_switch_data_segment(smpi_process_index()); - if(MC_is_active()) + if (MC_is_active() || MC_record_replay_is_active()) return; xbt_os_threadtimer_start(smpi_process_timer()); @@ -204,7 +204,7 @@ void smpi_bench_begin(void) void smpi_bench_end(void) { - if(MC_is_active()) + if (MC_is_active() || MC_record_replay_is_active()) return; xbt_os_timer_t timer = smpi_process_timer(); @@ -607,23 +607,29 @@ void* smpi_shared_set_call(const char* func, const char* input, void* data) { #define TOPAGE(addr) (void *)(((unsigned long)(addr) / xbt_pagesize) * xbt_pagesize) -/* - * - read the executable data+bss section addresses and sizes - * - for each process create a copy of these sections with mmap - * - store them in a dynar - * +/** Map a given SMPI privatization segment (make a SMPI process active) */ +void smpi_switch_data_segment(int dest){ + if (smpi_loaded_page==dest)//no need to switch either + return; + // So the job: + smpi_really_switch_data_segment(dest); +} -void smpi_switch_data_segment(int dest){ +/** Map a given SMPI privatization segment (make a SMPI process active) + * even if SMPI thinks it is already active + * + * When doing a state restoration, the state of the restored variables + * might not be consistent with the state of the virtual memory. + * In this case, we to change the data segment. + */ +void smpi_really_switch_data_segment(int dest) { if(size_data_exe == 0)//no need to switch return; - if (smpi_loaded_page==dest)//no need to switch either - return; - #ifdef HAVE_MMAP int i; if(smpi_loaded_page==-1){//initial switch, do the copy from the real page here @@ -641,6 +647,11 @@ void smpi_switch_data_segment(int dest){ #endif } +int smpi_is_privatisation_file(char* file) +{ + return strncmp("/dev/shm/my-buffer-", file, 19) == 0; +} + void smpi_get_executable_global_size(){ int size_bss_binary=0; int size_data_binary=0; @@ -742,8 +753,25 @@ void smpi_initialize_global_memory_segments(){ int status; int file_descriptor= mkstemp (path); - if (file_descriptor < 0) - xbt_die("Impossible to create temporary file for memory mapping"); + if (file_descriptor < 0) { + if (errno==EMFILE) { + xbt_die("Impossible to create temporary file for memory mapping: %s\n\ +The open() system call failed with the EMFILE error code (too many files). \n\n\ +This means that you reached the system limits concerning the amount of files per process. \ +This is not a surprise if you are trying to virtualize many processes on top of SMPI. \ +Don't panic -- you should simply increase your system limits and try again. \n\n\ +First, check what your limits are:\n\ + cat /proc/sys/fs/file-max # Gives you the system-wide limit\n\ + ulimit -Hn # Gives you the per process hard limit\n\ + ulimit -Sn # Gives you the per process soft limit\n\ + cat /proc/self/limits # Displays any per-process limitation (including the one given above)\n\n\ +If one of these values is less than the amount of MPI processes that you try to run, then you got the explanation of this error. \ +Ask the Internet about tutorials on how to increase the files limit such as: https://rtcamp.com/tutorials/linux/increase-open-files-limit/", + strerror(errno)); + } + xbt_die("Impossible to create temporary file for memory mapping: %s", + strerror(errno)); + } status = unlink (path); if (status) diff --git a/src/smpi/smpi_comm.c b/src/smpi/smpi_comm.c index 4c0283725b..c06b16d9f0 100644 --- a/src/smpi/smpi_comm.c +++ b/src/smpi/smpi_comm.c @@ -17,8 +17,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_comm, smpi, "Logging specific to SMPI (comm)"); -//number of bytes to hold an int converted in char* -#define INTSIZEDCHAR (sizeof(int)*CHAR_BIT-1)/3 + 3 xbt_dict_t smpi_comm_keyvals = NULL; int comm_keyval_id=MPI_TAG_UB+1;//avoid collisions @@ -123,16 +121,16 @@ int smpi_comm_dup(MPI_Comm comm, MPI_Comm* newcomm){ void* value_in; void* value_out; xbt_dict_foreach(comm->attributes, cursor, key, value_in){ - smpi_comm_key_elem elem = xbt_dict_get_or_null(smpi_comm_keyvals, (const char*)key); + smpi_comm_key_elem elem = xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)key, sizeof(int)); if(elem && elem->copy_fn!=MPI_NULL_COPY_FN){ - ret = elem->copy_fn(comm, atoi((const char*)key), NULL, value_in, &value_out, &flag ); + ret = elem->copy_fn(comm, *key, NULL, value_in, &value_out, &flag ); if(ret!=MPI_SUCCESS){ smpi_comm_destroy(*newcomm); *newcomm=MPI_COMM_NULL; return ret; } if(flag) - xbt_dict_set((*newcomm)->attributes, (const char*)key,value_out, NULL); + xbt_dict_set_ext((*newcomm)->attributes, (const char*)key, sizeof(int),value_out, NULL); } } } @@ -337,7 +335,7 @@ void smpi_comm_unuse(MPI_Comm comm){ xbt_dict_foreach(comm->attributes, cursor, key, value){ smpi_comm_key_elem elem = xbt_dict_get_or_null(smpi_comm_keyvals, (const char*)key); if(elem && elem->delete_fn) - elem->delete_fn(comm, atoi((const char*)key), value, &flag); + elem->delete_fn(comm, *key, value, &flag); } } xbt_free(comm); @@ -388,7 +386,7 @@ void smpi_comm_init_smp(MPI_Comm comm){ int i =0; int min_index=INT_MAX;//the minimum index will be the leader - msg_process_t process = NULL; + smx_process_t process = NULL; xbt_swag_foreach(process, process_list) { //is_in_comm=0; int index = SIMIX_process_get_PID(process) -1; @@ -536,9 +534,7 @@ void smpi_comm_init_smp(MPI_Comm comm){ } int smpi_comm_attr_delete(MPI_Comm comm, int keyval){ - char* tmpkey=xbt_malloc(INTSIZEDCHAR); - sprintf(tmpkey, "%d", keyval); - smpi_comm_key_elem elem = xbt_dict_get_or_null(smpi_comm_keyvals, (const char*)tmpkey); + smpi_comm_key_elem elem = xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)&keyval, sizeof(int)); if(!elem) return MPI_ERR_ARG; if(elem->delete_fn!=MPI_NULL_DELETE_FN){ @@ -552,15 +548,12 @@ int smpi_comm_attr_delete(MPI_Comm comm, int keyval){ if(comm->attributes==NULL) return MPI_ERR_ARG; - xbt_dict_remove(comm->attributes, (const char*)tmpkey); - xbt_free(tmpkey); + xbt_dict_remove_ext(comm->attributes, (const char*)&keyval, sizeof(int)); return MPI_SUCCESS; } int smpi_comm_attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag){ - char* tmpkey=xbt_malloc(INTSIZEDCHAR); - sprintf(tmpkey, "%d", keyval); - smpi_comm_key_elem elem = xbt_dict_get_or_null(smpi_comm_keyvals, (const char*)tmpkey); + smpi_comm_key_elem elem = xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)&keyval, sizeof(int)); if(!elem) return MPI_ERR_ARG; xbt_ex_t ex; @@ -569,23 +562,20 @@ int smpi_comm_attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag){ return MPI_SUCCESS; } TRY { - *(void**)attr_value = xbt_dict_get(comm->attributes, (const char*)tmpkey); + *(void**)attr_value = xbt_dict_get_ext(comm->attributes, (const char*)&keyval, sizeof(int)); *flag=1; } CATCH(ex) { *flag=0; xbt_ex_free(ex); } - xbt_free(tmpkey); return MPI_SUCCESS; } int smpi_comm_attr_put(MPI_Comm comm, int keyval, void* attr_value){ if(!smpi_comm_keyvals) smpi_comm_keyvals = xbt_dict_new(); - char* tmpkey=xbt_malloc(INTSIZEDCHAR); - sprintf(tmpkey, "%d", keyval); - smpi_comm_key_elem elem = xbt_dict_get_or_null(smpi_comm_keyvals, (const char*)tmpkey); + smpi_comm_key_elem elem = xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)&keyval, sizeof(int)); if(!elem ) return MPI_ERR_ARG; int flag; @@ -598,8 +588,7 @@ int smpi_comm_attr_put(MPI_Comm comm, int keyval, void* attr_value){ if(comm->attributes==NULL) comm->attributes=xbt_dict_new(); - xbt_dict_set(comm->attributes, (const char*)tmpkey, attr_value, NULL); - xbt_free(tmpkey); + xbt_dict_set_ext(comm->attributes, (const char*)&keyval, sizeof(int), attr_value, NULL); return MPI_SUCCESS; } @@ -614,25 +603,18 @@ int smpi_comm_keyval_create(MPI_Comm_copy_attr_function* copy_fn, MPI_Comm_delet value->delete_fn=delete_fn; *keyval = comm_keyval_id; - char* tmpkey=xbt_malloc(INTSIZEDCHAR); - sprintf(tmpkey, "%d", *keyval); - xbt_dict_set(smpi_comm_keyvals,(const char*)tmpkey,(void*)value, NULL); + xbt_dict_set_ext(smpi_comm_keyvals, (const char*)keyval, sizeof(int),(void*)value, NULL); comm_keyval_id++; - xbt_free(tmpkey); return MPI_SUCCESS; } int smpi_comm_keyval_free(int* keyval){ - char* tmpkey=xbt_malloc(INTSIZEDCHAR); - sprintf(tmpkey, "%d", *keyval); - smpi_comm_key_elem elem = xbt_dict_get_or_null(smpi_comm_keyvals, (const char*)tmpkey); + smpi_comm_key_elem elem = xbt_dict_get_or_null_ext(smpi_comm_keyvals, (const char*)keyval, sizeof(int)); if(!elem){ - xbt_free(tmpkey); return MPI_ERR_ARG; } - xbt_dict_remove(smpi_comm_keyvals, (const char*)tmpkey); + xbt_dict_remove_ext(smpi_comm_keyvals, (const char*)keyval, sizeof(int)); xbt_free(elem); - xbt_free(tmpkey); return MPI_SUCCESS; } diff --git a/src/smpi/smpi_f77.c b/src/smpi/smpi_f77.c index a6f528f94a..b044802389 100644 --- a/src/smpi/smpi_f77.c +++ b/src/smpi/smpi_f77.c @@ -16,6 +16,8 @@ static xbt_dict_t request_lookup = NULL; static xbt_dict_t datatype_lookup = NULL; static xbt_dict_t op_lookup = NULL; static xbt_dict_t win_lookup = NULL; +static xbt_dict_t info_lookup = NULL; + static int running_processes = 0; #if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__) @@ -191,7 +193,27 @@ static void free_win(int win) { } -void mpi_init_(int* ierr) { +int smpi_info_c2f(MPI_Info info) { + static int info_id = 0; + char key[KEY_SIZE]; + xbt_dict_set(info_lookup, get_key(key, info_id), info, NULL); + info_id++; + return info_id-1; +} + +MPI_Info smpi_info_f2c(int info) { + char key[KEY_SIZE]; + return info >= 0 + ? (MPI_Info)xbt_dict_get_or_null(info_lookup, get_key(key, info)) + : MPI_INFO_NULL; +} + +static void free_info(int info) { + char key[KEY_SIZE]; + xbt_dict_remove(info_lookup, get_key(key, info)); +} + +static void smpi_init_fortran_types(){ if(!comm_lookup){ comm_lookup = xbt_dict_new_homogeneous(NULL); smpi_comm_c2f(MPI_COMM_WORLD); @@ -199,6 +221,7 @@ void mpi_init_(int* ierr) { request_lookup = xbt_dict_new_homogeneous(NULL); datatype_lookup = xbt_dict_new_homogeneous(NULL); win_lookup = xbt_dict_new_homogeneous(NULL); + info_lookup = xbt_dict_new_homogeneous(NULL); smpi_type_c2f(MPI_BYTE); smpi_type_c2f(MPI_CHAR); #if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__) @@ -250,6 +273,11 @@ void mpi_init_(int* ierr) { smpi_op_c2f(MPI_BOR); smpi_op_c2f(MPI_BXOR); } +} + + +void mpi_init_(int* ierr) { + smpi_init_fortran_types(); *ierr = MPI_Init(NULL, NULL); running_processes++; } @@ -714,13 +742,35 @@ void mpi_win_free_( int* win, int* ierr){ void mpi_win_create_( int *base, MPI_Aint* size, int* disp_unit, int* info, int* comm, int *win, int* ierr){ MPI_Win tmp; - *ierr = MPI_Win_create( (void*)base, *size, *disp_unit, *(MPI_Info*)info, smpi_comm_f2c(*comm),&tmp); + *ierr = MPI_Win_create( (void*)base, *size, *disp_unit, smpi_info_f2c(*info), smpi_comm_f2c(*comm),&tmp); if(*ierr == MPI_SUCCESS) { *win = smpi_win_c2f(tmp); } } +void mpi_win_post_(int* group, int assert, int* win, int* ierr){ + *ierr = MPI_Win_post(smpi_group_f2c(*group), assert, smpi_win_f2c(*win)); +} + +void mpi_win_start_(int* group, int assert, int* win, int* ierr){ + *ierr = MPI_Win_start(smpi_group_f2c(*group), assert, smpi_win_f2c(*win)); +} + +void mpi_win_complete_(int* win, int* ierr){ + *ierr = MPI_Win_complete(smpi_win_f2c(*win)); +} + +void mpi_win_wait_(int* win, int* ierr){ + *ierr = MPI_Win_wait(smpi_win_f2c(*win)); +} + void mpi_win_set_name_ (int* win, char * name, int* ierr, int size){ + //handle trailing blanks + while(name[size-1]==' ')size--; + while(*name==' '){//handle leading blanks + size --; + name++; + } char* tname = xbt_malloc((size+1)*sizeof(char)); strncpy(tname, name, size); tname[size]='\0'; @@ -734,15 +784,58 @@ void mpi_win_get_name_ (int* win, char * name, int* len, int* ierr){ } void mpi_info_create_( int *info, int* ierr){ - *ierr = MPI_Info_create( (MPI_Info *)info); + MPI_Info tmp; + *ierr = MPI_Info_create(&tmp); + if(*ierr == MPI_SUCCESS) { + *info = smpi_info_c2f(tmp); + } } -void mpi_info_set_( int *info, char *key, char *value, int* ierr){ - *ierr = MPI_Info_set( *(MPI_Info *)info, key, value); +void mpi_info_set_( int *info, char *key, char *value, int* ierr, unsigned int keylen, unsigned int valuelen){ + //handle trailing blanks + while(key[keylen-1]==' ')keylen--; + while(*key==' '){//handle leading blanks + keylen --; + key++; + } + char* tkey = xbt_malloc((keylen+1)*sizeof(char)); + strncpy(tkey, key, keylen); + tkey[keylen]='\0'; + + while(value[valuelen-1]==' ')valuelen--; + while(*value==' '){//handle leading blanks + valuelen --; + value++; + } + char* tvalue = xbt_malloc((valuelen+1)*sizeof(char)); + strncpy(tvalue, value, valuelen); + + tvalue[valuelen]='\0'; + *ierr = MPI_Info_set( smpi_info_f2c(*info), tkey, tvalue); + xbt_free(tkey); +} + +void mpi_info_get_ (int* info,char *key,int* valuelen, char *value, int *flag, int* ierr, unsigned int keylen ){ + while(key[keylen-1]==' ')keylen--; + while(*key==' '){//handle leading blanks + keylen --; + key++; + } char* tkey = xbt_malloc((keylen+1)*sizeof(char)); + strncpy(tkey, key, keylen); + tkey[keylen]='\0'; + *ierr = MPI_Info_get(smpi_info_f2c(*info),tkey,*valuelen, value, flag); + xbt_free(tkey); + int i = 0; + for (i=strlen(value); i<*valuelen; i++) + value[i]=' '; } void mpi_info_free_(int* info, int* ierr){ - *ierr = MPI_Info_free((MPI_Info *) info); + MPI_Info tmp = smpi_info_f2c(*info); + *ierr = MPI_Info_free(&tmp); + if(*ierr == MPI_SUCCESS) { + free_info(*info); + } } void mpi_get_( int *origin_addr, int* origin_count, int* origin_datatype, int *target_rank, @@ -771,52 +864,9 @@ void mpi_finalized_ (int * flag, int* ierr){ } void mpi_init_thread_ (int* required, int *provided, int* ierr){ - if(!comm_lookup){ - comm_lookup = xbt_dict_new_homogeneous(NULL); - smpi_comm_c2f(MPI_COMM_WORLD); - group_lookup = xbt_dict_new_homogeneous(NULL); - - request_lookup = xbt_dict_new_homogeneous(NULL); - - datatype_lookup = xbt_dict_new_homogeneous(NULL); - smpi_type_c2f(MPI_BYTE); - smpi_type_c2f(MPI_CHAR); - smpi_type_c2f(MPI_INT); - smpi_type_c2f(MPI_INT); - smpi_type_c2f(MPI_INT8_T); - smpi_type_c2f(MPI_INT16_T); - smpi_type_c2f(MPI_INT32_T); - smpi_type_c2f(MPI_INT64_T); - smpi_type_c2f(MPI_FLOAT); - smpi_type_c2f(MPI_FLOAT); - smpi_type_c2f(MPI_DOUBLE); - smpi_type_c2f(MPI_DOUBLE); - smpi_type_c2f(MPI_C_FLOAT_COMPLEX); - smpi_type_c2f(MPI_C_DOUBLE_COMPLEX); - smpi_type_c2f(MPI_2INT); - smpi_type_c2f(MPI_UINT8_T); - smpi_type_c2f(MPI_UINT16_T); - smpi_type_c2f(MPI_UINT32_T); - smpi_type_c2f(MPI_UINT64_T); - smpi_type_c2f(MPI_2FLOAT); - smpi_type_c2f(MPI_2DOUBLE); - - op_lookup = xbt_dict_new_homogeneous( NULL); - smpi_op_c2f(MPI_MAX); - smpi_op_c2f(MPI_MIN); - smpi_op_c2f(MPI_MAXLOC); - smpi_op_c2f(MPI_MINLOC); - smpi_op_c2f(MPI_SUM); - smpi_op_c2f(MPI_PROD); - smpi_op_c2f(MPI_LAND); - smpi_op_c2f(MPI_LOR); - smpi_op_c2f(MPI_LXOR); - smpi_op_c2f(MPI_BAND); - smpi_op_c2f(MPI_BOR); - smpi_op_c2f(MPI_BXOR); - } - - *ierr = MPI_Init_thread(NULL, NULL,*required, provided); + smpi_init_fortran_types(); + *ierr = MPI_Init_thread(NULL, NULL,*required, provided); + running_processes++; } void mpi_query_thread_ (int *provided, int* ierr){ @@ -1502,7 +1552,7 @@ void mpi_comm_set_name_ (int* comm, char* name, int* ierr, int size){ void mpi_comm_dup_with_info_ (int* comm, int* info, int* newcomm, int* ierr){ MPI_Comm tmp; - *ierr = MPI_Comm_dup_with_info(smpi_comm_f2c(*comm),*(MPI_Info*)info,&tmp); + *ierr = MPI_Comm_dup_with_info(smpi_comm_f2c(*comm),smpi_info_f2c(*info),&tmp); if(*ierr == MPI_SUCCESS) { *newcomm = smpi_comm_c2f(tmp); } @@ -1510,23 +1560,24 @@ void mpi_comm_dup_with_info_ (int* comm, int* info, int* newcomm, int* ierr){ void mpi_comm_split_type_ (int* comm, int* split_type, int* key, int* info, int* newcomm, int* ierr){ MPI_Comm tmp; - *ierr = MPI_Comm_split_type(smpi_comm_f2c(*comm), *split_type, *key, *(MPI_Info*)info, &tmp); + *ierr = MPI_Comm_split_type(smpi_comm_f2c(*comm), *split_type, *key, smpi_info_f2c(*info), &tmp); if(*ierr == MPI_SUCCESS) { *newcomm = smpi_comm_c2f(tmp); } } void mpi_comm_set_info_ (int* comm, int* info, int* ierr){ - *ierr = MPI_Comm_set_info (smpi_comm_f2c(*comm), *(MPI_Info*)info); + *ierr = MPI_Comm_set_info (smpi_comm_f2c(*comm), smpi_info_f2c(*info)); } void mpi_comm_get_info_ (int* comm, int* info, int* ierr){ - *ierr = MPI_Comm_get_info (smpi_comm_f2c(*comm), (MPI_Info*)info); + MPI_Info tmp; + *ierr = MPI_Comm_get_info (smpi_comm_f2c(*comm), &tmp); + if(*ierr==MPI_SUCCESS){ + *info = smpi_info_c2f(tmp); + } } -void mpi_info_get_ (int* info,char *key,int* valuelen, char *value, int *flag, int* ierr){ - *ierr = MPI_Info_get(*(MPI_Info*)info,key,*valuelen, value, flag); -} void mpi_comm_create_errhandler_ ( void *function, void *errhandler, int* ierr){ *ierr = MPI_Comm_create_errhandler( (MPI_Comm_errhandler_fn*) function, (MPI_Errhandler*)errhandler); @@ -1549,23 +1600,48 @@ void mpi_comm_call_errhandler_ (int* comm,int* errorcode, int* ierr){ } void mpi_info_dup_ (int* info, int* newinfo, int* ierr){ - *ierr = MPI_Info_dup(*(MPI_Info*)info, (MPI_Info*)newinfo); -} - -void mpi_info_get_valuelen_ ( int* info, char *key, int *valuelen, int *flag, int* ierr){ - *ierr = MPI_Info_get_valuelen( *(MPI_Info*)info, key, valuelen, flag); + MPI_Info tmp; + *ierr = MPI_Info_dup(smpi_info_f2c(*info), &tmp); + if(*ierr==MPI_SUCCESS){ + *newinfo= smpi_info_c2f(tmp); + } } -void mpi_info_delete_ (int* info, char *key, int* ierr){ - *ierr = MPI_Info_delete(*(MPI_Info*)info, key); +void mpi_info_get_valuelen_ ( int* info, char *key, int *valuelen, int *flag, int* ierr, unsigned int keylen){ + while(key[keylen-1]==' ')keylen--; + while(*key==' '){//handle leading blanks + keylen --; + key++; + } + char* tkey = xbt_malloc((keylen+1)*sizeof(char)); + strncpy(tkey, key, keylen); + tkey[keylen]='\0'; + *ierr = MPI_Info_get_valuelen( smpi_info_f2c(*info), tkey, valuelen, flag); + xbt_free(tkey); +} + +void mpi_info_delete_ (int* info, char *key, int* ierr, unsigned int keylen){ + while(key[keylen-1]==' ')keylen--; + while(*key==' '){//handle leading blanks + keylen --; + key++; + } + char* tkey = xbt_malloc((keylen+1)*sizeof(char)); + strncpy(tkey, key, keylen); + tkey[keylen]='\0'; + *ierr = MPI_Info_delete(smpi_info_f2c(*info), tkey); + xbt_free(tkey); } void mpi_info_get_nkeys_ ( int* info, int *nkeys, int* ierr){ - *ierr = MPI_Info_get_nkeys( *(MPI_Info*)info, nkeys); + *ierr = MPI_Info_get_nkeys( smpi_info_f2c(*info), nkeys); } -void mpi_info_get_nthkey_ ( int* info, int* n, char *key, int* ierr){ - *ierr = MPI_Info_get_nthkey( *(MPI_Info*)info, *n, key); +void mpi_info_get_nthkey_ ( int* info, int* n, char *key, int* ierr, unsigned int keylen){ + *ierr = MPI_Info_get_nthkey( smpi_info_f2c(*info), *n, key); + int i = 0; + for (i=strlen(key); iargv = argv; // set the process attached to the mailbox simcall_rdv_set_receiver(data->mailbox_small, proc); - XBT_DEBUG("<%d> New process in the game: %p", index, proc); if(smpi_privatize_global_variables){ @@ -135,7 +136,7 @@ void smpi_process_finalize(void) { // This leads to an explosion of the search graph // which cannot be reduced: - if(MC_is_active()) + if(MC_is_active() || MC_record_replay_is_active()) return; int index = smpi_process_index(); @@ -254,6 +255,12 @@ smx_rdv_t smpi_process_mailbox_small(void) return data->mailbox_small; } +xbt_mutex_t smpi_process_mailboxes_mutex(void) +{ + smpi_process_data_t data = smpi_process_data(); + return data->mailboxes_mutex; +} + smx_rdv_t smpi_process_remote_mailbox(int index) { smpi_process_data_t data = smpi_process_remote_data(index); @@ -267,6 +274,12 @@ smx_rdv_t smpi_process_remote_mailbox_small(int index) return data->mailbox_small; } +xbt_mutex_t smpi_process_remote_mailboxes_mutex(int index) +{ + smpi_process_data_t data = smpi_process_remote_data(index); + return data->mailboxes_mutex; +} + xbt_os_timer_t smpi_process_timer(void) { smpi_process_data_t data = smpi_process_data(); @@ -330,7 +343,7 @@ void print_request(const char *message, MPI_Request request) request->dst, request->tag, request->flags); } -void smpi_comm_copy_buffer_callback(smx_action_t comm, +void smpi_comm_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t buff_size) { XBT_DEBUG("Copy the data over"); @@ -373,7 +386,7 @@ void smpi_comm_copy_buffer_callback(smx_action_t comm, } -void smpi_comm_null_copy_buffer_callback(smx_action_t comm, +void smpi_comm_null_copy_buffer_callback(smx_synchro_t comm, void *buff, size_t buff_size) { return; @@ -404,8 +417,10 @@ void smpi_global_init(void) char name[MAILBOX_NAME_MAXLEN]; int smpirun=0; - global_timer = xbt_os_timer_new(); - xbt_os_walltimer_start(global_timer); + if (!MC_is_active()) { + global_timer = xbt_os_timer_new(); + xbt_os_walltimer_start(global_timer); + } if (process_count == 0){ process_count = SIMIX_process_count(); smpirun=1; @@ -419,6 +434,7 @@ void smpi_global_init(void) process_data[i]->mailbox = simcall_rdv_create(get_mailbox_name(name, i)); process_data[i]->mailbox_small = simcall_rdv_create(get_mailbox_name_small(name, i)); + process_data[i]->mailboxes_mutex=xbt_mutex_init(); process_data[i]->timer = xbt_os_timer_new(); if (MC_is_active()) MC_ignore_heap(process_data[i]->timer, xbt_os_timer_size()); @@ -472,6 +488,7 @@ void smpi_global_destroy(void) xbt_os_timer_free(process_data[i]->timer); simcall_rdv_destroy(process_data[i]->mailbox); simcall_rdv_destroy(process_data[i]->mailbox_small); + xbt_mutex_destroy(process_data[i]->mailboxes_mutex); xbt_free(process_data[i]); } xbt_free(process_data); @@ -652,22 +669,24 @@ int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[]) fflush(stdout); fflush(stderr); - if (MC_is_active()) + if (MC_is_active()) { MC_do_the_modelcheck_for_real(); - else + } else { + SIMIX_run(); - xbt_os_walltimer_stop(global_timer); - if (sg_cfg_get_boolean("smpi/display_timing")){ - double global_time = xbt_os_timer_elapsed(global_timer); - XBT_INFO("Simulated time: %g seconds. \n " - "The simulation took %g seconds (after parsing and platform setup)\n" - "%g seconds were actual computation of the application" - , SIMIX_get_clock(), global_time , smpi_total_benched_time); - - if (smpi_total_benched_time/global_time>=0.75) - XBT_INFO("More than 75%% of the time was spent inside the application code.\n" - "You may want to use sampling functions or trace replay to reduce this."); + xbt_os_walltimer_stop(global_timer); + if (sg_cfg_get_boolean("smpi/display_timing")){ + double global_time = xbt_os_timer_elapsed(global_timer); + XBT_INFO("Simulated time: %g seconds. \n " + "The simulation took %g seconds (after parsing and platform setup)\n" + "%g seconds were actual computation of the application" + , SIMIX_get_clock(), global_time , smpi_total_benched_time); + + if (smpi_total_benched_time/global_time>=0.75) + XBT_INFO("More than 75%% of the time was spent inside the application code.\n" + "You may want to use sampling functions or trace replay to reduce this."); + } } smpi_global_destroy(); diff --git a/src/smpi/smpi_mpi_dt.c b/src/smpi/smpi_mpi_dt.c index 047cf91d8d..4692a2bd19 100644 --- a/src/smpi/smpi_mpi_dt.c +++ b/src/smpi/smpi_mpi_dt.c @@ -20,7 +20,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_mpi_dt, smpi, "Logging specific to SMPI (datatype)"); -#define INTSIZEDCHAR (sizeof(int)*CHAR_BIT-1)/3 + 3 xbt_dict_t smpi_type_keyvals = NULL; int type_keyval_id=0;//avoid collisions @@ -132,6 +131,7 @@ CREATE_MPI_DATATYPE(MPI_2FLOAT, float_float); CREATE_MPI_DATATYPE(MPI_2DOUBLE, double_double); CREATE_MPI_DATATYPE(MPI_2LONG, long_long); +CREATE_MPI_DATATYPE(MPI_REAL, float); CREATE_MPI_DATATYPE(MPI_REAL4, float); CREATE_MPI_DATATYPE(MPI_REAL8, float); CREATE_MPI_DATATYPE(MPI_REAL16, double); @@ -148,7 +148,7 @@ CREATE_MPI_DATATYPE(MPI_LONG_DOUBLE_INT, long_double_int); CREATE_MPI_DATATYPE_NULL(MPI_UB); CREATE_MPI_DATATYPE_NULL(MPI_LB); -CREATE_MPI_DATATYPE_NULL(MPI_PACKED); +CREATE_MPI_DATATYPE(MPI_PACKED, char); // Internal use only CREATE_MPI_DATATYPE(MPI_PTR, void*); @@ -194,15 +194,15 @@ int smpi_datatype_dup(MPI_Datatype datatype, MPI_Datatype* new_t) void* value_in; void* value_out; xbt_dict_foreach(datatype->attributes, cursor, key, value_in){ - smpi_type_key_elem elem = xbt_dict_get_or_null(smpi_type_keyvals, (const char*)key); + smpi_type_key_elem elem = xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)key, sizeof(int)); if(elem && elem->copy_fn!=MPI_NULL_COPY_FN){ - ret = elem->copy_fn(datatype, atoi((const char*)key), NULL, value_in, &value_out, &flag ); + ret = elem->copy_fn(datatype, *key, NULL, value_in, &value_out, &flag ); if(ret!=MPI_SUCCESS){ *new_t=MPI_DATATYPE_NULL; return ret; } if(flag) - xbt_dict_set((*new_t)->attributes, (const char*)key,value_out, NULL); + xbt_dict_set_ext((*new_t)->attributes, (const char*)key, sizeof(int),value_out, NULL); } } } @@ -258,12 +258,12 @@ int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype, else if (sendtype->has_subtype == 0) { s_smpi_subtype_t *subtype = recvtype->substruct; - subtype->unserialize( sendbuf, recvbuf,1, subtype, MPI_REPLACE); + subtype->unserialize( sendbuf, recvbuf, recvcount/smpi_datatype_size(recvtype), subtype, MPI_REPLACE); } else if (recvtype->has_subtype == 0) { s_smpi_subtype_t *subtype = sendtype->substruct; - subtype->serialize(sendbuf, recvbuf,1, subtype); + subtype->serialize(sendbuf, recvbuf, sendcount/smpi_datatype_size(sendtype), subtype); }else{ s_smpi_subtype_t *subtype = sendtype->substruct; @@ -410,9 +410,9 @@ void smpi_datatype_free(MPI_Datatype* type){ void * value; int flag; xbt_dict_foreach((*type)->attributes, cursor, key, value){ - smpi_type_key_elem elem = xbt_dict_get_or_null(smpi_type_keyvals, (const char*)key); + smpi_type_key_elem elem = xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)key, sizeof(int)); if(elem && elem->delete_fn) - elem->delete_fn(*type, atoi((const char*)key), value, &flag); + elem->delete_fn(*type,*key, value, &flag); } } @@ -1670,9 +1670,7 @@ void smpi_op_apply(MPI_Op op, void *invec, void *inoutvec, int *len, } int smpi_type_attr_delete(MPI_Datatype type, int keyval){ - char* tmpkey=xbt_malloc(INTSIZEDCHAR); - sprintf(tmpkey, "%d", keyval); - smpi_type_key_elem elem = xbt_dict_get_or_null(smpi_type_keyvals, (const char*)tmpkey); + smpi_type_key_elem elem = xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)); if(!elem) return MPI_ERR_ARG; if(elem->delete_fn!=MPI_NULL_DELETE_FN){ @@ -1686,15 +1684,12 @@ int smpi_type_attr_delete(MPI_Datatype type, int keyval){ if(type->attributes==NULL) return MPI_ERR_ARG; - xbt_dict_remove(type->attributes, (const char*)tmpkey); - xbt_free(tmpkey); + xbt_dict_remove_ext(type->attributes, (const char*)&keyval, sizeof(int)); return MPI_SUCCESS; } int smpi_type_attr_get(MPI_Datatype type, int keyval, void* attr_value, int* flag){ - char* tmpkey=xbt_malloc(INTSIZEDCHAR); - sprintf(tmpkey, "%d", keyval); - smpi_type_key_elem elem = xbt_dict_get_or_null(smpi_type_keyvals, (const char*)tmpkey); + smpi_type_key_elem elem = xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)); if(!elem) return MPI_ERR_ARG; xbt_ex_t ex; @@ -1703,23 +1698,20 @@ int smpi_type_attr_get(MPI_Datatype type, int keyval, void* attr_value, int* fla return MPI_SUCCESS; } TRY { - *(void**)attr_value = xbt_dict_get(type->attributes, (const char*)tmpkey); + *(void**)attr_value = xbt_dict_get_ext(type->attributes, (const char*)&keyval, sizeof(int)); *flag=1; } CATCH(ex) { *flag=0; xbt_ex_free(ex); } - xbt_free(tmpkey); return MPI_SUCCESS; } int smpi_type_attr_put(MPI_Datatype type, int keyval, void* attr_value){ if(!smpi_type_keyvals) smpi_type_keyvals = xbt_dict_new(); - char* tmpkey=xbt_malloc(INTSIZEDCHAR); - sprintf(tmpkey, "%d", keyval); - smpi_type_key_elem elem = xbt_dict_get_or_null(smpi_type_keyvals, (const char*)tmpkey); + smpi_type_key_elem elem = xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)&keyval, sizeof(int)); if(!elem ) return MPI_ERR_ARG; int flag; @@ -1732,8 +1724,7 @@ int smpi_type_attr_put(MPI_Datatype type, int keyval, void* attr_value){ if(type->attributes==NULL) type->attributes=xbt_dict_new(); - xbt_dict_set(type->attributes, (const char*)tmpkey, attr_value, NULL); - xbt_free(tmpkey); + xbt_dict_set_ext(type->attributes, (const char*)&keyval, sizeof(int), attr_value, NULL); return MPI_SUCCESS; } @@ -1748,24 +1739,38 @@ int smpi_type_keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delet value->delete_fn=delete_fn; *keyval = type_keyval_id; - char* tmpkey=xbt_malloc(INTSIZEDCHAR); - sprintf(tmpkey, "%d", *keyval); - xbt_dict_set(smpi_type_keyvals,(const char*)tmpkey,(void*)value, NULL); + xbt_dict_set_ext(smpi_type_keyvals,(const char*)keyval, sizeof(int),(void*)value, NULL); type_keyval_id++; - xbt_free(tmpkey); return MPI_SUCCESS; } int smpi_type_keyval_free(int* keyval){ - char* tmpkey=xbt_malloc(INTSIZEDCHAR); - sprintf(tmpkey, "%d", *keyval); - smpi_type_key_elem elem = xbt_dict_get_or_null(smpi_type_keyvals, (const char*)tmpkey); + smpi_type_key_elem elem = xbt_dict_get_or_null_ext(smpi_type_keyvals, (const char*)keyval, sizeof(int)); if(!elem){ - xbt_free(tmpkey); return MPI_ERR_ARG; } - xbt_dict_remove(smpi_type_keyvals, (const char*)tmpkey); + xbt_dict_remove_ext(smpi_type_keyvals, (const char*)keyval, sizeof(int)); xbt_free(elem); - xbt_free(tmpkey); return MPI_SUCCESS; } + +int smpi_mpi_pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm){ + size_t size = smpi_datatype_size(type); + if (outcount - *position < incount*size) + return MPI_ERR_BUFFER; + smpi_datatype_copy(inbuf, incount, type, + (char*)outbuf + *position, outcount, MPI_CHAR); + *position += incount * size; + return MPI_SUCCESS; +} + +int smpi_mpi_unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm){ + size_t size = smpi_datatype_size(type); + if (outcount*size> insize) + return MPI_ERR_BUFFER; + smpi_datatype_copy((char*)inbuf + *position, insize, MPI_CHAR, + outbuf, outcount, type); + *position += outcount * size; + return MPI_SUCCESS; +} + diff --git a/src/smpi/smpi_pmpi.c b/src/smpi/smpi_pmpi.c index 7a8e852c5f..f9c75dbc6e 100644 --- a/src/smpi/smpi_pmpi.c +++ b/src/smpi/smpi_pmpi.c @@ -1005,10 +1005,14 @@ int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_IRECV; - extra->send_size = count; extra->src = src_traced; extra->dst = rank; - extra->datatype1 = encode_datatype(datatype); + int known=0; + extra->datatype1 = encode_datatype(datatype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(datatype); + extra->send_size = count*dt_size_send; TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, extra); #endif @@ -1056,13 +1060,16 @@ int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, #ifdef HAVE_TRACING int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1; int dst_traced = smpi_group_index(smpi_comm_group(comm), dst); - instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_ISEND; - extra->send_size = count; extra->src = rank; extra->dst = dst_traced; - extra->datatype1 = encode_datatype(datatype); + int known=0; + extra->datatype1 = encode_datatype(datatype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(datatype); + extra->send_size = count*dt_size_send; TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra); TRACE_smpi_send(rank, rank, dst_traced, count*smpi_datatype_size(datatype)); #endif @@ -1112,10 +1119,14 @@ int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst_traced = smpi_group_index(smpi_comm_group(comm), dst); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_ISSEND; - extra->send_size = count; extra->src = rank; extra->dst = dst_traced; - extra->datatype1 = encode_datatype(datatype); + int known=0; + extra->datatype1 = encode_datatype(datatype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(datatype); + extra->send_size = count*dt_size_send; TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra); TRACE_smpi_send(rank, rank, dst_traced, count*smpi_datatype_size(datatype)); #endif @@ -1163,10 +1174,14 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, int src_traced = smpi_group_index(smpi_comm_group(comm), src); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_RECV; - extra->send_size = count; extra->src = src_traced; extra->dst = rank; - extra->datatype1 = encode_datatype(datatype); + int known=0; + extra->datatype1 = encode_datatype(datatype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(datatype); + extra->send_size = count*dt_size_send; TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, extra); #endif @@ -1215,10 +1230,14 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, int dst_traced = smpi_group_index(smpi_comm_group(comm), dst); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_SEND; - extra->send_size = count; extra->src = rank; extra->dst = dst_traced; - extra->datatype1 = encode_datatype(datatype); + int known=0; + extra->datatype1 = encode_datatype(datatype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(datatype); + extra->send_size = count*dt_size_send; TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra); TRACE_smpi_send(rank, rank, dst_traced,count*smpi_datatype_size(datatype)); #endif @@ -1263,10 +1282,14 @@ int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MP int dst_traced = smpi_group_index(smpi_comm_group(comm), dst); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_SSEND; - extra->send_size = count; extra->src = rank; extra->dst = dst_traced; - extra->datatype1 = encode_datatype(datatype); + int known=0; + extra->datatype1 = encode_datatype(datatype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(datatype); + extra->send_size = count*dt_size_send; TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra); TRACE_smpi_send(rank, rank, dst_traced,count*smpi_datatype_size(datatype)); #endif @@ -1317,12 +1340,19 @@ int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int src_traced = smpi_group_index(smpi_comm_group(comm), src); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_SENDRECV; - extra->send_size = sendcount; - extra->recv_size = recvcount; extra->src = src_traced; extra->dst = dst_traced; - extra->datatype1 = encode_datatype(sendtype); - extra->datatype2 = encode_datatype(recvtype); + int known=0; + extra->datatype1 = encode_datatype(sendtype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(sendtype); + extra->send_size = sendcount*dt_size_send; + extra->datatype2 = encode_datatype(recvtype, &known); + int dt_size_recv = 1; + if(!known) + dt_size_recv = smpi_datatype_size(recvtype); + extra->recv_size = recvcount*dt_size_recv; TRACE_smpi_ptp_in(rank, src_traced, dst_traced, __FUNCTION__, extra); TRACE_smpi_send(rank, rank, dst_traced,sendcount*smpi_datatype_size(sendtype)); @@ -1379,7 +1409,7 @@ int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status) } else if (*request == MPI_REQUEST_NULL) { *flag= TRUE; smpi_empty_status(status); - retval = MPI_ERR_REQUEST; + retval = MPI_SUCCESS; } else { #ifdef HAVE_TRACING int rank = request && (*request)->comm != MPI_COMM_NULL @@ -1486,7 +1516,7 @@ int PMPI_Wait(MPI_Request * request, MPI_Status * status) if (request == NULL) { retval = MPI_ERR_ARG; } else if (*request == MPI_REQUEST_NULL) { - retval = MPI_ERR_REQUEST; + retval = MPI_SUCCESS; } else { #ifdef HAVE_TRACING @@ -1692,9 +1722,13 @@ int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm c instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_BCAST; - extra->send_size = count; extra->root = root_traced; - extra->datatype1 = encode_datatype(datatype); + int known=0; + extra->datatype1 = encode_datatype(datatype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(datatype); + extra->send_size = count*dt_size_send; TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra); #endif @@ -1765,11 +1799,18 @@ int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype, int root_traced = smpi_group_index(smpi_comm_group(comm), root); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_GATHER; - extra->send_size = sendtmpcount; - extra->recv_size = recvcount; extra->root = root_traced; - extra->datatype1 = encode_datatype(sendtmptype); - extra->datatype2 = encode_datatype(recvtype); + int known=0; + extra->datatype1 = encode_datatype(sendtmptype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(sendtmptype); + extra->send_size = sendtmpcount*dt_size_send; + extra->datatype2 = encode_datatype(recvtype, &known); + int dt_size_recv = 1; + if((smpi_comm_rank(comm)==root) && !known) + dt_size_recv = smpi_datatype_size(recvtype); + extra->recv_size = recvcount*dt_size_recv; TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra); #endif @@ -1820,14 +1861,21 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int size = smpi_comm_size(comm); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_GATHERV; - extra->send_size = sendtmpcount; - extra->recvcounts= xbt_malloc(size*sizeof(int)); - for(i=0; i< size; i++)//copy data to avoid bad free - extra->recvcounts[i] = recvcounts[i]; extra->num_processes = size; extra->root = root_traced; - extra->datatype1 = encode_datatype(sendtmptype); - extra->datatype2 = encode_datatype(recvtype); + int known=0; + extra->datatype1 = encode_datatype(sendtmptype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(sendtype); + extra->send_size = sendtmpcount*dt_size_send; + extra->datatype2 = encode_datatype(recvtype, &known); + int dt_size_recv = 1; + if(!known) + dt_size_recv = smpi_datatype_size(recvtype); + extra->recvcounts= xbt_malloc(size*sizeof(int)); + for(i=0; i< size; i++)//copy data to avoid bad free + extra->recvcounts[i] = recvcounts[i]*dt_size_recv; TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__,extra); #endif @@ -1869,10 +1917,17 @@ int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype, int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1; instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_ALLGATHER; - extra->send_size = sendcount; - extra->recv_size = recvcount; - extra->datatype1 = encode_datatype(sendtype); - extra->datatype2 = encode_datatype(recvtype); + int known=0; + extra->datatype1 = encode_datatype(sendtype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(sendtype); + extra->send_size = sendcount*dt_size_send; + extra->datatype2 = encode_datatype(recvtype, &known); + int dt_size_recv = 1; + if(!known) + dt_size_recv = smpi_datatype_size(recvtype); + extra->recv_size = recvcount*dt_size_recv; TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra); #endif @@ -1918,13 +1973,20 @@ int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int size = smpi_comm_size(comm); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_ALLGATHERV; - extra->send_size = sendcount; + extra->num_processes = size; + int known=0; + extra->datatype1 = encode_datatype(sendtype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(sendtype); + extra->send_size = sendcount*dt_size_send; + extra->datatype2 = encode_datatype(recvtype, &known); + int dt_size_recv = 1; + if(!known) + dt_size_recv = smpi_datatype_size(recvtype); extra->recvcounts= xbt_malloc(size*sizeof(int)); for(i=0; i< size; i++)//copy data to avoid bad free - extra->recvcounts[i] = recvcounts[i]; - extra->num_processes = size; - extra->datatype1 = encode_datatype(sendtype); - extra->datatype2 = encode_datatype(recvtype); + extra->recvcounts[i] = recvcounts[i]*dt_size_recv; TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra); #endif @@ -1967,12 +2029,18 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype, int root_traced = smpi_group_index(smpi_comm_group(comm), root); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_SCATTER; - extra->send_size = sendcount; - extra->recv_size= recvcount; extra->root = root_traced; - extra->datatype1 = encode_datatype(sendtype); - extra->datatype2 = encode_datatype(recvtype); - + int known=0; + extra->datatype1 = encode_datatype(sendtype, &known); + int dt_size_send = 1; + if((smpi_comm_rank(comm)==root) && !known) + dt_size_send = smpi_datatype_size(sendtype); + extra->send_size = sendcount*dt_size_send; + extra->datatype2 = encode_datatype(recvtype, &known); + int dt_size_recv = 1; + if(!known) + dt_size_recv = smpi_datatype_size(recvtype); + extra->recv_size = recvcount*dt_size_recv; TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__,extra); #endif mpi_coll_scatter_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount, @@ -2014,15 +2082,21 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs, int size = smpi_comm_size(comm); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_SCATTERV; - extra->recv_size = recvcount; - extra->sendcounts= xbt_malloc(size*sizeof(int)); - for(i=0; i< size; i++)//copy data to avoid bad free - extra->sendcounts[i] = sendcounts[i]; extra->num_processes = size; extra->root = root_traced; - extra->datatype1 = encode_datatype(sendtype); - extra->datatype2 = encode_datatype(recvtype); - + int known=0; + extra->datatype1 = encode_datatype(sendtype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(sendtype); + extra->sendcounts= xbt_malloc(size*sizeof(int)); + for(i=0; i< size; i++)//copy data to avoid bad free + extra->sendcounts[i] = sendcounts[i]*dt_size_send; + extra->datatype2 = encode_datatype(recvtype, &known); + int dt_size_recv = 1; + if(!known) + dt_size_recv = smpi_datatype_size(recvtype); + extra->recv_size = recvcount*dt_size_recv; TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__,extra); #endif @@ -2055,8 +2129,12 @@ int PMPI_Reduce(void *sendbuf, void *recvbuf, int count, int root_traced = smpi_group_index(smpi_comm_group(comm), root); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_REDUCE; - extra->send_size = count; - extra->datatype1 = encode_datatype(datatype); + int known=0; + extra->datatype1 = encode_datatype(datatype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(datatype); + extra->send_size = count*dt_size_send; extra->root = root_traced; TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__,extra); @@ -2112,8 +2190,12 @@ int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count, int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1; instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_ALLREDUCE; - extra->send_size = count; - extra->datatype1 = encode_datatype(datatype); + int known=0; + extra->datatype1 = encode_datatype(datatype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(datatype); + extra->send_size = count*dt_size_send; TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra); #endif @@ -2151,8 +2233,12 @@ int PMPI_Scan(void *sendbuf, void *recvbuf, int count, int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1; instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_SCAN; - extra->send_size = count; - extra->datatype1 = encode_datatype(datatype); + int known=0; + extra->datatype1 = encode_datatype(datatype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(datatype); + extra->send_size = count*dt_size_send; TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra); #endif @@ -2184,9 +2270,12 @@ int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1; instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_EXSCAN; - extra->send_size = count; - extra->datatype1 = encode_datatype(datatype); - + int known=0; + extra->datatype1 = encode_datatype(datatype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(datatype); + extra->send_size = count*dt_size_send; TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra); #endif smpi_mpi_exscan(sendbuf, recvbuf, count, datatype, op, comm); @@ -2221,13 +2310,16 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, int size = smpi_comm_size(comm); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_REDUCE_SCATTER; + extra->num_processes = size; + int known=0; + extra->datatype1 = encode_datatype(datatype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(datatype); extra->send_size = 0; extra->recvcounts= xbt_malloc(size*sizeof(int)); for(i=0; i< size; i++)//copy data to avoid bad free - extra->recvcounts[i] = recvcounts[i]; - extra->num_processes = size; - extra->datatype1 = encode_datatype(datatype); - + extra->recvcounts[i] = recvcounts[i]*dt_size_send; TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra); #endif void* sendtmpbuf=sendbuf; @@ -2268,12 +2360,16 @@ int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount, int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1; instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_REDUCE_SCATTER; + extra->num_processes = count; + int known=0; + extra->datatype1 = encode_datatype(datatype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(datatype); extra->send_size = 0; extra->recvcounts= xbt_malloc(count*sizeof(int)); for(i=0; i< count; i++)//copy data to avoid bad free - extra->recvcounts[i] = recvcount; - extra->num_processes = count; - extra->datatype1 = encode_datatype(datatype); + extra->recvcounts[i] = recvcount*dt_size_send; TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra); #endif @@ -2310,11 +2406,17 @@ int PMPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype, int rank = comm != MPI_COMM_NULL ? smpi_process_index() : -1; instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type = TRACING_ALLTOALL; - extra->send_size = sendcount; - extra->recv_size = recvcount; - extra->datatype1 = encode_datatype(sendtype); - extra->datatype2 = encode_datatype(recvtype); - + int known=0; + extra->datatype1 = encode_datatype(sendtype, &known); + if(!known) + extra->send_size = sendcount*smpi_datatype_size(sendtype); + else + extra->send_size = sendcount; + extra->datatype2 = encode_datatype(recvtype, &known); + if(!known) + extra->recv_size = recvcount*smpi_datatype_size(recvtype); + else + extra->recv_size = recvcount; TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra); #endif retval = mpi_coll_alltoall_fun(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm); @@ -2354,19 +2456,23 @@ int PMPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps, extra->recv_size = 0; extra->recvcounts= xbt_malloc(size*sizeof(int)); extra->sendcounts= xbt_malloc(size*sizeof(int)); - + int known=0; + extra->datatype1 = encode_datatype(sendtype, &known); + int dt_size_send = 1; + if(!known) + dt_size_send = smpi_datatype_size(sendtype); + int dt_size_recv = 1; + extra->datatype2 = encode_datatype(recvtype, &known); + if(!known) + dt_size_recv = smpi_datatype_size(recvtype); for(i=0; i< size; i++){//copy data to avoid bad free - extra->send_size += sendcounts[i]; - extra->recv_size += recvcounts[i]; + extra->send_size += sendcounts[i]*dt_size_send; + extra->recv_size += recvcounts[i]*dt_size_recv; - extra->sendcounts[i] = sendcounts[i]; - extra->recvcounts[i] = recvcounts[i]; + extra->sendcounts[i] = sendcounts[i]*dt_size_send; + extra->recvcounts[i] = recvcounts[i]*dt_size_recv; } extra->num_processes = size; - - extra->datatype1 = encode_datatype(sendtype); - extra->datatype2 = encode_datatype(recvtype); - TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra); #endif retval = @@ -2591,7 +2697,7 @@ int PMPI_Cart_create(MPI_Comm comm_old, int ndims, int* dims, int* periodic, int if (comm_old == MPI_COMM_NULL){ retval = MPI_ERR_COMM; } else if (ndims < 0 || - (ndims > 0 && (dims == NULL || + (ndims > 0 && (dims == NULL || periodic == NULL)) || comm_cart == NULL) { retval = MPI_ERR_ARG; @@ -2685,7 +2791,7 @@ int PMPI_Type_create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent, int blocks[3] = { 1, 1, 1 }; MPI_Aint disps[3] = { lb, 0, lb+extent }; MPI_Datatype types[3] = { MPI_LB, oldtype, MPI_UB }; - + s_smpi_mpi_struct_t* subtype = smpi_datatype_struct_create( blocks, disps, 3, @@ -2772,7 +2878,15 @@ int PMPI_Win_fence( int assert, MPI_Win win){ if (win == MPI_WIN_NULL) { retval = MPI_ERR_WIN; } else { - retval = smpi_mpi_win_fence(assert, win); +#ifdef HAVE_TRACING + int rank = smpi_process_index(); + TRACE_smpi_collective_in(rank, -1, __FUNCTION__, NULL); +#endif + retval = smpi_mpi_win_fence(assert, win); +#ifdef HAVE_TRACING + TRACE_smpi_collective_out(rank, -1, __FUNCTION__); +#endif + } smpi_bench_begin(); return retval; @@ -2798,7 +2912,19 @@ int PMPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, (!is_datatype_valid(target_datatype))) { retval = MPI_ERR_TYPE; } else { +#ifdef HAVE_TRACING + int rank = smpi_process_index(); + MPI_Group group; + smpi_mpi_win_get_group(win, &group); + int src_traced = smpi_group_index(group, target_rank); + TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, NULL); +#endif + retval = smpi_mpi_get( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, win); + +#ifdef HAVE_TRACING + TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__); +#endif } smpi_bench_begin(); return retval; @@ -2824,7 +2950,21 @@ int PMPI_Put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, (!is_datatype_valid(target_datatype))) { retval = MPI_ERR_TYPE; } else { +#ifdef HAVE_TRACING + int rank = smpi_process_index(); + MPI_Group group; + smpi_mpi_win_get_group(win, &group); + int dst_traced = smpi_group_index(group, target_rank); + TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, NULL); + TRACE_smpi_send(rank, rank, dst_traced, origin_count*smpi_datatype_size(origin_datatype)); +#endif + retval = smpi_mpi_put( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, win); + +#ifdef HAVE_TRACING + TRACE_smpi_ptp_out(rank, rank, dst_traced, __FUNCTION__); +#endif + } smpi_bench_begin(); return retval; @@ -2853,13 +2993,111 @@ int PMPI_Accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_da } else if (op == MPI_OP_NULL) { retval = MPI_ERR_OP; } else { +#ifdef HAVE_TRACING + int rank = smpi_process_index(); + MPI_Group group; + smpi_mpi_win_get_group(win, &group); + int src_traced = smpi_group_index(group, target_rank); + TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, NULL); +#endif + retval = smpi_mpi_accumulate( origin_addr, origin_count, origin_datatype, target_rank, target_disp, target_count, target_datatype, op, win); + +#ifdef HAVE_TRACING + TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__); +#endif + } smpi_bench_begin(); return retval; } +int PMPI_Win_post(MPI_Group group, int assert, MPI_Win win){ + int retval = 0; + smpi_bench_end(); + if (win == MPI_WIN_NULL) { + retval = MPI_ERR_WIN; + } else if (group==MPI_GROUP_NULL){ + retval = MPI_ERR_GROUP; + } + else { +#ifdef HAVE_TRACING + int rank = smpi_process_index(); + TRACE_smpi_collective_in(rank, -1, __FUNCTION__, NULL); +#endif + retval = smpi_mpi_win_post(group,assert,win); +#ifdef HAVE_TRACING + TRACE_smpi_collective_out(rank, -1, __FUNCTION__); +#endif + } + smpi_bench_begin(); + return retval; +} + +int PMPI_Win_start(MPI_Group group, int assert, MPI_Win win){ + int retval = 0; + smpi_bench_end(); + if (win == MPI_WIN_NULL) { + retval = MPI_ERR_WIN; + } else if (group==MPI_GROUP_NULL){ + retval = MPI_ERR_GROUP; + } + else { +#ifdef HAVE_TRACING + int rank = smpi_process_index(); + TRACE_smpi_collective_in(rank, -1, __FUNCTION__, NULL); +#endif + retval = smpi_mpi_win_start(group,assert,win); +#ifdef HAVE_TRACING + TRACE_smpi_collective_out(rank, -1, __FUNCTION__); +#endif + } + smpi_bench_begin(); + return retval; +} + + +int PMPI_Win_complete(MPI_Win win){ + int retval = 0; + smpi_bench_end(); + if (win == MPI_WIN_NULL) { + retval = MPI_ERR_WIN; + } + else { +#ifdef HAVE_TRACING + int rank = smpi_process_index(); + TRACE_smpi_collective_in(rank, -1, __FUNCTION__, NULL); +#endif + retval = smpi_mpi_win_complete(win); +#ifdef HAVE_TRACING + TRACE_smpi_collective_out(rank, -1, __FUNCTION__); +#endif + } + smpi_bench_begin(); + return retval; +} + +int PMPI_Win_wait(MPI_Win win){ + int retval = 0; + smpi_bench_end(); + if (win == MPI_WIN_NULL) { + retval = MPI_ERR_WIN; + } + else { +#ifdef HAVE_TRACING + int rank = smpi_process_index(); + TRACE_smpi_collective_in(rank, -1, __FUNCTION__, NULL); +#endif + retval = smpi_mpi_win_wait(win); +#ifdef HAVE_TRACING + TRACE_smpi_collective_out(rank, -1, __FUNCTION__); +#endif + } + smpi_bench_begin(); + return retval; +} + int PMPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr){ void *ptr = xbt_malloc(size); if(!ptr) @@ -2953,6 +3191,14 @@ MPI_Fint PMPI_Comm_c2f(MPI_Comm comm){ return smpi_comm_c2f(comm); } +MPI_Info PMPI_Info_f2c(MPI_Fint info){ + return smpi_info_f2c(info); +} + +MPI_Fint PMPI_Info_c2f(MPI_Info info){ + return smpi_info_c2f(info); +} + int PMPI_Keyval_create(MPI_Copy_function* copy_fn, MPI_Delete_function* delete_fn, int* keyval, void* extra_state) { return smpi_comm_keyval_create(copy_fn, delete_fn, keyval, extra_state); } @@ -3058,41 +3304,168 @@ int PMPI_Type_free_keyval(int* keyval) { return smpi_type_keyval_free(keyval); } -/* The following calls are not yet implemented and will fail at runtime. */ -/* Once implemented, please move them above this notice. */ +int PMPI_Info_create( MPI_Info *info){ + if (info == NULL) + return MPI_ERR_ARG; + *info = xbt_new(s_smpi_mpi_info_t, 1); + (*info)->info_dict= xbt_dict_new_homogeneous(NULL); + (*info)->refcount=1; + return MPI_SUCCESS; +} -#define NOT_YET_IMPLEMENTED { \ - XBT_WARN("Not yet implemented : %s. Please contact the Simgrid team if support is needed", __FUNCTION__); \ - return MPI_SUCCESS; \ +int PMPI_Info_set( MPI_Info info, char *key, char *value){ + if (info == NULL || key == NULL || value == NULL) + return MPI_ERR_ARG; + + xbt_dict_set(info->info_dict, key, (void*)value, NULL); + return MPI_SUCCESS; +} + +int PMPI_Info_free( MPI_Info *info){ + if (info == NULL || *info==NULL) + return MPI_ERR_ARG; + (*info)->refcount--; + if((*info)->refcount==0){ + xbt_dict_free(&((*info)->info_dict)); + xbt_free(*info); } + *info=MPI_INFO_NULL; + return MPI_SUCCESS; +} +int PMPI_Info_get(MPI_Info info,char *key,int valuelen, char *value, int *flag){ + if (info == NULL || key == NULL || valuelen <0) + return MPI_ERR_ARG; + if (value == NULL) + return MPI_ERR_INFO_VALUE; + *flag=FALSE; + char* tmpvalue=(char*)xbt_dict_get_or_null(info->info_dict, key); + if(tmpvalue){ + memcpy(value,tmpvalue, (strlen(tmpvalue) + 1 < valuelen) ? + strlen(tmpvalue) + 1 : valuelen); + *flag=TRUE; + } + return MPI_SUCCESS; +} -MPI_Info PMPI_Info_f2c(MPI_Fint info){ - NOT_YET_IMPLEMENTED +int PMPI_Info_dup(MPI_Info info, MPI_Info *newinfo){ + if (info == NULL || newinfo==NULL) + return MPI_ERR_ARG; + *newinfo = xbt_new(s_smpi_mpi_info_t, 1); + (*newinfo)->info_dict= xbt_dict_new_homogeneous(NULL); + xbt_dict_cursor_t cursor = NULL; + int *key; + void* data; + xbt_dict_foreach(info->info_dict,cursor,key,data){ + xbt_dict_set((*newinfo)->info_dict, (char*)key, data, NULL); + } + return MPI_SUCCESS; } -MPI_Fint PMPI_Info_c2f(MPI_Info info){ - NOT_YET_IMPLEMENTED +int PMPI_Info_delete(MPI_Info info, char *key){ + xbt_ex_t e; + if (info == NULL || key==NULL) + return MPI_ERR_ARG; + TRY { + xbt_dict_remove(info->info_dict, key); + }CATCH(e){ + xbt_ex_free(e); + return MPI_ERR_INFO_NOKEY; + } + return MPI_SUCCESS; } -MPI_Errhandler PMPI_Errhandler_f2c(MPI_Fint errhandler){ - NOT_YET_IMPLEMENTED +int PMPI_Info_get_nkeys( MPI_Info info, int *nkeys){ + if (info == NULL || nkeys==NULL) + return MPI_ERR_ARG; + *nkeys=xbt_dict_size(info->info_dict); + return MPI_SUCCESS; } -MPI_Fint PMPI_Errhandler_c2f(MPI_Errhandler errhandler){ - NOT_YET_IMPLEMENTED +int PMPI_Info_get_nthkey( MPI_Info info, int n, char *key){ + if (info == NULL || key==NULL || n<0 || n> MPI_MAX_INFO_KEY) + return MPI_ERR_ARG; + + xbt_dict_cursor_t cursor = NULL; + char *keyn; + void* data; + int num=0; + xbt_dict_foreach(info->info_dict,cursor,keyn,data){ + if(num==n){ + strcpy(key,keyn); + return MPI_SUCCESS; + } + num++; + } + return MPI_ERR_ARG; +} + +int PMPI_Info_get_valuelen( MPI_Info info, char *key, int *valuelen, int *flag){ + if (info == NULL || key == NULL || valuelen <0) + return MPI_ERR_ARG; + *flag=FALSE; + char* tmpvalue=(char*)xbt_dict_get_or_null(info->info_dict, key); + if(tmpvalue){ + *valuelen=strlen(tmpvalue); + *flag=TRUE; + } + return MPI_SUCCESS; +} + +int PMPI_Unpack(void* inbuf, int incount, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) { + if(incount<0 || outcount < 0 || inbuf==NULL || outbuf==NULL) + return MPI_ERR_ARG; + if(!is_datatype_valid(type)) + return MPI_ERR_TYPE; + if(comm==MPI_COMM_NULL) + return MPI_ERR_COMM; + return smpi_mpi_unpack(inbuf, incount, position, outbuf,outcount,type, comm); +} + +int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) { + if(incount<0 || outcount < 0|| inbuf==NULL || outbuf==NULL) + return MPI_ERR_ARG; + if(!is_datatype_valid(type)) + return MPI_ERR_TYPE; + if(comm==MPI_COMM_NULL) + return MPI_ERR_COMM; + return smpi_mpi_pack(inbuf, incount, type, outbuf,outcount,position, comm); } int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) { + if(incount<0) + return MPI_ERR_ARG; + if(!is_datatype_valid(datatype)) + return MPI_ERR_TYPE; + if(comm==MPI_COMM_NULL) + return MPI_ERR_COMM; + + *size=incount*smpi_datatype_size(datatype); + + return MPI_SUCCESS; +} + + +/* The following calls are not yet implemented and will fail at runtime. */ +/* Once implemented, please move them above this notice. */ + +#define NOT_YET_IMPLEMENTED { \ + XBT_WARN("Not yet implemented : %s. Please contact the Simgrid team if support is needed", __FUNCTION__); \ + return MPI_SUCCESS; \ + } + +MPI_Errhandler PMPI_Errhandler_f2c(MPI_Fint errhandler){ NOT_YET_IMPLEMENTED } +MPI_Fint PMPI_Errhandler_c2f(MPI_Errhandler errhandler){ + NOT_YET_IMPLEMENTED +} int PMPI_Cart_map(MPI_Comm comm_old, int ndims, int* dims, int* periods, int* newrank) { NOT_YET_IMPLEMENTED } - int PMPI_Graph_create(MPI_Comm comm_old, int nnodes, int* index, int* edges, int reorder, MPI_Comm* comm_graph) { NOT_YET_IMPLEMENTED } @@ -3174,9 +3547,6 @@ int PMPI_Pcontrol(const int level ) NOT_YET_IMPLEMENTED } -int PMPI_Unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) { - NOT_YET_IMPLEMENTED -} int PMPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm* comm_out) { NOT_YET_IMPLEMENTED @@ -3222,9 +3592,7 @@ int PMPI_Test_cancelled(MPI_Status* status, int* flag) { NOT_YET_IMPLEMENTED } -int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) { - NOT_YET_IMPLEMENTED -} + int PMPI_Pack_external_size(char *datarep, int incount, MPI_Datatype datatype, MPI_Aint *size){ NOT_YET_IMPLEMENTED @@ -3242,17 +3610,7 @@ int PMPI_Get_elements(MPI_Status* status, MPI_Datatype datatype, int* elements) NOT_YET_IMPLEMENTED } -int PMPI_Info_create( MPI_Info *info){ - NOT_YET_IMPLEMENTED -} -int PMPI_Info_set( MPI_Info info, char *key, char *value){ - NOT_YET_IMPLEMENTED -} - -int PMPI_Info_free( MPI_Info *info){ - NOT_YET_IMPLEMENTED -} int PMPI_Type_get_envelope( MPI_Datatype datatype, int *num_integers, int *num_addresses, int *num_datatypes, int *combiner){ @@ -3305,10 +3663,6 @@ int PMPI_Comm_get_info (MPI_Comm comm, MPI_Info* info){ NOT_YET_IMPLEMENTED } -int PMPI_Info_get(MPI_Info info,char *key,int valuelen, char *value, int *flag){ - NOT_YET_IMPLEMENTED -} - int PMPI_Comm_create_errhandler( MPI_Comm_errhandler_fn *function, MPI_Errhandler *errhandler){ NOT_YET_IMPLEMENTED } @@ -3329,26 +3683,6 @@ int PMPI_Comm_call_errhandler(MPI_Comm comm,int errorcode){ NOT_YET_IMPLEMENTED } -int PMPI_Info_dup(MPI_Info info, MPI_Info *newinfo){ - NOT_YET_IMPLEMENTED -} - -int PMPI_Info_delete(MPI_Info info, char *key){ - NOT_YET_IMPLEMENTED -} - -int PMPI_Info_get_nkeys( MPI_Info info, int *nkeys){ - NOT_YET_IMPLEMENTED -} - -int PMPI_Info_get_nthkey( MPI_Info info, int n, char *key){ - NOT_YET_IMPLEMENTED -} - -int PMPI_Info_get_valuelen( MPI_Info info, char *key, int *valuelen, int *flag){ - NOT_YET_IMPLEMENTED -} - int PMPI_Request_get_status( MPI_Request request, int *flag, MPI_Status *status){ NOT_YET_IMPLEMENTED } @@ -3415,22 +3749,10 @@ int PMPI_Comm_get_parent( MPI_Comm *parent){ NOT_YET_IMPLEMENTED } -int PMPI_Win_complete(MPI_Win win){ - NOT_YET_IMPLEMENTED -} - int PMPI_Win_lock(int lock_type, int rank, int assert, MPI_Win win) { NOT_YET_IMPLEMENTED } -int PMPI_Win_post(MPI_Group group, int assert, MPI_Win win){ - NOT_YET_IMPLEMENTED -} - -int PMPI_Win_start(MPI_Group group, int assert, MPI_Win win){ - NOT_YET_IMPLEMENTED -} - int PMPI_Win_test(MPI_Win win, int *flag){ NOT_YET_IMPLEMENTED } @@ -3439,6 +3761,3 @@ int PMPI_Win_unlock(int rank, MPI_Win win){ NOT_YET_IMPLEMENTED } -int PMPI_Win_wait(MPI_Win win){ - NOT_YET_IMPLEMENTED -} diff --git a/src/smpi/smpi_replay.c b/src/smpi/smpi_replay.c index 2f6bebbfb5..f08faf1cc6 100644 --- a/src/smpi/smpi_replay.c +++ b/src/smpi/smpi_replay.c @@ -103,11 +103,12 @@ static MPI_Datatype decode_datatype(const char *const action) } -const char* encode_datatype(MPI_Datatype datatype) +const char* encode_datatype(MPI_Datatype datatype, int* known) { //default type for output is set to MPI_BYTE // MPI_DEFAULT_TYPE is not set for output, use directly MPI_BYTE + if(known)*known=1; if (datatype==MPI_BYTE){ return ""; } @@ -123,17 +124,30 @@ const char* encode_datatype(MPI_Datatype datatype) return "4"; if(datatype==MPI_FLOAT) return "5"; - + //tell that the datatype is not handled by replay, and that its size should be measured and replayed as size*MPI_BYTE + if(known)*known=0; // default - not implemented. // do not warn here as we pass in this function even for other trace formats return "-1"; } +#define CHECK_ACTION_PARAMS(action, mandatory, optional) {\ + int i=0;\ + while(action[i]!=NULL)\ + i++;\ + if(isend_size = size; extra->src = rank; extra->dst = dst_traced; - extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE); + extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL); TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra); TRACE_smpi_send(rank, rank, dst_traced, size*smpi_datatype_size(MPI_CURRENT_TYPE)); #endif @@ -234,6 +250,7 @@ static void action_send(const char *const *action) static void action_Isend(const char *const *action) { + CHECK_ACTION_PARAMS(action, 2, 1); int to = atoi(action[2]); double size=parse_double(action[3]); double clock = smpi_process_simulated_elapsed(); @@ -250,7 +267,7 @@ static void action_Isend(const char *const *action) extra->send_size = size; extra->src = rank; extra->dst = dst_traced; - extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE); + extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL); TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra); TRACE_smpi_send(rank, rank, dst_traced, size*smpi_datatype_size(MPI_CURRENT_TYPE)); #endif @@ -268,6 +285,7 @@ static void action_Isend(const char *const *action) } static void action_recv(const char *const *action) { + CHECK_ACTION_PARAMS(action, 2, 1); int from = atoi(action[2]); double size=parse_double(action[3]); double clock = smpi_process_simulated_elapsed(); @@ -285,7 +303,7 @@ static void action_recv(const char *const *action) { extra->send_size = size; extra->src = src_traced; extra->dst = rank; - extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE); + extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL); TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, extra); #endif @@ -307,6 +325,7 @@ static void action_recv(const char *const *action) { static void action_Irecv(const char *const *action) { + CHECK_ACTION_PARAMS(action, 2, 1); int from = atoi(action[2]); double size=parse_double(action[3]); double clock = smpi_process_simulated_elapsed(); @@ -323,7 +342,7 @@ static void action_Irecv(const char *const *action) extra->send_size = size; extra->src = src_traced; extra->dst = rank; - extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE); + extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL); TRACE_smpi_ptp_in(rank, src_traced, rank, __FUNCTION__, extra); #endif MPI_Status status; @@ -345,21 +364,26 @@ static void action_Irecv(const char *const *action) } static void action_test(const char *const *action){ + CHECK_ACTION_PARAMS(action, 0, 0); double clock = smpi_process_simulated_elapsed(); MPI_Request request; MPI_Status status; int flag = TRUE; request = xbt_dynar_pop_as(reqq[smpi_process_index()],MPI_Request); - xbt_assert(request != NULL, "found null request in reqq"); - + //if request is null here, this may mean that a previous test has succeeded + //Different times in traced application and replayed version may lead to this + //In this case, ignore the extra calls. + if(request){ #ifdef HAVE_TRACING int rank = smpi_process_index(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); extra->type=TRACING_TEST; TRACE_smpi_testing_in(rank, extra); #endif - flag = smpi_mpi_test(&request, &status); + + flag = smpi_mpi_test(&request, &status); + XBT_DEBUG("MPI_Test result: %d", flag); /* push back request in dynar to be caught by a subsequent wait. if the test * did succeed, the request is now NULL. @@ -369,11 +393,12 @@ static void action_test(const char *const *action){ #ifdef HAVE_TRACING TRACE_smpi_testing_out(rank); #endif - + } log_timed_action (action, clock); } static void action_wait(const char *const *action){ + CHECK_ACTION_PARAMS(action, 0, 0); double clock = smpi_process_simulated_elapsed(); MPI_Request request; MPI_Status status; @@ -415,6 +440,7 @@ static void action_wait(const char *const *action){ } static void action_waitall(const char *const *action){ + CHECK_ACTION_PARAMS(action, 0, 0); double clock = smpi_process_simulated_elapsed(); int count_requests=0; unsigned int i=0; @@ -483,7 +509,9 @@ static void action_waitall(const char *const *action){ xbt_dynar_free(&recvs); #endif - xbt_dynar_free_container(&(reqq[smpi_process_index()])); + int freedrank=smpi_process_index(); + xbt_dynar_free_container(&(reqq[freedrank])); + reqq[freedrank]=xbt_dynar_new(sizeof(MPI_Request),&xbt_free_ref); } log_timed_action (action, clock); } @@ -507,6 +535,7 @@ static void action_barrier(const char *const *action){ static void action_bcast(const char *const *action) { + CHECK_ACTION_PARAMS(action, 1, 2); double size = parse_double(action[2]); double clock = smpi_process_simulated_elapsed(); int root=0; @@ -531,7 +560,7 @@ static void action_bcast(const char *const *action) extra->type = TRACING_BCAST; extra->send_size = size; extra->root = root_traced; - extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE); + extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL); TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__, extra); #endif @@ -545,6 +574,7 @@ static void action_bcast(const char *const *action) static void action_reduce(const char *const *action) { + CHECK_ACTION_PARAMS(action, 2, 2); double comm_size = parse_double(action[2]); double comp_size = parse_double(action[3]); double clock = smpi_process_simulated_elapsed(); @@ -567,7 +597,7 @@ static void action_reduce(const char *const *action) extra->type = TRACING_REDUCE; extra->send_size = comm_size; extra->comp_size = comp_size; - extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE); + extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL); extra->root = root_traced; TRACE_smpi_collective_in(rank, root_traced, __FUNCTION__,extra); @@ -583,6 +613,7 @@ static void action_reduce(const char *const *action) } static void action_allReduce(const char *const *action) { + CHECK_ACTION_PARAMS(action, 2, 1); double comm_size = parse_double(action[2]); double comp_size = parse_double(action[3]); @@ -596,7 +627,7 @@ static void action_allReduce(const char *const *action) { extra->type = TRACING_ALLREDUCE; extra->send_size = comm_size; extra->comp_size = comp_size; - extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE); + extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL); TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra); #endif @@ -634,8 +665,8 @@ static void action_allToAll(const char *const *action) { extra->type = TRACING_ALLTOALL; extra->send_size = send_size; extra->recv_size = recv_size; - extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE); - extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2); + extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL); + extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, NULL); TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra); #endif @@ -663,6 +694,7 @@ static void action_gather(const char *const *action) { 4) 0 is the send datatype id, see decode_datatype() 5) 0 is the recv datatype id, see decode_datatype() */ + CHECK_ACTION_PARAMS(action, 2, 3); double clock = smpi_process_simulated_elapsed(); int comm_size = smpi_comm_size(MPI_COMM_WORLD); int send_size = parse_double(action[2]); @@ -677,8 +709,9 @@ static void action_gather(const char *const *action) { } void *send = smpi_get_tmp_sendbuffer(send_size* smpi_datatype_size(MPI_CURRENT_TYPE)); void *recv = NULL; - - int root=atoi(action[4]); + int root=0; + if(action[4]) + root=atoi(action[4]); int rank = smpi_comm_rank(MPI_COMM_WORLD); if(rank==root) @@ -690,8 +723,8 @@ static void action_gather(const char *const *action) { extra->send_size = send_size; extra->recv_size = recv_size; extra->root = root; - extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE); - extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2); + extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL); + extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, NULL); TRACE_smpi_collective_in(smpi_process_index(), root, __FUNCTION__, extra); #endif @@ -721,8 +754,10 @@ static void action_gatherv(const char *const *action) { 4) 0 is the send datatype id, see decode_datatype() 5) 0 is the recv datatype id, see decode_datatype() */ + double clock = smpi_process_simulated_elapsed(); int comm_size = smpi_comm_size(MPI_COMM_WORLD); + CHECK_ACTION_PARAMS(action, comm_size+1, 2); int send_size = parse_double(action[2]); int *disps = xbt_new0(int, comm_size); int *recvcounts = xbt_new0(int, comm_size); @@ -759,8 +794,8 @@ static void action_gatherv(const char *const *action) { extra->recvcounts[i] = recvcounts[i]; extra->root = root; extra->num_processes = comm_size; - extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE); - extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2); + extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL); + extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, NULL); TRACE_smpi_collective_in(smpi_process_index(), root, __FUNCTION__, extra); #endif @@ -795,6 +830,7 @@ static void action_reducescatter(const char *const *action) { double clock = smpi_process_simulated_elapsed(); int comm_size = smpi_comm_size(MPI_COMM_WORLD); + CHECK_ACTION_PARAMS(action, comm_size+1, 1); int comp_size = parse_double(action[2+comm_size]); int *recvcounts = xbt_new0(int, comm_size); int *disps = xbt_new0(int, comm_size); @@ -819,7 +855,7 @@ static void action_reducescatter(const char *const *action) { extra->recvcounts= xbt_malloc(comm_size*sizeof(int)); for(i=0; i< comm_size; i++)//copy data to avoid bad free extra->recvcounts[i] = recvcounts[i]; - extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE); + extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL); extra->comp_size = comp_size; extra->num_processes = comm_size; @@ -841,6 +877,59 @@ static void action_reducescatter(const char *const *action) { log_timed_action (action, clock); } +static void action_allgather(const char *const *action) { + /* + The structure of the allgather action for the rank 0 (total 4 processes) + is the following: + 0 allGather 275427 275427 + + where: + 1) 275427 is the sendcount + 2) 275427 is the recvcount + 3) No more values mean that the datatype for sent and receive buffer + is the default one, see decode_datatype(). + + */ + + double clock = smpi_process_simulated_elapsed(); + + CHECK_ACTION_PARAMS(action, 2, 2); + int sendcount=atoi(action[2]); + int recvcount=atoi(action[3]); + + MPI_Datatype MPI_CURRENT_TYPE2; + + if(action[4]) { + MPI_CURRENT_TYPE = decode_datatype(action[3]); + MPI_CURRENT_TYPE2 = decode_datatype(action[4]); + } else { + MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE; + MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE; + } + void *sendbuf = smpi_get_tmp_sendbuffer(sendcount* smpi_datatype_size(MPI_CURRENT_TYPE)); + void *recvbuf = smpi_get_tmp_recvbuffer(recvcount* smpi_datatype_size(MPI_CURRENT_TYPE2)); + +#ifdef HAVE_TRACING + int rank = smpi_process_index(); + instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); + extra->type = TRACING_ALLGATHER; + extra->send_size = sendcount; + extra->recv_size= recvcount; + extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL); + extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, NULL); + extra->num_processes = smpi_comm_size(MPI_COMM_WORLD); + + TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra); +#endif + + mpi_coll_allgather_fun(sendbuf, sendcount, MPI_CURRENT_TYPE, recvbuf, recvcount, MPI_CURRENT_TYPE2, MPI_COMM_WORLD); + +#ifdef HAVE_TRACING + TRACE_smpi_collective_out(rank, -1, __FUNCTION__); +#endif + + log_timed_action (action, clock); +} static void action_allgatherv(const char *const *action) { @@ -860,6 +949,7 @@ static void action_allgatherv(const char *const *action) { double clock = smpi_process_simulated_elapsed(); int comm_size = smpi_comm_size(MPI_COMM_WORLD); + CHECK_ACTION_PARAMS(action, comm_size+1, 2); int i=0; int sendcount=atoi(action[2]); int *recvcounts = xbt_new0(int, comm_size); @@ -890,8 +980,8 @@ static void action_allgatherv(const char *const *action) { extra->recvcounts= xbt_malloc(comm_size*sizeof(int)); for(i=0; i< comm_size; i++)//copy data to avoid bad free extra->recvcounts[i] = recvcounts[i]; - extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE); - extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2); + extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL); + extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, NULL); extra->num_processes = comm_size; TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra); @@ -908,7 +998,6 @@ static void action_allgatherv(const char *const *action) { xbt_free(disps); } - static void action_allToAllv(const char *const *action) { /* The structure of the allToAllV action for the rank 0 (total 4 processes) @@ -927,6 +1016,7 @@ static void action_allToAllv(const char *const *action) { double clock = smpi_process_simulated_elapsed(); int comm_size = smpi_comm_size(MPI_COMM_WORLD); + CHECK_ACTION_PARAMS(action, 2*comm_size+2, 2); int send_buf_size=0,recv_buf_size=0,i=0; int *sendcounts = xbt_new0(int, comm_size); int *recvcounts = xbt_new0(int, comm_size); @@ -969,8 +1059,8 @@ static void action_allToAllv(const char *const *action) { extra->recv_size += recvcounts[i]; extra->recvcounts[i] = recvcounts[i]; } - extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE); - extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2); + extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, NULL); + extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2, NULL); TRACE_smpi_collective_in(rank, -1, __FUNCTION__,extra); #endif @@ -1024,6 +1114,7 @@ void smpi_replay_init(int *argc, char***argv){ xbt_replay_action_register("allToAllV", action_allToAllv); xbt_replay_action_register("gather", action_gather); xbt_replay_action_register("gatherV", action_gatherv); + xbt_replay_action_register("allGather", action_allgather); xbt_replay_action_register("allGatherV", action_allgatherv); xbt_replay_action_register("reduceScatter", action_reducescatter); xbt_replay_action_register("compute", action_compute); @@ -1059,12 +1150,16 @@ int smpi_replay_finalize(){ active_processes--; } - xbt_dynar_free_container(&(reqq[smpi_process_index()])); - if(!active_processes){ /* Last process alive speaking */ /* end the simulated timer */ sim_time = smpi_process_simulated_elapsed(); + } + + + xbt_dynar_free_container(&(reqq[smpi_process_index()])); + + if(!active_processes){ XBT_INFO("Simulation time %f", sim_time); _xbt_replay_action_exit(); xbt_free(sendbuffer); @@ -1072,7 +1167,8 @@ int smpi_replay_finalize(){ xbt_free(reqq); reqq = NULL; } - mpi_coll_barrier_fun(MPI_COMM_WORLD); + + #ifdef HAVE_TRACING int rank = smpi_process_index(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); diff --git a/src/smpi/smpi_rma.c b/src/smpi/smpi_rma.c index 653131aba0..b35bc1a13c 100644 --- a/src/smpi/smpi_rma.c +++ b/src/smpi/smpi_rma.c @@ -18,12 +18,14 @@ typedef struct s_smpi_mpi_win{ MPI_Aint size; int disp_unit; MPI_Comm comm; - //MPI_Info info + MPI_Info info; int assert; xbt_dynar_t requests; xbt_bar_t bar; MPI_Win* connected_wins; char* name; + int opened; + MPI_Group group; } s_smpi_mpi_win_t; @@ -40,9 +42,13 @@ MPI_Win smpi_mpi_win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info win->size = size; win->disp_unit = disp_unit; win->assert = 0; - //win->info = info; + win->info = info; + if(info!=MPI_INFO_NULL) + info->refcount++; win->comm = comm; win->name = NULL; + win->opened = 0; + win->group = MPI_GROUP_NULL; win->requests = xbt_dynar_new(sizeof(MPI_Request), NULL); win->connected_wins = xbt_malloc0(comm_size*sizeof(MPI_Win)); win->connected_wins[rank] = win; @@ -79,6 +85,9 @@ int smpi_mpi_win_free( MPI_Win* win){ if ((*win)->name != NULL){ xbt_free((*win)->name); } + if((*win)->info!=MPI_INFO_NULL){ + MPI_Info_free(&(*win)->info); + } xbt_free(*win); win = MPI_WIN_NULL; return MPI_SUCCESS; @@ -95,8 +104,10 @@ void smpi_mpi_win_get_name(MPI_Win win, char* name, int* length){ } void smpi_mpi_win_get_group(MPI_Win win, MPI_Group* group){ - if(win->comm != MPI_COMM_NULL) + if(win->comm != MPI_COMM_NULL){ *group = smpi_comm_group(win->comm); + smpi_group_use(*group); + } } void smpi_mpi_win_set_name(MPI_Win win, char* name){ @@ -107,7 +118,8 @@ void smpi_mpi_win_set_name(MPI_Win win, char* name){ int smpi_mpi_win_fence( int assert, MPI_Win win){ XBT_DEBUG("Entering fence"); - + if(!win->opened) + win->opened=1; if(assert != MPI_MODE_NOPRECEDE){ xbt_barrier_wait(win->bar); @@ -137,6 +149,9 @@ int smpi_mpi_win_fence( int assert, MPI_Win win){ int smpi_mpi_put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win) { + + if(!win->opened)//check that post/start has been done + return MPI_ERR_WIN; //get receiver pointer MPI_Win recv_win = win->connected_wins[target_rank]; @@ -173,6 +188,8 @@ int smpi_mpi_put( void *origin_addr, int origin_count, MPI_Datatype origin_datat int smpi_mpi_get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win) { + if(!win->opened)//check that post/start has been done + return MPI_ERR_WIN; //get sender pointer MPI_Win send_win = win->connected_wins[target_rank]; @@ -213,6 +230,8 @@ int smpi_mpi_get( void *origin_addr, int origin_count, MPI_Datatype origin_datat int smpi_mpi_accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win) { + if(!win->opened)//check that post/start has been done + return MPI_ERR_WIN; //FIXME: local version //get receiver pointer MPI_Win recv_win = win->connected_wins[target_rank]; @@ -244,3 +263,183 @@ int smpi_mpi_accumulate( void *origin_addr, int origin_count, MPI_Datatype origi return MPI_SUCCESS; } +int smpi_mpi_win_start(MPI_Group group, int assert, MPI_Win win){ + /* From MPI forum advices + The call to MPI_WIN_COMPLETE does not return until the put call has completed at + the origin; and the target window will be accessed by the put operation only + after the call to MPI_WIN_START has matched a call to MPI_WIN_POST by the target + process. This still leaves much choice to implementors. The call to + MPI_WIN_START can block until the matching call to MPI_WIN_POST occurs at all + target processes. One can also have implementations where the call to + MPI_WIN_START is nonblocking, but the call to MPI_PUT blocks until the matching + call to MPI_WIN_POST occurred; or implementations where the first two calls are + nonblocking, but the call to MPI_WIN_COMPLETE blocks until the call to + MPI_WIN_POST occurred; or even implementations where all three calls can + complete before any target process called MPI_WIN_POST --- the data put must be + buffered, in this last case, so as to allow the put to complete at the origin + ahead of its completion at the target. However, once the call to MPI_WIN_POST is + issued, the sequence above must complete, without further dependencies. + */ + + //naive, blocking implementation. + int i=0,j=0; + int size = smpi_group_size(group); + MPI_Request* reqs = xbt_new0(MPI_Request, size); + +// for(i=0;iopened++; //we're open for business ! + win->group=group; + smpi_group_use(group); + return MPI_SUCCESS; +} + +int smpi_mpi_win_post(MPI_Group group, int assert, MPI_Win win){ + //let's make a synchronous send here + int i=0,j=0; + int size = smpi_group_size(group); + MPI_Request* reqs = xbt_new0(MPI_Request, size); + + while(j!=size){ + int dst=smpi_group_index(group,j); + if(dst!=smpi_process_index()){ + reqs[i]=smpi_mpi_send_init(NULL, 0, MPI_CHAR, dst, + RMA_TAG+4, MPI_COMM_WORLD); + i++; + } + j++; + } + size=i; + + smpi_mpi_startall(size, reqs); + smpi_mpi_waitall(size, reqs, MPI_STATUSES_IGNORE); + for(i=0;iopened++; //we're open for business ! + win->group=group; + smpi_group_use(group); + return MPI_SUCCESS; +} + +int smpi_mpi_win_complete(MPI_Win win){ + if(win->opened==0) + xbt_die("Complete called on already opened MPI_Win"); +// xbt_barrier_wait(win->bar); + //MPI_Comm comm = smpi_comm_new(win->group, NULL); + //mpi_coll_barrier_fun(comm); + //smpi_comm_destroy(comm); + + XBT_DEBUG("Entering MPI_Win_Complete"); + int i=0,j=0; + int size = smpi_group_size(win->group); + MPI_Request* reqs = xbt_new0(MPI_Request, size); + + while(j!=size){ + int dst=smpi_group_index(win->group,j); + if(dst!=smpi_process_index()){ + reqs[i]=smpi_mpi_send_init(NULL, 0, MPI_CHAR, dst, + RMA_TAG+5, MPI_COMM_WORLD); + i++; + } + j++; + } + size=i; + XBT_DEBUG("Win_complete - Sending sync messages to %d processes", size); + smpi_mpi_startall(size, reqs); + smpi_mpi_waitall(size, reqs, MPI_STATUSES_IGNORE); + + for(i=0;irequests; + size = xbt_dynar_length(reqqs); + + XBT_DEBUG("Win_complete - Finishing %d RMA calls", size); + unsigned int cpt=0; + MPI_Request req; + // start all requests that have been prepared by another process + xbt_dynar_foreach(reqqs, cpt, req){ + if (req->flags & PREPARED) smpi_mpi_start(req); + } + + MPI_Request* treqs = xbt_dynar_to_array(reqqs); + smpi_mpi_waitall(size,treqs,MPI_STATUSES_IGNORE); + xbt_free(treqs); + win->requests=xbt_dynar_new(sizeof(MPI_Request), NULL); + win->opened--; //we're closed for business ! + return MPI_SUCCESS; +} + + + +int smpi_mpi_win_wait(MPI_Win win){ +// xbt_barrier_wait(win->bar); + //MPI_Comm comm = smpi_comm_new(win->group, NULL); + //mpi_coll_barrier_fun(comm); + //smpi_comm_destroy(comm); + //naive, blocking implementation. + XBT_DEBUG("Entering MPI_Win_Wait"); + int i=0,j=0; + int size = smpi_group_size(win->group); + MPI_Request* reqs = xbt_new0(MPI_Request, size); + +// for(i=0;igroup,j); + if(src!=smpi_process_index()){ + reqs[i]=smpi_irecv_init(NULL, 0, MPI_CHAR, src,RMA_TAG+5, MPI_COMM_WORLD); + i++; + } + j++; + } + size=i; + XBT_DEBUG("Win_wait - Receiving sync messages from %d processes", size); + smpi_mpi_startall(size, reqs); + smpi_mpi_waitall(size, reqs, MPI_STATUSES_IGNORE); + for(i=0;irequests; + size = xbt_dynar_length(reqqs); + + XBT_DEBUG("Win_complete - Finishing %d RMA calls", size); + + unsigned int cpt=0; + MPI_Request req; + // start all requests that have been prepared by another process + xbt_dynar_foreach(reqqs, cpt, req){ + if (req->flags & PREPARED) smpi_mpi_start(req); + } + + MPI_Request* treqs = xbt_dynar_to_array(reqqs); + smpi_mpi_waitall(size,treqs,MPI_STATUSES_IGNORE); + xbt_free(treqs); + win->requests=xbt_dynar_new(sizeof(MPI_Request), NULL); + win->opened--; //we're opened for business ! + return MPI_SUCCESS; +} + + + diff --git a/src/smpi/smpicc.in b/src/smpi/smpicc.in index 6902a25e2f..41ece46fcb 100755 --- a/src/smpi/smpicc.in +++ b/src/smpi/smpicc.in @@ -1,12 +1,13 @@ #! /bin/sh -# Copyright (c) 2007-2014. The SimGrid Team. +# Copyright (c) 2007-2015. The SimGrid Team. # All rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the license (GNU LGPL) which comes with this package. SIMGRID_VERSION="@SIMGRID_VERSION_STRING@" +SIMGRID_GITHASH="@SIMGRID_GITHASH@" CC=@CMAKE_C_COMPILER@ @@ -46,6 +47,10 @@ while [ $# -gt 0 ]; do printf '%b\n' "$SIMGRID_VERSION" exit 0 ;; + "-git-version" | "--git-version") + printf '%b\n' "$SIMGRID_GITHASH" + exit 0 + ;; '-compiler-version' | '--compiler-version') ${CC} --version ;; diff --git a/src/smpi/smpicxx.in b/src/smpi/smpicxx.in index b23a2740ff..cec91154d9 100755 --- a/src/smpi/smpicxx.in +++ b/src/smpi/smpicxx.in @@ -1,12 +1,13 @@ #! /bin/sh -# Copyright (c) 2014. The SimGrid Team. +# Copyright (c) 2014-2015. The SimGrid Team. # All rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the license (GNU LGPL) which comes with this package. SIMGRID_VERSION="@SIMGRID_VERSION_STRING@" +SIMGRID_GITHASH="@SIMGRID_GITHASH@" CXX=@CMAKE_CXX_COMPILER@ @@ -46,6 +47,10 @@ while [ $# -gt 0 ]; do printf '%b\n' "$SIMGRID_VERSION" exit 0 ;; + "-git-version" | "--git-version") + printf '%b\n' "$SIMGRID_GITHASH" + exit 0 + ;; '-compiler-version' | '--compiler-version') ${CXX} --version ;; diff --git a/src/smpi/smpif90.in b/src/smpi/smpif90.in index 1a33ba1430..1e6a7e6703 100644 --- a/src/smpi/smpif90.in +++ b/src/smpi/smpif90.in @@ -1,12 +1,13 @@ #! /bin/sh -# Copyright (c) 2012-2014. The SimGrid Team. +# Copyright (c) 2012-2015. The SimGrid Team. # All rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the license (GNU LGPL) which comes with this package. SIMGRID_VERSION="@SIMGRID_VERSION_STRING@" +SIMGRID_GITHASH="@SIMGRID_GITHASH@" F90=@GFORTRAN_EXE@ @@ -49,6 +50,10 @@ while [ $# -gt 0 ]; do printf '%b\n' "$SIMGRID_VERSION" exit 0 ;; + "-git-version" | "--git-version") + printf '%b\n' "$SIMGRID_GITHASH" + exit 0 + ;; '-compiler-version' | '--compiler-version') ${F90} --version ;; diff --git a/src/smpi/smpiff.in b/src/smpi/smpiff.in index 1c6308dfc6..8cb4bf4ca2 100644 --- a/src/smpi/smpiff.in +++ b/src/smpi/smpiff.in @@ -1,12 +1,13 @@ #! /bin/sh -# Copyright (c) 2012-2014. The SimGrid Team. +# Copyright (c) 2012-2015. The SimGrid Team. # All rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the license (GNU LGPL) which comes with this package. SIMGRID_VERSION="@SIMGRID_VERSION_STRING@" +SIMGRID_GITHASH="@SIMGRID_GITHASH@" F77=@GFORTRAN_EXE@ @@ -53,6 +54,10 @@ while [ $# -gt 0 ]; do printf '%b\n' "$SIMGRID_VERSION" exit 0 ;; + "-git-version" | "--git-version") + printf '%b\n' "$SIMGRID_GITHASH" + exit 0 + ;; '-compiler-version' | '--compiler-version') ${F77} --version ;; diff --git a/src/smpi/smpirun.in b/src/smpi/smpirun.in index 5b588bf934..812acdbdfc 100755 --- a/src/smpi/smpirun.in +++ b/src/smpi/smpirun.in @@ -1,6 +1,6 @@ #! /bin/sh -# Copyright (c) 2007-2014. The SimGrid Team. +# Copyright (c) 2007-2015. The SimGrid Team. # All rights reserved. # This program is free software; you can redistribute it and/or modify it @@ -9,6 +9,7 @@ @CMAKE_SMPI_COMMAND@ SIMGRID_VERSION="@SIMGRID_VERSION_STRING@" +SIMGRID_GITHASH="@SIMGRID_GITHASH@" DEFAULT_LOOPBACK_BANDWIDTH="498000000" DEFAULT_LOOPBACK_LATENCY="0.000004" @@ -44,6 +45,9 @@ Options: -trace-viva # generate configuration for Viva's GraphView -trace-file # name of the tracefile (simgrid_smpi.trace) -ext # additional parameter (reserved) + + -version # Displays the SimGrid version (human readable) + -git-version # Displays the git hash of SimGrid or (deprecated usage): $0 [-keep-temps] [-np ] [-bandwidth ] [-latency ] program [program-options] @@ -172,6 +176,11 @@ while true; do printf '%b\n' "$SIMGRID_VERSION" exit 0 ;; + + "-git-version" | "--git-version") + printf '%b\n' "$SIMGRID_GITHASH" + exit 0 + ;; "--cfg="*|"--log="*) for OPT in ${1#*=} @@ -225,6 +234,20 @@ if [ -z "${HOSTFILE}" ] ; then HOSTFILETMP=1 HOSTFILE="$(mktemp tmphostXXXXXX)" perl -ne 'print "$1\n" if /.*.*/' ${PLATFORM} > ${HOSTFILE} + perl -ne 'if (/.*> ${HOSTFILE} fi UNROLLEDHOSTFILETMP=0 @@ -343,9 +366,9 @@ if [ -n "${HAVE_SEQ}" ]; then SEQ=`${HAVE_SEQ} 0 $((${NUMPROCS}-1))` else cnt=0 - while (( $cnt < ${NUMPROCS} )) ; do - SEQ="$SEQ $cnt" - cnt=$((cnt + 1)); + while [ $cnt -lt ${NUMPROCS} ] ; do + SEQ="$SEQ $cnt" + cnt=$((cnt + 1)); done fi diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index b58815c16a..98ad19a55c 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -118,8 +118,8 @@ CpuPtr CpuCas01Model::createCpu(const char *name, xbt_dynar_t power_peak, "Host '%s' declared several times in the platform file", name); xbt_assert(xbt_dynar_getfirst_as(power_peak, double) > 0.0, - "Power has to be >0.0"); - xbt_assert(core > 0, "Invalid number of cores %d", core); + "Power has to be >0.0. Did you forget to specify the mandatory power attribute?"); + xbt_assert(core > 0, "Invalid number of cores %d. Must be larger than 0", core); cpu = new CpuCas01(this, name, power_peak, pstate, power_scale, power_trace, core, state_initial, state_trace, cpu_properties); xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu); diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 38717da785..81a156d427 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -437,6 +437,8 @@ CpuPtr CpuTiModel::createCpu(const char *name, xbt_assert(!surf_cpu_resource_priv(surf_cpu_resource_by_name(name)), "Host '%s' declared several times in the platform file", name); + xbt_assert(xbt_dynar_getfirst_as(powerPeak, double) > 0.0, + "Power has to be >0.0. Did you forget to specify the mandatory power attribute?"); CpuTiPtr cpu = new CpuTi(this, name, powerPeak, pstate, powerScale, powerTrace, core, stateInitial, stateTrace, cpuProperties); xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, static_cast(cpu)); diff --git a/src/surf/maxmin.cpp b/src/surf/maxmin.cpp index 7a42307469..fc8b453746 100644 --- a/src/surf/maxmin.cpp +++ b/src/surf/maxmin.cpp @@ -431,6 +431,31 @@ lmm_variable_t lmm_get_var_from_cnst(lmm_system_t /*sys*/, return NULL; } +//if we modify the swag between calls, normal version may loop forever +//this safe version ensures that we browse the swag elements only once +lmm_variable_t lmm_get_var_from_cnst_safe(lmm_system_t /*sys*/, + lmm_constraint_t cnst, + lmm_element_t * elem, + lmm_element_t * nextelem, + int * numelem) +{ + if (!(*elem)){ + *elem = (lmm_element_t) xbt_swag_getFirst(&(cnst->element_set)); + *numelem = xbt_swag_size(&(cnst->element_set))-1; + }else{ + *elem = *nextelem; + if(*numelem>0){ + (*numelem) --; + }else + return NULL; + } + if (*elem){ + *nextelem = (lmm_element_t) xbt_swag_getNext(*elem, cnst->element_set.offset); + return (*elem)->variable; + }else + return NULL; +} + void *lmm_constraint_id(lmm_constraint_t cnst) { return cnst->id; diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 637a243f08..fe4d32da08 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -614,6 +614,9 @@ void NetworkCm02Link::updateBandwidth(double value, double date){ (p_power.peak * p_power.scale); lmm_variable_t var = NULL; lmm_element_t elem = NULL; + lmm_element_t nextelem = NULL; + int numelem = 0; + NetworkCm02ActionPtr action = NULL; p_power.peak = value; @@ -625,7 +628,7 @@ void NetworkCm02Link::updateBandwidth(double value, double date){ TRACE_surf_link_set_bandwidth(date, getName(), sg_bandwidth_factor * p_power.peak * p_power.scale); #endif if (sg_weight_S_parameter > 0) { - while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) { + while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) { action = (NetworkCm02ActionPtr) lmm_variable_id(var); action->m_weight += delta; if (!action->isSuspended()) @@ -638,10 +641,12 @@ void NetworkCm02Link::updateLatency(double value, double date){ double delta = value - m_latCurrent; lmm_variable_t var = NULL; lmm_element_t elem = NULL; + lmm_element_t nextelem = NULL; + int numelem = 0; NetworkCm02ActionPtr action = NULL; m_latCurrent = value; - while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) { + while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) { action = (NetworkCm02ActionPtr) lmm_variable_id(var); action->m_latCurrent += delta; action->m_weight += delta; diff --git a/src/surf/network_ib.cpp b/src/surf/network_ib.cpp index 29aeb32054..de303c931d 100644 --- a/src/surf/network_ib.cpp +++ b/src/surf/network_ib.cpp @@ -3,3 +3,224 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include "network_ib.hpp" +#include "simgrid/sg_config.h" +#include "maxmin_private.hpp" + +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network); + +static void IB_create_host_callback(sg_platf_host_cbarg_t t){ + + static int id=0; +// pour t->id -> rajouter une nouvelle struct dans le dict, pour stocker les comms actives + if(((NetworkIBModel*)surf_network_model)->active_nodes==NULL) + ((NetworkIBModel*)surf_network_model)->active_nodes=xbt_dict_new(); + + IBNode* act = new IBNode(id); + + id++; + xbt_dict_set(((NetworkIBModel*)surf_network_model)->active_nodes, t->id, act, NULL); + +} + +static void IB_action_state_changed_callback(NetworkActionPtr action, e_surf_action_state_t statein, e_surf_action_state_t stateout){ + if(statein!=SURF_ACTION_RUNNING|| stateout!=SURF_ACTION_DONE) + return; + std::pair pair = ((NetworkIBModel*)surf_network_model)->active_comms[action]; + XBT_DEBUG("IB callback - action %p finished", action); + + ((NetworkIBModel*)surf_network_model)->updateIBfactors(action, pair.first, pair.second, 1); + + ((NetworkIBModel*)surf_network_model)->active_comms.erase(action); + +} + + +static void IB_action_init_callback(NetworkActionPtr action,RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate){ + if(((NetworkIBModel*)surf_network_model)->active_nodes==NULL) + xbt_die("IB comm added, without any node connected !"); + + IBNode* act_src= (IBNode*) xbt_dict_get_or_null(((NetworkIBModel*)surf_network_model)->active_nodes, src->getName()); + if(act_src==NULL) + xbt_die("could not find src node active comms !"); + //act_src->rate=rate; + + IBNode* act_dst= (IBNode*) xbt_dict_get_or_null(((NetworkIBModel*)surf_network_model)->active_nodes, dst->getName()); + if(act_dst==NULL) + xbt_die("could not find dst node active comms !"); + // act_dst->rate=rate; + + ((NetworkIBModel*)surf_network_model)->active_comms[action]=make_pair(act_src, act_dst); + //post the action in the second dist, to retrieve in the other callback + XBT_DEBUG("IB callback - action %p init", action); + + ((NetworkIBModel*)surf_network_model)->updateIBfactors(action, act_src, act_dst, 0); + +} + + + +/********* + * Model * + *********/ + +/************************************************************************/ +/* New model based on MPI contention model for Infiniband platforms */ +/************************************************************************/ +/* @Inproceedings{mescal_vienne_phd, */ +/* author={Jérôme Vienne}, */ +/* title={prédiction de performances d’applications de calcul haute performance sur réseau Infiniband}, */ +/* address={Grenoble FRANCE}, */ +/* month=june, */ +/* year={2010} */ +/* } */ +void surf_network_model_init_IB(void) +{ + + if (surf_network_model) + return; + surf_network_model = new NetworkIBModel(); + net_define_callbacks(); + xbt_dynar_push(model_list, &surf_network_model); + surf_callback_connect(networkActionStateChangedCallbacks, IB_action_state_changed_callback); + surf_callback_connect(networkCommunicateCallbacks, IB_action_init_callback); + + sg_platf_host_add_cb(IB_create_host_callback); + xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775); + +} + +NetworkIBModel::NetworkIBModel() + : NetworkSmpiModel() { + m_haveGap=false; + active_nodes=NULL; + + const char* IB_factors_string=sg_cfg_get_string("smpi/IB_penalty_factors"); + xbt_dynar_t radical_elements = xbt_str_split(IB_factors_string, ";"); + + if(xbt_dynar_length(radical_elements)!=3) + surf_parse_error("smpi/IB_penalty_factors should be provided and contain 3 elements, semi-colon separated : for example 0.965;0.925;1.35"); + + Be = atof(xbt_dynar_get_as(radical_elements, 0, char *)); + Bs = atof(xbt_dynar_get_as(radical_elements, 1, char *)); + ys = atof(xbt_dynar_get_as(radical_elements, 2, char *)); + + xbt_dynar_free(&radical_elements); +} + +NetworkIBModel::~NetworkIBModel() +{ + xbt_dict_cursor_t cursor = NULL; + IBNode* instance = NULL; + char *name = NULL; + xbt_dict_foreach(active_nodes, cursor, name, instance) + delete instance; + xbt_dict_free(&active_nodes); +} + +void NetworkIBModel::computeIBfactors(IBNode *root) { + double penalized_bw=0.0; + double num_comm_out = (double) root->ActiveCommsUp.size(); + double max_penalty_out=0.0; + //first, compute all outbound penalties to get their max + for (std::vector::iterator it= root->ActiveCommsUp.begin(); it != root->ActiveCommsUp.end(); ++it) { + double my_penalty_out = 1.0; + + if(num_comm_out!=1){ + if((*it)->destination->nbActiveCommsDown > 2)//number of comms sent to the receiving node + my_penalty_out = num_comm_out * Bs * ys; + else + my_penalty_out = num_comm_out * Bs; + } + + max_penalty_out = max(max_penalty_out,my_penalty_out); + } + + for (std::vector::iterator it= root->ActiveCommsUp.begin(); it != root->ActiveCommsUp.end(); ++it) { + + //compute inbound penalty + double my_penalty_in = 1.0; + int nb_comms = (*it)->destination->nbActiveCommsDown;//total number of incoming comms + if(nb_comms!=1) + my_penalty_in = ((*it)->destination->ActiveCommsDown)[root] //number of comm sent to dest by root node + * Be + * (*it)->destination->ActiveCommsDown.size();//number of different nodes sending to dest + + double penalty=max(my_penalty_in,max_penalty_out); + + double rate_before_update = (*it)->action->getBound(); + //save initial rate of the action + if((*it)->init_rate==-1) + (*it)->init_rate= rate_before_update; + + penalized_bw= ! num_comm_out ? (*it)->init_rate : (*it)->init_rate /penalty; + + if (!double_equals(penalized_bw, rate_before_update, sg_surf_precision)){ + XBT_DEBUG("%d->%d action %p penalty updated : bw now %f, before %f , initial rate %f", root->id,(*it)->destination->id,(*it)->action,penalized_bw, (*it)->action->getBound(), (*it)->init_rate ); + lmm_update_variable_bound(p_maxminSystem, (*it)->action->getVariable(), penalized_bw); + }else{ + XBT_DEBUG("%d->%d action %p penalty not updated : bw %f, initial rate %f", root->id,(*it)->destination->id,(*it)->action,penalized_bw, (*it)->init_rate ); + } + + } + XBT_DEBUG("Finished computing IB penalties"); +} + +void NetworkIBModel::updateIBfactors_rec(IBNode *root, bool* updatedlist) { + if(updatedlist[root->id]==0){ + XBT_DEBUG("IB - Updating rec %d", root->id); + computeIBfactors(root); + updatedlist[root->id]=1; + for (std::vector::iterator it= root->ActiveCommsUp.begin(); it != root->ActiveCommsUp.end(); ++it) { + if(updatedlist[(*it)->destination->id]!=1) + updateIBfactors_rec((*it)->destination, updatedlist); + } + for (std::map::iterator it= root->ActiveCommsDown.begin(); it != root->ActiveCommsDown.end(); ++it) { + if(updatedlist[it->first->id]!=1) + updateIBfactors_rec(it->first, updatedlist); + } + } +} + + +void NetworkIBModel::updateIBfactors(NetworkActionPtr action, IBNode *from, IBNode * to, int remove) { + if (from == to)//disregard local comms (should use loopback) + return; + + bool* updated=(bool*)xbt_malloc0(xbt_dict_size(active_nodes)*sizeof(bool)); + ActiveComm* comm=NULL; + if(remove){ + if(to->ActiveCommsDown[from]==1) + to->ActiveCommsDown.erase(from); + else + to->ActiveCommsDown[from]-=1; + + to->nbActiveCommsDown--; + for (std::vector::iterator it= from->ActiveCommsUp.begin(); + it != from->ActiveCommsUp.end(); ++it) { + if((*it)->action==action){ + comm=(*it); + from->ActiveCommsUp.erase(it); + break; + } + } + action->unref(); + + }else{ + action->ref(); + ActiveComm* comm=new ActiveComm(); + comm->action=action; + comm->destination=to; + from->ActiveCommsUp.push_back(comm); + + to->ActiveCommsDown[from]+=1; + to->nbActiveCommsDown++; + } + XBT_DEBUG("IB - Updating %d", from->id); + updateIBfactors_rec(from, updated); + XBT_DEBUG("IB - Finished updating %d", from->id); + if(comm) + delete comm; + xbt_free(updated); +} diff --git a/src/surf/network_ib.hpp b/src/surf/network_ib.hpp index b7d17157c5..7328b97234 100644 --- a/src/surf/network_ib.hpp +++ b/src/surf/network_ib.hpp @@ -7,37 +7,50 @@ #ifndef SURF_NETWORK_IB_HPP_ #define SURF_NETWORK_IB_HPP_ -class NetworkIBModel : public NetworkModel { -private: -public: - NetworkIBModel(); - NetworkIBModel(const char *name); - ~NetworkModel(); - virtual ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst, - double size, double rate); - virtual NetworkLinkPtr createNetworkLink(const char *name, - double bw_initial, - tmgr_trace_t bw_trace, - double lat_initial, - tmgr_trace_t lat_trace, - e_surf_resource_state_t state_initial, - tmgr_trace_t state_trace, - e_surf_link_sharing_policy_t policy, - xbt_dict_t properties); +#include "network_smpi.hpp" +class IBNode; + + +class ActiveComm{ +public : + //IBNode* origin; + IBNode* destination; + NetworkActionPtr action; + double init_rate; + ActiveComm() : destination(NULL),action(NULL),init_rate(-1){}; + ~ActiveComm(){}; }; -class NetworkIBLink : public NetworkLink { +class IBNode{ +public : + int id; + //store related links, to ease computation of the penalties + std::vector ActiveCommsUp; + //store the number of comms received from each node + std::map ActiveCommsDown; + //number of comms the node is receiving + int nbActiveCommsDown; + IBNode(int id) : id(id),nbActiveCommsDown(0){}; + ~IBNode(){}; +}; + +class NetworkIBModel : public NetworkSmpiModel { private: + void updateIBfactors_rec(IBNode *root, bool* updatedlist); + void computeIBfactors(IBNode *root); public: - NetworkIBLink(NetworkModelPtr model, const char *name, xbt_dict_t props); - NetworkIBLink(NetworkModelPtr model, const char *name, xbt_dict_t props, - lmm_constraint_t constraint, - tmgr_history_t history, - tmgr_trace_t state_trace); - ~NetworkIBLink(); - virtual void updateLatency(double value, double date=surf_get_clock()); - virtual void updateBandwidth(double value, double date=surf_get_clock()); - + NetworkIBModel(); + NetworkIBModel(const char *name); + ~NetworkIBModel(); + void updateIBfactors(NetworkActionPtr action, IBNode *from, IBNode * to, int remove); + + xbt_dict_t active_nodes; + std::map > active_comms; + + double Bs; + double Be; + double ys; }; + #endif diff --git a/src/surf/plugins/energy.cpp b/src/surf/plugins/energy.cpp index 4fd94acf79..3badfdff6b 100644 --- a/src/surf/plugins/energy.cpp +++ b/src/surf/plugins/energy.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010, 2012-2014. The SimGrid Team. +/* Copyright (c) 2010, 2012-2015. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -10,7 +10,7 @@ /** @addtogroup SURF_plugin_energy * * - * BlaBla energy + * This is the energy plugin, enabling to account not only for computation time, but also for the dissipated energy in the simulated platform. */ XBT_LOG_EXTERNAL_CATEGORY(surf_kernel); @@ -23,12 +23,47 @@ static void energyCpuCreatedCallback(CpuPtr cpu){ (*surf_energy)[cpu] = new CpuEnergy(cpu); } +static void update_consumption_running(CpuPtr cpu, CpuEnergyPtr cpu_energy) { + double cpu_load = lmm_constraint_get_usage(cpu->getConstraint()) / cpu->m_powerPeak; + double start_time = cpu_energy->last_updated; + double finish_time = surf_get_clock(); + + double previous_energy = cpu_energy->total_energy; + double energy_this_step = cpu_energy->getCurrentWattsValue(cpu_load)*(finish_time-start_time); + + cpu_energy->total_energy = previous_energy + energy_this_step; + cpu_energy->last_updated = finish_time; + + XBT_DEBUG("[cpu_update_energy] period=[%.2f-%.2f]; current power peak=%.0E flop/s; consumption change: %.2f J -> %.2f J", + start_time, finish_time, cpu->m_powerPeak, previous_energy, energy_this_step); +} +static void update_consumption_off(CpuPtr cpu, CpuEnergyPtr cpu_energy) { + double start_time = cpu_energy->last_updated; + double finish_time = surf_get_clock(); + + double previous_energy = cpu_energy->total_energy; + double energy_this_step = cpu_energy->watts_off*(finish_time-start_time); + + cpu_energy->total_energy = previous_energy + energy_this_step; + cpu_energy->last_updated = finish_time; + + XBT_DEBUG("[cpu_update_energy] off period=[%.2f-%.2f]; consumption change: %.2f J -> %.2f J", + start_time, finish_time, previous_energy, energy_this_step); +} + static void energyCpuDestructedCallback(CpuPtr cpu){ - std::map::iterator cpuIt = surf_energy->find(cpu); - xbt_assert(cpuIt != surf_energy->end(), "The cpu is not in surf_energy."); - XBT_INFO("Total energy (Joules) of host %s: %f", cpu->getName(), cpuIt->second->getConsumedEnergy()); - delete cpuIt->second; - surf_energy->erase(cpuIt); + std::map::iterator cpu_energy_it = surf_energy->find(cpu); + xbt_assert(cpu_energy_it != surf_energy->end(), "The cpu is not in surf_energy."); + + CpuEnergyPtr cpu_energy = cpu_energy_it->second; + if (cpu->getState() == SURF_RESOURCE_OFF) + update_consumption_off(cpu, cpu_energy); + else + update_consumption_running(cpu, cpu_energy); + + XBT_INFO("Total energy of host %s: %f Joules", cpu->getName(), cpu_energy->getConsumedEnergy()); + delete cpu_energy_it->second; + surf_energy->erase(cpu_energy_it); } static void energyCpuActionStateChangedCallback(CpuActionPtr action, e_surf_action_state_t old, e_surf_action_state_t cur){ @@ -36,21 +71,18 @@ static void energyCpuActionStateChangedCallback(CpuActionPtr action, e_surf_acti CpuEnergyPtr cpu_energy = (*surf_energy)[cpu]; if(cpu_energy->last_updated < surf_get_clock()) { - double cpu_load = lmm_constraint_get_usage(cpu->getConstraint()) / cpu->m_powerPeak; - double start_time = cpu_energy->last_updated; - double finish_time = surf_get_clock(); - - /*XBT_DEBUG("[cpu_update_energy] action time interval=(%f-%f), current power peak=%f, current pstate=%d", - start_time, finish_time, cpu->m_powerPeak, cpu->m_pstate);*/ - XBT_DEBUG("[cpu_update_energy] action time interval=(%f-%f), current power peak=%f", - start_time, finish_time, cpu->m_powerPeak); - double current_energy = cpu_energy->total_energy; - double action_energy = cpu_energy->getCurrentWattsValue(cpu_load)*(finish_time-start_time); + update_consumption_running(cpu, cpu_energy); + } +} - cpu_energy->total_energy = current_energy + action_energy; - cpu_energy->last_updated = finish_time; +static void energyStateChangedCallback(CpuPtr cpu, e_surf_resource_state_t oldState, e_surf_resource_state_t newState){ + CpuEnergyPtr cpu_energy = (*surf_energy)[cpu]; - XBT_DEBUG("[cpu_update_energy] old_energy_value=%f, action_energy_value=%f", current_energy, action_energy); + if(cpu_energy->last_updated < surf_get_clock()) { + if (oldState == SURF_RESOURCE_OFF) + update_consumption_off(cpu, cpu_energy); + else + update_consumption_running(cpu, cpu_energy); } } @@ -71,6 +103,7 @@ void sg_energy_plugin_init() { surf_callback_connect(cpuDestructedCallbacks, energyCpuDestructedCallback); surf_callback_connect(cpuActionStateChangedCallbacks, energyCpuActionStateChangedCallback); surf_callback_connect(surfExitCallbacks, sg_energy_plugin_exit); + surf_callback_connect(cpuStateChangedCallbacks, energyStateChangedCallback); } } @@ -83,6 +116,15 @@ CpuEnergy::CpuEnergy(CpuPtr ptr) total_energy = 0; power_range_watts_list = getWattsRangeList(); last_updated = surf_get_clock(); + + if (cpu->getProperties() != NULL) { + char* off_power_str = (char*)xbt_dict_get_or_null(cpu->getProperties(), "watt_off"); + if (off_power_str != NULL) + watts_off = atof(off_power_str); + else + watts_off = 0; + } + } CpuEnergy::~CpuEnergy(){ @@ -93,7 +135,6 @@ CpuEnergy::~CpuEnergy(){ xbt_dynar_free(&power_range_watts_list); } - /** * Computes the power consumed by the host according to the current pstate and processor load * @@ -130,6 +171,12 @@ double CpuEnergy::getCurrentWattsValue(double cpu_load) double CpuEnergy::getConsumedEnergy() { + if(last_updated < surf_get_clock()) { + if (cpu->getState() == SURF_RESOURCE_OFF) + update_consumption_off(cpu, this); + else + update_consumption_running(cpu, this); + } return total_energy; } @@ -144,7 +191,7 @@ xbt_dynar_t CpuEnergy::getWattsRangeList() if (cpu->getProperties() == NULL) return NULL; - char* all_power_values_str = (char*)xbt_dict_get_or_null(cpu->getProperties(), "power_per_state"); + char* all_power_values_str = (char*)xbt_dict_get_or_null(cpu->getProperties(), "watt_per_state"); if (all_power_values_str == NULL) return NULL; diff --git a/src/surf/plugins/energy.hpp b/src/surf/plugins/energy.hpp index 5839da8b7c..682ae46d83 100644 --- a/src/surf/plugins/energy.hpp +++ b/src/surf/plugins/energy.hpp @@ -22,9 +22,10 @@ public: double getCurrentWattsValue(double cpu_load); double getConsumedEnergy(); - xbt_dynar_t getWattsRangeList(); - xbt_dynar_t power_range_watts_list; /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */ + xbt_dynar_t getWattsRangeList(); + xbt_dynar_t power_range_watts_list; /*< List of (min_power,max_power) pairs corresponding to each cpu pstate */ + double watts_off; /*< Consumption when the machine is turned off (shutdown) */ double total_energy; /*< Total energy consumed by the host */ double last_updated; /*< Timestamp of the last energy update event*/ CpuPtr cpu; diff --git a/src/surf/simgrid_dtd.c b/src/surf/simgrid_dtd.c index 3c8122d120..c110244cf3 100644 --- a/src/surf/simgrid_dtd.c +++ b/src/surf/simgrid_dtd.c @@ -4681,366 +4681,366 @@ const char surfxml_flexml_version[] = "1.9.6"; int surfxml_pcdata_ix; extern char *surfxml_bufferstack; #define surfxml_pcdata (surfxml_bufferstack + surfxml_pcdata_ix) -AT_surfxml_random_max AX_surfxml_random_max; -#define A_surfxml_random_max (surfxml_bufferstack + AX_surfxml_random_max) -short int surfxml_random_max_isset; -AT_surfxml_cluster_id AX_surfxml_cluster_id; -#define A_surfxml_cluster_id (surfxml_bufferstack + AX_surfxml_cluster_id) -short int surfxml_cluster_id_isset; -AT_surfxml_cabinet_lat AX_surfxml_cabinet_lat; -#define A_surfxml_cabinet_lat (surfxml_bufferstack + AX_surfxml_cabinet_lat) -short int surfxml_cabinet_lat_isset; -AT_surfxml_ASroute_symmetrical AX_surfxml_ASroute_symmetrical; -#define A_surfxml_ASroute_symmetrical AX_surfxml_ASroute_symmetrical -short int surfxml_ASroute_symmetrical_isset; -AT_surfxml_link_latency___file AX_surfxml_link_latency___file; -#define A_surfxml_link_latency___file (surfxml_bufferstack + AX_surfxml_link_latency___file) -short int surfxml_link_latency___file_isset; -AT_surfxml_cluster_bb___lat AX_surfxml_cluster_bb___lat; -#define A_surfxml_cluster_bb___lat (surfxml_bufferstack + AX_surfxml_cluster_bb___lat) -short int surfxml_cluster_bb___lat_isset; -AT_surfxml_host_coordinates AX_surfxml_host_coordinates; -#define A_surfxml_host_coordinates (surfxml_bufferstack + AX_surfxml_host_coordinates) -short int surfxml_host_coordinates_isset; -AT_surfxml_route_dst AX_surfxml_route_dst; -#define A_surfxml_route_dst (surfxml_bufferstack + AX_surfxml_route_dst) -short int surfxml_route_dst_isset; -AT_surfxml_bypassASroute_gw___dst AX_surfxml_bypassASroute_gw___dst; -#define A_surfxml_bypassASroute_gw___dst (surfxml_bufferstack + AX_surfxml_bypassASroute_gw___dst) -short int surfxml_bypassASroute_gw___dst_isset; -AT_surfxml_cluster_prefix AX_surfxml_cluster_prefix; -#define A_surfxml_cluster_prefix (surfxml_bufferstack + AX_surfxml_cluster_prefix) -short int surfxml_cluster_prefix_isset; -AT_surfxml_host_core AX_surfxml_host_core; -#define A_surfxml_host_core (surfxml_bufferstack + AX_surfxml_host_core) -short int surfxml_host_core_isset; -AT_surfxml_link_bandwidth___file AX_surfxml_link_bandwidth___file; -#define A_surfxml_link_bandwidth___file (surfxml_bufferstack + AX_surfxml_link_bandwidth___file) -short int surfxml_link_bandwidth___file_isset; -AT_surfxml_peer_bw___in AX_surfxml_peer_bw___in; -#define A_surfxml_peer_bw___in (surfxml_bufferstack + AX_surfxml_peer_bw___in) -short int surfxml_peer_bw___in_isset; -AT_surfxml_process_start___time AX_surfxml_process_start___time; -#define A_surfxml_process_start___time (surfxml_bufferstack + AX_surfxml_process_start___time) -short int surfxml_process_start___time_isset; AT_surfxml_platform_version AX_surfxml_platform_version; #define A_surfxml_platform_version (surfxml_bufferstack + AX_surfxml_platform_version) short int surfxml_platform_version_isset; -AT_surfxml_backbone_id AX_surfxml_backbone_id; -#define A_surfxml_backbone_id (surfxml_bufferstack + AX_surfxml_backbone_id) -short int surfxml_backbone_id_isset; +AT_surfxml_link___ctn_id AX_surfxml_link___ctn_id; +#define A_surfxml_link___ctn_id (surfxml_bufferstack + AX_surfxml_link___ctn_id) +short int surfxml_link___ctn_id_isset; +AT_surfxml_peer_availability___file AX_surfxml_peer_availability___file; +#define A_surfxml_peer_availability___file (surfxml_bufferstack + AX_surfxml_peer_availability___file) +short int surfxml_peer_availability___file_isset; AT_surfxml_storage_content AX_surfxml_storage_content; #define A_surfxml_storage_content (surfxml_bufferstack + AX_surfxml_storage_content) short int surfxml_storage_content_isset; +AT_surfxml_route_dst AX_surfxml_route_dst; +#define A_surfxml_route_dst (surfxml_bufferstack + AX_surfxml_route_dst) +short int surfxml_route_dst_isset; +AT_surfxml_mount_storageId AX_surfxml_mount_storageId; +#define A_surfxml_mount_storageId (surfxml_bufferstack + AX_surfxml_mount_storageId) +short int surfxml_mount_storageId_isset; +AT_surfxml_bypassASroute_src AX_surfxml_bypassASroute_src; +#define A_surfxml_bypassASroute_src (surfxml_bufferstack + AX_surfxml_bypassASroute_src) +short int surfxml_bypassASroute_src_isset; +AT_surfxml_cluster_router___id AX_surfxml_cluster_router___id; +#define A_surfxml_cluster_router___id (surfxml_bufferstack + AX_surfxml_cluster_router___id) +short int surfxml_cluster_router___id_isset; +AT_surfxml_cluster_topology AX_surfxml_cluster_topology; +#define A_surfxml_cluster_topology AX_surfxml_cluster_topology +short int surfxml_cluster_topology_isset; AT_surfxml_host___link_id AX_surfxml_host___link_id; #define A_surfxml_host___link_id (surfxml_bufferstack + AX_surfxml_host___link_id) short int surfxml_host___link_id_isset; -AT_surfxml_host_id AX_surfxml_host_id; -#define A_surfxml_host_id (surfxml_bufferstack + AX_surfxml_host_id) -short int surfxml_host_id_isset; -AT_surfxml_gpu_name AX_surfxml_gpu_name; -#define A_surfxml_gpu_name (surfxml_bufferstack + AX_surfxml_gpu_name) -short int surfxml_gpu_name_isset; -AT_surfxml_link_sharing___policy AX_surfxml_link_sharing___policy; -#define A_surfxml_link_sharing___policy AX_surfxml_link_sharing___policy -short int surfxml_link_sharing___policy_isset; -AT_surfxml_cluster_bw AX_surfxml_cluster_bw; -#define A_surfxml_cluster_bw (surfxml_bufferstack + AX_surfxml_cluster_bw) -short int surfxml_cluster_bw_isset; -AT_surfxml_cabinet_prefix AX_surfxml_cabinet_prefix; -#define A_surfxml_cabinet_prefix (surfxml_bufferstack + AX_surfxml_cabinet_prefix) -short int surfxml_cabinet_prefix_isset; -AT_surfxml_router_coordinates AX_surfxml_router_coordinates; -#define A_surfxml_router_coordinates (surfxml_bufferstack + AX_surfxml_router_coordinates) -short int surfxml_router_coordinates_isset; -AT_surfxml_storage_attach AX_surfxml_storage_attach; -#define A_surfxml_storage_attach (surfxml_bufferstack + AX_surfxml_storage_attach) -short int surfxml_storage_attach_isset; -AT_surfxml_cluster_bb___sharing___policy AX_surfxml_cluster_bb___sharing___policy; -#define A_surfxml_cluster_bb___sharing___policy AX_surfxml_cluster_bb___sharing___policy -short int surfxml_cluster_bb___sharing___policy_isset; +AT_surfxml_trace___connect_trace AX_surfxml_trace___connect_trace; +#define A_surfxml_trace___connect_trace (surfxml_bufferstack + AX_surfxml_trace___connect_trace) +short int surfxml_trace___connect_trace_isset; +AT_surfxml_host_pstate AX_surfxml_host_pstate; +#define A_surfxml_host_pstate (surfxml_bufferstack + AX_surfxml_host_pstate) +short int surfxml_host_pstate_isset; +AT_surfxml_storage___type_content___type AX_surfxml_storage___type_content___type; +#define A_surfxml_storage___type_content___type (surfxml_bufferstack + AX_surfxml_storage___type_content___type) +short int surfxml_storage___type_content___type_isset; +AT_surfxml_model___prop_value AX_surfxml_model___prop_value; +#define A_surfxml_model___prop_value (surfxml_bufferstack + AX_surfxml_model___prop_value) +short int surfxml_model___prop_value_isset; +AT_surfxml_prop_id AX_surfxml_prop_id; +#define A_surfxml_prop_id (surfxml_bufferstack + AX_surfxml_prop_id) +short int surfxml_prop_id_isset; +AT_surfxml_ASroute_symmetrical AX_surfxml_ASroute_symmetrical; +#define A_surfxml_ASroute_symmetrical AX_surfxml_ASroute_symmetrical +short int surfxml_ASroute_symmetrical_isset; +AT_surfxml_link_id AX_surfxml_link_id; +#define A_surfxml_link_id (surfxml_bufferstack + AX_surfxml_link_id) +short int surfxml_link_id_isset; +AT_surfxml_ASroute_gw___src AX_surfxml_ASroute_gw___src; +#define A_surfxml_ASroute_gw___src (surfxml_bufferstack + AX_surfxml_ASroute_gw___src) +short int surfxml_ASroute_gw___src_isset; AT_surfxml_cabinet_radical AX_surfxml_cabinet_radical; #define A_surfxml_cabinet_radical (surfxml_bufferstack + AX_surfxml_cabinet_radical) short int surfxml_cabinet_radical_isset; -AT_surfxml_cabinet_suffix AX_surfxml_cabinet_suffix; -#define A_surfxml_cabinet_suffix (surfxml_bufferstack + AX_surfxml_cabinet_suffix) -short int surfxml_cabinet_suffix_isset; +AT_surfxml_cabinet_id AX_surfxml_cabinet_id; +#define A_surfxml_cabinet_id (surfxml_bufferstack + AX_surfxml_cabinet_id) +short int surfxml_cabinet_id_isset; +AT_surfxml_argument_value AX_surfxml_argument_value; +#define A_surfxml_argument_value (surfxml_bufferstack + AX_surfxml_argument_value) +short int surfxml_argument_value_isset; +AT_surfxml_random_seed AX_surfxml_random_seed; +#define A_surfxml_random_seed (surfxml_bufferstack + AX_surfxml_random_seed) +short int surfxml_random_seed_isset; +AT_surfxml_trace_periodicity AX_surfxml_trace_periodicity; +#define A_surfxml_trace_periodicity (surfxml_bufferstack + AX_surfxml_trace_periodicity) +short int surfxml_trace_periodicity_isset; AT_surfxml_cluster_state___file AX_surfxml_cluster_state___file; #define A_surfxml_cluster_state___file (surfxml_bufferstack + AX_surfxml_cluster_state___file) short int surfxml_cluster_state___file_isset; -AT_surfxml_cluster_lat AX_surfxml_cluster_lat; -#define A_surfxml_cluster_lat (surfxml_bufferstack + AX_surfxml_cluster_lat) -short int surfxml_cluster_lat_isset; -AT_surfxml_cluster_radical AX_surfxml_cluster_radical; -#define A_surfxml_cluster_radical (surfxml_bufferstack + AX_surfxml_cluster_radical) -short int surfxml_cluster_radical_isset; -AT_surfxml_peer_power AX_surfxml_peer_power; -#define A_surfxml_peer_power (surfxml_bufferstack + AX_surfxml_peer_power) -short int surfxml_peer_power_isset; -AT_surfxml_host_state___file AX_surfxml_host_state___file; -#define A_surfxml_host_state___file (surfxml_bufferstack + AX_surfxml_host_state___file) -short int surfxml_host_state___file_isset; -AT_surfxml_peer_state___file AX_surfxml_peer_state___file; -#define A_surfxml_peer_state___file (surfxml_bufferstack + AX_surfxml_peer_state___file) -short int surfxml_peer_state___file_isset; -AT_surfxml_cluster_loopback___lat AX_surfxml_cluster_loopback___lat; -#define A_surfxml_cluster_loopback___lat (surfxml_bufferstack + AX_surfxml_cluster_loopback___lat) -short int surfxml_cluster_loopback___lat_isset; -AT_surfxml_random_mean AX_surfxml_random_mean; -#define A_surfxml_random_mean (surfxml_bufferstack + AX_surfxml_random_mean) -short int surfxml_random_mean_isset; -AT_surfxml_random_std___deviation AX_surfxml_random_std___deviation; -#define A_surfxml_random_std___deviation (surfxml_bufferstack + AX_surfxml_random_std___deviation) -short int surfxml_random_std___deviation_isset; -AT_surfxml_route_src AX_surfxml_route_src; -#define A_surfxml_route_src (surfxml_bufferstack + AX_surfxml_route_src) -short int surfxml_route_src_isset; -AT_surfxml_bypassASroute_src AX_surfxml_bypassASroute_src; -#define A_surfxml_bypassASroute_src (surfxml_bufferstack + AX_surfxml_bypassASroute_src) -short int surfxml_bypassASroute_src_isset; -AT_surfxml_cluster_topo___parameters AX_surfxml_cluster_topo___parameters; -#define A_surfxml_cluster_topo___parameters (surfxml_bufferstack + AX_surfxml_cluster_topo___parameters) -short int surfxml_cluster_topo___parameters_isset; +AT_surfxml_model___prop_id AX_surfxml_model___prop_id; +#define A_surfxml_model___prop_id (surfxml_bufferstack + AX_surfxml_model___prop_id) +short int surfxml_model___prop_id_isset; +AT_surfxml_host_state AX_surfxml_host_state; +#define A_surfxml_host_state AX_surfxml_host_state +short int surfxml_host_state_isset; +AT_surfxml_link_bandwidth AX_surfxml_link_bandwidth; +#define A_surfxml_link_bandwidth (surfxml_bufferstack + AX_surfxml_link_bandwidth) +short int surfxml_link_bandwidth_isset; +AT_surfxml_backbone_bandwidth AX_surfxml_backbone_bandwidth; +#define A_surfxml_backbone_bandwidth (surfxml_bufferstack + AX_surfxml_backbone_bandwidth) +short int surfxml_backbone_bandwidth_isset; +AT_surfxml_host_availability___file AX_surfxml_host_availability___file; +#define A_surfxml_host_availability___file (surfxml_bufferstack + AX_surfxml_host_availability___file) +short int surfxml_host_availability___file_isset; +AT_surfxml_mstorage_name AX_surfxml_mstorage_name; +#define A_surfxml_mstorage_name (surfxml_bufferstack + AX_surfxml_mstorage_name) +short int surfxml_mstorage_name_isset; +AT_surfxml_cluster_core AX_surfxml_cluster_core; +#define A_surfxml_cluster_core (surfxml_bufferstack + AX_surfxml_cluster_core) +short int surfxml_cluster_core_isset; +AT_surfxml_trace_id AX_surfxml_trace_id; +#define A_surfxml_trace_id (surfxml_bufferstack + AX_surfxml_trace_id) +short int surfxml_trace_id_isset; +AT_surfxml_process_function AX_surfxml_process_function; +#define A_surfxml_process_function (surfxml_bufferstack + AX_surfxml_process_function) +short int surfxml_process_function_isset; +AT_surfxml_backbone_id AX_surfxml_backbone_id; +#define A_surfxml_backbone_id (surfxml_bufferstack + AX_surfxml_backbone_id) +short int surfxml_backbone_id_isset; +AT_surfxml_host_coordinates AX_surfxml_host_coordinates; +#define A_surfxml_host_coordinates (surfxml_bufferstack + AX_surfxml_host_coordinates) +short int surfxml_host_coordinates_isset; +AT_surfxml_storage___type_model AX_surfxml_storage___type_model; +#define A_surfxml_storage___type_model (surfxml_bufferstack + AX_surfxml_storage___type_model) +short int surfxml_storage___type_model_isset; +AT_surfxml_cluster_loopback___bw AX_surfxml_cluster_loopback___bw; +#define A_surfxml_cluster_loopback___bw (surfxml_bufferstack + AX_surfxml_cluster_loopback___bw) +short int surfxml_cluster_loopback___bw_isset; +AT_surfxml_ASroute_gw___dst AX_surfxml_ASroute_gw___dst; +#define A_surfxml_ASroute_gw___dst (surfxml_bufferstack + AX_surfxml_ASroute_gw___dst) +short int surfxml_ASroute_gw___dst_isset; +AT_surfxml_mount_name AX_surfxml_mount_name; +#define A_surfxml_mount_name (surfxml_bufferstack + AX_surfxml_mount_name) +short int surfxml_mount_name_isset; +AT_surfxml_trace___connect_element AX_surfxml_trace___connect_element; +#define A_surfxml_trace___connect_element (surfxml_bufferstack + AX_surfxml_trace___connect_element) +short int surfxml_trace___connect_element_isset; AT_surfxml_cluster_sharing___policy AX_surfxml_cluster_sharing___policy; #define A_surfxml_cluster_sharing___policy AX_surfxml_cluster_sharing___policy short int surfxml_cluster_sharing___policy_isset; -AT_surfxml_trace_periodicity AX_surfxml_trace_periodicity; -#define A_surfxml_trace_periodicity (surfxml_bufferstack + AX_surfxml_trace_periodicity) -short int surfxml_trace_periodicity_isset; -AT_surfxml_peer_lat AX_surfxml_peer_lat; -#define A_surfxml_peer_lat (surfxml_bufferstack + AX_surfxml_peer_lat) -short int surfxml_peer_lat_isset; -AT_surfxml_cluster_suffix AX_surfxml_cluster_suffix; -#define A_surfxml_cluster_suffix (surfxml_bufferstack + AX_surfxml_cluster_suffix) -short int surfxml_cluster_suffix_isset; -AT_surfxml_cluster_router___id AX_surfxml_cluster_router___id; -#define A_surfxml_cluster_router___id (surfxml_bufferstack + AX_surfxml_cluster_router___id) -short int surfxml_cluster_router___id_isset; -AT_surfxml_backbone_latency AX_surfxml_backbone_latency; -#define A_surfxml_backbone_latency (surfxml_bufferstack + AX_surfxml_backbone_latency) -short int surfxml_backbone_latency_isset; +AT_surfxml_random_generator AX_surfxml_random_generator; +#define A_surfxml_random_generator AX_surfxml_random_generator +short int surfxml_random_generator_isset; +AT_surfxml_config_id AX_surfxml_config_id; +#define A_surfxml_config_id (surfxml_bufferstack + AX_surfxml_config_id) +short int surfxml_config_id_isset; +AT_surfxml_storage_typeId AX_surfxml_storage_typeId; +#define A_surfxml_storage_typeId (surfxml_bufferstack + AX_surfxml_storage_typeId) +short int surfxml_storage_typeId_isset; +AT_surfxml_host_power AX_surfxml_host_power; +#define A_surfxml_host_power (surfxml_bufferstack + AX_surfxml_host_power) +short int surfxml_host_power_isset; +AT_surfxml_process_host AX_surfxml_process_host; +#define A_surfxml_process_host (surfxml_bufferstack + AX_surfxml_process_host) +short int surfxml_process_host_isset; AT_surfxml_route_symmetrical AX_surfxml_route_symmetrical; #define A_surfxml_route_symmetrical AX_surfxml_route_symmetrical short int surfxml_route_symmetrical_isset; -AT_surfxml_cabinet_bw AX_surfxml_cabinet_bw; -#define A_surfxml_cabinet_bw (surfxml_bufferstack + AX_surfxml_cabinet_bw) -short int surfxml_cabinet_bw_isset; -AT_surfxml_prop_value AX_surfxml_prop_value; -#define A_surfxml_prop_value (surfxml_bufferstack + AX_surfxml_prop_value) -short int surfxml_prop_value_isset; -AT_surfxml_storage___type_id AX_surfxml_storage___type_id; -#define A_surfxml_storage___type_id (surfxml_bufferstack + AX_surfxml_storage___type_id) -short int surfxml_storage___type_id_isset; -AT_surfxml_storage___type_model AX_surfxml_storage___type_model; -#define A_surfxml_storage___type_model (surfxml_bufferstack + AX_surfxml_storage___type_model) -short int surfxml_storage___type_model_isset; +AT_surfxml_trace___connect_kind AX_surfxml_trace___connect_kind; +#define A_surfxml_trace___connect_kind AX_surfxml_trace___connect_kind +short int surfxml_trace___connect_kind_isset; +AT_surfxml_cluster_suffix AX_surfxml_cluster_suffix; +#define A_surfxml_cluster_suffix (surfxml_bufferstack + AX_surfxml_cluster_suffix) +short int surfxml_cluster_suffix_isset; AT_surfxml_random_radical AX_surfxml_random_radical; #define A_surfxml_random_radical (surfxml_bufferstack + AX_surfxml_random_radical) short int surfxml_random_radical_isset; AT_surfxml_link___ctn_direction AX_surfxml_link___ctn_direction; #define A_surfxml_link___ctn_direction AX_surfxml_link___ctn_direction short int surfxml_link___ctn_direction_isset; -AT_surfxml_model___prop_id AX_surfxml_model___prop_id; -#define A_surfxml_model___prop_id (surfxml_bufferstack + AX_surfxml_model___prop_id) -short int surfxml_model___prop_id_isset; -AT_surfxml_include_file AX_surfxml_include_file; -#define A_surfxml_include_file (surfxml_bufferstack + AX_surfxml_include_file) -short int surfxml_include_file_isset; -AT_surfxml_ASroute_src AX_surfxml_ASroute_src; -#define A_surfxml_ASroute_src (surfxml_bufferstack + AX_surfxml_ASroute_src) -short int surfxml_ASroute_src_isset; -AT_surfxml_storage___type_size AX_surfxml_storage___type_size; -#define A_surfxml_storage___type_size (surfxml_bufferstack + AX_surfxml_storage___type_size) -short int surfxml_storage___type_size_isset; -AT_surfxml_host___link_up AX_surfxml_host___link_up; -#define A_surfxml_host___link_up (surfxml_bufferstack + AX_surfxml_host___link_up) -short int surfxml_host___link_up_isset; -AT_surfxml_cabinet_id AX_surfxml_cabinet_id; -#define A_surfxml_cabinet_id (surfxml_bufferstack + AX_surfxml_cabinet_id) -short int surfxml_cabinet_id_isset; -AT_surfxml_peer_bw___out AX_surfxml_peer_bw___out; -#define A_surfxml_peer_bw___out (surfxml_bufferstack + AX_surfxml_peer_bw___out) -short int surfxml_peer_bw___out_isset; -AT_surfxml_host_availability___file AX_surfxml_host_availability___file; -#define A_surfxml_host_availability___file (surfxml_bufferstack + AX_surfxml_host_availability___file) -short int surfxml_host_availability___file_isset; +AT_surfxml_random_max AX_surfxml_random_max; +#define A_surfxml_random_max (surfxml_bufferstack + AX_surfxml_random_max) +short int surfxml_random_max_isset; +AT_surfxml_mstorage_typeId AX_surfxml_mstorage_typeId; +#define A_surfxml_mstorage_typeId (surfxml_bufferstack + AX_surfxml_mstorage_typeId) +short int surfxml_mstorage_typeId_isset; +AT_surfxml_cluster_loopback___lat AX_surfxml_cluster_loopback___lat; +#define A_surfxml_cluster_loopback___lat (surfxml_bufferstack + AX_surfxml_cluster_loopback___lat) +short int surfxml_cluster_loopback___lat_isset; +AT_surfxml_storage_attach AX_surfxml_storage_attach; +#define A_surfxml_storage_attach (surfxml_bufferstack + AX_surfxml_storage_attach) +short int surfxml_storage_attach_isset; +AT_surfxml_backbone_latency AX_surfxml_backbone_latency; +#define A_surfxml_backbone_latency (surfxml_bufferstack + AX_surfxml_backbone_latency) +short int surfxml_backbone_latency_isset; AT_surfxml_trace_file AX_surfxml_trace_file; #define A_surfxml_trace_file (surfxml_bufferstack + AX_surfxml_trace_file) short int surfxml_trace_file_isset; +AT_surfxml_peer_coordinates AX_surfxml_peer_coordinates; +#define A_surfxml_peer_coordinates (surfxml_bufferstack + AX_surfxml_peer_coordinates) +short int surfxml_peer_coordinates_isset; AT_surfxml_cluster_bb___bw AX_surfxml_cluster_bb___bw; #define A_surfxml_cluster_bb___bw (surfxml_bufferstack + AX_surfxml_cluster_bb___bw) short int surfxml_cluster_bb___bw_isset; -AT_surfxml_storage_id AX_surfxml_storage_id; -#define A_surfxml_storage_id (surfxml_bufferstack + AX_surfxml_storage_id) -short int surfxml_storage_id_isset; -AT_surfxml_ASroute_gw___src AX_surfxml_ASroute_gw___src; -#define A_surfxml_ASroute_gw___src (surfxml_bufferstack + AX_surfxml_ASroute_gw___src) -short int surfxml_ASroute_gw___src_isset; -AT_surfxml_storage___type_content AX_surfxml_storage___type_content; -#define A_surfxml_storage___type_content (surfxml_bufferstack + AX_surfxml_storage___type_content) -short int surfxml_storage___type_content_isset; -AT_surfxml_link_id AX_surfxml_link_id; -#define A_surfxml_link_id (surfxml_bufferstack + AX_surfxml_link_id) -short int surfxml_link_id_isset; -AT_surfxml_peer_availability___file AX_surfxml_peer_availability___file; -#define A_surfxml_peer_availability___file (surfxml_bufferstack + AX_surfxml_peer_availability___file) -short int surfxml_peer_availability___file_isset; -AT_surfxml_cluster_core AX_surfxml_cluster_core; -#define A_surfxml_cluster_core (surfxml_bufferstack + AX_surfxml_cluster_core) -short int surfxml_cluster_core_isset; AT_surfxml_link_state___file AX_surfxml_link_state___file; #define A_surfxml_link_state___file (surfxml_bufferstack + AX_surfxml_link_state___file) short int surfxml_link_state___file_isset; -AT_surfxml_trace___connect_kind AX_surfxml_trace___connect_kind; -#define A_surfxml_trace___connect_kind AX_surfxml_trace___connect_kind -short int surfxml_trace___connect_kind_isset; -AT_surfxml_peer_coordinates AX_surfxml_peer_coordinates; -#define A_surfxml_peer_coordinates (surfxml_bufferstack + AX_surfxml_peer_coordinates) -short int surfxml_peer_coordinates_isset; -AT_surfxml_prop_id AX_surfxml_prop_id; -#define A_surfxml_prop_id (surfxml_bufferstack + AX_surfxml_prop_id) -short int surfxml_prop_id_isset; -AT_surfxml_mstorage_name AX_surfxml_mstorage_name; -#define A_surfxml_mstorage_name (surfxml_bufferstack + AX_surfxml_mstorage_name) -short int surfxml_mstorage_name_isset; -AT_surfxml_trace___connect_element AX_surfxml_trace___connect_element; -#define A_surfxml_trace___connect_element (surfxml_bufferstack + AX_surfxml_trace___connect_element) -short int surfxml_trace___connect_element_isset; -AT_surfxml_host_power AX_surfxml_host_power; -#define A_surfxml_host_power (surfxml_bufferstack + AX_surfxml_host_power) -short int surfxml_host_power_isset; -AT_surfxml_argument_value AX_surfxml_argument_value; -#define A_surfxml_argument_value (surfxml_bufferstack + AX_surfxml_argument_value) -short int surfxml_argument_value_isset; -AT_surfxml_ASroute_gw___dst AX_surfxml_ASroute_gw___dst; -#define A_surfxml_ASroute_gw___dst (surfxml_bufferstack + AX_surfxml_ASroute_gw___dst) -short int surfxml_ASroute_gw___dst_isset; -AT_surfxml_model___prop_value AX_surfxml_model___prop_value; -#define A_surfxml_model___prop_value (surfxml_bufferstack + AX_surfxml_model___prop_value) -short int surfxml_model___prop_value_isset; +AT_surfxml_link_latency___file AX_surfxml_link_latency___file; +#define A_surfxml_link_latency___file (surfxml_bufferstack + AX_surfxml_link_latency___file) +short int surfxml_link_latency___file_isset; +AT_surfxml_cabinet_bw AX_surfxml_cabinet_bw; +#define A_surfxml_cabinet_bw (surfxml_bufferstack + AX_surfxml_cabinet_bw) +short int surfxml_cabinet_bw_isset; +AT_surfxml_prop_value AX_surfxml_prop_value; +#define A_surfxml_prop_value (surfxml_bufferstack + AX_surfxml_prop_value) +short int surfxml_prop_value_isset; +AT_surfxml_ASroute_src AX_surfxml_ASroute_src; +#define A_surfxml_ASroute_src (surfxml_bufferstack + AX_surfxml_ASroute_src) +short int surfxml_ASroute_src_isset; +AT_surfxml_ASroute_dst AX_surfxml_ASroute_dst; +#define A_surfxml_ASroute_dst (surfxml_bufferstack + AX_surfxml_ASroute_dst) +short int surfxml_ASroute_dst_isset; +AT_surfxml_link_sharing___policy AX_surfxml_link_sharing___policy; +#define A_surfxml_link_sharing___policy AX_surfxml_link_sharing___policy +short int surfxml_link_sharing___policy_isset; AT_surfxml_router_id AX_surfxml_router_id; #define A_surfxml_router_id (surfxml_bufferstack + AX_surfxml_router_id) short int surfxml_router_id_isset; -AT_surfxml_cluster_availability___file AX_surfxml_cluster_availability___file; -#define A_surfxml_cluster_availability___file (surfxml_bufferstack + AX_surfxml_cluster_availability___file) -short int surfxml_cluster_availability___file_isset; -AT_surfxml_cluster_loopback___bw AX_surfxml_cluster_loopback___bw; -#define A_surfxml_cluster_loopback___bw (surfxml_bufferstack + AX_surfxml_cluster_loopback___bw) -short int surfxml_cluster_loopback___bw_isset; -AT_surfxml_host_pstate AX_surfxml_host_pstate; -#define A_surfxml_host_pstate (surfxml_bufferstack + AX_surfxml_host_pstate) -short int surfxml_host_pstate_isset; -AT_surfxml_cabinet_power AX_surfxml_cabinet_power; -#define A_surfxml_cabinet_power (surfxml_bufferstack + AX_surfxml_cabinet_power) -short int surfxml_cabinet_power_isset; -AT_surfxml_process_kill___time AX_surfxml_process_kill___time; -#define A_surfxml_process_kill___time (surfxml_bufferstack + AX_surfxml_process_kill___time) -short int surfxml_process_kill___time_isset; -AT_surfxml_process_function AX_surfxml_process_function; -#define A_surfxml_process_function (surfxml_bufferstack + AX_surfxml_process_function) -short int surfxml_process_function_isset; -AT_surfxml_storage___type_content___type AX_surfxml_storage___type_content___type; -#define A_surfxml_storage___type_content___type (surfxml_bufferstack + AX_surfxml_storage___type_content___type) -short int surfxml_storage___type_content___type_isset; -AT_surfxml_mount_storageId AX_surfxml_mount_storageId; -#define A_surfxml_mount_storageId (surfxml_bufferstack + AX_surfxml_mount_storageId) -short int surfxml_mount_storageId_isset; -AT_surfxml_random_seed AX_surfxml_random_seed; -#define A_surfxml_random_seed (surfxml_bufferstack + AX_surfxml_random_seed) -short int surfxml_random_seed_isset; -AT_surfxml_backbone_bandwidth AX_surfxml_backbone_bandwidth; -#define A_surfxml_backbone_bandwidth (surfxml_bufferstack + AX_surfxml_backbone_bandwidth) -short int surfxml_backbone_bandwidth_isset; +AT_surfxml_cluster_limiter___link AX_surfxml_cluster_limiter___link; +#define A_surfxml_cluster_limiter___link (surfxml_bufferstack + AX_surfxml_cluster_limiter___link) +short int surfxml_cluster_limiter___link_isset; +AT_surfxml_route_src AX_surfxml_route_src; +#define A_surfxml_route_src (surfxml_bufferstack + AX_surfxml_route_src) +short int surfxml_route_src_isset; +AT_surfxml_peer_bw___in AX_surfxml_peer_bw___in; +#define A_surfxml_peer_bw___in (surfxml_bufferstack + AX_surfxml_peer_bw___in) +short int surfxml_peer_bw___in_isset; +AT_surfxml_AS_routing AX_surfxml_AS_routing; +#define A_surfxml_AS_routing AX_surfxml_AS_routing +short int surfxml_AS_routing_isset; +AT_surfxml_cabinet_suffix AX_surfxml_cabinet_suffix; +#define A_surfxml_cabinet_suffix (surfxml_bufferstack + AX_surfxml_cabinet_suffix) +short int surfxml_cabinet_suffix_isset; +AT_surfxml_cluster_radical AX_surfxml_cluster_radical; +#define A_surfxml_cluster_radical (surfxml_bufferstack + AX_surfxml_cluster_radical) +short int surfxml_cluster_radical_isset; +AT_surfxml_storage___type_id AX_surfxml_storage___type_id; +#define A_surfxml_storage___type_id (surfxml_bufferstack + AX_surfxml_storage___type_id) +short int surfxml_storage___type_id_isset; +AT_surfxml_peer_power AX_surfxml_peer_power; +#define A_surfxml_peer_power (surfxml_bufferstack + AX_surfxml_peer_power) +short int surfxml_peer_power_isset; +AT_surfxml_include_file AX_surfxml_include_file; +#define A_surfxml_include_file (surfxml_bufferstack + AX_surfxml_include_file) +short int surfxml_include_file_isset; AT_surfxml_bypassRoute_src AX_surfxml_bypassRoute_src; #define A_surfxml_bypassRoute_src (surfxml_bufferstack + AX_surfxml_bypassRoute_src) short int surfxml_bypassRoute_src_isset; -AT_surfxml_random_id AX_surfxml_random_id; -#define A_surfxml_random_id (surfxml_bufferstack + AX_surfxml_random_id) -short int surfxml_random_id_isset; +AT_surfxml_cluster_lat AX_surfxml_cluster_lat; +#define A_surfxml_cluster_lat (surfxml_bufferstack + AX_surfxml_cluster_lat) +short int surfxml_cluster_lat_isset; +AT_surfxml_link_state AX_surfxml_link_state; +#define A_surfxml_link_state AX_surfxml_link_state +short int surfxml_link_state_isset; AT_surfxml_host_availability AX_surfxml_host_availability; #define A_surfxml_host_availability (surfxml_bufferstack + AX_surfxml_host_availability) short int surfxml_host_availability_isset; -AT_surfxml_mount_name AX_surfxml_mount_name; -#define A_surfxml_mount_name (surfxml_bufferstack + AX_surfxml_mount_name) -short int surfxml_mount_name_isset; -AT_surfxml_bypassASroute_dst AX_surfxml_bypassASroute_dst; -#define A_surfxml_bypassASroute_dst (surfxml_bufferstack + AX_surfxml_bypassASroute_dst) -short int surfxml_bypassASroute_dst_isset; +AT_surfxml_cabinet_power AX_surfxml_cabinet_power; +#define A_surfxml_cabinet_power (surfxml_bufferstack + AX_surfxml_cabinet_power) +short int surfxml_cabinet_power_isset; +AT_surfxml_cluster_bb___sharing___policy AX_surfxml_cluster_bb___sharing___policy; +#define A_surfxml_cluster_bb___sharing___policy AX_surfxml_cluster_bb___sharing___policy +short int surfxml_cluster_bb___sharing___policy_isset; +AT_surfxml_cluster_availability___file AX_surfxml_cluster_availability___file; +#define A_surfxml_cluster_availability___file (surfxml_bufferstack + AX_surfxml_cluster_availability___file) +short int surfxml_cluster_availability___file_isset; +AT_surfxml_host___link_up AX_surfxml_host___link_up; +#define A_surfxml_host___link_up (surfxml_bufferstack + AX_surfxml_host___link_up) +short int surfxml_host___link_up_isset; +AT_surfxml_process_on___failure AX_surfxml_process_on___failure; +#define A_surfxml_process_on___failure AX_surfxml_process_on___failure +short int surfxml_process_on___failure_isset; +AT_surfxml_link_bandwidth___file AX_surfxml_link_bandwidth___file; +#define A_surfxml_link_bandwidth___file (surfxml_bufferstack + AX_surfxml_link_bandwidth___file) +short int surfxml_link_bandwidth___file_isset; +AT_surfxml_cluster_topo___parameters AX_surfxml_cluster_topo___parameters; +#define A_surfxml_cluster_topo___parameters (surfxml_bufferstack + AX_surfxml_cluster_topo___parameters) +short int surfxml_cluster_topo___parameters_isset; AT_surfxml_random_min AX_surfxml_random_min; #define A_surfxml_random_min (surfxml_bufferstack + AX_surfxml_random_min) short int surfxml_random_min_isset; -AT_surfxml_mstorage_typeId AX_surfxml_mstorage_typeId; -#define A_surfxml_mstorage_typeId (surfxml_bufferstack + AX_surfxml_mstorage_typeId) -short int surfxml_mstorage_typeId_isset; -AT_surfxml_host___link_down AX_surfxml_host___link_down; -#define A_surfxml_host___link_down (surfxml_bufferstack + AX_surfxml_host___link_down) -short int surfxml_host___link_down_isset; -AT_surfxml_cluster_limiter___link AX_surfxml_cluster_limiter___link; -#define A_surfxml_cluster_limiter___link (surfxml_bufferstack + AX_surfxml_cluster_limiter___link) -short int surfxml_cluster_limiter___link_isset; AT_surfxml_peer_id AX_surfxml_peer_id; #define A_surfxml_peer_id (surfxml_bufferstack + AX_surfxml_peer_id) short int surfxml_peer_id_isset; -AT_surfxml_cluster_topology AX_surfxml_cluster_topology; -#define A_surfxml_cluster_topology AX_surfxml_cluster_topology -short int surfxml_cluster_topology_isset; -AT_surfxml_host_state AX_surfxml_host_state; -#define A_surfxml_host_state AX_surfxml_host_state -short int surfxml_host_state_isset; -AT_surfxml_trace___connect_trace AX_surfxml_trace___connect_trace; -#define A_surfxml_trace___connect_trace (surfxml_bufferstack + AX_surfxml_trace___connect_trace) -short int surfxml_trace___connect_trace_isset; +AT_surfxml_cluster_id AX_surfxml_cluster_id; +#define A_surfxml_cluster_id (surfxml_bufferstack + AX_surfxml_cluster_id) +short int surfxml_cluster_id_isset; +AT_surfxml_peer_bw___out AX_surfxml_peer_bw___out; +#define A_surfxml_peer_bw___out (surfxml_bufferstack + AX_surfxml_peer_bw___out) +short int surfxml_peer_bw___out_isset; +AT_surfxml_bypassASroute_gw___dst AX_surfxml_bypassASroute_gw___dst; +#define A_surfxml_bypassASroute_gw___dst (surfxml_bufferstack + AX_surfxml_bypassASroute_gw___dst) +short int surfxml_bypassASroute_gw___dst_isset; +AT_surfxml_cluster_bb___lat AX_surfxml_cluster_bb___lat; +#define A_surfxml_cluster_bb___lat (surfxml_bufferstack + AX_surfxml_cluster_bb___lat) +short int surfxml_cluster_bb___lat_isset; +AT_surfxml_storage___type_size AX_surfxml_storage___type_size; +#define A_surfxml_storage___type_size (surfxml_bufferstack + AX_surfxml_storage___type_size) +short int surfxml_storage___type_size_isset; AT_surfxml_AS_id AX_surfxml_AS_id; #define A_surfxml_AS_id (surfxml_bufferstack + AX_surfxml_AS_id) short int surfxml_AS_id_isset; -AT_surfxml_bypassASroute_gw___src AX_surfxml_bypassASroute_gw___src; -#define A_surfxml_bypassASroute_gw___src (surfxml_bufferstack + AX_surfxml_bypassASroute_gw___src) -short int surfxml_bypassASroute_gw___src_isset; -AT_surfxml_process_on___failure AX_surfxml_process_on___failure; -#define A_surfxml_process_on___failure AX_surfxml_process_on___failure -short int surfxml_process_on___failure_isset; -AT_surfxml_link_state AX_surfxml_link_state; -#define A_surfxml_link_state AX_surfxml_link_state -short int surfxml_link_state_isset; -AT_surfxml_random_generator AX_surfxml_random_generator; -#define A_surfxml_random_generator AX_surfxml_random_generator -short int surfxml_random_generator_isset; -AT_surfxml_link___ctn_id AX_surfxml_link___ctn_id; -#define A_surfxml_link___ctn_id (surfxml_bufferstack + AX_surfxml_link___ctn_id) -short int surfxml_link___ctn_id_isset; -AT_surfxml_storage_typeId AX_surfxml_storage_typeId; -#define A_surfxml_storage_typeId (surfxml_bufferstack + AX_surfxml_storage_typeId) -short int surfxml_storage_typeId_isset; -AT_surfxml_cluster_power AX_surfxml_cluster_power; -#define A_surfxml_cluster_power (surfxml_bufferstack + AX_surfxml_cluster_power) -short int surfxml_cluster_power_isset; -AT_surfxml_ASroute_dst AX_surfxml_ASroute_dst; -#define A_surfxml_ASroute_dst (surfxml_bufferstack + AX_surfxml_ASroute_dst) -short int surfxml_ASroute_dst_isset; -AT_surfxml_AS_routing AX_surfxml_AS_routing; -#define A_surfxml_AS_routing AX_surfxml_AS_routing -short int surfxml_AS_routing_isset; AT_surfxml_storage_content___type AX_surfxml_storage_content___type; #define A_surfxml_storage_content___type (surfxml_bufferstack + AX_surfxml_storage_content___type) short int surfxml_storage_content___type_isset; -AT_surfxml_link_latency AX_surfxml_link_latency; -#define A_surfxml_link_latency (surfxml_bufferstack + AX_surfxml_link_latency) -short int surfxml_link_latency_isset; -AT_surfxml_config_id AX_surfxml_config_id; -#define A_surfxml_config_id (surfxml_bufferstack + AX_surfxml_config_id) -short int surfxml_config_id_isset; -AT_surfxml_process_host AX_surfxml_process_host; -#define A_surfxml_process_host (surfxml_bufferstack + AX_surfxml_process_host) -short int surfxml_process_host_isset; +AT_surfxml_process_start___time AX_surfxml_process_start___time; +#define A_surfxml_process_start___time (surfxml_bufferstack + AX_surfxml_process_start___time) +short int surfxml_process_start___time_isset; +AT_surfxml_bypassASroute_dst AX_surfxml_bypassASroute_dst; +#define A_surfxml_bypassASroute_dst (surfxml_bufferstack + AX_surfxml_bypassASroute_dst) +short int surfxml_bypassASroute_dst_isset; AT_surfxml_bypassRoute_dst AX_surfxml_bypassRoute_dst; #define A_surfxml_bypassRoute_dst (surfxml_bufferstack + AX_surfxml_bypassRoute_dst) short int surfxml_bypassRoute_dst_isset; -AT_surfxml_trace_id AX_surfxml_trace_id; -#define A_surfxml_trace_id (surfxml_bufferstack + AX_surfxml_trace_id) -short int surfxml_trace_id_isset; -AT_surfxml_link_bandwidth AX_surfxml_link_bandwidth; -#define A_surfxml_link_bandwidth (surfxml_bufferstack + AX_surfxml_link_bandwidth) -short int surfxml_link_bandwidth_isset; +AT_surfxml_gpu_name AX_surfxml_gpu_name; +#define A_surfxml_gpu_name (surfxml_bufferstack + AX_surfxml_gpu_name) +short int surfxml_gpu_name_isset; +AT_surfxml_cluster_prefix AX_surfxml_cluster_prefix; +#define A_surfxml_cluster_prefix (surfxml_bufferstack + AX_surfxml_cluster_prefix) +short int surfxml_cluster_prefix_isset; +AT_surfxml_peer_state___file AX_surfxml_peer_state___file; +#define A_surfxml_peer_state___file (surfxml_bufferstack + AX_surfxml_peer_state___file) +short int surfxml_peer_state___file_isset; +AT_surfxml_process_kill___time AX_surfxml_process_kill___time; +#define A_surfxml_process_kill___time (surfxml_bufferstack + AX_surfxml_process_kill___time) +short int surfxml_process_kill___time_isset; +AT_surfxml_storage_id AX_surfxml_storage_id; +#define A_surfxml_storage_id (surfxml_bufferstack + AX_surfxml_storage_id) +short int surfxml_storage_id_isset; +AT_surfxml_cabinet_lat AX_surfxml_cabinet_lat; +#define A_surfxml_cabinet_lat (surfxml_bufferstack + AX_surfxml_cabinet_lat) +short int surfxml_cabinet_lat_isset; +AT_surfxml_random_mean AX_surfxml_random_mean; +#define A_surfxml_random_mean (surfxml_bufferstack + AX_surfxml_random_mean) +short int surfxml_random_mean_isset; +AT_surfxml_random_std___deviation AX_surfxml_random_std___deviation; +#define A_surfxml_random_std___deviation (surfxml_bufferstack + AX_surfxml_random_std___deviation) +short int surfxml_random_std___deviation_isset; +AT_surfxml_cabinet_prefix AX_surfxml_cabinet_prefix; +#define A_surfxml_cabinet_prefix (surfxml_bufferstack + AX_surfxml_cabinet_prefix) +short int surfxml_cabinet_prefix_isset; +AT_surfxml_peer_lat AX_surfxml_peer_lat; +#define A_surfxml_peer_lat (surfxml_bufferstack + AX_surfxml_peer_lat) +short int surfxml_peer_lat_isset; +AT_surfxml_link_latency AX_surfxml_link_latency; +#define A_surfxml_link_latency (surfxml_bufferstack + AX_surfxml_link_latency) +short int surfxml_link_latency_isset; +AT_surfxml_host_state___file AX_surfxml_host_state___file; +#define A_surfxml_host_state___file (surfxml_bufferstack + AX_surfxml_host_state___file) +short int surfxml_host_state___file_isset; +AT_surfxml_cluster_power AX_surfxml_cluster_power; +#define A_surfxml_cluster_power (surfxml_bufferstack + AX_surfxml_cluster_power) +short int surfxml_cluster_power_isset; +AT_surfxml_random_id AX_surfxml_random_id; +#define A_surfxml_random_id (surfxml_bufferstack + AX_surfxml_random_id) +short int surfxml_random_id_isset; +AT_surfxml_router_coordinates AX_surfxml_router_coordinates; +#define A_surfxml_router_coordinates (surfxml_bufferstack + AX_surfxml_router_coordinates) +short int surfxml_router_coordinates_isset; +AT_surfxml_host_core AX_surfxml_host_core; +#define A_surfxml_host_core (surfxml_bufferstack + AX_surfxml_host_core) +short int surfxml_host_core_isset; +AT_surfxml_bypassASroute_gw___src AX_surfxml_bypassASroute_gw___src; +#define A_surfxml_bypassASroute_gw___src (surfxml_bufferstack + AX_surfxml_bypassASroute_gw___src) +short int surfxml_bypassASroute_gw___src_isset; +AT_surfxml_host_id AX_surfxml_host_id; +#define A_surfxml_host_id (surfxml_bufferstack + AX_surfxml_host_id) +short int surfxml_host_id_isset; +AT_surfxml_host___link_down AX_surfxml_host___link_down; +#define A_surfxml_host___link_down (surfxml_bufferstack + AX_surfxml_host___link_down) +short int surfxml_host___link_down_isset; +AT_surfxml_cluster_bw AX_surfxml_cluster_bw; +#define A_surfxml_cluster_bw (surfxml_bufferstack + AX_surfxml_cluster_bw) +short int surfxml_cluster_bw_isset; +AT_surfxml_storage___type_content AX_surfxml_storage___type_content; +#define A_surfxml_storage___type_content (surfxml_bufferstack + AX_surfxml_storage___type_content) +short int surfxml_storage___type_content_isset; /* XML state. */ #ifdef FLEX_DEBUG @@ -5927,13 +5927,13 @@ case 26: YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",surf_parse_text[0]); YY_BREAK +case YY_STATE_EOF(S_surfxml_platform_1): +case YY_STATE_EOF(E_surfxml_platform): +case YY_STATE_EOF(S_surfxml_platform_3): +case YY_STATE_EOF(S_surfxml_platform_8): case YY_STATE_EOF(S_surfxml_platform_4): case YY_STATE_EOF(S_surfxml_platform_6): -case YY_STATE_EOF(S_surfxml_platform_8): -case YY_STATE_EOF(E_surfxml_platform): case YY_STATE_EOF(S_surfxml_platform): -case YY_STATE_EOF(S_surfxml_platform_1): -case YY_STATE_EOF(S_surfxml_platform_3): if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `' expected."); YY_BREAK @@ -5975,10 +5975,10 @@ YY_RULE_SETUP if (!AX_surfxml_include_file) FAIL("Required attribute `file' not set for `include' element."); LEAVE; STag_surfxml_include(); surfxml_pcdata_ix = 0; ETag_surfxml_include(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_platform_5: case S_surfxml_platform_3: case S_surfxml_platform_1: case S_surfxml_platform: case S_surfxml_platform_6: SET(S_surfxml_platform_6); break; case S_surfxml_AS_3: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break; - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; - case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break; + case S_surfxml_platform_3: case S_surfxml_platform_6: case S_surfxml_platform: case S_surfxml_platform_5: case S_surfxml_platform_1: SET(S_surfxml_platform_6); break; + case S_surfxml_AS_14: case S_surfxml_AS_13: case S_surfxml_AS: case S_surfxml_AS_1: SET(S_surfxml_AS_14); break; + case S_surfxml_include_1: case S_surfxml_include: case S_surfxml_include_2: SET(S_surfxml_include_2); break; } } YY_BREAK @@ -6002,10 +6002,10 @@ YY_RULE_SETUP ETag_surfxml_include(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_platform_5: case S_surfxml_platform_3: case S_surfxml_platform_1: case S_surfxml_platform: case S_surfxml_platform_6: SET(S_surfxml_platform_6); break; case S_surfxml_AS_3: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break; - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; - case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break; + case S_surfxml_platform_3: case S_surfxml_platform_6: case S_surfxml_platform: case S_surfxml_platform_5: case S_surfxml_platform_1: SET(S_surfxml_platform_6); break; + case S_surfxml_AS_14: case S_surfxml_AS_13: case S_surfxml_AS: case S_surfxml_AS_1: SET(S_surfxml_AS_14); break; + case S_surfxml_include_1: case S_surfxml_include: case S_surfxml_include_2: SET(S_surfxml_include_2); break; } } YY_BREAK @@ -6018,9 +6018,9 @@ case 37: YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",surf_parse_text[0]); YY_BREAK -case YY_STATE_EOF(S_surfxml_include): -case YY_STATE_EOF(S_surfxml_include_2): case YY_STATE_EOF(E_surfxml_include): +case YY_STATE_EOF(S_surfxml_include_2): +case YY_STATE_EOF(S_surfxml_include): if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `' expected."); YY_BREAK @@ -6088,13 +6088,13 @@ YY_RULE_SETUP if (!AX_surfxml_trace_periodicity) FAIL("Required attribute `periodicity' not set for `trace' element."); LEAVE; STag_surfxml_trace(); surfxml_pcdata_ix = 0; ETag_surfxml_trace(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_1: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; - case S_surfxml_include_2: case S_surfxml_include_1: case S_surfxml_include: SET(S_surfxml_include_2); break; - case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform_6: case S_surfxml_platform: SET(S_surfxml_platform_6); break; - case S_surfxml_AS_5: SET(S_surfxml_AS_6); break; - case S_surfxml_AS_16: case S_surfxml_AS_12: case S_surfxml_AS_14: case S_surfxml_AS_15: SET(S_surfxml_AS_16); break; - case S_surfxml_AS_8: case S_surfxml_AS_6: case S_surfxml_AS_9: SET(S_surfxml_AS_9); break; - case S_surfxml_AS_11: case S_surfxml_AS_4: case S_surfxml_AS_10: case S_surfxml_AS: case S_surfxml_AS_7: case S_surfxml_AS_3: SET(S_surfxml_AS_11); break; + case S_surfxml_AS_12: case S_surfxml_AS_15: case S_surfxml_AS_16: SET(S_surfxml_AS_16); break; + case S_surfxml_include: case S_surfxml_include_1: case S_surfxml_include_2: SET(S_surfxml_include_2); break; + case S_surfxml_AS_13: case S_surfxml_AS_1: case S_surfxml_AS_14: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_8: SET(S_surfxml_AS_9); break; + case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_1: case S_surfxml_platform_5: case S_surfxml_platform_6: SET(S_surfxml_platform_6); break; + case S_surfxml_AS_5: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_AS_9: case S_surfxml_AS_6: case S_surfxml_AS_7: case S_surfxml_AS_10: case S_surfxml_AS: case S_surfxml_AS_4: case S_surfxml_AS_11: SET(S_surfxml_AS_11); break; } } YY_BREAK @@ -6120,13 +6120,13 @@ YY_RULE_SETUP surfxml_pcdata_ix = popbuffer(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_1: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; - case S_surfxml_include_2: case S_surfxml_include_1: case S_surfxml_include: SET(S_surfxml_include_2); break; - case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform_6: case S_surfxml_platform: SET(S_surfxml_platform_6); break; - case S_surfxml_AS_5: SET(S_surfxml_AS_6); break; - case S_surfxml_AS_16: case S_surfxml_AS_12: case S_surfxml_AS_14: case S_surfxml_AS_15: SET(S_surfxml_AS_16); break; - case S_surfxml_AS_8: case S_surfxml_AS_6: case S_surfxml_AS_9: SET(S_surfxml_AS_9); break; - case S_surfxml_AS_11: case S_surfxml_AS_4: case S_surfxml_AS_10: case S_surfxml_AS: case S_surfxml_AS_7: case S_surfxml_AS_3: SET(S_surfxml_AS_11); break; + case S_surfxml_AS_12: case S_surfxml_AS_15: case S_surfxml_AS_16: SET(S_surfxml_AS_16); break; + case S_surfxml_include: case S_surfxml_include_1: case S_surfxml_include_2: SET(S_surfxml_include_2); break; + case S_surfxml_AS_13: case S_surfxml_AS_1: case S_surfxml_AS_14: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_8: SET(S_surfxml_AS_9); break; + case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_1: case S_surfxml_platform_5: case S_surfxml_platform_6: SET(S_surfxml_platform_6); break; + case S_surfxml_AS_5: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_AS_9: case S_surfxml_AS_6: case S_surfxml_AS_7: case S_surfxml_AS_10: case S_surfxml_AS: case S_surfxml_AS_4: case S_surfxml_AS_11: SET(S_surfxml_AS_11); break; } } YY_BREAK @@ -6287,7 +6287,7 @@ YY_RULE_SETUP if (!AX_surfxml_random_std___deviation) FAIL("Required attribute `std_deviation' not set for `random' element."); LEAVE; STag_surfxml_random(); surfxml_pcdata_ix = 0; ETag_surfxml_random(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_2: SET(S_surfxml_platform_3); break; + case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break; } } YY_BREAK @@ -6311,7 +6311,7 @@ YY_RULE_SETUP ETag_surfxml_random(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_2: SET(S_surfxml_platform_3); break; + case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break; } } YY_BREAK @@ -6417,13 +6417,13 @@ YY_RULE_SETUP if (!AX_surfxml_trace___connect_element) FAIL("Required attribute `element' not set for `trace_connect' element."); LEAVE; STag_surfxml_trace___connect(); surfxml_pcdata_ix = 0; ETag_surfxml_trace___connect(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break; - case S_surfxml_AS_1: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; - case S_surfxml_AS_5: SET(S_surfxml_AS_6); break; - case S_surfxml_platform_6: case S_surfxml_platform: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform_5: SET(S_surfxml_platform_6); break; - case S_surfxml_AS_9: case S_surfxml_AS_6: case S_surfxml_AS_8: SET(S_surfxml_AS_9); break; - case S_surfxml_AS_15: case S_surfxml_AS_12: case S_surfxml_AS_16: case S_surfxml_AS_14: SET(S_surfxml_AS_16); break; - case S_surfxml_AS_3: case S_surfxml_AS_7: case S_surfxml_AS_10: case S_surfxml_AS_4: case S_surfxml_AS_11: case S_surfxml_AS: SET(S_surfxml_AS_11); break; + case S_surfxml_AS_12: case S_surfxml_AS_15: case S_surfxml_AS_16: SET(S_surfxml_AS_16); break; + case S_surfxml_include: case S_surfxml_include_1: case S_surfxml_include_2: SET(S_surfxml_include_2); break; + case S_surfxml_AS_13: case S_surfxml_AS_1: case S_surfxml_AS_14: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_8: SET(S_surfxml_AS_9); break; + case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_1: case S_surfxml_platform_5: case S_surfxml_platform_6: SET(S_surfxml_platform_6); break; + case S_surfxml_AS_5: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_AS_9: case S_surfxml_AS_6: case S_surfxml_AS_7: case S_surfxml_AS: case S_surfxml_AS_10: case S_surfxml_AS_4: case S_surfxml_AS_11: SET(S_surfxml_AS_11); break; } } YY_BREAK @@ -6447,13 +6447,13 @@ YY_RULE_SETUP ETag_surfxml_trace___connect(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break; - case S_surfxml_AS_1: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; - case S_surfxml_AS_5: SET(S_surfxml_AS_6); break; - case S_surfxml_platform_6: case S_surfxml_platform: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform_5: SET(S_surfxml_platform_6); break; - case S_surfxml_AS_9: case S_surfxml_AS_6: case S_surfxml_AS_8: SET(S_surfxml_AS_9); break; - case S_surfxml_AS_15: case S_surfxml_AS_12: case S_surfxml_AS_16: case S_surfxml_AS_14: SET(S_surfxml_AS_16); break; - case S_surfxml_AS_3: case S_surfxml_AS_7: case S_surfxml_AS_10: case S_surfxml_AS_4: case S_surfxml_AS_11: case S_surfxml_AS: SET(S_surfxml_AS_11); break; + case S_surfxml_AS_12: case S_surfxml_AS_15: case S_surfxml_AS_16: SET(S_surfxml_AS_16); break; + case S_surfxml_include: case S_surfxml_include_1: case S_surfxml_include_2: SET(S_surfxml_include_2); break; + case S_surfxml_AS_13: case S_surfxml_AS_1: case S_surfxml_AS_14: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_8: SET(S_surfxml_AS_9); break; + case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_1: case S_surfxml_platform_5: case S_surfxml_platform_6: SET(S_surfxml_platform_6); break; + case S_surfxml_AS_5: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_AS_9: case S_surfxml_AS_6: case S_surfxml_AS_7: case S_surfxml_AS: case S_surfxml_AS_10: case S_surfxml_AS_4: case S_surfxml_AS_11: SET(S_surfxml_AS_11); break; } } YY_BREAK @@ -6575,9 +6575,9 @@ YY_RULE_SETUP if (!AX_surfxml_AS_routing) FAIL("Required attribute `routing' not set for `AS' element."); LEAVE; STag_surfxml_AS(); surfxml_pcdata_ix = 0; ETag_surfxml_AS(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_3: case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break; - case S_surfxml_platform: case S_surfxml_platform_6: case S_surfxml_platform_3: case S_surfxml_platform_1: case S_surfxml_platform_5: SET(S_surfxml_platform_6); break; - case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break; + case S_surfxml_include: case S_surfxml_include_1: case S_surfxml_include_2: SET(S_surfxml_include_2); break; + case S_surfxml_AS_1: case S_surfxml_AS_5: case S_surfxml_AS_6: case S_surfxml_AS: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform_6: SET(S_surfxml_platform_6); break; } } YY_BREAK @@ -6601,9 +6601,9 @@ YY_RULE_SETUP ETag_surfxml_AS(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_3: case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break; - case S_surfxml_platform: case S_surfxml_platform_6: case S_surfxml_platform_3: case S_surfxml_platform_1: case S_surfxml_platform_5: SET(S_surfxml_platform_6); break; - case S_surfxml_include: case S_surfxml_include_2: case S_surfxml_include_1: SET(S_surfxml_include_2); break; + case S_surfxml_include: case S_surfxml_include_1: case S_surfxml_include_2: SET(S_surfxml_include_2); break; + case S_surfxml_AS_1: case S_surfxml_AS_5: case S_surfxml_AS_6: case S_surfxml_AS: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform_6: SET(S_surfxml_platform_6); break; } } YY_BREAK @@ -6617,17 +6617,17 @@ YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",surf_parse_text[0]); YY_BREAK case YY_STATE_EOF(S_surfxml_AS): +case YY_STATE_EOF(S_surfxml_AS_12): +case YY_STATE_EOF(S_surfxml_AS_4): +case YY_STATE_EOF(S_surfxml_AS_7): case YY_STATE_EOF(S_surfxml_AS_14): case YY_STATE_EOF(S_surfxml_AS_9): case YY_STATE_EOF(S_surfxml_AS_6): -case YY_STATE_EOF(S_surfxml_AS_16): -case YY_STATE_EOF(S_surfxml_AS_12): -case YY_STATE_EOF(S_surfxml_AS_3): case YY_STATE_EOF(S_surfxml_AS_11): -case YY_STATE_EOF(S_surfxml_AS_7): +case YY_STATE_EOF(S_surfxml_AS_3): +case YY_STATE_EOF(S_surfxml_AS_16): case YY_STATE_EOF(S_surfxml_AS_1): case YY_STATE_EOF(E_surfxml_AS): -case YY_STATE_EOF(S_surfxml_AS_4): if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `' expected."); YY_BREAK @@ -6721,8 +6721,8 @@ YY_RULE_SETUP if (!AX_surfxml_storage___type_size) FAIL("Required attribute `size' not set for `storage_type' element."); LEAVE; STag_surfxml_storage___type(); surfxml_pcdata_ix = 0; ETag_surfxml_storage___type(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_6: case S_surfxml_AS_5: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_5: case S_surfxml_AS_6: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_AS_1: case S_surfxml_AS_13: case S_surfxml_AS_14: case S_surfxml_AS: SET(S_surfxml_AS_14); break; } } YY_BREAK @@ -6746,8 +6746,8 @@ YY_RULE_SETUP ETag_surfxml_storage___type(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_6: case S_surfxml_AS_5: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_5: case S_surfxml_AS_6: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_AS_1: case S_surfxml_AS_13: case S_surfxml_AS_14: case S_surfxml_AS: SET(S_surfxml_AS_14); break; } } YY_BREAK @@ -6760,9 +6760,9 @@ case 153: YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",surf_parse_text[0]); YY_BREAK -case YY_STATE_EOF(E_surfxml_storage___type): -case YY_STATE_EOF(S_surfxml_storage___type): case YY_STATE_EOF(S_surfxml_storage___type_2): +case YY_STATE_EOF(S_surfxml_storage___type): +case YY_STATE_EOF(E_surfxml_storage___type): if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `' expected."); YY_BREAK @@ -6818,7 +6818,7 @@ YY_RULE_SETUP if (!AX_surfxml_mount_name) FAIL("Required attribute `name' not set for `mount' element."); LEAVE; STag_surfxml_mount(); surfxml_pcdata_ix = 0; ETag_surfxml_mount(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_host_2: case S_surfxml_host: case S_surfxml_host_1: SET(S_surfxml_host_2); break; + case S_surfxml_host: case S_surfxml_host_2: case S_surfxml_host_1: SET(S_surfxml_host_2); break; } } YY_BREAK @@ -6842,7 +6842,7 @@ YY_RULE_SETUP ETag_surfxml_mount(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_host_2: case S_surfxml_host: case S_surfxml_host_1: SET(S_surfxml_host_2); break; + case S_surfxml_host: case S_surfxml_host_2: case S_surfxml_host_1: SET(S_surfxml_host_2); break; } } YY_BREAK @@ -6911,7 +6911,7 @@ YY_RULE_SETUP if (!AX_surfxml_mstorage_name) FAIL("Required attribute `name' not set for `mstorage' element."); LEAVE; STag_surfxml_mstorage(); surfxml_pcdata_ix = 0; ETag_surfxml_mstorage(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_host_1: case S_surfxml_host: case S_surfxml_host_2: SET(S_surfxml_host_2); break; + case S_surfxml_host_2: case S_surfxml_host_1: case S_surfxml_host: SET(S_surfxml_host_2); break; } } YY_BREAK @@ -6935,7 +6935,7 @@ YY_RULE_SETUP ETag_surfxml_mstorage(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_host_1: case S_surfxml_host: case S_surfxml_host_2: SET(S_surfxml_host_2); break; + case S_surfxml_host_2: case S_surfxml_host_1: case S_surfxml_host: SET(S_surfxml_host_2); break; } } YY_BREAK @@ -7092,7 +7092,7 @@ YY_RULE_SETUP if (!AX_surfxml_host_power) FAIL("Required attribute `power' not set for `host' element."); LEAVE; STag_surfxml_host(); surfxml_pcdata_ix = 0; ETag_surfxml_host(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_13: case S_surfxml_AS_3: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_1: case S_surfxml_AS_13: case S_surfxml_AS_3: case S_surfxml_AS_14: case S_surfxml_AS: SET(S_surfxml_AS_14); break; } } YY_BREAK @@ -7116,7 +7116,7 @@ YY_RULE_SETUP ETag_surfxml_host(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_13: case S_surfxml_AS_3: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_1: case S_surfxml_AS_13: case S_surfxml_AS_3: case S_surfxml_AS_14: case S_surfxml_AS: SET(S_surfxml_AS_14); break; } } YY_BREAK @@ -7129,9 +7129,9 @@ case 208: YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",surf_parse_text[0]); YY_BREAK +case YY_STATE_EOF(S_surfxml_host): case YY_STATE_EOF(E_surfxml_host): case YY_STATE_EOF(S_surfxml_host_2): -case YY_STATE_EOF(S_surfxml_host): if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `' expected."); YY_BREAK @@ -7225,8 +7225,8 @@ YY_RULE_SETUP if (!AX_surfxml_storage_attach) FAIL("Required attribute `attach' not set for `storage' element."); LEAVE; STag_surfxml_storage(); surfxml_pcdata_ix = 0; ETag_surfxml_storage(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_3: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break; - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_6: case S_surfxml_AS_5: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_AS_1: case S_surfxml_AS_13: case S_surfxml_AS: case S_surfxml_AS_14: SET(S_surfxml_AS_14); break; } } YY_BREAK @@ -7250,8 +7250,8 @@ YY_RULE_SETUP ETag_surfxml_storage(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_3: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break; - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_6: case S_surfxml_AS_5: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_AS_1: case S_surfxml_AS_13: case S_surfxml_AS: case S_surfxml_AS_14: SET(S_surfxml_AS_14); break; } } YY_BREAK @@ -7308,7 +7308,7 @@ YY_RULE_SETUP if (!AX_surfxml_gpu_name) FAIL("Required attribute `name' not set for `gpu' element."); LEAVE; STag_surfxml_gpu(); surfxml_pcdata_ix = 0; ETag_surfxml_gpu(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_13: case S_surfxml_AS_1: case S_surfxml_AS_3: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_13: case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_3: SET(S_surfxml_AS_14); break; } } YY_BREAK @@ -7332,7 +7332,7 @@ YY_RULE_SETUP ETag_surfxml_gpu(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_13: case S_surfxml_AS_1: case S_surfxml_AS_3: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_13: case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_3: SET(S_surfxml_AS_14); break; } } YY_BREAK @@ -7415,7 +7415,7 @@ YY_RULE_SETUP if (!AX_surfxml_host___link_down) FAIL("Required attribute `down' not set for `host_link' element."); LEAVE; STag_surfxml_host___link(); surfxml_pcdata_ix = 0; ETag_surfxml_host___link(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_13: case S_surfxml_AS_14: case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_3: case S_surfxml_AS_14: case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; } } YY_BREAK @@ -7439,7 +7439,7 @@ YY_RULE_SETUP ETag_surfxml_host___link(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_13: case S_surfxml_AS_14: case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_3: case S_surfxml_AS_14: case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; } } YY_BREAK @@ -7760,9 +7760,9 @@ YY_RULE_SETUP if (!AX_surfxml_cluster_lat) FAIL("Required attribute `lat' not set for `cluster' element."); LEAVE; STag_surfxml_cluster(); surfxml_pcdata_ix = 0; ETag_surfxml_cluster(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_6: case S_surfxml_AS_5: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; - case S_surfxml_platform_6: case S_surfxml_platform: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform_5: SET(S_surfxml_platform_6); break; - case S_surfxml_include_2: case S_surfxml_include_1: case S_surfxml_include: SET(S_surfxml_include_2); break; + case S_surfxml_include_1: case S_surfxml_include_2: case S_surfxml_include: SET(S_surfxml_include_2); break; + case S_surfxml_AS: case S_surfxml_AS_3: case S_surfxml_AS_6: case S_surfxml_AS_5: case S_surfxml_AS_1: SET(S_surfxml_AS_6); break; + case S_surfxml_platform_6: case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_1: case S_surfxml_platform_5: SET(S_surfxml_platform_6); break; } } YY_BREAK @@ -7786,9 +7786,9 @@ YY_RULE_SETUP ETag_surfxml_cluster(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_6: case S_surfxml_AS_5: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; - case S_surfxml_platform_6: case S_surfxml_platform: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform_5: SET(S_surfxml_platform_6); break; - case S_surfxml_include_2: case S_surfxml_include_1: case S_surfxml_include: SET(S_surfxml_include_2); break; + case S_surfxml_include_1: case S_surfxml_include_2: case S_surfxml_include: SET(S_surfxml_include_2); break; + case S_surfxml_AS: case S_surfxml_AS_3: case S_surfxml_AS_6: case S_surfxml_AS_5: case S_surfxml_AS_1: SET(S_surfxml_AS_6); break; + case S_surfxml_platform_6: case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_1: case S_surfxml_platform_5: SET(S_surfxml_platform_6); break; } } YY_BREAK @@ -7802,8 +7802,8 @@ YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",surf_parse_text[0]); YY_BREAK case YY_STATE_EOF(S_surfxml_cluster): -case YY_STATE_EOF(S_surfxml_cluster_2): case YY_STATE_EOF(E_surfxml_cluster): +case YY_STATE_EOF(S_surfxml_cluster_2): if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `' expected."); YY_BREAK @@ -7929,10 +7929,10 @@ YY_RULE_SETUP if (!AX_surfxml_cabinet_lat) FAIL("Required attribute `lat' not set for `cabinet' element."); LEAVE; STag_surfxml_cabinet(); surfxml_pcdata_ix = 0; ETag_surfxml_cabinet(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_5: case S_surfxml_AS_6: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; - case S_surfxml_platform_3: case S_surfxml_platform_1: case S_surfxml_platform: case S_surfxml_platform_6: case S_surfxml_platform_5: SET(S_surfxml_platform_6); break; - case S_surfxml_include_2: case S_surfxml_include_1: case S_surfxml_include: SET(S_surfxml_include_2); break; - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_13: case S_surfxml_AS_1: case S_surfxml_AS_14: case S_surfxml_AS: SET(S_surfxml_AS_14); break; + case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform_6: SET(S_surfxml_platform_6); break; + case S_surfxml_AS_6: case S_surfxml_AS_5: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_include: case S_surfxml_include_1: case S_surfxml_include_2: SET(S_surfxml_include_2); break; } } YY_BREAK @@ -7956,10 +7956,10 @@ YY_RULE_SETUP ETag_surfxml_cabinet(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_5: case S_surfxml_AS_6: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; - case S_surfxml_platform_3: case S_surfxml_platform_1: case S_surfxml_platform: case S_surfxml_platform_6: case S_surfxml_platform_5: SET(S_surfxml_platform_6); break; - case S_surfxml_include_2: case S_surfxml_include_1: case S_surfxml_include: SET(S_surfxml_include_2); break; - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_13: case S_surfxml_AS_1: case S_surfxml_AS_14: case S_surfxml_AS: SET(S_surfxml_AS_14); break; + case S_surfxml_platform_3: case S_surfxml_platform: case S_surfxml_platform_5: case S_surfxml_platform_1: case S_surfxml_platform_6: SET(S_surfxml_platform_6); break; + case S_surfxml_AS_6: case S_surfxml_AS_5: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_include: case S_surfxml_include_1: case S_surfxml_include_2: SET(S_surfxml_include_2); break; } } YY_BREAK @@ -8106,9 +8106,9 @@ YY_RULE_SETUP if (!AX_surfxml_peer_lat) FAIL("Required attribute `lat' not set for `peer' element."); LEAVE; STag_surfxml_peer(); surfxml_pcdata_ix = 0; ETag_surfxml_peer(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_platform: case S_surfxml_platform_6: case S_surfxml_platform_3: case S_surfxml_platform_1: case S_surfxml_platform_5: SET(S_surfxml_platform_6); break; - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_5: case S_surfxml_AS_6: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; - case S_surfxml_include_2: case S_surfxml_include_1: case S_surfxml_include: SET(S_surfxml_include_2); break; + case S_surfxml_platform_6: case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_5: case S_surfxml_platform_1: SET(S_surfxml_platform_6); break; + case S_surfxml_AS: case S_surfxml_AS_3: case S_surfxml_AS_1: case S_surfxml_AS_6: case S_surfxml_AS_5: SET(S_surfxml_AS_6); break; + case S_surfxml_include_1: case S_surfxml_include_2: case S_surfxml_include: SET(S_surfxml_include_2); break; } } YY_BREAK @@ -8132,9 +8132,9 @@ YY_RULE_SETUP ETag_surfxml_peer(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_platform: case S_surfxml_platform_6: case S_surfxml_platform_3: case S_surfxml_platform_1: case S_surfxml_platform_5: SET(S_surfxml_platform_6); break; - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_5: case S_surfxml_AS_6: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; - case S_surfxml_include_2: case S_surfxml_include_1: case S_surfxml_include: SET(S_surfxml_include_2); break; + case S_surfxml_platform_6: case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_5: case S_surfxml_platform_1: SET(S_surfxml_platform_6); break; + case S_surfxml_AS: case S_surfxml_AS_3: case S_surfxml_AS_1: case S_surfxml_AS_6: case S_surfxml_AS_5: SET(S_surfxml_AS_6); break; + case S_surfxml_include_1: case S_surfxml_include_2: case S_surfxml_include: SET(S_surfxml_include_2); break; } } YY_BREAK @@ -8201,7 +8201,7 @@ YY_RULE_SETUP if (!AX_surfxml_router_id) FAIL("Required attribute `id' not set for `router' element."); LEAVE; STag_surfxml_router(); surfxml_pcdata_ix = 0; ETag_surfxml_router(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_13: case S_surfxml_AS_3: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_3: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_1: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; } } YY_BREAK @@ -8225,7 +8225,7 @@ YY_RULE_SETUP ETag_surfxml_router(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_13: case S_surfxml_AS_3: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_3: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_1: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; } } YY_BREAK @@ -8308,8 +8308,8 @@ YY_RULE_SETUP if (!AX_surfxml_backbone_latency) FAIL("Required attribute `latency' not set for `backbone' element."); LEAVE; STag_surfxml_backbone(); surfxml_pcdata_ix = 0; ETag_surfxml_backbone(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_1: case S_surfxml_AS_13: case S_surfxml_AS_14: case S_surfxml_AS: SET(S_surfxml_AS_14); break; - case S_surfxml_AS_5: case S_surfxml_AS_6: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_AS_3: case S_surfxml_AS_6: case S_surfxml_AS_5: SET(S_surfxml_AS_6); break; + case S_surfxml_AS_14: case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; } } YY_BREAK @@ -8333,8 +8333,8 @@ YY_RULE_SETUP ETag_surfxml_backbone(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_1: case S_surfxml_AS_13: case S_surfxml_AS_14: case S_surfxml_AS: SET(S_surfxml_AS_14); break; - case S_surfxml_AS_5: case S_surfxml_AS_6: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_AS_3: case S_surfxml_AS_6: case S_surfxml_AS_5: SET(S_surfxml_AS_6); break; + case S_surfxml_AS_14: case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; } } YY_BREAK @@ -8490,8 +8490,8 @@ YY_RULE_SETUP if (!AX_surfxml_link_bandwidth) FAIL("Required attribute `bandwidth' not set for `link' element."); LEAVE; STag_surfxml_link(); surfxml_pcdata_ix = 0; ETag_surfxml_link(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_1: case S_surfxml_AS_13: case S_surfxml_AS_14: case S_surfxml_AS: SET(S_surfxml_AS_14); break; - case S_surfxml_AS_5: case S_surfxml_AS_6: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_1: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_3: case S_surfxml_AS_6: case S_surfxml_AS_5: SET(S_surfxml_AS_6); break; } } YY_BREAK @@ -8515,8 +8515,8 @@ YY_RULE_SETUP ETag_surfxml_link(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_1: case S_surfxml_AS_13: case S_surfxml_AS_14: case S_surfxml_AS: SET(S_surfxml_AS_14); break; - case S_surfxml_AS_5: case S_surfxml_AS_6: case S_surfxml_AS_3: SET(S_surfxml_AS_6); break; + case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_1: case S_surfxml_AS_13: SET(S_surfxml_AS_14); break; + case S_surfxml_AS_3: case S_surfxml_AS_6: case S_surfxml_AS_5: SET(S_surfxml_AS_6); break; } } YY_BREAK @@ -8530,8 +8530,8 @@ YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",surf_parse_text[0]); YY_BREAK case YY_STATE_EOF(S_surfxml_link_2): -case YY_STATE_EOF(E_surfxml_link): case YY_STATE_EOF(S_surfxml_link): +case YY_STATE_EOF(E_surfxml_link): if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `' expected."); YY_BREAK @@ -8603,7 +8603,7 @@ YY_RULE_SETUP if (!AX_surfxml_route_dst) FAIL("Required attribute `dst' not set for `route' element."); LEAVE; STag_surfxml_route(); surfxml_pcdata_ix = 0; ETag_surfxml_route(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_15: case S_surfxml_AS_3: case S_surfxml_AS_14: case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_12: case S_surfxml_AS_16: SET(S_surfxml_AS_16); break; + case S_surfxml_AS_3: case S_surfxml_AS_16: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_1: case S_surfxml_AS_12: case S_surfxml_AS_15: SET(S_surfxml_AS_16); break; } } YY_BREAK @@ -8627,7 +8627,7 @@ YY_RULE_SETUP ETag_surfxml_route(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_15: case S_surfxml_AS_3: case S_surfxml_AS_14: case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_12: case S_surfxml_AS_16: SET(S_surfxml_AS_16); break; + case S_surfxml_AS_3: case S_surfxml_AS_16: case S_surfxml_AS: case S_surfxml_AS_14: case S_surfxml_AS_1: case S_surfxml_AS_12: case S_surfxml_AS_15: SET(S_surfxml_AS_16); break; } } YY_BREAK @@ -8640,9 +8640,9 @@ case 436: YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",surf_parse_text[0]); YY_BREAK -case YY_STATE_EOF(E_surfxml_route): -case YY_STATE_EOF(S_surfxml_route_2): case YY_STATE_EOF(S_surfxml_route): +case YY_STATE_EOF(S_surfxml_route_2): +case YY_STATE_EOF(E_surfxml_route): if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `' expected."); YY_BREAK @@ -8742,7 +8742,7 @@ YY_RULE_SETUP if (!AX_surfxml_ASroute_gw___dst) FAIL("Required attribute `gw_dst' not set for `ASroute' element."); LEAVE; STag_surfxml_ASroute(); surfxml_pcdata_ix = 0; ETag_surfxml_ASroute(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_6: case S_surfxml_AS_8: case S_surfxml_AS: case S_surfxml_AS_4: case S_surfxml_AS_1: case S_surfxml_AS_9: case S_surfxml_AS_3: SET(S_surfxml_AS_9); break; + case S_surfxml_AS_6: case S_surfxml_AS_8: case S_surfxml_AS_1: case S_surfxml_AS_9: case S_surfxml_AS_3: case S_surfxml_AS: case S_surfxml_AS_4: SET(S_surfxml_AS_9); break; } } YY_BREAK @@ -8766,7 +8766,7 @@ YY_RULE_SETUP ETag_surfxml_ASroute(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_6: case S_surfxml_AS_8: case S_surfxml_AS: case S_surfxml_AS_4: case S_surfxml_AS_1: case S_surfxml_AS_9: case S_surfxml_AS_3: SET(S_surfxml_AS_9); break; + case S_surfxml_AS_6: case S_surfxml_AS_8: case S_surfxml_AS_1: case S_surfxml_AS_9: case S_surfxml_AS_3: case S_surfxml_AS: case S_surfxml_AS_4: SET(S_surfxml_AS_9); break; } } YY_BREAK @@ -8780,8 +8780,8 @@ YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",surf_parse_text[0]); YY_BREAK case YY_STATE_EOF(E_surfxml_ASroute): -case YY_STATE_EOF(S_surfxml_ASroute_2): case YY_STATE_EOF(S_surfxml_ASroute): +case YY_STATE_EOF(S_surfxml_ASroute_2): if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `' expected."); YY_BREAK @@ -8846,10 +8846,10 @@ YY_RULE_SETUP if (!AX_surfxml_link___ctn_id) FAIL("Required attribute `id' not set for `link_ctn' element."); LEAVE; STag_surfxml_link___ctn(); surfxml_pcdata_ix = 0; ETag_surfxml_link___ctn(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_bypassRoute_1: case S_surfxml_bypassRoute: case S_surfxml_bypassRoute_2: SET(S_surfxml_bypassRoute_2); break; case S_surfxml_route_2: case S_surfxml_route: case S_surfxml_route_1: SET(S_surfxml_route_2); break; - case S_surfxml_bypassASroute_1: case S_surfxml_bypassASroute: case S_surfxml_bypassASroute_2: SET(S_surfxml_bypassASroute_2); break; - case S_surfxml_ASroute: case S_surfxml_ASroute_2: case S_surfxml_ASroute_1: SET(S_surfxml_ASroute_2); break; + case S_surfxml_bypassRoute_2: case S_surfxml_bypassRoute_1: case S_surfxml_bypassRoute: SET(S_surfxml_bypassRoute_2); break; + case S_surfxml_ASroute_1: case S_surfxml_ASroute_2: case S_surfxml_ASroute: SET(S_surfxml_ASroute_2); break; + case S_surfxml_bypassASroute_2: case S_surfxml_bypassASroute_1: case S_surfxml_bypassASroute: SET(S_surfxml_bypassASroute_2); break; } } YY_BREAK @@ -8873,10 +8873,10 @@ YY_RULE_SETUP ETag_surfxml_link___ctn(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_bypassRoute_1: case S_surfxml_bypassRoute: case S_surfxml_bypassRoute_2: SET(S_surfxml_bypassRoute_2); break; case S_surfxml_route_2: case S_surfxml_route: case S_surfxml_route_1: SET(S_surfxml_route_2); break; - case S_surfxml_bypassASroute_1: case S_surfxml_bypassASroute: case S_surfxml_bypassASroute_2: SET(S_surfxml_bypassASroute_2); break; - case S_surfxml_ASroute: case S_surfxml_ASroute_2: case S_surfxml_ASroute_1: SET(S_surfxml_ASroute_2); break; + case S_surfxml_bypassRoute_2: case S_surfxml_bypassRoute_1: case S_surfxml_bypassRoute: SET(S_surfxml_bypassRoute_2); break; + case S_surfxml_ASroute_1: case S_surfxml_ASroute_2: case S_surfxml_ASroute: SET(S_surfxml_ASroute_2); break; + case S_surfxml_bypassASroute_2: case S_surfxml_bypassASroute_1: case S_surfxml_bypassASroute: SET(S_surfxml_bypassASroute_2); break; } } YY_BREAK @@ -8945,7 +8945,7 @@ YY_RULE_SETUP if (!AX_surfxml_bypassRoute_dst) FAIL("Required attribute `dst' not set for `bypassRoute' element."); LEAVE; STag_surfxml_bypassRoute(); surfxml_pcdata_ix = 0; ETag_surfxml_bypassRoute(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_3: case S_surfxml_AS_15: case S_surfxml_AS_16: case S_surfxml_AS_12: case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: SET(S_surfxml_AS_16); break; + case S_surfxml_AS_1: case S_surfxml_AS_15: case S_surfxml_AS_12: case S_surfxml_AS_16: case S_surfxml_AS_3: case S_surfxml_AS_14: case S_surfxml_AS: SET(S_surfxml_AS_16); break; } } YY_BREAK @@ -8969,7 +8969,7 @@ YY_RULE_SETUP ETag_surfxml_bypassRoute(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_3: case S_surfxml_AS_15: case S_surfxml_AS_16: case S_surfxml_AS_12: case S_surfxml_AS_1: case S_surfxml_AS: case S_surfxml_AS_14: SET(S_surfxml_AS_16); break; + case S_surfxml_AS_1: case S_surfxml_AS_15: case S_surfxml_AS_12: case S_surfxml_AS_16: case S_surfxml_AS_3: case S_surfxml_AS_14: case S_surfxml_AS: SET(S_surfxml_AS_16); break; } } YY_BREAK @@ -8982,9 +8982,9 @@ case 487: YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",surf_parse_text[0]); YY_BREAK -case YY_STATE_EOF(S_surfxml_bypassRoute): case YY_STATE_EOF(S_surfxml_bypassRoute_2): case YY_STATE_EOF(E_surfxml_bypassRoute): +case YY_STATE_EOF(S_surfxml_bypassRoute): if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `' expected."); YY_BREAK @@ -9068,7 +9068,7 @@ YY_RULE_SETUP if (!AX_surfxml_bypassASroute_gw___dst) FAIL("Required attribute `gw_dst' not set for `bypassASroute' element."); LEAVE; STag_surfxml_bypassASroute(); surfxml_pcdata_ix = 0; ETag_surfxml_bypassASroute(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_8: case S_surfxml_AS_6: case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_4: case S_surfxml_AS_9: case S_surfxml_AS_3: SET(S_surfxml_AS_9); break; + case S_surfxml_AS_1: case S_surfxml_AS_8: case S_surfxml_AS_6: case S_surfxml_AS_9: case S_surfxml_AS_3: case S_surfxml_AS: case S_surfxml_AS_4: SET(S_surfxml_AS_9); break; } } YY_BREAK @@ -9092,7 +9092,7 @@ YY_RULE_SETUP ETag_surfxml_bypassASroute(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_AS_8: case S_surfxml_AS_6: case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_4: case S_surfxml_AS_9: case S_surfxml_AS_3: SET(S_surfxml_AS_9); break; + case S_surfxml_AS_1: case S_surfxml_AS_8: case S_surfxml_AS_6: case S_surfxml_AS_9: case S_surfxml_AS_3: case S_surfxml_AS: case S_surfxml_AS_4: SET(S_surfxml_AS_9); break; } } YY_BREAK @@ -9105,9 +9105,9 @@ case 504: YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",surf_parse_text[0]); YY_BREAK +case YY_STATE_EOF(E_surfxml_bypassASroute): case YY_STATE_EOF(S_surfxml_bypassASroute): case YY_STATE_EOF(S_surfxml_bypassASroute_2): -case YY_STATE_EOF(E_surfxml_bypassASroute): if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `' expected."); YY_BREAK @@ -9203,7 +9203,7 @@ YY_RULE_SETUP if (!AX_surfxml_process_function) FAIL("Required attribute `function' not set for `process' element."); LEAVE; STag_surfxml_process(); surfxml_pcdata_ix = 0; ETag_surfxml_process(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_platform_3: case S_surfxml_platform_1: case S_surfxml_platform_7: case S_surfxml_platform: case S_surfxml_platform_6: case S_surfxml_platform_4: case S_surfxml_platform_8: SET(S_surfxml_platform_8); break; + case S_surfxml_platform_7: case S_surfxml_platform_6: case S_surfxml_platform_4: case S_surfxml_platform_8: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_8); break; } } YY_BREAK @@ -9227,7 +9227,7 @@ YY_RULE_SETUP ETag_surfxml_process(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_platform_3: case S_surfxml_platform_1: case S_surfxml_platform_7: case S_surfxml_platform: case S_surfxml_platform_6: case S_surfxml_platform_4: case S_surfxml_platform_8: SET(S_surfxml_platform_8); break; + case S_surfxml_platform_7: case S_surfxml_platform_6: case S_surfxml_platform_4: case S_surfxml_platform_8: case S_surfxml_platform_1: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_8); break; } } YY_BREAK @@ -9240,9 +9240,9 @@ case 525: YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",surf_parse_text[0]); YY_BREAK +case YY_STATE_EOF(S_surfxml_process): case YY_STATE_EOF(E_surfxml_process): case YY_STATE_EOF(S_surfxml_process_2): -case YY_STATE_EOF(S_surfxml_process): if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `' expected."); YY_BREAK @@ -9284,7 +9284,7 @@ YY_RULE_SETUP if (!AX_surfxml_argument_value) FAIL("Required attribute `value' not set for `argument' element."); LEAVE; STag_surfxml_argument(); surfxml_pcdata_ix = 0; ETag_surfxml_argument(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_process: case S_surfxml_process_2: case S_surfxml_process_1: SET(S_surfxml_process_2); break; + case S_surfxml_process_2: case S_surfxml_process: case S_surfxml_process_1: SET(S_surfxml_process_2); break; } } YY_BREAK @@ -9308,7 +9308,7 @@ YY_RULE_SETUP ETag_surfxml_argument(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_process: case S_surfxml_process_2: case S_surfxml_process_1: SET(S_surfxml_process_2); break; + case S_surfxml_process_2: case S_surfxml_process: case S_surfxml_process_1: SET(S_surfxml_process_2); break; } } YY_BREAK @@ -9361,7 +9361,7 @@ YY_RULE_SETUP { LEAVE; STag_surfxml_config(); surfxml_pcdata_ix = 0; ETag_surfxml_config(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_2: SET(S_surfxml_platform_3); break; + case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break; } } YY_BREAK @@ -9385,7 +9385,7 @@ YY_RULE_SETUP ETag_surfxml_config(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_platform: case S_surfxml_platform_3: case S_surfxml_platform_2: SET(S_surfxml_platform_3); break; + case S_surfxml_platform_2: case S_surfxml_platform_3: case S_surfxml_platform: SET(S_surfxml_platform_3); break; } } YY_BREAK @@ -9398,9 +9398,9 @@ case 547: YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",surf_parse_text[0]); YY_BREAK -case YY_STATE_EOF(S_surfxml_config): case YY_STATE_EOF(E_surfxml_config): case YY_STATE_EOF(S_surfxml_config_2): +case YY_STATE_EOF(S_surfxml_config): if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `' expected."); YY_BREAK @@ -9458,14 +9458,14 @@ YY_RULE_SETUP if (!AX_surfxml_prop_value) FAIL("Required attribute `value' not set for `prop' element."); LEAVE; STag_surfxml_prop(); surfxml_pcdata_ix = 0; ETag_surfxml_prop(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_storage_1: case S_surfxml_storage_2: case S_surfxml_storage: SET(S_surfxml_storage_2); break; - case S_surfxml_cluster_2: case S_surfxml_cluster: case S_surfxml_cluster_1: SET(S_surfxml_cluster_2); break; - case S_surfxml_host_1: case S_surfxml_host: case S_surfxml_host_2: SET(S_surfxml_host_2); break; - case S_surfxml_config_1: case S_surfxml_config_2: case S_surfxml_config: SET(S_surfxml_config_2); break; - case S_surfxml_AS: case S_surfxml_AS_3: case S_surfxml_AS_2: SET(S_surfxml_AS_3); break; - case S_surfxml_storage___type: case S_surfxml_storage___type_1: case S_surfxml_storage___type_2: SET(S_surfxml_storage___type_2); break; - case S_surfxml_process_1: case S_surfxml_process_2: case S_surfxml_process: SET(S_surfxml_process_2); break; - case S_surfxml_link_2: case S_surfxml_link_1: case S_surfxml_link: SET(S_surfxml_link_2); break; + case S_surfxml_AS: case S_surfxml_AS_2: case S_surfxml_AS_3: SET(S_surfxml_AS_3); break; + case S_surfxml_host_2: case S_surfxml_host_1: case S_surfxml_host: SET(S_surfxml_host_2); break; + case S_surfxml_config_2: case S_surfxml_config: case S_surfxml_config_1: SET(S_surfxml_config_2); break; + case S_surfxml_process: case S_surfxml_process_1: case S_surfxml_process_2: SET(S_surfxml_process_2); break; + case S_surfxml_link_2: case S_surfxml_link: case S_surfxml_link_1: SET(S_surfxml_link_2); break; + case S_surfxml_cluster_1: case S_surfxml_cluster_2: case S_surfxml_cluster: SET(S_surfxml_cluster_2); break; + case S_surfxml_storage___type_2: case S_surfxml_storage___type_1: case S_surfxml_storage___type: SET(S_surfxml_storage___type_2); break; + case S_surfxml_storage_2: case S_surfxml_storage: case S_surfxml_storage_1: SET(S_surfxml_storage_2); break; } } YY_BREAK @@ -9489,14 +9489,14 @@ YY_RULE_SETUP ETag_surfxml_prop(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_storage_1: case S_surfxml_storage_2: case S_surfxml_storage: SET(S_surfxml_storage_2); break; - case S_surfxml_cluster_2: case S_surfxml_cluster: case S_surfxml_cluster_1: SET(S_surfxml_cluster_2); break; - case S_surfxml_host_1: case S_surfxml_host: case S_surfxml_host_2: SET(S_surfxml_host_2); break; - case S_surfxml_config_1: case S_surfxml_config_2: case S_surfxml_config: SET(S_surfxml_config_2); break; - case S_surfxml_AS: case S_surfxml_AS_3: case S_surfxml_AS_2: SET(S_surfxml_AS_3); break; - case S_surfxml_storage___type: case S_surfxml_storage___type_1: case S_surfxml_storage___type_2: SET(S_surfxml_storage___type_2); break; - case S_surfxml_process_1: case S_surfxml_process_2: case S_surfxml_process: SET(S_surfxml_process_2); break; - case S_surfxml_link_2: case S_surfxml_link_1: case S_surfxml_link: SET(S_surfxml_link_2); break; + case S_surfxml_AS: case S_surfxml_AS_2: case S_surfxml_AS_3: SET(S_surfxml_AS_3); break; + case S_surfxml_host_2: case S_surfxml_host_1: case S_surfxml_host: SET(S_surfxml_host_2); break; + case S_surfxml_config_2: case S_surfxml_config: case S_surfxml_config_1: SET(S_surfxml_config_2); break; + case S_surfxml_process: case S_surfxml_process_1: case S_surfxml_process_2: SET(S_surfxml_process_2); break; + case S_surfxml_link_2: case S_surfxml_link: case S_surfxml_link_1: SET(S_surfxml_link_2); break; + case S_surfxml_cluster_1: case S_surfxml_cluster_2: case S_surfxml_cluster: SET(S_surfxml_cluster_2); break; + case S_surfxml_storage___type_2: case S_surfxml_storage___type_1: case S_surfxml_storage___type: SET(S_surfxml_storage___type_2); break; + case S_surfxml_storage_2: case S_surfxml_storage: case S_surfxml_storage_1: SET(S_surfxml_storage_2); break; } } YY_BREAK @@ -9567,7 +9567,7 @@ YY_RULE_SETUP if (!AX_surfxml_model___prop_value) FAIL("Required attribute `value' not set for `model_prop' element."); LEAVE; STag_surfxml_model___prop(); surfxml_pcdata_ix = 0; ETag_surfxml_model___prop(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_storage___type_2: case S_surfxml_storage___type_1: case S_surfxml_storage___type: SET(S_surfxml_storage___type_2); break; + case S_surfxml_storage___type: case S_surfxml_storage___type_2: case S_surfxml_storage___type_1: SET(S_surfxml_storage___type_2); break; } } YY_BREAK @@ -9591,7 +9591,7 @@ YY_RULE_SETUP ETag_surfxml_model___prop(); popbuffer(); /* attribute */ switch (YY_START) { - case S_surfxml_storage___type_2: case S_surfxml_storage___type_1: case S_surfxml_storage___type: SET(S_surfxml_storage___type_2); break; + case S_surfxml_storage___type: case S_surfxml_storage___type_2: case S_surfxml_storage___type_1: SET(S_surfxml_storage___type_2); break; } } YY_BREAK diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 6de2b62a46..2e799547f8 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -117,6 +117,9 @@ s_surf_model_description_t surf_network_model_description[] = { {"SMPI", "Realistic network model specifically tailored for HPC settings (accurate modeling of slow start with correction factors on three intervals: < 1KiB, < 64 KiB, >= 64 KiB)", surf_network_model_init_SMPI}, + {"IB", + "Realistic network model specifically tailored for HPC settings, with Infiniband contention model", + surf_network_model_init_IB}, {"CM02", "Legacy network analytic model (Very similar to LV08, but without corrective factors. The timings of small messages are thus poorly modeled).", surf_network_model_init_CM02}, @@ -872,7 +875,7 @@ void Action::setBound(double bound) { XBT_IN("(%p,%g)", this, bound); if (p_variable) - lmm_update_variable_bound(getModel()->getMaxminSystem(), getVariable(), bound); + lmm_update_variable_bound(getModel()->getMaxminSystem(), p_variable, bound); if (getModel()->getUpdateMechanism() == UM_LAZY && getLastUpdate()!=surf_get_clock()) heapRemove(getModel()->getActionHeap()); diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 48caddead1..06f68802b2 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -894,6 +894,15 @@ static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster) memset(&host, 0, sizeof(host)); host.id = host_id; + if ((cluster->properties != NULL) && (!xbt_dict_is_empty(cluster->properties))) { + xbt_dict_cursor_t cursor=NULL; + char *key,*data; + host.properties = xbt_dict_new(); + + xbt_dict_foreach(cluster->properties,cursor,key,data) { + xbt_dict_set(host.properties, key, xbt_strdup(data),free); + } + } if (cluster->availability_trace && strcmp(cluster->availability_trace, "")) { xbt_dict_set(patterns, "radical", bprintf("%d", i), NULL); char *avail_file = xbt_str_varsubst(cluster->availability_trace, patterns); diff --git a/src/surf/surf_routing_cluster.cpp b/src/surf/surf_routing_cluster.cpp index 25cf788bdd..02c11ba7b1 100644 --- a/src/surf/surf_routing_cluster.cpp +++ b/src/surf/surf_routing_cluster.cpp @@ -90,7 +90,7 @@ void AsCluster::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) xbt_node_t current, previous, backboneNode = NULL, routerNode; s_surf_parsing_link_up_down_t info; - xbt_assert(p_router,"Malformed cluster"); + xbt_assert(p_router,"Malformed cluster. This may be because your platform file is a hypergraph while it must be a graph."); /* create the router */ char *link_name = p_router->getName(); diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 98f90f9f73..90c3711c97 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -414,15 +414,17 @@ void STag_surfxml_prop(void) as_current_property_set = xbt_dict_new_homogeneous(xbt_free_f); // Maybe, it should raise an error as_name_tab[as_prop_nb] = xbt_strdup(A_surfxml_AS_id); as_dict_tab[as_prop_nb] = as_current_property_set; - XBT_DEBUG("PUSH prop %p for AS '%s'",as_dict_tab[as_prop_nb],as_name_tab[as_prop_nb]); + XBT_DEBUG("PUSH prop set %p for AS '%s'",as_dict_tab[as_prop_nb],as_name_tab[as_prop_nb]); as_prop_nb++; } + XBT_DEBUG("add prop %s=%s into current AS property set", A_surfxml_prop_id, A_surfxml_prop_value); xbt_dict_set(as_current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), NULL); } else{ if (!current_property_set) current_property_set = xbt_dict_new(); // Maybe, it should raise an error xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), xbt_free_f); + XBT_DEBUG("add prop %s=%s into current property set", A_surfxml_prop_id, A_surfxml_prop_value); } } @@ -503,7 +505,7 @@ void STag_surfxml_router(void){ void ETag_surfxml_cluster(void){ s_sg_platf_cluster_cbarg_t cluster; memset(&cluster,0,sizeof(cluster)); - cluster.properties = current_property_set; + cluster.properties = as_current_property_set; cluster.id = A_surfxml_cluster_id; cluster.prefix = A_surfxml_cluster_prefix; diff --git a/src/xbt/automaton/automaton_lexer.yy.c b/src/xbt/automaton/automaton_lexer.yy.c index d6e56e4ced..e5f85d817a 100644 --- a/src/xbt/automaton/automaton_lexer.yy.c +++ b/src/xbt/automaton/automaton_lexer.yy.c @@ -1937,7 +1937,7 @@ void xbt_automaton_parser_free (void * ptr ) #define YYTABLES_NAME "yytables" -#line 77 "parserPromela.lex" +#line 76 "parserPromela.lex" diff --git a/src/xbt/config.c b/src/xbt/config.c index 60bf7a6d9a..69389e7175 100644 --- a/src/xbt/config.c +++ b/src/xbt/config.c @@ -275,7 +275,7 @@ xbt_cfg_register(xbt_cfg_t * cfg, break; default: - XBT_ERROR("%d is an invalide type code", (int)type); + XBT_ERROR("%d is an invalid type code", (int)type); } xbt_dict_set((xbt_dict_t) * cfg, name, res, NULL); @@ -284,7 +284,7 @@ xbt_cfg_register(xbt_cfg_t * cfg, /** @brief Unregister an element from a config set. * * @param cfg the config set - * @param name the name of the elem to be freed + * @param name the name of the element to be freed * * Note that it removes both the description and the actual content. * Throws not_found when no such element exists. @@ -667,7 +667,7 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) { val = strchr(name, ':'); if (!val) { /* don't free(optionlist_cpy) here, 'name' points inside it */ - xbt_die("Option '%s' badly formated. Should be of the form 'name:value'", + xbt_die("Option '%s' badly formatted. Should be of the form 'name:value'", name); } *(val++) = '\0'; diff --git a/src/xbt/graphxml.c b/src/xbt/graphxml.c index be9aeaac89..9391589c9e 100644 --- a/src/xbt/graphxml.c +++ b/src/xbt/graphxml.c @@ -481,7 +481,7 @@ static yyconst flex_int16_t yy_accept[564] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 15, 0, 0, 14, + 0, 0, 0, 0, 0, 0, 14, 0, 0, 15, 0, 13, 0 } ; @@ -1148,36 +1148,36 @@ short int graphxml_node_position___y_isset; AT_graphxml_edge_label AX_graphxml_edge_label; #define A_graphxml_edge_label (graphxml_bufferstack + AX_graphxml_edge_label) short int graphxml_edge_label_isset; -AT_graphxml_edge_data AX_graphxml_edge_data; -#define A_graphxml_edge_data (graphxml_bufferstack + AX_graphxml_edge_data) -short int graphxml_edge_data_isset; +AT_graphxml_graph_isDirected AX_graphxml_graph_isDirected; +#define A_graphxml_graph_isDirected AX_graphxml_graph_isDirected +short int graphxml_graph_isDirected_isset; +AT_graphxml_node_label AX_graphxml_node_label; +#define A_graphxml_node_label (graphxml_bufferstack + AX_graphxml_node_label) +short int graphxml_node_label_isset; +AT_graphxml_edge_length AX_graphxml_edge_length; +#define A_graphxml_edge_length (graphxml_bufferstack + AX_graphxml_edge_length) +short int graphxml_edge_length_isset; +AT_graphxml_edge_source AX_graphxml_edge_source; +#define A_graphxml_edge_source (graphxml_bufferstack + AX_graphxml_edge_source) +short int graphxml_edge_source_isset; +AT_graphxml_edge_target AX_graphxml_edge_target; +#define A_graphxml_edge_target (graphxml_bufferstack + AX_graphxml_edge_target) +short int graphxml_edge_target_isset; AT_graphxml_node_name AX_graphxml_node_name; #define A_graphxml_node_name (graphxml_bufferstack + AX_graphxml_node_name) short int graphxml_node_name_isset; +AT_graphxml_edge_data AX_graphxml_edge_data; +#define A_graphxml_edge_data (graphxml_bufferstack + AX_graphxml_edge_data) +short int graphxml_edge_data_isset; +AT_graphxml_node_data AX_graphxml_node_data; +#define A_graphxml_node_data (graphxml_bufferstack + AX_graphxml_node_data) +short int graphxml_node_data_isset; AT_graphxml_edge_name AX_graphxml_edge_name; #define A_graphxml_edge_name (graphxml_bufferstack + AX_graphxml_edge_name) short int graphxml_edge_name_isset; -AT_graphxml_edge_source AX_graphxml_edge_source; -#define A_graphxml_edge_source (graphxml_bufferstack + AX_graphxml_edge_source) -short int graphxml_edge_source_isset; -AT_graphxml_edge_length AX_graphxml_edge_length; -#define A_graphxml_edge_length (graphxml_bufferstack + AX_graphxml_edge_length) -short int graphxml_edge_length_isset; -AT_graphxml_graph_isDirected AX_graphxml_graph_isDirected; -#define A_graphxml_graph_isDirected AX_graphxml_graph_isDirected -short int graphxml_graph_isDirected_isset; AT_graphxml_node_position___x AX_graphxml_node_position___x; #define A_graphxml_node_position___x (graphxml_bufferstack + AX_graphxml_node_position___x) short int graphxml_node_position___x_isset; -AT_graphxml_node_data AX_graphxml_node_data; -#define A_graphxml_node_data (graphxml_bufferstack + AX_graphxml_node_data) -short int graphxml_node_data_isset; -AT_graphxml_edge_target AX_graphxml_edge_target; -#define A_graphxml_edge_target (graphxml_bufferstack + AX_graphxml_edge_target) -short int graphxml_edge_target_isset; -AT_graphxml_node_label AX_graphxml_node_label; -#define A_graphxml_node_label (graphxml_bufferstack + AX_graphxml_node_label) -short int graphxml_node_label_isset; /* XML state. */ #ifdef FLEX_DEBUG @@ -1758,12 +1758,12 @@ SET(ROOT_graphxml_graph); case 14: /* rule 14 can match eol */ YY_RULE_SETUP -SET(ROOT_graphxml_node); +SET(ROOT_graphxml_edge); YY_BREAK case 15: /* rule 15 can match eol */ YY_RULE_SETUP -SET(ROOT_graphxml_edge); +SET(ROOT_graphxml_node); YY_BREAK case 16: /* rule 16 can match eol */ @@ -1860,10 +1860,10 @@ case 30: YY_RULE_SETUP FAIL("Unexpected character `%c': `' expected.",xbt_graph_parse_text[0]); YY_BREAK -case YY_STATE_EOF(S_graphxml_graph_5): +case YY_STATE_EOF(S_graphxml_graph): case YY_STATE_EOF(E_graphxml_graph): case YY_STATE_EOF(S_graphxml_graph_3): -case YY_STATE_EOF(S_graphxml_graph): +case YY_STATE_EOF(S_graphxml_graph_5): case YY_STATE_EOF(S_graphxml_graph_1): FAIL("Premature EOF: `' expected."); YY_BREAK @@ -1960,8 +1960,8 @@ YY_RULE_SETUP if (!AX_graphxml_node_name) FAIL("Required attribute `name' not set for `node' element."); LEAVE; STag_graphxml_node(); graphxml_pcdata_ix = 0; ETag_graphxml_node(); popbuffer(); /* attribute */ switch (YY_START) { + case S_graphxml_graph: case S_graphxml_graph_2: case S_graphxml_graph_3: SET(S_graphxml_graph_3); break; case ROOT_graphxml_node: SET(EPILOG); break; - case S_graphxml_graph_2: case S_graphxml_graph_3: case S_graphxml_graph: SET(S_graphxml_graph_3); break; } } YY_BREAK @@ -1985,8 +1985,8 @@ YY_RULE_SETUP ETag_graphxml_node(); popbuffer(); /* attribute */ switch (YY_START) { + case S_graphxml_graph: case S_graphxml_graph_2: case S_graphxml_graph_3: SET(S_graphxml_graph_3); break; case ROOT_graphxml_node: SET(EPILOG); break; - case S_graphxml_graph_2: case S_graphxml_graph_3: case S_graphxml_graph: SET(S_graphxml_graph_3); break; } } YY_BREAK @@ -2110,8 +2110,8 @@ YY_RULE_SETUP if (!AX_graphxml_edge_target) FAIL("Required attribute `target' not set for `edge' element."); LEAVE; STag_graphxml_edge(); graphxml_pcdata_ix = 0; ETag_graphxml_edge(); popbuffer(); /* attribute */ switch (YY_START) { - case S_graphxml_graph_5: case S_graphxml_graph_4: case S_graphxml_graph_1: case S_graphxml_graph: case S_graphxml_graph_3: SET(S_graphxml_graph_5); break; case ROOT_graphxml_edge: SET(EPILOG); break; + case S_graphxml_graph_5: case S_graphxml_graph_4: case S_graphxml_graph_1: case S_graphxml_graph: case S_graphxml_graph_3: SET(S_graphxml_graph_5); break; } } YY_BREAK @@ -2135,8 +2135,8 @@ YY_RULE_SETUP ETag_graphxml_edge(); popbuffer(); /* attribute */ switch (YY_START) { - case S_graphxml_graph_5: case S_graphxml_graph_4: case S_graphxml_graph_1: case S_graphxml_graph: case S_graphxml_graph_3: SET(S_graphxml_graph_5); break; case ROOT_graphxml_edge: SET(EPILOG); break; + case S_graphxml_graph_5: case S_graphxml_graph_4: case S_graphxml_graph_1: case S_graphxml_graph: case S_graphxml_graph_3: SET(S_graphxml_graph_5); break; } } YY_BREAK diff --git a/src/xbt/log.c b/src/xbt/log.c index ce695aac07..a121bd8776 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -104,13 +104,14 @@ higher about the XBT internals. \subsection log_app 1.3 Message appenders The message appenders are the elements in charge of actually displaying the -message to the user. For now, only two appenders exist: the default one prints -stuff on stderr while it is possible to create appenders printing to a specific -file. +message to the user. For now, four appenders exist: +- the default one prints stuff on stderr +- file sends the data to a single file +- rollfile overwrites the file when the file grows too large +- splitfile creates new files with a specific maximum size -Other are planed (such as the one sending everything to a remote server, -or the one using only a fixed amount of lines in a file, and rotating content on -need). One day, for sure ;) +Other are planed (such as the one sending everything to a remote server) +One day, for sure ;) \subsection log_lay 1.4 Message layouts @@ -398,6 +399,17 @@ messages. This is done through the app keyword. For example, \verbatim --log=root.app:file:mylogfile\endverbatim redirects the output to the file mylogfile. +For splitfile appender, the format is +\verbatim --log=root.app:splitfile:size:mylogfile_%.format\endverbatim + +The size is in bytes, and the % wildcard will be replaced by the number of the +file. If no % is present, it will be appended at the end. + +rollfile appender is also available, it can be used as +\verbatim --log=root.app:rollfile:size:mylogfile\endverbatim +When the file grows to be larger than the size, it will be emptied and new log +events will be sent at its beginning + Any appender setup this way have its own layout format (simple one by default), so you may have to change it too afterward. Moreover, the additivity of the log category is also set to false to prevent log event displayed by this appender to "leak" to any other @@ -480,11 +492,8 @@ By default, only the root category have an appender, and any other category has its additivity set to true. This causes all messages to be logged by the root category's appender. -The default appender function currently prints to stderr, and the only other -existing one writes to the specified file. More would be needed, like the one -able to send the logs to a remote dedicated server. -This is on our TODO list for quite a while now, but your help would be -welcome here, too. */ +The default appender function currently prints to stderr +*/ xbt_log_appender_t xbt_log_default_appender = NULL; /* set in log_init */ xbt_log_layout_t xbt_log_default_layout = NULL; /* set in log_init */ @@ -651,7 +660,6 @@ static void xbt_log_connect_categories(void) XBT_LOG_CONNECT(msg_io); XBT_LOG_CONNECT(msg_kernel); XBT_LOG_CONNECT(msg_mailbox); - XBT_LOG_CONNECT(msg_new_API); XBT_LOG_CONNECT(msg_process); XBT_LOG_CONNECT(msg_synchro); XBT_LOG_CONNECT(msg_task); @@ -676,9 +684,8 @@ static void xbt_log_connect_categories(void) XBT_LOG_CONNECT(simix_io); XBT_LOG_CONNECT(simix_kernel); XBT_LOG_CONNECT(simix_network); - XBT_LOG_CONNECT(simix_new_api); XBT_LOG_CONNECT(simix_process); - XBT_LOG_CONNECT(simix_smurf); + XBT_LOG_CONNECT(simix_popping); XBT_LOG_CONNECT(simix_synchro); XBT_LOG_CONNECT(simix_vm); @@ -1158,6 +1165,10 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string) if (!strncmp(neweq, "file:", 5)) { set->appender = xbt_log_appender_file_new(neweq + 5); + }else if (!strncmp(neweq, "rollfile:", 9)) { + set->appender = xbt_log_appender2_file_new(neweq + 9,1); + }else if (!strncmp(neweq, "splitfile:", 10)) { + set->appender = xbt_log_appender2_file_new(neweq + 10,0); } else { THROWF(arg_error, 0, "Unknown appender log type: '%s'", neweq); } diff --git a/src/xbt/mmalloc/mfree.c b/src/xbt/mmalloc/mfree.c index 5586cf5400..373c1149f5 100644 --- a/src/xbt/mmalloc/mfree.c +++ b/src/xbt/mmalloc/mfree.c @@ -215,4 +215,3 @@ void mfree(struct mdesc *mdp, void *ptr) break; } } - diff --git a/src/xbt/mmalloc/mm_legacy.c b/src/xbt/mmalloc/mm_legacy.c index 68cd43f40c..3d58ba5929 100644 --- a/src/xbt/mmalloc/mm_legacy.c +++ b/src/xbt/mmalloc/mm_legacy.c @@ -34,7 +34,7 @@ void mmalloc_set_current_heap(xbt_mheap_t new_heap) #ifdef MMALLOC_WANT_OVERRIDE_LEGACY -#ifdef HAVE_GNU_LD +#if 0 && defined(HAVE_GNU_LD) #undef _GNU_SOURCE #define _GNU_SOURCE 1 @@ -49,7 +49,7 @@ static void mm_gnuld_legacy_init(void) { /* This function is called from mmalloc real_realloc = (void * (*) (void*,size_t)) dlsym(RTLD_NEXT, "realloc"); real_free = (void * (*) (void*)) dlsym(RTLD_NEXT, "free"); __mmalloc_current_heap = __mmalloc_default_mdp; -} +} /* Hello pimple! * DL needs some memory while resolving the malloc symbol, that is somehow problematic @@ -57,7 +57,7 @@ static void mm_gnuld_legacy_init(void) { /* This function is called from mmalloc */ static int allocated_junk = 0; /* keep track of many blocks of our little area was already given to someone */ #define JUNK_SIZE 8 -#define MAX_JUNK_AREAS (32 * 1024 / JUNK_SIZE) +#define MAX_JUNK_AREAS (64 * 1024 / JUNK_SIZE) static char junkareas[MAX_JUNK_AREAS][JUNK_SIZE]; /* This version use mmalloc if there is a current heap, or the legacy implem if not */ @@ -141,7 +141,9 @@ void free(void *p) { if (p==NULL) return; - if (p<=(void*)junkareas || p>(void*)(junkareas[MAX_JUNK_AREAS]) ) { + if (p<(void*)junkareas || p>=(void*)(junkareas[MAX_JUNK_AREAS]) ) { + // main use case + xbt_mheap_t mdp = __mmalloc_current_heap; if (mdp) { @@ -151,10 +153,16 @@ void free(void *p) } else { real_free(p); } - } else if(allocated_junk && p==junkareas[allocated_junk-1]) { - allocated_junk--; } else { - // Leaked memory. + // We are in the junkarea. + // This area is used to allocate memory at initilization time. + + if(allocated_junk && p==junkareas[allocated_junk-1]) { + // Last junkarea. We can reuse it. + allocated_junk--; + } else { + // We currently cannot reuse freed junkareas in the general case. + } } } @@ -168,6 +176,7 @@ void *malloc(size_t n) void *ret = mmalloc(mdp, n); UNLOCK(mdp); + return ret; } @@ -178,8 +187,11 @@ void *calloc(size_t nmemb, size_t size) LOCK(mdp); void *ret = mmalloc(mdp, nmemb*size); UNLOCK(mdp); - memset(ret, 0, nmemb * size); + // This was already done in the callee: + if(!(mdp->options & XBT_MHEAP_OPTION_MEMSET)) { + memset(ret, 0, nmemb * size); + } return ret; } @@ -208,5 +220,3 @@ void free(void *p) } #endif /* NO GNU_LD */ #endif /* WANT_MALLOC_OVERRIDE */ - - diff --git a/src/xbt/mmalloc/mm_module.c b/src/xbt/mmalloc/mm_module.c index a2c36cddb6..86c342163b 100644 --- a/src/xbt/mmalloc/mm_module.c +++ b/src/xbt/mmalloc/mm_module.c @@ -137,7 +137,7 @@ xbt_mheap_t xbt_mheap_new_options(int fd, void *baseaddr, int options) mdptr = (struct mdesc *) newmd.base; mdptr->fd = fd; if(!mdptr->refcount){ - sem_init(&mdptr->sem, 0, 1); + pthread_mutex_init(&mdptr->mutex, NULL); mdptr->refcount++; } } @@ -182,8 +182,7 @@ xbt_mheap_t xbt_mheap_new_options(int fd, void *baseaddr, int options) if (mdp->fd < 0){ mdp->flags |= MMALLOC_ANONYMOUS; } - sem_init(&mdp->sem, 0, 1); - + pthread_mutex_init(&mdp->mutex, NULL); /* If we have not been passed a valid open file descriptor for the file to map to, then open /dev/zero and use that to map to. */ @@ -225,8 +224,7 @@ void xbt_mheap_destroy_no_free(xbt_mheap_t md) struct mdesc *mdp = md; if(--mdp->refcount == 0){ - LOCK(mdp) ; - sem_destroy(&mdp->sem); + pthread_mutex_destroy(&mdp->mutex); } } @@ -330,6 +328,8 @@ void *mmalloc_preinit(void) { int res; if (__mmalloc_default_mdp == NULL) { + if(!xbt_pagesize) + xbt_pagesize = getpagesize(); unsigned long mask = ~((unsigned long)xbt_pagesize - 1); void *addr = (void*)(((unsigned long)sbrk(0) + HEAP_OFFSET) & mask); __mmalloc_default_mdp = xbt_mheap_new_options(-1, addr, XBT_MHEAP_OPTION_MEMSET); @@ -343,7 +343,7 @@ void *mmalloc_preinit(void) } xbt_assert(__mmalloc_default_mdp != NULL); -#if defined(HAVE_GNU_LD) && defined(MMALLOC_WANT_OVERRIDE_LEGACY) +#if 0 && defined(HAVE_GNU_LD) && defined(MMALLOC_WANT_OVERRIDE_LEGACY) mm_gnuld_legacy_init(); #endif diff --git a/src/xbt/mmalloc/mmprivate.h b/src/xbt/mmalloc/mmprivate.h index 09cb4be8b2..c652e41965 100644 --- a/src/xbt/mmalloc/mmprivate.h +++ b/src/xbt/mmalloc/mmprivate.h @@ -20,7 +20,8 @@ #include "xbt/ex.h" #include "xbt/dynar.h" #include "xbt/swag.h" -#include + +#include #include #ifdef HAVE_LIMITS_H @@ -190,8 +191,8 @@ typedef struct { * */ struct mdesc { - /** @brief Semaphore locking the access to the heap */ - sem_t sem; + /** @brief Mutex locking the access to the heap */ + pthread_mutex_t mutex; /** @brief Number of processes that attached the heap */ unsigned int refcount; @@ -293,14 +294,14 @@ XBT_PUBLIC( void *)__mmalloc_remap_core(xbt_mheap_t mdp); XBT_PUBLIC( void *)mmorecore(struct mdesc *mdp, ssize_t size); -/* Thread-safety (if the sem is already created) +/** Thread-safety (if the mutex is already created) * * This is mandatory in the case where the user runs a parallel simulation * in a model-checking enabled tree. Without this protection, our malloc * implementation will not like multi-threading AT ALL. */ -#define LOCK(mdp) sem_wait(&mdp->sem) -#define UNLOCK(mdp) sem_post(&mdp->sem) +#define LOCK(mdp) pthread_mutex_lock(&mdp->mutex) +#define UNLOCK(mdp) pthread_mutex_unlock(&mdp->mutex) static XBT_INLINE void mmalloc_paranoia(struct mdesc *mdp){ diff --git a/src/xbt/probes.h b/src/xbt/probes.h new file mode 100644 index 0000000000..187e4cd946 --- /dev/null +++ b/src/xbt/probes.h @@ -0,0 +1,52 @@ +/* Copyright (c) 2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifdef USE_UST +# include +# include "simgrid_ust.h" +# define XBT_TRACE0 tracepoint +# define XBT_TRACE1 tracepoint +# define XBT_TRACE2 tracepoint +# define XBT_TRACE3 tracepoint +# define XBT_TRACE4 tracepoint +# define XBT_TRACE5 tracepoint +# define XBT_TRACE6 tracepoint +# define XBT_TRACE7 tracepoint +# define XBT_TRACE8 tracepoint +# define XBT_TRACE9 tracepoint +# define XBT_TRACE10 tracepoint +# define XBT_TRACE11 tracepoint +# define XBT_TRACE12 tracepoint +#elif USE_SDT +# include +# define XBT_TRACE0 DTRACE_PROBE0 +# define XBT_TRACE1 DTRACE_PROBE1 +# define XBT_TRACE2 DTRACE_PROBE2 +# define XBT_TRACE3 DTRACE_PROBE3 +# define XBT_TRACE4 DTRACE_PROBE4 +# define XBT_TRACE5 DTRACE_PROBE5 +# define XBT_TRACE6 DTRACE_PROBE6 +# define XBT_TRACE7 DTRACE_PROBE7 +# define XBT_TRACE8 DTRACE_PROBE8 +# define XBT_TRACE9 DTRACE_PROBE9 +# define XBT_TRACE10 DTRACE_PROBE10 +# define XBT_TRACE11 DTRACE_PROBE11 +# define XBT_TRACE12 DTRACE_PROBE12 +#else +# define XBT_TRACE0(...) +# define XBT_TRACE1(...) +# define XBT_TRACE2(...) +# define XBT_TRACE3(...) +# define XBT_TRACE4(...) +# define XBT_TRACE5(...) +# define XBT_TRACE6(...) +# define XBT_TRACE7(...) +# define XBT_TRACE8(...) +# define XBT_TRACE9(...) +# define XBT_TRACE10(...) +# define XBT_TRACE11(...) +# define XBT_TRACE12(...) +#endif diff --git a/src/xbt/xbt_log_appender_file.c b/src/xbt/xbt_log_appender_file.c index 124c51f956..d06d9b9d00 100644 --- a/src/xbt/xbt_log_appender_file.c +++ b/src/xbt/xbt_log_appender_file.c @@ -49,3 +49,102 @@ xbt_log_appender_t xbt_log_appender_file_new(char *arg) { res->data = (void *) stderr; return res; } + +struct xbt_log_append2_file_s { + FILE* file; + char* filename; + int count; //negative for roll + long int limit; +}; +typedef struct xbt_log_append2_file_s* xbt_log_append2_file_t; + +#define APPEND2_END_TOKEN "\n[End of log]\n" +#define APPEND2_END_TOKEN_CLEAR "\n " + +static void open_append2_file(xbt_log_append2_file_t data){ + if(data->count<0) + { + //Roll + if(!data->file) + data->file= fopen(data->filename, "w"); + else{ + fputs(APPEND2_END_TOKEN_CLEAR,data->file); + fseek(data->file,0,SEEK_SET); + } + } + else{ + //printf("Splitting\n"); + //Split + if(data->file) + fclose(data->file); + char newname[512]; + char* pre=xbt_strdup(data->filename); + char* sep=strchr(pre,'%'); + if(!sep) + sep=pre+strlen(pre); + char* post=sep+1; + *sep='\0'; + snprintf(newname,511,"%s%i%s",pre,data->count,post); + data->count++; + data->file= fopen(newname, "w"); + xbt_assert(data->file); + + } +} + + + + +static void append2_file(xbt_log_appender_t this_, char *str) { + xbt_log_append2_file_t d=(xbt_log_append2_file_t) this_->data; + xbt_assert(d->file); + if(ftell(d->file)>=d->limit) + { + open_append2_file(d); + } + fputs(str, d->file); + if(d->count<0){ + fputs(APPEND2_END_TOKEN,d->file); + fseek(d->file,-strlen(APPEND2_END_TOKEN),SEEK_CUR); + } +} + +static void smpi_append2_file(xbt_log_appender_t this_, char *str) { + append2_file(this_,str); +} + +static void free_append2_(xbt_log_appender_t this_) { + FILE* f=((xbt_log_append2_file_t)(this_->data))->file; + if (f) + fclose(f); +} + + +//syntax is : +//If roll is 0, use split files, otherwise, use roll file +//For split, replace % in the file by the current count +xbt_log_appender_t xbt_log_appender2_file_new(char *arg,int roll) { + + xbt_log_appender_t res = xbt_new0(s_xbt_log_appender_t, 1); + if (_XBT_LOGV(smpi).initialized) // HACK to detect if we run in SMPI mode. Relies on MAIN__ source disposition + res->do_append = smpi_append2_file; + else + res->do_append = append2_file; + res->free_ = free_append2_; + xbt_log_append2_file_t data = xbt_new0(struct xbt_log_append2_file_s, 1); + xbt_assert(arg); + char* buf=xbt_strdup(arg); + char* sep=strchr(buf,':'); + xbt_assert(sep>0); + data->filename=xbt_strdup(sep+1); + *sep='\0'; + data->limit=atol(buf); + if(roll) + data->count=-1; + else + data->count=0; + open_append2_file(data); + res->data = data; + return res; +} + diff --git a/src/xbt/xbt_os_time.c b/src/xbt/xbt_os_time.c index 869a0f50ee..b9912ace94 100644 --- a/src/xbt/xbt_os_time.c +++ b/src/xbt/xbt_os_time.c @@ -18,7 +18,7 @@ #endif //Freebsd doesn't provide this clock_gettime flag yet, because it was added too recently (after 1993) -#ifdef __FreeBSD__ +#if defined (CLOCK_PROF) && ! defined (CLOCK_PROCESS_CPUTIME_ID) #define CLOCK_PROCESS_CPUTIME_ID CLOCK_PROF #endif diff --git a/src/xbt/xbt_replay.c b/src/xbt/xbt_replay.c index 7cc39e4286..47ae0ee894 100644 --- a/src/xbt/xbt_replay.c +++ b/src/xbt/xbt_replay.c @@ -20,7 +20,8 @@ typedef struct s_replay_reader { char *line; size_t line_len; char *position; /* stable storage */ - char *filename; int linenum; + char *filename; + int linenum; } s_xbt_replay_reader_t; FILE *action_fp; @@ -154,6 +155,7 @@ void _xbt_replay_action_exit(void) int xbt_replay_action_runner(int argc, char *argv[]) { int i; + xbt_ex_t e; if (action_fp) { // A unique trace file char **evt; while ((evt = action_get_action(argv[0]))) { @@ -161,7 +163,14 @@ int xbt_replay_action_runner(int argc, char *argv[]) action_fun function = (action_fun)xbt_dict_get(action_funs, lowername); xbt_free(lowername); - function((const char **)evt); + TRY{ + function((const char **)evt); + } + CATCH(e) { + free(evt); + xbt_die("Replay error :\n %s" + , e.msg); + } for (i=0;evt[i]!= NULL;i++) free(evt[i]); free(evt); @@ -179,7 +188,14 @@ int xbt_replay_action_runner(int argc, char *argv[]) char* lowername = str_tolower (evt[1]); action_fun function = (action_fun)xbt_dict_get(action_funs, lowername); xbt_free(lowername); - function(evt); + TRY{ + function(evt); + } + CATCH(e) { + free(evt); + xbt_die("Replay error on line %d of file %s :\n %s" + , reader->linenum,reader->filename, e.msg); + } } else { XBT_WARN("%s: Ignore trace element not for me", xbt_replay_reader_position(reader)); diff --git a/teshsuite/bug-17132/CMakeLists.txt b/teshsuite/bug-17132/CMakeLists.txt index 8cc6e77b54..aeaae90d8d 100644 --- a/teshsuite/bug-17132/CMakeLists.txt +++ b/teshsuite/bug-17132/CMakeLists.txt @@ -10,7 +10,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(bug-17132 ${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132/bug-17132.c) target_link_libraries(bug-17132 simgrid) diff --git a/teshsuite/java/sleep_host_off/SleepHostOff.java b/teshsuite/java/sleep_host_off/SleepHostOff.java index a18c9b27d5..1d60cad739 100644 --- a/teshsuite/java/sleep_host_off/SleepHostOff.java +++ b/teshsuite/java/sleep_host_off/SleepHostOff.java @@ -38,8 +38,8 @@ public class SleepHostOff extends Process{ try { Process.sleep(10); } catch (HostFailureException e) { - Msg.info("catch HostException"); - e.printStackTrace(); + Msg.info("catch HostException: "+e.getLocalizedMessage()); + break; //Break is needed to finalize the endless loop } } } diff --git a/teshsuite/java/sleep_host_off/sleep_host_off.tesh b/teshsuite/java/sleep_host_off/sleep_host_off.tesh index a1d464e552..949ad0a3f4 100644 --- a/teshsuite/java/sleep_host_off/sleep_host_off.tesh +++ b/teshsuite/java/sleep_host_off/sleep_host_off.tesh @@ -1,2 +1,13 @@ $ java -classpath ${classpath:=.} sleep_host_off.Main ${srcdir:=.}/../../examples/platforms/small_platform.xml ${srcdir:=.}/sleep_host_off/sleep_host_off_d.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" +> [ 0.000000] (0:@) Using regular java threads. Coroutines could speed your simulation up. +> [ 0.000000] (1:sleep_host_off.SleepHostOff@Tremblay) **** **** **** ***** ***** Test Sleep ***** ***** **** **** **** +> [ 0.000000] (1:sleep_host_off.SleepHostOff@Tremblay) Test sleep: Create a process on Jupiter, the process simply make periodic sleep, turn off Jupiter +> [ 0.000000] (2:sleep@Jupiter) I'm not dead +> [ 0.010000] (2:sleep@Jupiter) I'm not dead +> [ 0.020000] (1:sleep_host_off.SleepHostOff@Tremblay) Stop Jupiter +> [ 0.020000] (2:sleep@Jupiter) I'm not dead +> [ 0.020000] (2:sleep@Jupiter) catch HostException: Host Failure (null) +> [ 0.020000] (1:sleep_host_off.SleepHostOff@Tremblay) Jupiter has been stopped +> [ 0.320000] (1:sleep_host_off.SleepHostOff@Tremblay) Test sleep seems ok, cool !(number of Process : 1, it should be 1 (i.e. the Test one)) > +> [ 0.320000] (0:@) MSG_main finished; Cleaning up the simulation... diff --git a/teshsuite/mc/dwarf/dwarf.c b/teshsuite/mc/dwarf/dwarf.c index ab52f5b882..8b22d4be31 100644 --- a/teshsuite/mc/dwarf/dwarf.c +++ b/teshsuite/mc/dwarf/dwarf.c @@ -15,6 +15,7 @@ #include #include "../../src/include/mc/datatypes.h" +#include "../../src/mc/mc_object_info.h" #include "../../src/mc/mc_private.h" int test_some_array[4][5][6]; @@ -82,7 +83,15 @@ static void test_local_variable(mc_object_info_t info, const char* function, con assert(var); void* frame_base = mc_find_frame_base(subprogram, info, cursor); - xbt_assert((void*)mc_dwarf_resolve_locations(&var->locations, info, cursor, frame_base, NULL, -1) == address, + s_mc_location_t location; + + mc_dwarf_resolve_locations(&location, + &var->locations, info, cursor, frame_base, NULL, -1); + + xbt_assert(mc_get_location_type(&location)==MC_LOCATION_TYPE_ADDRESS, + "Unexpected location type for variable %s of %s", variable, function); + + xbt_assert(location.memory_location == address, "Bad resolution of local variable %s of %s", variable, function); } diff --git a/teshsuite/mc/dwarf_expression/dwarf_expression.c b/teshsuite/mc/dwarf_expression/dwarf_expression.c index 905f88aee8..998b779aa1 100644 --- a/teshsuite/mc/dwarf_expression/dwarf_expression.c +++ b/teshsuite/mc/dwarf_expression/dwarf_expression.c @@ -13,6 +13,7 @@ #include #include "../src/mc/mc_private.h" +#include "../src/mc/mc_object_info.h" static uintptr_t eval_binary_operation(mc_expression_state_t state, int op, uintptr_t a, uintptr_t b) { diff --git a/teshsuite/mc/replay/CMakeLists.txt b/teshsuite/mc/replay/CMakeLists.txt new file mode 100644 index 0000000000..806d65146f --- /dev/null +++ b/teshsuite/mc/replay/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.6) + +set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") +add_executable(random_bug random_bug.c) +target_link_libraries(random_bug simgrid) + +set(tesh_files + ${tesh_files} + ${CMAKE_CURRENT_SOURCE_DIR}/random_bug.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/random_bug_replay.tesh + PARENT_SCOPE + ) +set(testsuite_src + ${testsuite_src} + ${CMAKE_CURRENT_SOURCE_DIR}/random_bug.c + PARENT_SCOPE + ) +set(xml_files + ${xml_files} + ${CMAKE_CURRENT_SOURCE_DIR}/random_bug.xml + PARENT_SCOPE + ) diff --git a/teshsuite/mc/replay/random_bug.c b/teshsuite/mc/replay/random_bug.c new file mode 100644 index 0000000000..80bcf410eb --- /dev/null +++ b/teshsuite/mc/replay/random_bug.c @@ -0,0 +1,37 @@ +/* Copyright (c) 2014. The SimGrid Team. + * All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#include + +#include +#include + +/** An (fake) application with a bug occuring for some random values + */ +static int app(int argc, char *argv[]) +{ + int x = MC_random(0, 5); + int y = MC_random(0, 5); + + if (MC_is_active()) { + MC_assert(x !=3 || y !=4); + } + if (x ==3 && y ==4) { + fprintf(stderr, "Error reached\n"); + } + + return 0; +} + +/** Main function */ +int main(int argc, char *argv[]) +{ + MSG_init(&argc, argv); + MSG_function_register("app", &app); + MSG_create_environment(argv[1]); + MSG_launch_application(argv[2]); + return (int) MSG_main(); +} diff --git a/teshsuite/mc/replay/random_bug.tesh b/teshsuite/mc/replay/random_bug.tesh new file mode 100644 index 0000000000..63b5b8f13d --- /dev/null +++ b/teshsuite/mc/replay/random_bug.tesh @@ -0,0 +1,18 @@ +#!/usr/bin/env tesh +!expect signal SIGABRT +$ ${bindir:=.}/random_bug ${srcdir:=.}/../../../examples/platforms/small_platform.xml ${srcdir:=.}/random_bug.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" --cfg=model-check:1 --cfg=model-check/record:1 +> [ 0.000000] (0:@) Configuration change: Set 'model-check' to '1' +> [ 0.000000] (0:@) Configuration change: Set 'model-check/record' to '1' +> [ 0.000000] (0:@) Check a safety property +> [ 0.000000] (0:@) Get debug information ... +> [ 0.000000] (0:@) Get debug information done ! +> [ 0.000000] (1:app@Tremblay) ************************** +> [ 0.000000] (1:app@Tremblay) *** PROPERTY NOT VALID *** +> [ 0.000000] (1:app@Tremblay) ************************** +> [ 0.000000] (1:app@Tremblay) Counter-example execution trace: +> [ 0.000000] (1:app@Tremblay) Path = 1/3;1/4 +> [ 0.000000] (1:app@Tremblay) [(1)Tremblay (app)] MC_RANDOM(3) +> [ 0.000000] (1:app@Tremblay) [(1)Tremblay (app)] MC_RANDOM(4) +> [ 0.000000] (1:app@Tremblay) Expanded states = 27 +> [ 0.000000] (1:app@Tremblay) Visited states = 68 +> [ 0.000000] (1:app@Tremblay) Executed transitions = 46 diff --git a/teshsuite/mc/replay/random_bug.xml b/teshsuite/mc/replay/random_bug.xml new file mode 100644 index 0000000000..46b16ec035 --- /dev/null +++ b/teshsuite/mc/replay/random_bug.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/teshsuite/mc/replay/random_bug_replay.tesh b/teshsuite/mc/replay/random_bug_replay.tesh new file mode 100644 index 0000000000..4f60925ac8 --- /dev/null +++ b/teshsuite/mc/replay/random_bug_replay.tesh @@ -0,0 +1,5 @@ +#!/usr/bin/env tesh +$ ${bindir:=.}/random_bug ${srcdir:=.}/../../../examples/platforms/small_platform.xml ${srcdir:=.}/random_bug.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" "--cfg=model-check/replay:1/3;1/4" +> [ 0.000000] (0:@) Configuration change: Set 'model-check/replay' to '1/3;1/4' +> [ 0.000000] (0:@) path=1/3;1/4 +> Error reached diff --git a/teshsuite/msg/host_on_off_processes/host_on_off_processes.c b/teshsuite/msg/host_on_off_processes/host_on_off_processes.c index cb48a8a970..8c136170a0 100644 --- a/teshsuite/msg/host_on_off_processes/host_on_off_processes.c +++ b/teshsuite/msg/host_on_off_processes/host_on_off_processes.c @@ -32,7 +32,7 @@ int test_launcher(int argc, char *argv[]) test = 1; // Create a process running a simple task on a host and turn the host off during the execution of the process. - if (xbt_dynar_member(tests, &test)){ + if (xbt_dynar_search_or_negative(tests, &test)!=-1){ XBT_INFO("Test 1:"); XBT_INFO(" Create a process on Jupiter"); argvF = xbt_new(char*, 2); @@ -47,7 +47,7 @@ int test_launcher(int argc, char *argv[]) test = 2; // Create a process that on a host that is turned off (this should not be possible) - if (xbt_dynar_member(tests, &test)){ + if (xbt_dynar_search_or_negative(tests, &test)!=-1){ XBT_INFO("Test 2:"); XBT_INFO(" Turn off Jupiter"); // adsein: Jupiter is already, hence nothing should happen @@ -69,7 +69,7 @@ int test_launcher(int argc, char *argv[]) test = 3; // Create a process running sucessive sleeps on a host and turn the host off during the execution of the process. - if (xbt_dynar_member(tests, &test)){ + if (xbt_dynar_search_or_negative(tests, &test)!=-1){ XBT_INFO("Test 3:"); MSG_host_on(jupiter); argvF = xbt_new(char*, 2); @@ -84,7 +84,7 @@ int test_launcher(int argc, char *argv[]) } test = 4; - if (xbt_dynar_member(tests, &test)){ + if (xbt_dynar_search_or_negative(tests, &test)!=-1){ XBT_INFO("Test 4 (turn off src during a communication) : Create a Process/task to make a communication between Jupiter and Tremblay and turn off Jupiter during the communication"); MSG_host_on(jupiter); MSG_process_sleep(10); @@ -102,7 +102,7 @@ int test_launcher(int argc, char *argv[]) } test = 5; - if (xbt_dynar_member(tests, &test)){ + if (xbt_dynar_search_or_negative(tests, &test)!=-1){ XBT_INFO("Test 5 (turn off dest during a communication : Create a Process/task to make a communication between Tremblay and Jupiter and turn off Jupiter during the communication"); MSG_host_on(jupiter); MSG_process_sleep(10); @@ -120,7 +120,7 @@ int test_launcher(int argc, char *argv[]) } test =6; - if (xbt_dynar_member(tests, &test)){ + if (xbt_dynar_search_or_negative(tests, &test)!=-1){ XBT_INFO("Test 6: Turn on Jupiter, assign a VM on Jupiter, launch a process inside the VM, and turn off the node"); // Create VM0 @@ -155,17 +155,17 @@ int test_launcher(int argc, char *argv[]) } test = 7; - if (xbt_dynar_member(tests, &test)){ + if (xbt_dynar_search_or_negative(tests, &test)!=-1){ } test = 8; - if (xbt_dynar_member(tests, &test)){ + if (xbt_dynar_search_or_negative(tests, &test)!=-1){ } test = 9; - if (xbt_dynar_member(tests, &test)){ + if (xbt_dynar_search_or_negative(tests, &test)!=-1){ } XBT_INFO(" Test done. See you!"); diff --git a/teshsuite/smpi/allgather/CMakeLists.txt b/teshsuite/smpi/allgather/CMakeLists.txt index ecdaa81fc3..6ed0ecbd05 100644 --- a/teshsuite/smpi/allgather/CMakeLists.txt +++ b/teshsuite/smpi/allgather/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(allgather_coll allgather_coll.c) target_link_libraries(allgather_coll simgrid) endif() diff --git a/teshsuite/smpi/allgatherv/CMakeLists.txt b/teshsuite/smpi/allgatherv/CMakeLists.txt index 8e1693c5fa..75445206fa 100644 --- a/teshsuite/smpi/allgatherv/CMakeLists.txt +++ b/teshsuite/smpi/allgatherv/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(allgatherv_coll allgatherv_coll.c) target_link_libraries(allgatherv_coll simgrid) endif() diff --git a/teshsuite/smpi/allreduce/CMakeLists.txt b/teshsuite/smpi/allreduce/CMakeLists.txt index a4ad62cb9a..69511aab2d 100644 --- a/teshsuite/smpi/allreduce/CMakeLists.txt +++ b/teshsuite/smpi/allreduce/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(allreduce allreduce.c) add_executable(allreduce_coll allreduce_coll.c) target_link_libraries(allreduce simgrid) diff --git a/teshsuite/smpi/alltoall/CMakeLists.txt b/teshsuite/smpi/alltoall/CMakeLists.txt index 371e7d6964..c4ad5461ac 100644 --- a/teshsuite/smpi/alltoall/CMakeLists.txt +++ b/teshsuite/smpi/alltoall/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(alltoall2 alltoall2.c) add_executable(alltoall_basic alltoall_basic.c) add_executable(alltoall_coll alltoall_coll.c) diff --git a/teshsuite/smpi/alltoallv/CMakeLists.txt b/teshsuite/smpi/alltoallv/CMakeLists.txt index 00ba90cb9a..5c96bad442 100644 --- a/teshsuite/smpi/alltoallv/CMakeLists.txt +++ b/teshsuite/smpi/alltoallv/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(alltoallv_coll alltoallv_coll.c) target_link_libraries(alltoallv_coll simgrid) endif() diff --git a/teshsuite/smpi/barrier/CMakeLists.txt b/teshsuite/smpi/barrier/CMakeLists.txt index 2d7d550cca..72fd58fff3 100644 --- a/teshsuite/smpi/barrier/CMakeLists.txt +++ b/teshsuite/smpi/barrier/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(barrier_coll barrier.c ) target_link_libraries(barrier_coll simgrid) endif() diff --git a/teshsuite/smpi/bcast/CMakeLists.txt b/teshsuite/smpi/bcast/CMakeLists.txt index 0ad7183b57..27643587d9 100644 --- a/teshsuite/smpi/bcast/CMakeLists.txt +++ b/teshsuite/smpi/bcast/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(bcast bcast.c) add_executable(bcast_coll bcast_coll.c) target_link_libraries(bcast simgrid) diff --git a/teshsuite/smpi/compute/CMakeLists.txt b/teshsuite/smpi/compute/CMakeLists.txt index 1f259147b5..45bd3fa9dd 100644 --- a/teshsuite/smpi/compute/CMakeLists.txt +++ b/teshsuite/smpi/compute/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(compute compute.c) add_executable(compute2 compute2.c) add_executable(compute3 compute3.c) diff --git a/teshsuite/smpi/gather/CMakeLists.txt b/teshsuite/smpi/gather/CMakeLists.txt index 386a6641fe..3bfd8dab01 100644 --- a/teshsuite/smpi/gather/CMakeLists.txt +++ b/teshsuite/smpi/gather/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(gather_coll gather_coll.c) target_link_libraries(gather_coll simgrid) endif() diff --git a/teshsuite/smpi/hvector/CMakeLists.txt b/teshsuite/smpi/hvector/CMakeLists.txt index fe240c2d74..99fddbfede 100644 --- a/teshsuite/smpi/hvector/CMakeLists.txt +++ b/teshsuite/smpi/hvector/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(hvector_test hvector_test.c) target_link_libraries(hvector_test simgrid) endif() diff --git a/teshsuite/smpi/indexed/CMakeLists.txt b/teshsuite/smpi/indexed/CMakeLists.txt index e6c9af4e82..927e849d90 100644 --- a/teshsuite/smpi/indexed/CMakeLists.txt +++ b/teshsuite/smpi/indexed/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(indexed_test indexed_test.c) target_link_libraries(indexed_test simgrid) endif() diff --git a/teshsuite/smpi/isp/umpire/CMakeLists.txt b/teshsuite/smpi/isp/umpire/CMakeLists.txt index 254020f2af..ac4e2da883 100644 --- a/teshsuite/smpi/isp/umpire/CMakeLists.txt +++ b/teshsuite/smpi/isp/umpire/CMakeLists.txt @@ -201,7 +201,7 @@ if(enable_smpi AND enable_smpi_ISP_testsuite) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") FOREACH (s ${umpire_src}) STRING(REGEX REPLACE "\\.c$" "" exe ${s}) diff --git a/teshsuite/smpi/mpich3-test/attr/CMakeLists.txt b/teshsuite/smpi/mpich3-test/attr/CMakeLists.txt index 3d71bdf407..ff018b3e25 100644 --- a/teshsuite/smpi/mpich3-test/attr/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/attr/CMakeLists.txt @@ -10,7 +10,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") add_executable(attr2type attr2type.c) diff --git a/teshsuite/smpi/mpich3-test/coll/CMakeLists.txt b/teshsuite/smpi/mpich3-test/coll/CMakeLists.txt index 0945a17d70..8f1fde7919 100644 --- a/teshsuite/smpi/mpich3-test/coll/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/coll/CMakeLists.txt @@ -9,14 +9,18 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") add_executable(allgather2 allgather2.c) add_executable(allgather3 allgather3.c) add_executable(allgatherv2 allgatherv2.c) add_executable(allgatherv3 allgatherv3.c) - add_executable(allgatherv4 allgatherv4.c) + if(HAVE_MMAP) + add_executable(allgatherv4 allgatherv4.c) + else() + add_executable(allgatherv4 allgatherv4_manual.c) + endif() add_executable(allred2 allred2.c) add_executable(allred3 allred3.c) add_executable(allred4 allred4.c) @@ -212,6 +216,7 @@ set(examples_src ${CMAKE_CURRENT_SOURCE_DIR}/allgatherv2.c ${CMAKE_CURRENT_SOURCE_DIR}/allgatherv3.c ${CMAKE_CURRENT_SOURCE_DIR}/allgatherv4.c + ${CMAKE_CURRENT_SOURCE_DIR}/allgatherv4_manual.c ${CMAKE_CURRENT_SOURCE_DIR}/allred2.c ${CMAKE_CURRENT_SOURCE_DIR}/allred3.c ${CMAKE_CURRENT_SOURCE_DIR}/allred4.c diff --git a/teshsuite/smpi/mpich3-test/coll/allgatherv4.c b/teshsuite/smpi/mpich3-test/coll/allgatherv4.c index 60bf0a4ebe..2af91af50e 100644 --- a/teshsuite/smpi/mpich3-test/coll/allgatherv4.c +++ b/teshsuite/smpi/mpich3-test/coll/allgatherv4.c @@ -112,8 +112,8 @@ int main(int argc, char ** argv) comm_tests(comm); MPI_Comm_free(&comm); - //free(SMPI_VARGET_GLOBAL(sbuf)); - //free(SMPI_VARGET_GLOBAL(rbuf)); + free(SMPI_VARGET_GLOBAL(sbuf)); + free(SMPI_VARGET_GLOBAL(rbuf)); free(SMPI_VARGET_GLOBAL(recvcounts)); free(SMPI_VARGET_GLOBAL(displs)); diff --git a/teshsuite/smpi/mpich3-test/coll/allgatherv4_manual.c b/teshsuite/smpi/mpich3-test/coll/allgatherv4_manual.c new file mode 100644 index 0000000000..60bf0a4ebe --- /dev/null +++ b/teshsuite/smpi/mpich3-test/coll/allgatherv4_manual.c @@ -0,0 +1,251 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * + * (C) 2003 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ + +#include "mpi.h" +#include "mpitest.h" +#include "smpi_cocci.h" +#include +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +#include +#include +#include + +/* FIXME: What is this test supposed to accomplish? */ + +#define START_BUF (1) +#define LARGE_BUF (256 * 1024) + +/* FIXME: MAX_BUF is too large */ +#define MAX_BUF (32 * 1024 * 1024) +#define LOOPS 10 + +SMPI_VARINIT_GLOBAL(sbuf, char*); +SMPI_VARINIT_GLOBAL(rbuf, char*); +SMPI_VARINIT_GLOBAL(recvcounts, int*); +SMPI_VARINIT_GLOBAL(displs, int*); +SMPI_VARINIT_GLOBAL_AND_SET(errs, int, 0); + +/* #define dprintf printf */ +#define dprintf(...) + +typedef enum { + REGULAR, + BCAST, + SPIKE, + HALF_FULL, + LINEAR_DECREASE, + BELL_CURVE +} test_t; + +void comm_tests(MPI_Comm comm); +double run_test(long long msg_size, MPI_Comm comm, test_t test_type, double * max_time); + +int main(int argc, char ** argv) +{ + int comm_size, comm_rank; + MPI_Comm comm; + + MTest_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &comm_size); + MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank); + + if (LARGE_BUF * comm_size > MAX_BUF) + goto fn_exit; + + SMPI_VARGET_GLOBAL(sbuf) = (void *) calloc(MAX_BUF, 1); + SMPI_VARGET_GLOBAL(rbuf) = (void *) calloc(MAX_BUF, 1); + + srand(time(NULL)); + + SMPI_VARGET_GLOBAL(recvcounts) = (void *) malloc(comm_size * sizeof(int)); + SMPI_VARGET_GLOBAL(displs) = (void *) malloc(comm_size * sizeof(int)); + if (!SMPI_VARGET_GLOBAL(recvcounts) || !SMPI_VARGET_GLOBAL(displs) || !SMPI_VARGET_GLOBAL(sbuf) || !SMPI_VARGET_GLOBAL(rbuf)) { + fprintf(stderr, "Unable to allocate memory:\n"); + if (!SMPI_VARGET_GLOBAL(sbuf)) fprintf(stderr,"\tsbuf of %d bytes\n", MAX_BUF ); + if (!SMPI_VARGET_GLOBAL(rbuf)) fprintf(stderr,"\trbuf of %d bytes\n", MAX_BUF ); + if (!SMPI_VARGET_GLOBAL(recvcounts)) fprintf(stderr,"\trecvcounts of %zd bytes\n", comm_size * sizeof(int) ); + if (!SMPI_VARGET_GLOBAL(displs)) fprintf(stderr,"\tdispls of %zd bytes\n", comm_size * sizeof(int) ); + fflush(stderr); + MPI_Abort(MPI_COMM_WORLD, -1); + exit(-1); + } + + if (!comm_rank) { + dprintf("Message Range: (%d, %d); System size: %d\n", START_BUF, LARGE_BUF, comm_size); + fflush(stdout); + } + + + /* COMM_WORLD tests */ + if (!comm_rank) { + dprintf("\n\n==========================================================\n"); + dprintf(" MPI_COMM_WORLD\n"); + dprintf("==========================================================\n"); + } + comm_tests(MPI_COMM_WORLD); + + /* non-COMM_WORLD tests */ + if (!comm_rank) { + dprintf("\n\n==========================================================\n"); + dprintf(" non-COMM_WORLD\n"); + dprintf("==========================================================\n"); + } + MPI_Comm_split(MPI_COMM_WORLD, (comm_rank == comm_size - 1) ? 0 : 1, 0, &comm); + if (comm_rank < comm_size - 1) + comm_tests(comm); + MPI_Comm_free(&comm); + + /* Randomized communicator tests */ + if (!comm_rank) { + dprintf("\n\n==========================================================\n"); + dprintf(" Randomized Communicator\n"); + dprintf("==========================================================\n"); + } + MPI_Comm_split(MPI_COMM_WORLD, 0, rand(), &comm); + comm_tests(comm); + MPI_Comm_free(&comm); + + //free(SMPI_VARGET_GLOBAL(sbuf)); + //free(SMPI_VARGET_GLOBAL(rbuf)); + free(SMPI_VARGET_GLOBAL(recvcounts)); + free(SMPI_VARGET_GLOBAL(displs)); + +fn_exit: + MTest_Finalize(SMPI_VARGET_GLOBAL(errs)); + MPI_Finalize(); + + return 0; +} + +void comm_tests(MPI_Comm comm) +{ + int comm_size, comm_rank; + double rtime = rtime; /* stop warning about unused variable */ + double max_time; + long long msg_size; + + MPI_Comm_size(comm, &comm_size); + MPI_Comm_rank(comm, &comm_rank); + + for (msg_size = START_BUF; msg_size <= LARGE_BUF; msg_size *= 2) { + if (!comm_rank) { + dprintf("\n====> MSG_SIZE: %d\n", (int) msg_size); + fflush(stdout); + } + + rtime = run_test(msg_size, comm, REGULAR, &max_time); + if (!comm_rank) { + dprintf("REGULAR:\tAVG: %.3f\tMAX: %.3f\n", rtime, max_time); + fflush(stdout); + } + + rtime = run_test(msg_size, comm, BCAST, &max_time); + if (!comm_rank) { + dprintf("BCAST:\tAVG: %.3f\tMAX: %.3f\n", rtime, max_time); + fflush(stdout); + } + + rtime = run_test(msg_size, comm, SPIKE, &max_time); + if (!comm_rank) { + dprintf("SPIKE:\tAVG: %.3f\tMAX: %.3f\n", rtime, max_time); + fflush(stdout); + } + + rtime = run_test(msg_size, comm, HALF_FULL, &max_time); + if (!comm_rank) { + dprintf("HALF_FULL:\tAVG: %.3f\tMAX: %.3f\n", rtime, max_time); + fflush(stdout); + } + + rtime = run_test(msg_size, comm, LINEAR_DECREASE, &max_time); + if (!comm_rank) { + dprintf("LINEAR_DECREASE:\tAVG: %.3f\tMAX: %.3f\n", rtime, max_time); + fflush(stdout); + } + + rtime = run_test(msg_size, comm, BELL_CURVE, &max_time); + if (!comm_rank) { + dprintf("BELL_CURVE:\tAVG: %.3f\tMAX: %.3f\n", rtime, max_time); + fflush(stdout); + } + } +} + +double run_test(long long msg_size, MPI_Comm comm, test_t test_type, + double * max_time) +{ + int i, j; + int comm_size, comm_rank; + double start, end; + double total_time, avg_time; + MPI_Aint tmp; + + MPI_Comm_size(comm, &comm_size); + MPI_Comm_rank(comm, &comm_rank); + + SMPI_VARGET_GLOBAL(displs)[0] = 0; + for (i = 0; i < comm_size; i++) { + if (test_type == REGULAR) + SMPI_VARGET_GLOBAL(recvcounts)[i] = msg_size; + else if (test_type == BCAST) + SMPI_VARGET_GLOBAL(recvcounts)[i] = (!i) ? msg_size : 0; + else if (test_type == SPIKE) + SMPI_VARGET_GLOBAL(recvcounts)[i] = (!i) ? (msg_size / 2) : (msg_size / (2 * (comm_size - 1))); + else if (test_type == HALF_FULL) + SMPI_VARGET_GLOBAL(recvcounts)[i] = (i < (comm_size / 2)) ? (2 * msg_size) : 0; + else if (test_type == LINEAR_DECREASE) { + tmp = 2 * msg_size * (comm_size - 1 - i) / (comm_size - 1); + if (tmp != (int)tmp) { + fprintf( stderr, "Integer overflow in variable tmp\n" ); + MPI_Abort( MPI_COMM_WORLD, 1 ); + exit(1); + } + SMPI_VARGET_GLOBAL(recvcounts)[i] = (int) tmp; + + /* If the maximum message size is too large, don't run */ + if (tmp > MAX_BUF) return 0; + } + else if (test_type == BELL_CURVE) { + for (j = 0; j < i; j++) { + if (i - 1 + j >= comm_size) continue; + tmp = msg_size * comm_size / (log(comm_size) * i); + SMPI_VARGET_GLOBAL(recvcounts)[i - 1 + j] = (int) tmp; + SMPI_VARGET_GLOBAL(displs)[i - 1 + j] = 0; + + /* If the maximum message size is too large, don't run */ + if (tmp > MAX_BUF) return 0; + } + } + + if (i < comm_size - 1) + SMPI_VARGET_GLOBAL(displs)[i+1] = SMPI_VARGET_GLOBAL(displs)[i] + SMPI_VARGET_GLOBAL(recvcounts)[i]; + } + + /* Test that: + 1: sbuf is large enough + 2: rbuf is large enough + 3: There were no failures (e.g., tmp nowhere > rbuf size + */ + MPI_Barrier(comm); + start = MPI_Wtime(); + for (i = 0; i < LOOPS; i++) { + MPI_Allgatherv(SMPI_VARGET_GLOBAL(sbuf), SMPI_VARGET_GLOBAL(recvcounts)[comm_rank], MPI_CHAR, + SMPI_VARGET_GLOBAL(rbuf), SMPI_VARGET_GLOBAL(recvcounts), SMPI_VARGET_GLOBAL(displs), MPI_CHAR, comm); + } + end = MPI_Wtime(); + MPI_Barrier(comm); + + /* Convert to microseconds (why?) */ + total_time = 1.0e6 * (end - start); + MPI_Reduce(&total_time, &avg_time, 1, MPI_DOUBLE, MPI_SUM, 0, comm); + MPI_Reduce(&total_time, max_time, 1, MPI_DOUBLE, MPI_MAX, 0, comm); + + return (avg_time / (LOOPS * comm_size)); +} diff --git a/teshsuite/smpi/mpich3-test/comm/CMakeLists.txt b/teshsuite/smpi/mpich3-test/comm/CMakeLists.txt index ab5663beaa..779209f9e5 100644 --- a/teshsuite/smpi/mpich3-test/comm/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/comm/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") add_executable(cmfree cmfree.c) diff --git a/teshsuite/smpi/mpich3-test/datatype/CMakeLists.txt b/teshsuite/smpi/mpich3-test/datatype/CMakeLists.txt index 8f4b6c4e6c..7568eecec9 100644 --- a/teshsuite/smpi/mpich3-test/datatype/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/datatype/CMakeLists.txt @@ -9,13 +9,13 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") # add_executable(blockindexed-misc blockindexed-misc.c) add_executable(blockindexed-zero-count blockindexed-zero-count.c) # add_executable(contents contents.c) -# add_executable(contigstruct contigstruct.c) + add_executable(contigstruct contigstruct.c) add_executable(contig-zero-count contig-zero-count.c) add_executable(cxx-types cxx-types.c) # add_executable(darray-cyclic darray-cyclic.c) @@ -35,7 +35,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) # add_executable(large_type large_type.c) # add_executable(large_type_sendrec large_type_sendrec.c) # add_executable(lbub lbub.c) -# add_executable(localpack localpack.c) + add_executable(localpack localpack.c) add_executable(longdouble longdouble.c) # add_executable(lots-of-types lots-of-types.c) # add_executable(pairtype-pack pairtype-pack.c) @@ -44,7 +44,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) add_executable(sendrecvt2 ${CMAKE_CURRENT_SOURCE_DIR}/../util/dtypes.c sendrecvt2.c) add_executable(sendrecvt4 ${CMAKE_CURRENT_SOURCE_DIR}/../util/dtypes.c sendrecvt4.c) add_executable(simple-commit simple-commit.c) -# add_executable(simple-pack simple-pack.c) + add_executable(simple-pack simple-pack.c) # add_executable(simple-pack-external simple-pack-external.c) add_executable(simple-resized simple-resized.c) add_executable(simple-size-extent simple-size-extent.c) @@ -55,7 +55,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) # add_executable(struct-empty-el struct-empty-el.c) add_executable(struct-ezhov struct-ezhov.c) # add_executable(struct-no-real-types struct-no-real-types.c) -# add_executable(struct-pack struct-pack.c) + add_executable(struct-pack struct-pack.c) # add_executable(structpack2 structpack2.c) add_executable(struct-verydeep struct-verydeep.c) add_executable(struct-zero-count struct-zero-count.c) @@ -63,7 +63,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) # add_executable(subarray-pack subarray-pack.c) add_executable(tfree tfree.c) # add_executable(tmatchsize tmatchsize.c) -# add_executable(transpose-pack transpose-pack.c) + add_executable(transpose-pack transpose-pack.c) add_executable(tresized2 tresized2.c) add_executable(tresized tresized.c) # add_executable(triangular-pack triangular-pack.c) @@ -71,17 +71,17 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) add_executable(typefree typefree.c) add_executable(typelb typelb.c) add_executable(typename typename.c) -# add_executable(unpack unpack.c) + add_executable(unpack unpack.c) # add_executable(unusual-noncontigs unusual-noncontigs.c) # add_executable(vecblklen vecblklen.c) # add_executable(zero-blklen-vector zero-blklen-vector.c) -# add_executable(zeroblks zeroblks.c) + add_executable(zeroblks zeroblks.c) add_executable(zeroparms zeroparms.c) # target_link_libraries(blockindexed-misc simgrid mtest_c) target_link_libraries(blockindexed-zero-count simgrid mtest_c) # target_link_libraries(contents simgrid mtest_c) -# target_link_libraries(contigstruct simgrid mtest_c) + target_link_libraries(contigstruct simgrid mtest_c) target_link_libraries(contig-zero-count simgrid mtest_c) target_link_libraries(cxx-types simgrid mtest_c) # target_link_libraries(darray-cyclic simgrid mtest_c) @@ -101,7 +101,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) # target_link_libraries(large_type simgrid mtest_c) # target_link_libraries(large_type_sendrec simgrid mtest_c) # target_link_libraries(lbub simgrid mtest_c) -# target_link_libraries(localpack simgrid mtest_c) + target_link_libraries(localpack simgrid mtest_c) target_link_libraries(longdouble simgrid mtest_c) # target_link_libraries(lots-of-types simgrid mtest_c) # target_link_libraries(pairtype-pack simgrid mtest_c) @@ -110,7 +110,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) target_link_libraries(sendrecvt2 simgrid mtest_c) target_link_libraries(sendrecvt4 simgrid mtest_c) target_link_libraries(simple-commit simgrid mtest_c) -# target_link_libraries(simple-pack simgrid mtest_c) + target_link_libraries(simple-pack simgrid mtest_c) # target_link_libraries(simple-pack-external simgrid mtest_c) target_link_libraries(simple-resized simgrid mtest_c) target_link_libraries(simple-size-extent simgrid mtest_c) @@ -121,7 +121,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) # target_link_libraries(struct-empty-el simgrid mtest_c) target_link_libraries(struct-ezhov simgrid mtest_c) # target_link_libraries(struct-no-real-types simgrid mtest_c) -# target_link_libraries(struct-pack simgrid mtest_c) + target_link_libraries(struct-pack simgrid mtest_c) # target_link_libraries(structpack2 simgrid mtest_c) target_link_libraries(struct-verydeep simgrid mtest_c) target_link_libraries(struct-zero-count simgrid mtest_c) @@ -129,7 +129,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) # target_link_libraries(subarray-pack simgrid mtest_c) target_link_libraries(tfree simgrid mtest_c) # target_link_libraries(tmatchsize simgrid mtest_c) -# target_link_libraries(transpose-pack simgrid mtest_c) + target_link_libraries(transpose-pack simgrid mtest_c) target_link_libraries(tresized2 simgrid mtest_c) target_link_libraries(tresized simgrid mtest_c) # target_link_libraries(triangular-pack simgrid mtest_c) @@ -137,11 +137,11 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) target_link_libraries(typefree simgrid mtest_c) target_link_libraries(typelb simgrid mtest_c) target_link_libraries(typename simgrid mtest_c) -# target_link_libraries(unpack simgrid mtest_c) + target_link_libraries(unpack simgrid mtest_c) # target_link_libraries(unusual-noncontigs simgrid mtest_c) # target_link_libraries(vecblklen simgrid mtest_c) # target_link_libraries(zero-blklen-vector simgrid mtest_c) -# target_link_libraries(zeroblks simgrid mtest_c) + target_link_libraries(zeroblks simgrid mtest_c) target_link_libraries(zeroparms simgrid mtest_c) endif() diff --git a/teshsuite/smpi/mpich3-test/datatype/testlist b/teshsuite/smpi/mpich3-test/datatype/testlist index 23f42be5ac..c16b840d72 100644 --- a/teshsuite/smpi/mpich3-test/datatype/testlist +++ b/teshsuite/smpi/mpich3-test/datatype/testlist @@ -3,13 +3,13 @@ gaddress 1 #complex games with negative extents... #lbub 1 -#needs MPI_Pack, MPI_Unpack -#localpack 1 +localpack 1 +#needs MPI_Type_get_envelope #simple-pack 1 #simple-pack-external 1 -#transpose-pack 1 +transpose-pack 1 #slice-pack 1 -#struct-pack 1 +struct-pack 1 #structpack2 1 typecommit 1 typename 1 @@ -25,13 +25,11 @@ sendrecvt4 2 #tmatchsize 1 tfree 2 typelb 1 -#needs MPI_Pack_size -#contigstruct 1 +contigstruct 1 struct-zero-count 1 blockindexed-zero-count 1 -#needs MPI_Pack, MPI_unpack, MPI_Pack_size +#needs better handling of lb/ub #blockindexed-misc 1 -#needs MPI_Pack, MPI_unpack, MPI_Pack_size #indexed-misc 1 #needs MPI_Type_create_subarray #subarray-pack 1 @@ -57,10 +55,9 @@ simple-resized 1 #hindexed-zeros 1 #lots-of-types 1 #get-elements-pairtype 1 -#unpack 1 +unpack 1 struct-ezhov 1 -#needs MPI_Pack, MPI_Unpack -#zeroblks 1 +zeroblks 1 struct-derived-zeros 1 struct-verydeep 1 #get-elements 1 diff --git a/teshsuite/smpi/mpich3-test/f77/attr/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f77/attr/CMakeLists.txt index 55916b7646..9e4767b6e1 100644 --- a/teshsuite/smpi/mpich3-test/f77/attr/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f77/attr/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../include/") add_executable(attrmpi1f attrmpi1f.f) diff --git a/teshsuite/smpi/mpich3-test/f77/coll/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f77/coll/CMakeLists.txt index 0ae2a3fadd..2db2d5e015 100644 --- a/teshsuite/smpi/mpich3-test/f77/coll/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f77/coll/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") # add_executable(allredint8f allredint8f.f) diff --git a/teshsuite/smpi/mpich3-test/f77/comm/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f77/comm/CMakeLists.txt index 3560877ccf..b3017ef19e 100644 --- a/teshsuite/smpi/mpich3-test/f77/comm/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f77/comm/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") # add_executable(commerrf commerrf.f) diff --git a/teshsuite/smpi/mpich3-test/f77/datatype/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f77/datatype/CMakeLists.txt index fc6366cf1a..79dc501ad2 100644 --- a/teshsuite/smpi/mpich3-test/f77/datatype/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f77/datatype/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/typeaints.h.in ${CMAKE_CURRENT_SOURCE_DIR}/typeaints.h @ONLY) diff --git a/teshsuite/smpi/mpich3-test/f77/ext/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f77/ext/CMakeLists.txt index 2d0c9204ec..161fc3165e 100644 --- a/teshsuite/smpi/mpich3-test/f77/ext/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f77/ext/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") # add_executable(allocmemf allocmemf.f) diff --git a/teshsuite/smpi/mpich3-test/f77/info/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f77/info/CMakeLists.txt new file mode 100644 index 0000000000..c0912b37bd --- /dev/null +++ b/teshsuite/smpi/mpich3-test/f77/info/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 2.6) + +if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) + if(WIN32) + set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h") + else() + set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc") + set(CMAKE_Fortran_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff") + endif() + + set(CMAKE_INCLUDE_CURRENT_DIR ON) + set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") + + + add_executable(infotest2f infotest2f.f ../util/mtestf.f) + add_executable(infotestf infotestf.f ../util/mtestf.f) + target_link_libraries(infotest2f simgrid mtest_f77) + target_link_libraries(infotestf simgrid mtest_f77) + +endif() + +set(tesh_files + ${tesh_files} + PARENT_SCOPE + ) +set(xml_files + ${xml_files} + PARENT_SCOPE + ) +set(examples_src + ${examples_src} + ${CMAKE_CURRENT_SOURCE_DIR}/infotest2f.f + ${CMAKE_CURRENT_SOURCE_DIR}/infotestf.f + PARENT_SCOPE + ) +set(bin_files + ${bin_files} + PARENT_SCOPE + ) +set(txt_files + ${txt_files} + ${CMAKE_CURRENT_SOURCE_DIR}/testlist + PARENT_SCOPE + ) diff --git a/teshsuite/smpi/mpich3-test/f77/info/infotest2f.f b/teshsuite/smpi/mpich3-test/f77/info/infotest2f.f new file mode 100644 index 0000000000..204897c357 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/f77/info/infotest2f.f @@ -0,0 +1,141 @@ +C -*- Mode: Fortran; -*- +C +C (C) 2003 by Argonne National Laboratory. +C See COPYRIGHT in top-level directory. +C + program main + implicit none + include 'mpif.h' + integer ierr, errs + integer i1, i2 + integer nkeys, i, j, sumindex, vlen, ln, valuelen + logical found, flag + character*(MPI_MAX_INFO_KEY) keys(6) + character*(MPI_MAX_INFO_VAL) values(6) + character*(MPI_MAX_INFO_KEY) mykey + character*(MPI_MAX_INFO_VAL) myvalue +C + data keys/"Key1", "key2", "KeY3", "A Key With Blanks","See Below", + & "last"/ + data values/"value 1", "value 2", "VaLue 3", "key=valu:3","false", + & "no test"/ +C + errs = 0 + + call mtest_init( ierr ) + +C Note that the MPI standard requires that leading an trailing blanks +C are stripped from keys and values (Section 4.10, The Info Object) +C +C First, create and initialize an info + call mpi_info_create( i1, ierr ) + call mpi_info_set( i1, keys(1), values(1), ierr ) + call mpi_info_set( i1, keys(2), values(2), ierr ) + call mpi_info_set( i1, keys(3), values(3), ierr ) + call mpi_info_set( i1, keys(4), values(4), ierr ) + call mpi_info_set( i1, " See Below", values(5), ierr ) + call mpi_info_set( i1, keys(6), " no test ", ierr ) +C + call mpi_info_get_nkeys( i1, nkeys, ierr ) + if (nkeys .ne. 6) then + print *, ' Number of keys should be 6, is ', nkeys + endif + sumindex = 0 + do i=1, nkeys +C keys are number from 0 to n-1, even in Fortran (Section 4.10) + call mpi_info_get_nthkey( i1, i-1, mykey, ierr ) + found = .false. + do j=1, 6 + if (mykey .eq. keys(j)) then + found = .true. + sumindex = sumindex + j + call mpi_info_get_valuelen( i1, mykey, vlen, flag, ierr ) + if (.not.flag) then + errs = errs + 1 + print *, ' no value for key', mykey + else + call mpi_info_get( i1, mykey, MPI_MAX_INFO_VAL, + & myvalue, flag, ierr ) + if (myvalue .ne. values(j)) then + errs = errs + 1 + print *, ' Value for ', mykey, ' not expected' + else + do ln=MPI_MAX_INFO_VAL,1,-1 + if (myvalue(ln:ln) .ne. ' ') then + if (vlen .ne. ln) then + errs = errs + 1 + print *, ' length is ', ln, + & ' but valuelen gave ', vlen, + & ' for key ', mykey + endif + goto 100 + endif + enddo + 100 continue + endif + endif + endif + enddo + if (.not.found) then + print *, i, 'th key ', mykey, ' not in list' + endif + enddo + if (sumindex .ne. 21) then + errs = errs + 1 + print *, ' Not all keys found' + endif +C +C delete 2, then dup, then delete 2 more + call mpi_info_delete( i1, keys(1), ierr ) + call mpi_info_delete( i1, keys(2), ierr ) + call mpi_info_dup( i1, i2, ierr ) + call mpi_info_delete( i1, keys(3), ierr ) +C +C check the contents of i2 +C valuelen does not signal an error for unknown keys; instead, sets +C flag to false + do i=1,2 + flag = .true. + call mpi_info_get_valuelen( i2, keys(i), valuelen, flag, ierr ) + if (flag) then + errs = errs + 1 + print *, ' Found unexpected key ', keys(i) + endif + myvalue = 'A test' + call mpi_info_get( i2, keys(i), MPI_MAX_INFO_VAL, + & myvalue, flag, ierr ) + if (flag) then + errs = errs + 1 + print *, ' Found unexpected key in MPI_Info_get ', keys(i) + else + if (myvalue .ne. 'A test') then + errs = errs + 1 + print *, ' Returned value overwritten, is now ', myvalue + endif + endif + + enddo + do i=3,6 + myvalue = ' ' + call mpi_info_get( i2, keys(i), MPI_MAX_INFO_VAL, + & myvalue, flag, ierr ) + if (.not. flag) then + errs = errs + 1 + print *, ' Did not find key ', keys(i) + else + if (myvalue .ne. values(i)) then + errs = errs + 1 + print *, ' Found wrong value (', myvalue, ') for key ', + & keys(i) + endif + endif + enddo +C +C Free info + call mpi_info_free( i1, ierr ) + call mpi_info_free( i2, ierr ) + + call mtest_finalize( errs ) + call mpi_finalize( ierr ) + + end diff --git a/teshsuite/smpi/mpich3-test/f77/info/infotestf.f b/teshsuite/smpi/mpich3-test/f77/info/infotestf.f new file mode 100644 index 0000000000..a2ec83bc2c --- /dev/null +++ b/teshsuite/smpi/mpich3-test/f77/info/infotestf.f @@ -0,0 +1,57 @@ +C -*- Mode: Fortran; -*- +C +C (C) 2003 by Argonne National Laboratory. +C See COPYRIGHT in top-level directory. +C +C Simple info test + program main + implicit none + include 'mpif.h' + integer i1, i2 + integer i, errs, ierr + integer valuelen + parameter (valuelen=64) + character*(valuelen) value + logical flag +C + errs = 0 + + call MTest_Init( ierr ) + + call mpi_info_create( i1, ierr ) + call mpi_info_create( i2, ierr ) + + call mpi_info_set( i1, "key1", "value1", ierr ) + call mpi_info_set( i2, "key2", "value2", ierr ) + + call mpi_info_get( i1, "key2", valuelen, value, flag, ierr ) + if (flag) then + print *, "Found key2 in info1" + errs = errs + 1 + endif + + call MPI_Info_get( i1, "key1", 64, value, flag, ierr ) + if (.not. flag ) then + print *, "Did not find key1 in info1" + errs = errs + 1 + else + if (value .ne. "value1") then + print *, "Found wrong value (", value, "), expected value1" + errs = errs + 1 + else +C check for trailing blanks + do i=7,valuelen + if (value(i:i) .ne. " ") then + print *, "Found non blank in info value" + errs = errs + 1 + endif + enddo + endif + endif + + call mpi_info_free( i1, ierr ) + call mpi_info_free( i2, ierr ) + + call MTest_Finalize( errs ) + call MPI_Finalize( ierr ) + end diff --git a/teshsuite/smpi/mpich3-test/f77/info/testlist b/teshsuite/smpi/mpich3-test/f77/info/testlist new file mode 100644 index 0000000000..e7512e6d0d --- /dev/null +++ b/teshsuite/smpi/mpich3-test/f77/info/testlist @@ -0,0 +1,2 @@ +infotestf 1 +infotest2f 1 diff --git a/teshsuite/smpi/mpich3-test/f77/init/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f77/init/CMakeLists.txt index 7cee626164..af11de1b3b 100644 --- a/teshsuite/smpi/mpich3-test/f77/init/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f77/init/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") add_executable(baseenvf baseenvf.f) diff --git a/teshsuite/smpi/mpich3-test/f77/pt2pt/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f77/pt2pt/CMakeLists.txt index 90782d45e3..c75bfc8941 100644 --- a/teshsuite/smpi/mpich3-test/f77/pt2pt/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f77/pt2pt/CMakeLists.txt @@ -10,7 +10,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") add_executable(allpairf allpairf.f) diff --git a/teshsuite/smpi/mpich3-test/f77/rma/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f77/rma/CMakeLists.txt index f13b8813d2..d1e702cecc 100644 --- a/teshsuite/smpi/mpich3-test/f77/rma/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f77/rma/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") add_executable(winaccf winaccf.f) @@ -22,7 +22,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) add_executable(c2f2cwinf c2f2cwinf.f c2f2cwin.c) add_executable(wingetf wingetf.f) add_executable(winnamef winnamef.f) -# add_executable(winscale1f winscale1f.f) + add_executable(winscale1f winscale1f.f) # add_executable(winscale2f winscale2f.f) target_link_libraries(winaccf simgrid mtest_f77) @@ -35,7 +35,7 @@ target_link_libraries(c2f2cwinf simgrid mtest_f77) #target_link_libraries(winattrf simgrid mtest_f77) target_link_libraries(wingetf simgrid mtest_f77) target_link_libraries(winnamef simgrid mtest_f77) -#target_link_libraries(winscale1f simgrid mtest_f77) +target_link_libraries(winscale1f simgrid mtest_f77) #target_link_libraries(winscale2f simgrid mtest_f77) diff --git a/teshsuite/smpi/mpich3-test/f77/rma/testlist b/teshsuite/smpi/mpich3-test/f77/rma/testlist index 5d902cb9c8..1e3dac2a46 100644 --- a/teshsuite/smpi/mpich3-test/f77/rma/testlist +++ b/teshsuite/smpi/mpich3-test/f77/rma/testlist @@ -1,8 +1,7 @@ -#Needs post,start, complete, wait -#winscale1f 4 +winscale1f 4 winfencef 4 wingetf 5 -#Needs post,start, complete, wait +#Needs win_test #winscale2f 4 #Needs win error handling #winerrf 1 diff --git a/teshsuite/smpi/mpich3-test/f77/testlist b/teshsuite/smpi/mpich3-test/f77/testlist index e275a57ead..faa6ac4337 100644 --- a/teshsuite/smpi/mpich3-test/f77/testlist +++ b/teshsuite/smpi/mpich3-test/f77/testlist @@ -2,7 +2,7 @@ coll datatype pt2pt -#info +info #spawn #io rma diff --git a/teshsuite/smpi/mpich3-test/f77/topo/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f77/topo/CMakeLists.txt index 50f2d08524..2e39977efd 100644 --- a/teshsuite/smpi/mpich3-test/f77/topo/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f77/topo/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") add_executable(cartcrf cartcrf.f) diff --git a/teshsuite/smpi/mpich3-test/f77/util/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f77/util/CMakeLists.txt index b56403b14f..ab18767254 100644 --- a/teshsuite/smpi/mpich3-test/f77/util/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f77/util/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") #F77 version of the mtest library diff --git a/teshsuite/smpi/mpich3-test/f90/coll/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f90/coll/CMakeLists.txt index c48dd83e41..95a7b5e451 100644 --- a/teshsuite/smpi/mpich3-test/f90/coll/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f90/coll/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") # add_executable(allredint8f90 allredint8f90.f90) # add_executable(allredopttf90 allredopttf90.f90) diff --git a/teshsuite/smpi/mpich3-test/f90/datatype/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f90/datatype/CMakeLists.txt index d5c02d2b39..a400a1c01c 100644 --- a/teshsuite/smpi/mpich3-test/f90/datatype/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f90/datatype/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") # add_executable(allctypesf90 allctypesf90.f90) # add_executable(createf90 createf90.f90) diff --git a/teshsuite/smpi/mpich3-test/f90/info/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f90/info/CMakeLists.txt new file mode 100644 index 0000000000..b538ccc200 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/f90/info/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 2.6) + +if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) + if(WIN32) + set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h") + else() + set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc") + set(CMAKE_Fortran_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpif90") + endif() + + set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") + + add_executable(infotest2f90 infotest2f90.f90 ../util/mtestf90.f90) + add_executable(infotestf90 infotestf90.f90 ../util/mtestf90.f90) + target_link_libraries(infotest2f90 simgrid mtest_f90) + target_link_libraries(infotestf90 simgrid mtest_f90) + +endif() + +set(tesh_files + ${tesh_files} + PARENT_SCOPE + ) +set(xml_files + ${xml_files} + PARENT_SCOPE + ) +set(examples_src + ${examples_src} + ${CMAKE_CURRENT_SOURCE_DIR}/infotest2f90.f90 + ${CMAKE_CURRENT_SOURCE_DIR}/infotestf90.f90 + PARENT_SCOPE + ) +set(bin_files + ${bin_files} + PARENT_SCOPE + ) +set(txt_files + ${txt_files} + ${CMAKE_CURRENT_SOURCE_DIR}/testlist + PARENT_SCOPE + ) diff --git a/teshsuite/smpi/mpich3-test/f90/info/infotest2f90.f90 b/teshsuite/smpi/mpich3-test/f90/info/infotest2f90.f90 new file mode 100644 index 0000000000..d3f6091e74 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/f90/info/infotest2f90.f90 @@ -0,0 +1,141 @@ +! This file created from test/mpi/f77/info/infotest2f.f with f77tof90 +! -*- Mode: Fortran; -*- +! +! (C) 2003 by Argonne National Laboratory. +! See COPYRIGHT in top-level directory. +! + program main + use mpi + integer ierr, errs + integer i1, i2 + integer nkeys, i, j, sumindex, vlen, ln, valuelen + logical found, flag + character*(MPI_MAX_INFO_KEY) keys(6) + character*(MPI_MAX_INFO_VAL) values(6) + character*(MPI_MAX_INFO_KEY) mykey + character*(MPI_MAX_INFO_VAL) myvalue +! + data keys/"Key1", "key2", "KeY3", "A Key With Blanks","See Below", & + & "last"/ + data values/"value 1", "value 2", "VaLue 3", "key=valu:3","false", & + & "no test"/ +! + errs = 0 + + call mtest_init( ierr ) + +! Note that the MPI standard requires that leading an trailing blanks +! are stripped from keys and values (Section 4.10, The Info Object) +! +! First, create and initialize an info + call mpi_info_create( i1, ierr ) + call mpi_info_set( i1, keys(1), values(1), ierr ) + call mpi_info_set( i1, keys(2), values(2), ierr ) + call mpi_info_set( i1, keys(3), values(3), ierr ) + call mpi_info_set( i1, keys(4), values(4), ierr ) + call mpi_info_set( i1, " See Below", values(5), ierr ) + call mpi_info_set( i1, keys(6), " no test ", ierr ) +! + call mpi_info_get_nkeys( i1, nkeys, ierr ) + if (nkeys .ne. 6) then + print *, ' Number of keys should be 6, is ', nkeys + endif + sumindex = 0 + do i=1, nkeys +! keys are number from 0 to n-1, even in Fortran (Section 4.10) + call mpi_info_get_nthkey( i1, i-1, mykey, ierr ) + found = .false. + do j=1, 6 + if (mykey .eq. keys(j)) then + found = .true. + sumindex = sumindex + j + call mpi_info_get_valuelen( i1, mykey, vlen, flag, ierr ) + if (.not.flag) then + errs = errs + 1 + print *, ' no value for key', mykey + else + call mpi_info_get( i1, mykey, MPI_MAX_INFO_VAL, & + & myvalue, flag, ierr ) + if (myvalue .ne. values(j)) then + errs = errs + 1 + print *, ' Value for ', mykey, ' not expected' + else + do ln=MPI_MAX_INFO_VAL,1,-1 + if (myvalue(ln:ln) .ne. ' ') then + if (vlen .ne. ln) then + errs = errs + 1 + print *, ' length is ', ln, & + & ' but valuelen gave ', vlen, & + & ' for key ', mykey + endif + goto 100 + endif + enddo + 100 continue + endif + endif + endif + enddo + if (.not.found) then + print *, i, 'th key ', mykey, ' not in list' + endif + enddo + if (sumindex .ne. 21) then + errs = errs + 1 + print *, ' Not all keys found' + endif +! +! delete 2, then dup, then delete 2 more + call mpi_info_delete( i1, keys(1), ierr ) + call mpi_info_delete( i1, keys(2), ierr ) + call mpi_info_dup( i1, i2, ierr ) + call mpi_info_delete( i1, keys(3), ierr ) +! +! check the contents of i2 +! valuelen does not signal an error for unknown keys; instead, sets +! flag to false + do i=1,2 + flag = .true. + call mpi_info_get_valuelen( i2, keys(i), valuelen, flag, ierr ) + if (flag) then + errs = errs + 1 + print *, ' Found unexpected key ', keys(i) + endif + myvalue = 'A test' + call mpi_info_get( i2, keys(i), MPI_MAX_INFO_VAL, & + & myvalue, flag, ierr ) + if (flag) then + errs = errs + 1 + print *, ' Found unexpected key in MPI_Info_get ', keys(i) + else + if (myvalue .ne. 'A test') then + errs = errs + 1 + print *, ' Returned value overwritten, is now ', myvalue + endif + endif + + enddo + do i=3,6 + myvalue = ' ' + call mpi_info_get( i2, keys(i), MPI_MAX_INFO_VAL, & + & myvalue, flag, ierr ) + if (.not. flag) then + errs = errs + 1 + print *, ' Did not find key ', keys(i) + else + if (myvalue .ne. values(i)) then + errs = errs + 1 + print *, ' Found wrong value (', myvalue, ') for key ', & + & keys(i) + endif + endif + enddo +! +! Free info + call mpi_info_free( i1, ierr ) + call mpi_info_free( i2, ierr ) + + call mtest_finalize( errs ) + call mpi_finalize( ierr ) + + end diff --git a/teshsuite/smpi/mpich3-test/f90/info/infotestf90.f90 b/teshsuite/smpi/mpich3-test/f90/info/infotestf90.f90 new file mode 100644 index 0000000000..05419ab748 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/f90/info/infotestf90.f90 @@ -0,0 +1,57 @@ +! This file created from test/mpi/f77/info/infotestf.f with f77tof90 +! -*- Mode: Fortran; -*- +! +! (C) 2003 by Argonne National Laboratory. +! See COPYRIGHT in top-level directory. +! +! Simple info test + program main + use mpi + integer i1, i2 + integer i, errs, ierr + integer valuelen + parameter (valuelen=64) + character*(valuelen) value + logical flag +! + errs = 0 + + call MTest_Init( ierr ) + + call mpi_info_create( i1, ierr ) + call mpi_info_create( i2, ierr ) + + call mpi_info_set( i1, "key1", "value1", ierr ) + call mpi_info_set( i2, "key2", "value2", ierr ) + + call mpi_info_get( i1, "key2", valuelen, value, flag, ierr ) + if (flag) then + print *, "Found key2 in info1" + errs = errs + 1 + endif + + call MPI_Info_get( i1, "key1", 64, value, flag, ierr ) + if (.not. flag ) then + print *, "Did not find key1 in info1" + errs = errs + 1 + else + if (value .ne. "value1") then + print *, "Found wrong value (", value, "), expected value1" + errs = errs + 1 + else +! check for trailing blanks + do i=7,valuelen + if (value(i:i) .ne. " ") then + print *, "Found non blank in info value" + errs = errs + 1 + endif + enddo + endif + endif + + call mpi_info_free( i1, ierr ) + call mpi_info_free( i2, ierr ) + + call MTest_Finalize( errs ) + call MPI_Finalize( ierr ) + end diff --git a/teshsuite/smpi/mpich3-test/f90/info/testlist b/teshsuite/smpi/mpich3-test/f90/info/testlist new file mode 100644 index 0000000000..9c664b1c11 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/f90/info/testlist @@ -0,0 +1,3 @@ +# This file generated by f77tof90 +infotestf90 1 +infotest2f90 1 diff --git a/teshsuite/smpi/mpich3-test/f90/init/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f90/init/CMakeLists.txt index 254e6b1708..0f0449fe72 100644 --- a/teshsuite/smpi/mpich3-test/f90/init/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f90/init/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(baseenvf90 baseenvf90.f90) target_link_libraries(baseenvf90 simgrid mtest_f90) diff --git a/teshsuite/smpi/mpich3-test/f90/pt2pt/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f90/pt2pt/CMakeLists.txt index 89e3b7db91..564a213d59 100644 --- a/teshsuite/smpi/mpich3-test/f90/pt2pt/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f90/pt2pt/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(allpairf90 allpairf90.f90) # add_executable(greqf90 greqf90.f90 dummyf90.f90) diff --git a/teshsuite/smpi/mpich3-test/f90/rma/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f90/rma/CMakeLists.txt index 6292467547..dc43b4887f 100644 --- a/teshsuite/smpi/mpich3-test/f90/rma/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f90/rma/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") add_executable(winaccf90 winaccf90.f90) @@ -22,7 +22,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) add_executable(c2f2cwinf90 c2f2cwinf90.f90 c2f902cwin.c) add_executable(wingetf90 wingetf90.f90) add_executable(winnamef90 winnamef90.f90) -# add_executable(winscale1f90 winscale1f90.f90) + add_executable(winscale1f90 winscale1f90.f90) # add_executable(winscale2f90 winscale2f90.f90) target_link_libraries(winaccf90 simgrid mtest_f90) @@ -35,7 +35,7 @@ target_link_libraries(c2f2cwinf90 simgrid mtest_f90) #target_link_libraries(winattrf90 simgrid mtest_f90) target_link_libraries(wingetf90 simgrid mtest_f90) target_link_libraries(winnamef90 simgrid mtest_f90) -#target_link_libraries(winscale1f90 simgrid mtest_f90) +target_link_libraries(winscale1f90 simgrid mtest_f90) #target_link_libraries(winscale2f90 simgrid mtest_f90) diff --git a/teshsuite/smpi/mpich3-test/f90/rma/testlist b/teshsuite/smpi/mpich3-test/f90/rma/testlist index e85fb8474a..337fe3188d 100644 --- a/teshsuite/smpi/mpich3-test/f90/rma/testlist +++ b/teshsuite/smpi/mpich3-test/f90/rma/testlist @@ -1,6 +1,6 @@ # This file generated by f77tof90 #See ../../f77/rma/testlist for reasons of deactivation -#winscale1f90 4 +winscale1f90 4 winfencef90 4 wingetf90 5 #winscale2f90 4 diff --git a/teshsuite/smpi/mpich3-test/f90/testlist b/teshsuite/smpi/mpich3-test/f90/testlist index 5e3e7d8841..ccba896965 100644 --- a/teshsuite/smpi/mpich3-test/f90/testlist +++ b/teshsuite/smpi/mpich3-test/f90/testlist @@ -2,7 +2,7 @@ coll #comm #ext -#info +info init #io #misc diff --git a/teshsuite/smpi/mpich3-test/f90/util/CMakeLists.txt b/teshsuite/smpi/mpich3-test/f90/util/CMakeLists.txt index 224b03193b..d7295b209e 100644 --- a/teshsuite/smpi/mpich3-test/f90/util/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/f90/util/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite AND SMPI_FORTRAN) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") #F90 version of the mtest library add_library(mtest_f90 STATIC ../util/mtestf90.f90) diff --git a/teshsuite/smpi/mpich3-test/group/CMakeLists.txt b/teshsuite/smpi/mpich3-test/group/CMakeLists.txt index 41ea6ff190..313a147beb 100644 --- a/teshsuite/smpi/mpich3-test/group/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/group/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") add_executable(groupcreate groupcreate.c) diff --git a/teshsuite/smpi/mpich3-test/info/CMakeLists.txt b/teshsuite/smpi/mpich3-test/info/CMakeLists.txt new file mode 100644 index 0000000000..8fb163226c --- /dev/null +++ b/teshsuite/smpi/mpich3-test/info/CMakeLists.txt @@ -0,0 +1,70 @@ +cmake_minimum_required(VERSION 2.6) + +if(enable_smpi AND enable_smpi_MPICH3_testsuite) + if(WIN32) + set(CMAKE_C_FLAGS "-include ${CMAKE_HOME_DIRECTORY}/include/smpi/smpi_main.h") + else() + set(CMAKE_C_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpicc") + set(CMAKE_Fortran_COMPILER "${CMAKE_BINARY_DIR}/smpi_script/bin/smpiff") + endif() + + set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") + + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") + + + add_executable(infodel infodel.c) + add_executable(infodup infodup.c) +# add_executable(infoenv infoenv.c) + add_executable(infomany2 infomany2.c) + add_executable(infomany infomany.c) + add_executable(infoorder infoorder.c) + add_executable(infotest infotest.c) + add_executable(infovallen infovallen.c) + + + + target_link_libraries(infodel simgrid mtest_c) + target_link_libraries(infodup simgrid mtest_c) +# target_link_libraries(infoenv simgrid mtest_c) + target_link_libraries(infomany2 simgrid mtest_c) + target_link_libraries(infomany simgrid mtest_c) + target_link_libraries(infoorder simgrid mtest_c) + target_link_libraries(infotest simgrid mtest_c) + target_link_libraries(infovallen simgrid mtest_c) + + + + +endif() + +set(tesh_files + ${tesh_files} + PARENT_SCOPE + ) +set(xml_files + ${xml_files} + PARENT_SCOPE + ) +set(examples_src + ${examples_src} + ${CMAKE_CURRENT_SOURCE_DIR}/infodel.c + ${CMAKE_CURRENT_SOURCE_DIR}/infodup.c + ${CMAKE_CURRENT_SOURCE_DIR}/infoenv.c + ${CMAKE_CURRENT_SOURCE_DIR}/infomany2.c + ${CMAKE_CURRENT_SOURCE_DIR}/infomany.c + ${CMAKE_CURRENT_SOURCE_DIR}/infoorder.c + ${CMAKE_CURRENT_SOURCE_DIR}/infotest.c + ${CMAKE_CURRENT_SOURCE_DIR}/infovallen.c + PARENT_SCOPE + ) +set(bin_files + ${bin_files} + PARENT_SCOPE + ) +set(txt_files + ${txt_files} + ${CMAKE_CURRENT_SOURCE_DIR}/testlist + PARENT_SCOPE + ) diff --git a/teshsuite/smpi/mpich3-test/info/infodel.c b/teshsuite/smpi/mpich3-test/info/infodel.c new file mode 100644 index 0000000000..a62f362789 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/info/infodel.c @@ -0,0 +1,83 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * + * (C) 2003 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include "mpi.h" +#include +#include +#include "mpitest.h" +#include "mpitestconf.h" +#ifdef HAVE_STRING_H +#include +#endif + +#define NKEYS 3 +int main( int argc, char *argv[] ) +{ + int errs = 0; + MPI_Info info; + char *keys[NKEYS] = { (char*)"file", (char*)"soft", (char*)"host" }; + char *values[NKEYS] = { (char*)"runfile.txt", (char*)"2:1000:4,3:1000:7", + (char*)"myhost.myorg.org" }; + char value[MPI_MAX_INFO_VAL]; + int i, flag, nkeys; + + MTest_Init( &argc, &argv ); + + MPI_Info_create( &info ); + /* Use only named keys incase the info implementation only supports + the predefined keys (e.g., IBM) */ + for (i=0; i +#include +#include "mpitest.h" +#include "mpitestconf.h" +#ifdef HAVE_STRING_H +#include +#endif + +int main( int argc, char *argv[] ) +{ + int errs = 0; + MPI_Info info1, infodup; + int nkeys, nkeysdup, i, vallen, flag, flagdup; + char key[MPI_MAX_INFO_KEY], keydup[MPI_MAX_INFO_KEY]; + char value[MPI_MAX_INFO_VAL], valdup[MPI_MAX_INFO_VAL]; + + MTest_Init( &argc, &argv ); + + MPI_Info_create( &info1 ); + /* Use only named keys incase the info implementation only supports + the predefined keys (e.g., IBM) */ + MPI_Info_set( info1, (char*)"host", (char*)"myhost.myorg.org" ); + MPI_Info_set( info1, (char*)"file", (char*)"runfile.txt" ); + MPI_Info_set( info1, (char*)"soft", (char*)"2:1000:4,3:1000:7" ); + + MPI_Info_dup( info1, &infodup ); + + MPI_Info_get_nkeys( infodup, &nkeysdup ); + MPI_Info_get_nkeys( info1, &nkeys ); + if (nkeys != nkeysdup) { + errs++; + printf( "Dup'ed info has a different number of keys; is %d should be %d\n", + nkeysdup, nkeys ); + } + vallen = MPI_MAX_INFO_VAL; + for (i=0; i + +static int verbose = 0; + +int main(int argc, char *argv[]) +{ + char value[MPI_MAX_INFO_VAL]; + char *keys[] = { "command", "argv", "maxprocs", "soft", "host", "arch", "wdir", "file", + "thread_level", 0 }; + int flag, i; + + MPI_Init(NULL, NULL); + + for (i = 0; keys[i]; i++) { + MPI_Info_get(MPI_INFO_ENV, keys[i], MPI_MAX_INFO_VAL, value, &flag); + if (flag && verbose) + printf("command: %s\n", value); + } + + printf(" No Errors\n"); + + MPI_Finalize(); + return 0; +} diff --git a/teshsuite/smpi/mpich3-test/info/infomany.c b/teshsuite/smpi/mpich3-test/info/infomany.c new file mode 100644 index 0000000000..c9f8213598 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/info/infomany.c @@ -0,0 +1,105 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +/* Test of info that makes use of the extended handles */ +#include "mpi.h" +#include +#include +#include "mpitest.h" +#include "mpitestconf.h" +#ifdef HAVE_STRING_H +#include +#endif + +#ifndef MAX_INFOS +#define MAX_INFOS 4000 +#endif +#define MAX_ERRORS 10 +#define info_list 16 +/* #define DBG */ + +int main( int argc, char *argv[] ) +{ + MPI_Info infos[MAX_INFOS]; + char key[64], value[64]; + int errs = 0; + int i, j; + + MTest_Init( &argc, &argv ); + + for (i=0; i +#include +#include "mpitest.h" +#include "mpitestconf.h" +#ifdef HAVE_STRING_H +#include +#endif + +#ifndef MAX_INFOS +#define MAX_INFOS 4000 +#endif +#define MAX_ERRORS 10 +#define info_list 16 +/* #define DBG */ + +#ifdef DEBUG +#define DBGPRINTF(a) printf a; fflush(stdout) +#else +#define DBGPRINTF(a) +#endif + +int main( int argc, char *argv[] ) +{ + MPI_Info infos[MAX_INFOS]; + char key[64], value[64]; + int errs = 0; + int i, j; + + MTest_Init( &argc, &argv ); + + /* We create max_info items, then delete the middle third of them, + then recreate them, then check them, then + delete them all. This checks that the MPICH algorithm for + handling large numbers of items works correctly; other MPI + implementations should also be able to handle this */ + + /* Create them all */ + for (i=0; i +#include +#include "mpitest.h" +#include "mpitestconf.h" +#ifdef HAVE_STRING_H +#include +#endif + +#define NKEYS 3 +int main( int argc, char *argv[] ) +{ + int errs = 0; + MPI_Info info; + char *keys1[NKEYS] = { (char*)"file", (char*)"soft", (char*)"host" }; + char *values1[NKEYS] = { (char*)"runfile.txt", (char*)"2:1000:4,3:1000:7", + (char*)"myhost.myorg.org" }; + + char value[MPI_MAX_INFO_VAL]; + int i, flag; + + MTest_Init( &argc, &argv ); + + /* 1,2,3 */ + MPI_Info_create( &info ); + /* Use only named keys incase the info implementation only supports + the predefined keys (e.g., IBM) */ + for (i=0; i=0; i--) { + MPI_Info_set( info, keys1[i], values1[i] ); + } + + /* Check that all values are present */ + for (i=0; i +#include +#include "mpitestconf.h" +#ifdef HAVE_STRING_H +#include +#endif + +int main( int argc, char *argv[] ) +{ + MPI_Info i1, i2; + int errs = 0; + char value[64]; + int flag; + + MPI_Init( &argc, &argv ); + + MPI_Info_create( &i1 ); + MPI_Info_create( &i2 ); + + MPI_Info_set( i1, (char*)"key1", (char*)"value1" ); + MPI_Info_set( i2, (char*)"key2", (char*)"value2" ); + + MPI_Info_get( i1, (char*)"key2", 64, value, &flag ); + if (flag) { + printf( "Found key2 in info1\n" ); + errs ++; + } + MPI_Info_get( i1, (char*)"key1", 64, value, &flag ); + if (!flag) { + errs++; + printf( "Did not find key1 in info1\n" ); + } + else if (strcmp( value, "value1" )) { + errs++; + printf( "Found wrong value (%s), expected value1\n", value ); + } + + MPI_Info_free( &i1 ); + MPI_Info_free( &i2 ); + if (errs) { + printf( " Found %d errors\n", errs ); + } + else { + printf( " No Errors\n" ); + } + MPI_Finalize( ); + return 0; +} diff --git a/teshsuite/smpi/mpich3-test/info/infovallen.c b/teshsuite/smpi/mpich3-test/info/infovallen.c new file mode 100644 index 0000000000..fdce0e37c6 --- /dev/null +++ b/teshsuite/smpi/mpich3-test/info/infovallen.c @@ -0,0 +1,61 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * + * (C) 2003 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include "mpi.h" +#include +#include +#include "mpitest.h" + +#define NKEYS 3 +int main( int argc, char *argv[] ) +{ + int errs = 0; + MPI_Info info; + char *keys[NKEYS] = { (char*)"file", (char*)"soft", (char*)"host" }; + char *values[NKEYS] = { (char*)"runfile.txt", (char*)"2:1000:4,3:1000:7", + (char*)"myhost.myorg.org" }; + char value[MPI_MAX_INFO_VAL]; + int i, flag, vallen; + + MTest_Init( &argc, &argv ); + + MPI_Info_create( &info ); + /* Use only named keys incase the info implementation only supports + the predefined keys (e.g., IBM) */ + for (i=0; i won't work with SMPI. #test3 2 #Needs lock, unlock #test4 2 @@ -37,12 +37,12 @@ test5 2 #transpose4 2 #fetchandadd 7 #fetchandadd_tree 7 -#Needs start, complete +#Needs MPI_Win_test #wintest 2 #Needs lock, unlock #contig_displ 1 test1_am 2 -#test2_am 2 +test2_am 2 #test3_am 2 #test4_am 2 test5_am 2 @@ -51,7 +51,7 @@ test5_am 2 accfence2_am 4 test1_dt 2 timeLimit=30 #Needs post/start -#nullpscw 7 +nullpscw 7 #Needs win_attr #attrorderwin 1 #Needs MPI_Win_call_errhandler diff --git a/teshsuite/smpi/mpich3-test/testlist b/teshsuite/smpi/mpich3-test/testlist index aef3b2c9c2..9904225e85 100644 --- a/teshsuite/smpi/mpich3-test/testlist +++ b/teshsuite/smpi/mpich3-test/testlist @@ -8,7 +8,7 @@ datatype #errhan rma group -#info +info init #mpi_t pt2pt diff --git a/teshsuite/smpi/mpich3-test/topo/CMakeLists.txt b/teshsuite/smpi/mpich3-test/topo/CMakeLists.txt index f2f36dded0..1170fa0212 100644 --- a/teshsuite/smpi/mpich3-test/topo/CMakeLists.txt +++ b/teshsuite/smpi/mpich3-test/topo/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi AND enable_smpi_MPICH3_testsuite) endif() set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/") diff --git a/teshsuite/smpi/pingpong/CMakeLists.txt b/teshsuite/smpi/pingpong/CMakeLists.txt index f1f3c9a6c0..642cf716eb 100644 --- a/teshsuite/smpi/pingpong/CMakeLists.txt +++ b/teshsuite/smpi/pingpong/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(pingpong pingpong.c) add_executable(dsend dsend.c) target_link_libraries(pingpong simgrid) diff --git a/teshsuite/smpi/reduce/CMakeLists.txt b/teshsuite/smpi/reduce/CMakeLists.txt index 8e36392306..4b9bc6c4fc 100644 --- a/teshsuite/smpi/reduce/CMakeLists.txt +++ b/teshsuite/smpi/reduce/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(reduce reduce.c) add_executable(reduce_coll reduce_coll.c) add_executable(reduce_scatter_coll reduce_scatter_coll.c) diff --git a/teshsuite/smpi/scatter/CMakeLists.txt b/teshsuite/smpi/scatter/CMakeLists.txt index ca5efd0c64..0df80e4203 100644 --- a/teshsuite/smpi/scatter/CMakeLists.txt +++ b/teshsuite/smpi/scatter/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(scatter scatter.c) target_link_libraries(scatter simgrid) endif() diff --git a/teshsuite/smpi/shared/CMakeLists.txt b/teshsuite/smpi/shared/CMakeLists.txt index 0e44008dbc..8ad5a316be 100644 --- a/teshsuite/smpi/shared/CMakeLists.txt +++ b/teshsuite/smpi/shared/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") if(NOT WIN32) add_executable(shared shared.c) target_link_libraries(shared simgrid) diff --git a/teshsuite/smpi/shared/shared.c b/teshsuite/smpi/shared/shared.c index 78759352b6..8636be2836 100644 --- a/teshsuite/smpi/shared/shared.c +++ b/teshsuite/smpi/shared/shared.c @@ -1,11 +1,10 @@ -/* Copyright (c) 2009-2014. The SimGrid Team. +/* Copyright (c) 2009-2015. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -/* This example should be instructive to learn about SMPI_SAMPLE_LOCAL and - SMPI_SAMPLE_GLOBAL macros for execution sampling */ +/* This example should be instructive to learn about SMPI_SHARED_CALL */ #include #include @@ -39,7 +38,7 @@ int main(int argc, char *argv[]) } MPI_Barrier(MPI_COMM_WORLD); - //everyobne reads from it. + //everyone reads from it. printf("[%d] The value in the shared buffer is: %" PRIu64"\n", rank, *buf); diff --git a/teshsuite/smpi/struct/CMakeLists.txt b/teshsuite/smpi/struct/CMakeLists.txt index b8b2a830aa..5a48e12468 100644 --- a/teshsuite/smpi/struct/CMakeLists.txt +++ b/teshsuite/smpi/struct/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(struct_test struct_test.c) target_link_libraries(struct_test simgrid) endif() diff --git a/teshsuite/smpi/vector/CMakeLists.txt b/teshsuite/smpi/vector/CMakeLists.txt index 0eb0ee2b25..388a732854 100644 --- a/teshsuite/smpi/vector/CMakeLists.txt +++ b/teshsuite/smpi/vector/CMakeLists.txt @@ -9,7 +9,7 @@ if(enable_smpi) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}") - include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi") + include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi") add_executable(vector_test vector_test.c) target_link_libraries(vector_test simgrid) endif() diff --git a/teshsuite/xbt/log_large/log_large_test.tesh b/teshsuite/xbt/log_large/log_large_test.tesh index 32a8cf992c..a53218eb9c 100644 --- a/teshsuite/xbt/log_large/log_large_test.tesh +++ b/teshsuite/xbt/log_large/log_large_test.tesh @@ -115,7 +115,7 @@ $ $SG_EXENV_TEST ${bindir:=.}/log_large_test "--log=root.fmt:%m%n" > > Done (strlen>10210) -p Check that the dynamic version of the log formated layout works +p Check that the dynamic version of the log formatted layout works $ $SG_EXENV_TEST ${bindir:=.}/log_large_test "--log=root.fmt:%m%n" > This is a very large message: > 0 diff --git a/tools/check_dist_archive.exclude b/tools/check_dist_archive.exclude index 1082e69733..22152d3888 100644 --- a/tools/check_dist_archive.exclude +++ b/tools/check_dist_archive.exclude @@ -13,6 +13,7 @@ + \.cproject + \.gitignore + \.project ++ \.travis.yml + COPYRIGHT.template + README\.(coding|git) + mk_win-dist.sh diff --git a/tools/stack-cleaner/README b/tools/stack-cleaner/README new file mode 100644 index 0000000000..3aff70a29c --- /dev/null +++ b/tools/stack-cleaner/README @@ -0,0 +1,26 @@ +Provides stack-cleaning compilers for x86_64: + + * as + * cc + * c++ + * fortran + +Each of them modify the generated/given X86_64 assembly by prepending +stack-cleanup code to each function: + + movq $0x7ffff7ff8000, %r11 + cmpq %r11, %rsp + jbe .Lstack_cleaner_done0 + movq $QSIZE, %r11 +.Lstack_cleaner_loop0: + movq $0, OFFSET(%rsp,%r11,8) + subq $1, %r11 + jne .Lstack_cleaner_loop0: +.Lstack_cleaner_done0: + +The modification of the assembly is done by the clean-stack-filter +program. + +If the underlying compiler is clang, it might be necessary to add the +-no-integrated-as flag in order to force the usage of an external +assembler. diff --git a/tools/stack-cleaner/as b/tools/stack-cleaner/as new file mode 100755 index 0000000000..1a66dd3798 --- /dev/null +++ b/tools/stack-cleaner/as @@ -0,0 +1,59 @@ +#!/usr/bin/ruby +# Wrapper around the real `as` which adds filtering capabilities. + +require "tempfile" +require "fileutils" + +def wrapped_as(argv) + + args=[] + input=nil + + i = 0 + while i input, 1 => tempfile.path) + status=$?.exitstatus + FileUtils.rm tempfile + exit status + end + args.push(tempfile.path) + + # Call the real assembler: + res = system("as", *args) + status = if res != nil + $?.exitstatus + else + 1 + end + FileUtils.rm tempfile + exit status + +end + +wrapped_as(ARGV) diff --git a/tools/stack-cleaner/c++ b/tools/stack-cleaner/c++ new file mode 100755 index 0000000000..51082b0971 --- /dev/null +++ b/tools/stack-cleaner/c++ @@ -0,0 +1,3 @@ +#!/bin/sh +path="$(dirname $0)" +exec "$path"/compiler-wrapper c++ "$@" diff --git a/tools/stack-cleaner/cc b/tools/stack-cleaner/cc new file mode 100755 index 0000000000..d6da0f2a1c --- /dev/null +++ b/tools/stack-cleaner/cc @@ -0,0 +1,3 @@ +#!/bin/sh +path="$(dirname $0)" +exec "$path"/compiler-wrapper cc "$@" diff --git a/tools/stack-cleaner/clean-stack-filter b/tools/stack-cleaner/clean-stack-filter new file mode 100755 index 0000000000..95a3b520f4 --- /dev/null +++ b/tools/stack-cleaner/clean-stack-filter @@ -0,0 +1,70 @@ +#!/usr/bin/perl -w +# Transform assembly in order to clean each stack frame for X86_64. + +use strict; +$SIG{__WARN__} = sub { die @_ }; + + +# Whether we are still scanning the content of a function: +our $scanproc = 0; + +# Save lines of the function: +our $lines = ""; + +# Size of the stack for this function: +our $size = 0; + + +# Counter for assigning unique ids to labels: +our $id=0; + +sub emit_code { + my $qsize = $size / 8; + my $offset = - $size - 8; + + if($size != 0) { + # This is a crude hack to disable the stack cleaning on the main + # stack. It rellies on the fact that the main stack is high in + # the address space and the other stacks are in the hap (lower). + print("\tmovq \$0x7fff00000000, %r11\n"); + print("\tcmpq %r11, %rsp\n"); + print("\tjae .Lstack_cleaner_done$id\n"); + + # Loop over the stack frame quadwords and zero it: + print("\tmovabsq \$$qsize, %r11\n"); + print(".Lstack_cleaner_loop$id:\n"); + print("\tmovq \$0, $offset(%rsp,%r11,8)\n"); + print("\tsubq \$1, %r11\n"); + print("\tjne .Lstack_cleaner_loop$id\n"); + print(".Lstack_cleaner_done$id:\n"); + } + + print $lines; + + $id = $id + 1; + $size = 0; + $lines = ""; + $scanproc = 0; +} + +while (<>) { + if ($scanproc) { + $lines = $lines . $_; + if (m/^[ \t]*.cfi_endproc$/) { + emit_code(); + } elsif (m/^[ \t]*pushq/) { + $size += 8; + } elsif (m/^[ \t]*subq[\t *]\$([0-9]*),[ \t]*%rsp$/) { + my $val = $1; + $val = oct($val) if $val =~ /^0/; + $size += $val; + emit_code(); + } + } elsif (m/^[ \t]*.cfi_startproc$/) { + print $_; + + $scanproc = 1; + } else { + print $_; + } +} diff --git a/tools/stack-cleaner/compiler-wrapper b/tools/stack-cleaner/compiler-wrapper new file mode 100755 index 0000000000..8b8a62f5fd --- /dev/null +++ b/tools/stack-cleaner/compiler-wrapper @@ -0,0 +1,32 @@ +#!/usr/bin/perl -w +# Compiler wrapper with stack-cleaner support (enabled by default). +# Usage: ./compiler-wrapper target-compiler args [-f[no-]stack-cleaner] + +use File::Basename; + +my $compiler = shift(@ARGV); + +my $enable = 1; + +my @args; +my $arg; +while($arg=shift(@ARGV)) { + if ($arg eq "-fno-stack-cleaner") { + $enable = 0; + } elsif ($arg eq "-fstack-cleaner") { + $enable = 1; + } + else { + push @args, $arg; + } +} + +if ($enable) { + if (basename($0) =~ /^clang/) { + unshift @args, "-no-integrated-as" + } + unshift @args, dirname($0); + unshift @args, "-B"; +} + +exec $compiler, @args diff --git a/tools/stack-cleaner/fortran b/tools/stack-cleaner/fortran new file mode 100755 index 0000000000..62087fddb7 --- /dev/null +++ b/tools/stack-cleaner/fortran @@ -0,0 +1,3 @@ +#!/bin/sh +path="$(dirname $0)" +exec "$path"/compiler-wrapper gfortran "$@"