<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?fileVersion 5.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage2">
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
- <cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.2015407975">
- <storageModule externalCElementFile="cdt.managedbuild.config.gnu.exe.debug.2015407975_org.eclipse.cdt.core.settings" id="cdt.managedbuild.config.gnu.exe.debug.2015407975" name="Debug"/>
- <storageModule externalCElementFile="cdt.managedbuild.config.gnu.exe.debug.2015407975_cdtBuildSystem" version="4.0.0"/>
- <storageModule externalCElementFile="cdt.managedbuild.config.gnu.exe.debug.2015407975_org.eclipse.cdt.core.externalSettings"/>
- </cconfiguration>
- <cconfiguration id="cdt.managedbuild.config.gnu.exe.release.114488438">
- <storageModule externalCElementFile="cdt.managedbuild.config.gnu.exe.release.114488438_org.eclipse.cdt.core.settings" id="cdt.managedbuild.config.gnu.exe.release.114488438" name="Release"/>
- <storageModule externalCElementFile="cdt.managedbuild.config.gnu.exe.release.114488438_cdtBuildSystem" version="4.0.0"/>
- <storageModule externalCElementFile="cdt.managedbuild.config.gnu.exe.release.114488438_org.eclipse.cdt.core.externalSettings"/>
+ <cconfiguration id="cdt.managedbuild.toolchain.gnu.base.1011977604">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.1011977604" moduleId="org.eclipse.cdt.core.settings" name="Default">
+ <externalSettings/>
+ <extensions>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration buildProperties="" id="cdt.managedbuild.toolchain.gnu.base.1011977604" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
+ <folderInfo id="cdt.managedbuild.toolchain.gnu.base.1011977604.157358594" name="/" resourcePath="">
+ <toolChain id="cdt.managedbuild.toolchain.gnu.base.368132295" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
+ <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.1122260779" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
+ <builder id="cdt.managedbuild.target.gnu.builder.base.1747533038" managedBuildOn="false" name="Gnu Make Builder.Default" superClass="cdt.managedbuild.target.gnu.builder.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.archiver.base.374652938" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.738159103" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.c.compiler.base.1053916774" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.c.linker.base.293965464" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.277853741" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.assembler.base.1593279917" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base"/>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
- <project id="simgrid.cdt.managedbuild.target.gnu.exe.761220255" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
+ <project id="simgrid.null.30922824" name="simgrid"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
- <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.114488438;cdt.managedbuild.config.gnu.exe.release.114488438.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1274273113;cdt.managedbuild.tool.gnu.cpp.compiler.input.172936601">
- <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
- </scannerConfigBuildInfo>
- <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.114488438;cdt.managedbuild.config.gnu.exe.release.114488438.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1343200016;cdt.managedbuild.tool.gnu.c.compiler.input.437437566">
- <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
- </scannerConfigBuildInfo>
- <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.2015407975;cdt.managedbuild.config.gnu.exe.debug.2015407975.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.317634629;cdt.managedbuild.tool.gnu.cpp.compiler.input.575478253">
- <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
- </scannerConfigBuildInfo>
- <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.2015407975;cdt.managedbuild.config.gnu.exe.debug.2015407975.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1036608105;cdt.managedbuild.tool.gnu.c.compiler.input.1837769819">
- <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
- </scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
- <storageModule moduleId="refreshScope" versionNumber="2">
- <configuration configurationName="Release">
- <resource resourceType="PROJECT" workspacePath="/simgrid"/>
- </configuration>
- <configuration configurationName="Debug">
- <resource resourceType="PROJECT" workspacePath="/simgrid"/>
- </configuration>
- </storageModule>
</cproject>
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()
* Bug fixes
- "Full" network optimization flag was broken since Surf++
- Better handling of precision flags in maxmin
- - Fix bug causing sometimes "Impossible" errors
+ - 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 <simgrid-devel@lists.gforge.inria.fr>
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)
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
)
COMMAND ${RSYNC_CMD} src/surf/simgrid.dtd scm.gforge.inria.fr:/home/groups/simgrid/htdocs/simgrid.dtd
WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}"
)
-
+
endif()
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)
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
(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 <tt>smpi/
+privatize_global_variableles</tt> 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
> [ 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) 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] (5:__pr_mig_tx:VM00(Intel-Fernand)@Intel) mig: tx_done
> [3467.577368] (1:Master@Jacquelin) Migrate VM01fromProvostto Fernand
+> [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] (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.
> [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.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
> [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.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: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] - 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.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
> [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.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: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)
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");
#! 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)
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"
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
- Directory:
examples/lua/multi_matrix
-
+
- Platform Files:
- quicksort_platform.xml
-
+ quicksort_platform.xml
+
- Deployment Files:
quicksort_deployment.xml
- - Execute:
+ - Execute:
lua mult_matrix.lua
-
+
================================================================================
================================================================================
> [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] 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] 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
> [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
> [Jacquelin:master:(1) 3567.161124] [msg_test/INFO] # Migrate all VMs to PM(Provost)
> [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
> [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
> [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)
> [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] 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] 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_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:master_:(1) 339.199251] [msg_test/INFO] ## Test 6 (ended)
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
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
// 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;
}
{
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;
}
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;
! 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
> [ 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
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
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;
> [ 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:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
> [ 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
+
> [ 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:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
> [ 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
> [ 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:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
> [ 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
+
> [ 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:@) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
> [ 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
</process>
<process host="host2" function="carole" />
+
+ <process host="host2" function="david" />
</platform>
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);
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);
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[])
{
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);
! 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
> [ 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
> [ 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
<host id="MyHost1" power="100.0Mf,50.0Mf,20.0Mf" pstate="0" >
<!-- List of min_power:max_power pairs (in Watts) corresponding to the power consumed when the processor is idle and when it is fully loaded -->
<!-- The list must contain one power pair for each previously defined pstate-->
- <prop id="power_per_state" value="95.0:200.0, 93.0:170.0, 90.0:150.0" />
+ <prop id="watt_per_state" value="95.0:200.0, 93.0:170.0, 90.0:150.0" />
+ <prop id="watt_off" value="10" />
</host>
<host id="MyHost2" power="100.0Mf" >
- <prop id="power_per_state" value="95.0:200.0" />
+ <prop id="watt_per_state" value="100.0:200.0" />
+ <prop id="watt_off" value="10" />
</host>
<link id="link1" bandwidth="100kBps" latency="0"/>
<prop id="name" value="AS2"/>
</AS>
</AS>
-
+
+ <cluster id="acme"
+ prefix="node-" suffix=".acme.org"
+ radical="0-4" power="1Gf"
+ bw="125MBps" lat="50us"
+ bb_bw="2.25GBps" bb_lat="500us">
+
+ <prop id="bla" value="acme cluster"/>
+ <prop id="Hdd" value="180"/>
+ <prop id="mem" value="42"/>
+ </cluster>
+
<AS id="AS4" routing="Full">
<host id="host1" power="1Gf">
<prop id="Hdd" value="180"/>
int main(int argc, char **argv)
{
- const SD_workstation_t *workstations;
SD_workstation_t w1;
SD_workstation_t w2;
const char *name1;
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);
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/")
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)
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)
> [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
> [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
> [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
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)
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)
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);
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);
/* ********************************** */
#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)");
if (context->iwannadie) {
context->iwannadie = 0;
JNIEnv *env = get_current_thread_env();
- XBT_DEBUG("Gonnal launch Killed Error");
+ 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)", 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 {
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;
xbt_dynar_t initial_communications_pattern;
xbt_dynar_t incomplete_communications_pattern;
-xbt_dynar_t communications_pattern;
-int nb_comm_pattern;
/********** Static functions ***********/
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;
+ return DST_PROC_DIFF;
if (comm1->data_size != comm2->data_size)
- return 1;
- if (memcmp(comm1->data, comm2->data, comm1->data_size) != 0)
- return 1;
+ 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 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;
+ 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 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;
+ }
+ MC_print_statistics(mc_stats);
+ xbt_abort();
}
}
-static void print_communications_pattern(xbt_dynar_t comms_pattern)
+static void print_communications_pattern()
{
- unsigned int cursor = 0;
+ unsigned int cursor = 0, cursor2 = 0;
mc_comm_pattern_t current_comm;
+ mc_list_comm_pattern_t current_list;
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);
+ current_list = (mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, current_process, mc_list_comm_pattern_t);
XBT_INFO("Communications from the process %u:", current_process);
- xbt_dynar_foreach(current_pattern, cursor, current_comm) {
+ while(cursor2 < current_list->index_comm){
+ current_comm = (mc_comm_pattern_t)xbt_dynar_get_as(current_list->list, cursor2, mc_comm_pattern_t);
if (current_comm->type == SIMIX_COMM_SEND) {
- XBT_INFO("[(%lu) %s -> (%lu) %s] %s ", current_comm->src_proc,
+ XBT_INFO("(%u) [(%lu) %s -> (%lu) %s] %s ", cursor,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,
+ XBT_INFO("(%u) [(%lu) %s <- (%lu) %s] %s ", cursor, current_comm->dst_proc,
current_comm->dst_host, current_comm->src_proc,
current_comm->src_host, "iRecv");
}
+ cursor2++;
+ }
+ current_process++;
+ cursor = 0;
+ cursor2 = 0;
+ }
+}
+
+static void print_incomplete_communications_pattern(){
+ unsigned int cursor = 0;
+ unsigned int current_process = 1;
+ xbt_dynar_t current_pattern;
+ mc_comm_pattern_t comm;
+ while (current_process < simix_process_maxpid) {
+ current_pattern = (xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, current_process, xbt_dynar_t);
+ XBT_INFO("Incomplete communications from the process %u:", current_process);
+ xbt_dynar_foreach(current_pattern, cursor, comm) {
+ XBT_DEBUG("(%u) Communication %p", cursor, comm);
}
current_process++;
cursor = 0;
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;
}
}
+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, mc_call_type call_type)
+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_process_t process = &mc_model_checker->process;
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_type == MC_CALL_TYPE_SEND) { // 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 > (void*) process->heap_address
- && addr_pointed < MC_process_get_heap(process)->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) { // IRECV
+ 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*) process->heap_address
+ && addr_pointed < MC_process_get_heap(process)->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->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_synchro_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 ************************/
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);
- for (i=0; i<simix_process_maxpid; i++){
- xbt_dynar_t process_pattern = xbt_dynar_new(sizeof(mc_comm_pattern_t), comm_pattern_free_voidp);
- xbt_dynar_insert_at(initial_communications_pattern, i, &process_pattern);
- }
- 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; i<simix_process_maxpid; i++){
- xbt_dynar_t process_pattern = xbt_dynar_new(sizeof(mc_comm_pattern_t), comm_pattern_free_voidp);
- xbt_dynar_insert_at(communications_pattern, i, &process_pattern);
+ mc_list_comm_pattern_t process_list_pattern = xbt_new0(s_mc_list_comm_pattern_t, 1);
+ process_list_pattern->list = 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<simix_process_maxpid; i++){
- xbt_dynar_t process_pattern = xbt_dynar_new(sizeof(int), NULL);
+ xbt_dynar_t process_pattern = xbt_dynar_new(sizeof(mc_comm_pattern_t), NULL);
xbt_dynar_insert_at(incomplete_communications_pattern, i, &process_pattern);
}
- nb_comm_pattern = 0;
-
initial_state = MC_state_new();
-
MC_SET_STD_HEAP;
-
+
XBT_DEBUG("********* Start communication determinism verification *********");
/* Wait for requests (schedules processes) */
smx_simcall_t req = NULL;
smx_process_t process = NULL;
mc_state_t state = NULL, next_state = NULL;
- xbt_dynar_t current_pattern;
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 = %d, interleaved processes = %d)",
&& (req = MC_state_get_request(state, &value))
&& (visited_state == NULL)) {
- MC_LOG_REQUEST(mc_comm_determinism, req, value);
-
+ 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_stats->executed_transitions++;
/* TODO : handle test and testany simcalls */
- mc_call_type call = MC_CALL_TYPE_NONE;
+ 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); /* 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;
- mc_update_comm_pattern(call, req, value, current_pattern);
+ 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;
/* Wait for requests (schedules processes) */
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) {
}
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);
}
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;
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);
}
}
char *rdv;
ssize_t data_size;
void *data;
+ 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 communications_pattern;
extern xbt_dynar_t incomplete_communications_pattern;
-// Can we use the SIMIX syscall for this?
-typedef enum mc_call_type {
+typedef enum {
MC_CALL_TYPE_NONE,
MC_CALL_TYPE_SEND,
MC_CALL_TYPE_RECV,
MC_CALL_TYPE_WAIT,
MC_CALL_TYPE_WAITANY,
-} mc_call_type;
+} e_mc_call_type_t;
+
+typedef enum {
+ NONE_DIFF,
+ TYPE_DIFF,
+ RDV_DIFF,
+ SRC_PROC_DIFF,
+ DST_PROC_DIFF,
+ DATA_SIZE_DIFF,
+ DATA_DIFF,
+} e_mc_comm_pattern_difference_t;
-static inline mc_call_type mc_get_call_type(smx_simcall_t req)
+static inline e_mc_call_type_t mc_get_call_type(smx_simcall_t req)
{
switch(req->call) {
case SIMCALL_COMM_ISEND:
}
}
-void get_comm_pattern(xbt_dynar_t communications_pattern, smx_simcall_t request, mc_call_type call_type);
-void mc_update_comm_pattern(mc_call_type call_type, smx_simcall_t request, int value, xbt_dynar_t current_pattern);
-void complete_comm_pattern(xbt_dynar_t list, smx_synchro_t comm);
+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);
#define MC_FORWARD_H
#include <mc/datatypes.h>
+#include "mc_interface.h"
typedef struct s_mc_object_info s_mc_object_info_t, *mc_object_info_t;
-typedef struct s_mc_transition s_mc_transition_t, *mc_transition_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;
/* Main MC state: */
MC_ignore_global_variable("mc_model_checker");
- MC_ignore_global_variable("communications_pattern");
MC_ignore_global_variable("initial_communications_pattern");
MC_ignore_global_variable("incomplete_communications_pattern");
+ MC_ignore_global_variable("nb_comm_pattern");
/* MC __thread variables: */
MC_ignore_global_variable("mc_diff_info");
if (mc_mode == MC_MODE_STANDALONE || mc_mode == MC_MODE_CLIENT) {
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));
+ }
}
}
return deadlock;
}
-void mc_update_comm_pattern(mc_call_type call_type, smx_simcall_t req, int value, xbt_dynar_t pattern) {
+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;
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 = 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);
+ 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; i<simix_process_maxpid; i++){
+ initial_incomplete_process_comms = xbt_dynar_get_as(incomplete_communications_pattern, i, xbt_dynar_t);
+ xbt_dynar_reset(initial_incomplete_process_comms);
+ incomplete_process_comms = xbt_dynar_get_as(state->incomplete_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);
+ }
+ }
}
/**
* a given model-checker stack.
* \param stack The stack with the transitions to execute.
* \param start Start index to begin the re-execution.
- *
- * If start==-1, restore the initial state and replay the actions the
- * the transitions in the stack.
- *
- * Otherwise, we only replay a part of the transitions of the stacks
- * without restoring the state: it is assumed that the current state
- * match with the transitions to execute.
*/
-void MC_replay(xbt_fifo_t stack, int start)
+void MC_replay(xbt_fifo_t stack)
{
xbt_mheap_t heap = mmalloc_set_current_heap(mc_heap);
- int value, i = 1, count = 1, 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;
-
+
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; j<simix_process_maxpid; j++) {
- xbt_dynar_reset((xbt_dynar_t)xbt_dynar_get_as(communications_pattern, j, xbt_dynar_t));
- }
for (j=0; j<simix_process_maxpid; j++) {
xbt_dynar_reset((xbt_dynar_t)xbt_dynar_get_as(incomplete_communications_pattern, j, xbt_dynar_t));
+ ((mc_list_comm_pattern_t)xbt_dynar_get_as(initial_communications_pattern, j, mc_list_comm_pattern_t))->index_comm = 0;
}
}
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 */
}
/* TODO : handle test and testany simcalls */
- mc_call_type call = MC_CALL_TYPE_NONE;
- if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
+ 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);
- if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
- MC_SET_MC_HEAP;
- mc_update_comm_pattern(call, req, value, communications_pattern);
- MC_SET_STD_HEAP;
- }
-
+ 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 */
mmalloc_set_current_heap(heap);
}
-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);
/* 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)) {
mc_stats->executed_transitions++;
depth++;
-
+
}
XBT_DEBUG("**** End Replay ****");
xbt_mheap_t heap = mmalloc_set_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);
mmalloc_set_current_heap(heap);
}
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)
{
xbt_mheap_t heap = mmalloc_set_current_heap(mc_heap);
}
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(heap);
}
SG_BEGIN_DECL()
-typedef struct s_mc_snapshot *mc_snapshot_t;
+typedef struct s_mc_snapshot s_mc_snapshot_t, *mc_snapshot_t;
SG_END_DECL()
/********* Global variables *********/
xbt_dynar_t acceptance_pairs;
-xbt_dynar_t successors;
xbt_parmap_t parmap;
/********* Static functions *********/
return 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) {
xbt_mheap_t heap = mmalloc_set_current_heap(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 {
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
} */
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);
- mmalloc_set_current_heap(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);
+ mmalloc_set_current_heap(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);
}
}
}
mmalloc_set_current_heap(heap);
- return pair;
+ return new_pair;
}
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);
}
mmalloc_set_current_heap(heap);
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(xbt_automaton_propositional_symbol_get_name(p), 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;
}
}
}
-void MC_pre_modelcheck_liveness(void)
-{
+void MC_pre_modelcheck_liveness(void) {
initial_global_state->raw_mem_set = (mmalloc_get_current_heap() == mc_heap);
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) {
}
}
- 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()
{
- 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;
-
- 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;
+
+ 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->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();
+ 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) {
-
- 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;
- }
- MC_SET_STD_HEAP;
-
- MC_LOG_REQUEST(mc_liveness, req, value);
-
- 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_handle(req, value);
-
- /* Wait for requests (schedules processes) */
- MC_wait_for_requests();
+ /* 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;
- prop_values = get_atomic_propositions_values();
+ 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;
+ }
- 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)) {
}
}
- 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();
-
- }
-
- }
-
- /* 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);
-
- 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();
-
- }
-
- }
-
- 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) */
+
}
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{
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_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_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);
+int is_visited_pair(mc_visited_pair_t visited_pair, mc_pair_t pair);
SG_END_DECL()
#include <xbt.h>
#include "mc_mmu.h"
+#include "mc_forward.h"
#ifndef MC_PAGE_STORE_H
#define MC_PAGE_STORE_H
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(void);
void mc_pages_store_delete(mc_pages_store_t store);
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;
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_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);
* */
uint64_t mc_hash_processes_state(int num_state, xbt_dynar_t stacks);
-/* *********** Snapshot *********** */
-
-#define MC_LOG_REQUEST(log, req, value) \
- if (XBT_LOG_ISENABLED(log, xbt_log_priority_debug)) { \
- char* req_str = MC_request_to_string(req, value); \
- XBT_DEBUG("Execute: %s", req_str); \
- xbt_free(req_str); \
- }
-
/** @brief Dump the stacks of the application processes
*
* This functions is currently not used but it is quite convenient
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
*/
xbt_mheap_t heap = mmalloc_set_current_heap(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();
}
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);
- }
- }
- }
mmalloc_set_current_heap(heap);
}
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++;
if (xbt_fifo_size(mc_stack) <= _sg_mc_max_depth && !user_max_depth_reached
&& (req = MC_state_get_request(state, &value)) && visited_state == NULL) {
- MC_LOG_REQUEST(mc_safety, req, value);
+ char* 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;
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_handle(req, value);
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) {
}
}
- 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);
/* 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 !");
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);
}
/* 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;
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);
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;
#include <simgrid_config.h>
#include <xbt/dict.h>
#include "mc_interface.h"
+#include "mc_state.h"
SG_BEGIN_DECL()
} 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);
}s_mc_visited_state_t, *mc_visited_state_t;
extern xbt_dynar_t visited_states;
-mc_visited_state_t is_visited_state(void);
+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);
#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; i<simix_process_maxpid; i++) {
+ incomplete_process_comms = xbt_dynar_get_as(incomplete_communications_pattern, i, xbt_dynar_t);
+ xbt_dynar_t incomplete_process_comms_copy = xbt_dynar_new(sizeof(mc_comm_pattern_t), comm_pattern_free_voidp);
+ xbt_dynar_foreach(incomplete_process_comms, cursor, 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(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
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;
}
* \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);
}
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);
+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);
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);
}
}
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_process_t process = &(mc_model_checker->process);
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_remote(
MC_process_get_heap(process)->heaplimit,
MC_process_get_malloc_info(process));
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;
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;
}
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--;
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++;
* \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++;
}
}
xbt_mheap_t heap = mmalloc_set_current_heap(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)) {
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);
-
- mmalloc_set_current_heap(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);
+
+ mmalloc_set_current_heap(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 {
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;
// and drop it:
xbt_dynar_remove_at(visited_states, index2, NULL);
+ XBT_DEBUG("Remove visited state (maximum number of stored states reached)");
}
mmalloc_set_current_heap(heap);
/**
* \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;
xbt_mheap_t heap = mmalloc_set_current_heap(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 {
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);
} */
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)
MC_visited_pair_delete(pair_test);
}
mmalloc_set_current_heap(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);
}
}
* \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));
}
* \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);
}
*
* \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));
* \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);
* \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);
}
else {
simdata = simcall_process_get_data(process);
}
- return simdata->m_host;
+ return simdata ? simdata->m_host : NULL;
}
/** \ingroup m_process_management
/* 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);
sg_size_t sent = 0;
double clock_prev_send = MSG_get_clock();
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_dirty_page_tracking(ms->vm);
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)
}
// 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");
+ XBT_INFO("mig: tx_done");
return 0;
}
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
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
msg_task_t task = NULL;
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, 10);
+ ret = MSG_task_receive_with_timeout(&task, ms->mbox_ctl, 4);
xbt_free(ms->mbox_ctl);
xbt_free(ms->mbox);
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
- //XBT_INFO("SRC crashes, throw an exception (m-control)");
- return -1;
- }
+ 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;
+ XBT_INFO("DST crashes, throw an exception (m-control)");
+ return -2;
}
# CallType handler? name (resulttype,resultcast) (arg0name,arg0type,arg0cast) (arg1name,arg1type,arg1cast)
# CallType must be one of the three:
-# - Func: returning a value immediately
-# - Blck: Blocking call that does not return in the same scheduling round
+#
+# - 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)
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 */
#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;
"put", "0.3 1 0",
"get", "0 1 0.3",
"accumulate", "1 0.3 0",
- "fence", "1 0 0.3",
+ "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,
};
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);
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,
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, unsigned int keylen, unsigned int valuelen);
void mpi_info_free_(int* info, int* ierr);
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 in the small mailbox %p (in case of SSEND)?", mailbox);
- smx_synchro_t action = SIMIX_comm_iprobe(SIMIX_process_self(), 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){
mailbox = smpi_process_mailbox();
XBT_DEBUG("No, nothing in the small mailbox test the other one : %p", mailbox);
- action = SIMIX_comm_iprobe(SIMIX_process_self(), mailbox, 0, request->src,request->tag, &match_recv, (void*)request);
+ action = simcall_comm_iprobe(mailbox, 0, request->src,request->tag, &match_recv, (void*)request);
if(action ==NULL){
XBT_DEBUG("Still nothing, switch back to the small mailbox : %p", mailbox);
mailbox = smpi_process_mailbox_small();
}else{
mailbox = smpi_process_mailbox_small();
XBT_DEBUG("Is there a corresponding send already posted the small mailbox?");
- smx_synchro_t action = SIMIX_comm_iprobe(SIMIX_process_self(), 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");
request, -1.0);
XBT_DEBUG("recv simcall posted");
-
+ xbt_mutex_release(mut);
} else {
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_synchro_t action = SIMIX_comm_iprobe(SIMIX_process_self(), 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);
} else{
mailbox = smpi_process_remote_mailbox_small(receiver);
XBT_DEBUG("SSEND : Is there a corresponding recv already posted in the small mailbox %p?", mailbox);
- action = SIMIX_comm_iprobe(SIMIX_process_self(), mailbox, 1,request->dst, request->tag, &match_send, (void*)request);
+ action = simcall_comm_iprobe(mailbox, 1,request->dst, request->tag, &match_send, (void*)request);
if(action ==NULL){
XBT_DEBUG("No, we are first, send to large mailbox");
mailbox = smpi_process_remote_mailbox(receiver);
simcall_set_category(request->action, TRACE_internal_smpi_get_category());
#endif
-
+ xbt_mutex_release(mut);
}
}
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)
}
}
+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--;
*parent = smpi_comm_c2f(tmp);
}
}
+
char ***argv;
smx_rdv_t mailbox;
smx_rdv_t mailbox_small;
+ xbt_mutex_t mailboxes_mutex;
xbt_os_timer_t timer;
MPI_Comm comm_self;
MPI_Comm comm_intra;
data->argv = 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){
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);
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();
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());
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);
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;
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,
}
+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)
return MPI_ERR_ARG;
if (value == NULL)
return MPI_ERR_INFO_VALUE;
- *flag=FALSE;
+ *flag=FALSE;
char* tmpvalue=(char*)xbt_dict_get_or_null(info->info_dict, key);
if(tmpvalue){
- memcpy(value,tmpvalue, (strlen(tmpvalue) + 1 < valuelen) ?
+ memcpy(value,tmpvalue, (strlen(tmpvalue) + 1 < valuelen) ?
strlen(tmpvalue) + 1 : valuelen);
*flag=TRUE;
}
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;
+ *flag=FALSE;
char* tmpvalue=(char*)xbt_dict_get_or_null(info->info_dict, key);
if(tmpvalue){
*valuelen=strlen(tmpvalue);
return MPI_ERR_TYPE;
if(comm==MPI_COMM_NULL)
return MPI_ERR_COMM;
-
+
*size=incount*smpi_datatype_size(datatype);
-
+
return MPI_SUCCESS;
}
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
}
NOT_YET_IMPLEMENTED
}
-int PMPI_Win_wait(MPI_Win win){
- NOT_YET_IMPLEMENTED
-}
xbt_bar_t bar;
MPI_Win* connected_wins;
char* name;
+ int opened;
+ MPI_Group group;
} s_smpi_mpi_win_t;
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;
}
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){
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);
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];
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];
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];
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;i<size;i++){
+ while(j!=size){
+ int src=smpi_group_index(group,j);
+ if(src!=smpi_process_index()){
+ reqs[i]=smpi_irecv_init(NULL, 0, MPI_CHAR, src,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;i<size;i++){
+ smpi_mpi_request_free(&reqs[i]);
+ }
+ xbt_free(reqs);
+ win->opened++; //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;i<size;i++){
+ smpi_mpi_request_free(&reqs[i]);
+ }
+ xbt_free(reqs);
+ win->opened++; //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;i<size;i++){
+ smpi_mpi_request_free(&reqs[i]);
+ }
+ xbt_free(reqs);
+
+ //now we can finish RMA calls
+
+ xbt_dynar_t reqqs = win->requests;
+ 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;i<size;i++){
+ while(j!=size){
+ int src=smpi_group_index(win->group,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;i<size;i++){
+ smpi_mpi_request_free(&reqs[i]);
+ }
+ xbt_free(reqs);
+
+ xbt_dynar_t reqqs = win->requests;
+ 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;
+}
+
+
+
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
"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);
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<ResourcePtr>(cpu));
-/* 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
/** @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);
(*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<CpuPtr, CpuEnergyPtr>::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<CpuPtr, CpuEnergyPtr>::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){
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);
}
}
surf_callback_connect(cpuDestructedCallbacks, energyCpuDestructedCallback);
surf_callback_connect(cpuActionStateChangedCallbacks, energyCpuActionStateChangedCallback);
surf_callback_connect(surfExitCallbacks, sg_energy_plugin_exit);
+ surf_callback_connect(cpuStateChangedCallbacks, energyStateChangedCallback);
}
}
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(){
xbt_dynar_free(&power_range_watts_list);
}
-
/**
* Computes the power consumed by the host according to the current pstate and processor 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;
}
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;
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;
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);
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();
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);
}
}
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;
\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
\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
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 */
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);
}
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 <maxsize>:<filename>
+//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;
+}
+
#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
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)
> [ 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] (1:sleep_host_off.SleepHostOff@Tremblay) Jupiter has been stopped
> [ 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...
\ No newline at end of file
+> [ 0.320000] (0:@) MSG_main finished; Cleaning up the simulation...
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()
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()
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)
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)
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()
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()
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)
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)
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()
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()
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()
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})
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)
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)
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)
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)
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)
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)
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)
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)
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)
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/")
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)
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)
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)
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)
#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)
-#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
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)
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
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)
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)
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(infotest2f90 infotest2f90.f90 ../util/mtestf90.f90)
add_executable(infotestf90 infotestf90.f90 ../util/mtestf90.f90)
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)
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)
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)
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)
#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)
# This file generated by f77tof90
#See ../../f77/rma/testlist for reasons of deactivation
-#winscale1f90 4
+winscale1f90 4
winfencef90 4
wingetf90 5
#winscale2f90 4
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)
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)
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/")
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(attrself attrself.c)
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/")
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(anyall anyall.c)
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
set(MPICH_FLAGS "-DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRING_H=1 -DUSE_STDARG=1 -DHAVE_LONG_DOUBLE=1 -DHAVE_PROTOTYPES=1 -DHAVE_SIGNAL_H=1 -DHAVE_SIGACTION=1 -DHAVE_SLEEP=1 -DHAVE_SYSCONF=1 -Wno-error=unused-variable")
- include_directories("${CMAKE_HOME_DIRECTORY}/include/smpi")
+ include_directories(BEFORE "${CMAKE_HOME_DIRECTORY}/include/smpi")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../include/")
add_executable(accfence1 accfence1.c)
add_executable(accfence2_am accfence2_am.c)
add_executable(accfence2 accfence2.c)
-# add_executable(accpscw1 accpscw1.c)
+ add_executable(accpscw1 accpscw1.c)
# add_executable(acc-loc acc-loc.c)
# add_executable(adlb_mimic1 adlb_mimic1.c)
add_executable(allocmem allocmem.c)
# add_executable(mcs-mutex mcs-mutex.c)
# add_executable(mixedsync mixedsync.c)
# add_executable(mutex_bench mutex_bench.c)
-# add_executable(nullpscw nullpscw.c)
+ add_executable(nullpscw nullpscw.c)
# add_executable(pscw_ordering pscw_ordering.c)
# add_executable(put_base put_base.c)
# add_executable(put_bottom put_bottom.c)
add_executable(putfence1 putfence1.c)
add_executable(putfidx putfidx.c)
-# add_executable(putpscw1 putpscw1.c)
+ add_executable(putpscw1 putpscw1.c)
# add_executable(req_example req_example.c)
# add_executable(reqops reqops.c)
# add_executable(rmanull rmanull.c)
add_executable(test1_am test1_am.c)
add_executable(test1 test1.c)
add_executable(test1_dt test1_dt.c)
-# add_executable(test2_am test2_am.c)
-# add_executable(test2 test2.c)
+ add_executable(test2_am test2_am.c)
+ add_executable(test2 test2.c)
# add_executable(test3_am test3_am.c)
-# add_executable(test3 test3.c)
+ add_executable(test3 test3.c)
# add_executable(test4_am test4_am.c)
# add_executable(test4 test4.c)
add_executable(test5_am test5_am.c)
add_executable(test5 test5.c)
add_executable(transpose1 transpose1.c)
add_executable(transpose2 transpose2.c)
-# add_executable(transpose3 transpose3.c)
+ add_executable(transpose3 transpose3.c)
# add_executable(transpose4 transpose4.c)
# add_executable(transpose5 transpose5.c)
add_executable(transpose6 transpose6.c)
target_link_libraries(accfence1 simgrid mtest_c)
target_link_libraries(accfence2_am simgrid mtest_c)
target_link_libraries(accfence2 simgrid mtest_c)
-# target_link_libraries(accpscw1 simgrid mtest_c)
+ target_link_libraries(accpscw1 simgrid mtest_c)
# target_link_libraries(acc-loc simgrid mtest_c)
# target_link_libraries(adlb_mimic1 simgrid mtest_c)
target_link_libraries(allocmem simgrid mtest_c)
# target_link_libraries(mcs-mutex simgrid mtest_c)
# target_link_libraries(mixedsync simgrid mtest_c)
# target_link_libraries(mutex_bench simgrid mtest_c)
-# target_link_libraries(nullpscw simgrid mtest_c)
+ target_link_libraries(nullpscw simgrid mtest_c)
# target_link_libraries(pscw_ordering simgrid mtest_c)
# target_link_libraries(put_base simgrid mtest_c)
# target_link_libraries(put_bottom simgrid mtest_c)
target_link_libraries(putfence1 simgrid mtest_c)
target_link_libraries(putfidx simgrid mtest_c)
-# target_link_libraries(putpscw1 simgrid mtest_c)
+ target_link_libraries(putpscw1 simgrid mtest_c)
# target_link_libraries(req_example simgrid mtest_c)
# target_link_libraries(reqops simgrid mtest_c)
# target_link_libraries(rma-contig simgrid mtest_c)
target_link_libraries(test1_am simgrid mtest_c)
target_link_libraries(test1 simgrid mtest_c)
target_link_libraries(test1_dt simgrid mtest_c)
-# target_link_libraries(test2_am simgrid mtest_c)
-# target_link_libraries(test2 simgrid mtest_c)
+ target_link_libraries(test2_am simgrid mtest_c)
+ target_link_libraries(test2 simgrid mtest_c)
# target_link_libraries(test3_am simgrid mtest_c)
-# target_link_libraries(test3 simgrid mtest_c)
+ target_link_libraries(test3 simgrid mtest_c)
# target_link_libraries(test4_am simgrid mtest_c)
# target_link_libraries(test4 simgrid mtest_c)
target_link_libraries(test5_am simgrid mtest_c)
target_link_libraries(test5 simgrid mtest_c)
target_link_libraries(transpose1 simgrid mtest_c)
target_link_libraries(transpose2 simgrid mtest_c)
-# target_link_libraries(transpose3 simgrid mtest_c)
+ target_link_libraries(transpose3 simgrid mtest_c)
# target_link_libraries(transpose4 simgrid mtest_c)
# target_link_libraries(transpose5 simgrid mtest_c)
target_link_libraries(transpose6 simgrid mtest_c)
set_target_properties(accfence2_am PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
set_target_properties(accfence2 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(acc-loc PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
-# set_target_properties(accpscw1 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
+ set_target_properties(accpscw1 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(adlb_mimic1 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
set_target_properties(allocmem PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(attrorderwin PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(mcs-mutex PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(mixedsync PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(mutex_bench PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
-# set_target_properties(nullpscw PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
+ set_target_properties(nullpscw PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(pscw_ordering PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(put_base PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(put_bottom PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
set_target_properties(putfence1 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
set_target_properties(putfidx PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
-# set_target_properties(putpscw1 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
+ set_target_properties(putpscw1 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(req_example PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(reqops PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(rmanull PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
set_target_properties(test1_am PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
set_target_properties(test1 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
set_target_properties(test1_dt PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
-# set_target_properties(test2_am PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
-# set_target_properties(test2 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
+ set_target_properties(test2_am PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
+ set_target_properties(test2 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(test3_am PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
-# set_target_properties(test3 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
+ set_target_properties(test3 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(test4_am PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(test4 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
set_target_properties(test5_am PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
set_target_properties(test5 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
set_target_properties(transpose1 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
set_target_properties(transpose2 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
-# set_target_properties(transpose3 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
+ set_target_properties(transpose3 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(transpose4 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
# set_target_properties(transpose5 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
set_target_properties(transpose6 PROPERTIES COMPILE_FLAGS "${MPICH_FLAGS}")
#adlb_mimic1 3
accfence2 4
#Needs post
-#putpscw1 4
-#accpscw1 4
+putpscw1 4
+accpscw1 4
#Needs get_group
#getgroup 4
transpose1 2
transpose2 2
-#Needs post/start
-#transpose3 2
+transpose3 2
#Needs lock/unlock
#transpose5 2
transpose6 1
transpose7 2
test1 2
-#Needs post/start
-#test2 2
+test2 2
+#this example will not run if the one-sided operations are simply
+#implemented on top of MPI_Isends and Irecvs -> won't work with SMPI.
#test3 2
#Needs lock, unlock
#test4 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
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
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/")
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)
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)
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()
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)
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()
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()