<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?fileVersion 5.0.0?>
-
-<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage2">
+<?fileVersion 5.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage2">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.toolchain.gnu.base.1053321950">
<storageModule externalCElementFile="cdt.managedbuild.toolchain.gnu.base.1053321950_org.eclipse.cdt.core.settings" id="cdt.managedbuild.toolchain.gnu.base.1053321950" name="Default"/>
ADD_TEST(smpi-mpich3-coll-ompi-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/send_is_detached_thres:0)
ADD_TEST(smpi-mpich3-coll-mpich-thread ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:thread -execarg=--cfg=smpi/coll_selector:mpich)
set_tests_properties(smpi-mpich3-coll-thread smpi-mpich3-coll-ompi-thread smpi-mpich3-coll-mpich-thread PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
+ if(CONTEXT_UCONTEXT)
+ ADD_TEST(smpi-mpich3-coll-ucontext ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext)
+ ADD_TEST(smpi-mpich3-coll-ompi-ucontext ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/send_is_detached_thres:0)
+ ADD_TEST(smpi-mpich3-coll-mpich-ucontext ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:ucontext -execarg=--cfg=smpi/coll_selector:mpich)
+ set_tests_properties(smpi-mpich3-coll-ucontext smpi-mpich3-coll-ompi-ucontext smpi-mpich3-coll-mpich-ucontext PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
+ endif()
+ if(HAVE_RAWCTX)
+ ADD_TEST(smpi-mpich3-coll-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw)
+ ADD_TEST(smpi-mpich3-coll-ompi-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:ompi -execarg=--cfg=smpi/send_is_detached_thres:0)
+ ADD_TEST(smpi-mpich3-coll-mpich-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/coll perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/coll -tests=testlist -execarg=--cfg=contexts/factory:raw -execarg=--cfg=smpi/coll_selector:mpich)
+ set_tests_properties(smpi-mpich3-coll-raw smpi-mpich3-coll-ompi-raw smpi-mpich3-coll-mpich-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
+ endif()
+
if(HAVE_RAWCTX)
ADD_TEST(smpi-mpich3-attr-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/attr perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/attr -tests=testlist -execarg=--cfg=contexts/factory:raw)
ADD_TEST(smpi-mpich3-comm-raw ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/comm perl ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/comm -tests=testlist -execarg=--cfg=contexts/factory:raw)
TEST_BIG_ENDIAN(BIGENDIAN)
include(FindGraphviz)
+include(FindLibSigc++)
set(HAVE_GTNETS 0)
if(enable_gtnets)
src/smpi/colls/coll_tuned_topo.h
src/smpi/private.h
src/smpi/smpi_mpi_dt_private.h
+ src/surf/plugins/energy.hpp
src/surf/cpu_interface.hpp
src/surf/cpu_ti.hpp
src/surf/cpu_cas01.hpp
)
set(SURF_SRC
+ src/surf/plugins/energy.cpp
src/surf/cpu_interface.cpp
src/surf/cpu_ti.cpp
src/surf/cpu_cas01.cpp
)
set(headers_to_install
+ include/simgrid.h
include/instr/instr.h
include/msg/datatypes.h
include/msg/msg.h
include/simgrid/modelchecker.h
include/simgrid/platf.h
include/simgrid/platf_generator.h
+ include/simgrid/plugins.h
include/simgrid/simix.h
include/smpi/mpi.h
include/smpi/smpi.h
buildtools/Cmake/Modules/FindGFortran.cmake
buildtools/Cmake/Modules/FindGTnets.cmake
buildtools/Cmake/Modules/FindGraphviz.cmake
+ buildtools/Cmake/Modules/FindLibSigc++.cmake
buildtools/Cmake/Modules/FindLibunwind.cmake
buildtools/Cmake/Modules/FindLua51Simgrid.cmake
buildtools/Cmake/Modules/FindNS3.cmake
endif()
endif()
+if(HAVE_LIBSIGC++)
+ SET(SIMGRID_DEP "${SIMGRID_DEP} -lsigc-2.0")
+endif()
+
if(HAVE_GTNETS)
SET(SIMGRID_DEP "${SIMGRID_DEP} -lgtnets")
endif()
--- /dev/null
+find_path(PATH_LIBSIGC++_H "sigc++/sigc++.h"
+ HINTS
+ $ENV{LD_LIBRARY_PATH}
+ PATH_SUFFIXES include/sigc++-2.0/ include/
+ PATHS
+ /opt
+ /opt/local
+ /opt/csw
+ /sw
+ /usr)
+
+find_path(PATH_LIBSIGC++CONFIG_H "sigc++config.h"
+ HINTS
+ $ENV{LD_LIBRARY_PATH}
+ PATH_SUFFIXES lib/x86_64-linux-gnu/sigc++-2.0/include/ include/
+ PATHS
+ /opt
+ /opt/local
+ /opt/csw
+ /sw
+ /usr)
+
+find_library(PATH_LIBSIGC++_LIB
+ NAMES sigc-2.0
+ HINTS
+ $ENV{LD_LIBRARY_PATH}
+ PATH_SUFFIXES lib/x86_64-linux-gnu/ lib/sigc++/ lib/
+ PATHS
+ /opt
+ /opt/local
+ /opt/csw
+ /sw
+ /usr)
+
+message(STATUS "Looking for sigc++/sigc++.h")
+if(PATH_LIBSIGC++_H)
+ message(STATUS "Looking for sigc++/sigc++.h - found")
+else()
+ message(STATUS "Looking for sigc++/sigc++.h - not found")
+endif()
+
+message(STATUS "Looking for sigc++config.h")
+if(PATH_LIBSIGC++CONFIG_H)
+ message(STATUS "Looking for sigc++config.h - found")
+else()
+ message(STATUS "Looking for sigc++config.h - not found")
+endif()
+
+message(STATUS "Looking for libsigc++")
+if(PATH_LIBSIGC++_LIB)
+ message(STATUS "Looking for libsigc++ - found")
+else()
+ message(STATUS "Looking for libsigc++ - not found")
+endif()
+
+if(PATH_LIBSIGC++_LIB AND PATH_LIBSIGC++_H AND PATH_LIBSIGC++CONFIG_H)
+ string(REGEX REPLACE "/sigc\\+\\+/sigc\\+\\+.h" "" PATH_LIBSIGC++_H "${PATH_LIBSIGC++_H}")
+ string(REGEX REPLACE "/sigc\\+\\+config.h" "" PATH_LIBSIGC++CONFIG_H "${PATH_LIBSIGC++CONFIG_H}")
+ string(REGEX REPLACE "/libsig.*" "" PATH_LIBSIGC++_LIB "${PATH_LIBSIGC++_LIB}")
+
+ include_directories(${PATH_LIBSIGC++_H})
+ include_directories(${PATH_LIBSIGC++CONFIG_H})
+ link_directories(${PATH_LIBSIGC++_LIB})
+ set(HAVE_LIBSIGC++ "1")
+else()
+ set(HAVE_LIBSIGC++ "0")
+endif()
+
+mark_as_advanced(PATH_LIBSIGC++_H)
+mark_as_advanced(PATH_LIBSIGC++CONFIG_H)
+mark_as_advanced(PATH_LIBSIGC++_LIB)
message(" Jedule mode ........: ${enable_jedule}")
message(" Latency bound .......: ${enable_latency_bound_tracking}")
message(" Graphviz mode .......: ${HAVE_GRAPHVIZ}")
+message(" Sigc++ mode .........: ${HAVE_LIBSIGC++}")
message(" Mallocators .........: ${enable_mallocators}")
message("")
message(" Simgrid dependencies : ${SIMGRID_DEP}")
/* If have linux_futex.h */
#cmakedefine HAVE_FUTEX_H @HAVE_FUTEX_H@
+/* Some variable for libsigc++ */
+#cmakedefine HAVE_LIBSIGC @HAVE_LIBSIGC++@
+
/* Some variable for graphviz */
#cmakedefine HAVE_GRAPHVIZ @HAVE_GRAPHVIZ@
#cmakedefine HAVE_GRAPH_H @GRAPH_H@
# members were ordinary class members. Constructors, destructors and assignment
# operators of the base classes will not be shown.
-INLINE_INHERITED_MEMB = YES
+INLINE_INHERITED_MEMB = NO
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
# path before files name in the file list and in the header files. If set
@top_srcdir@/src/include/surf \
@top_srcdir@/src/xbt/ \
@top_srcdir@/src/surf/ \
+ @top_srcdir@/src/surf/plugins/ \
@top_srcdir@/src/msg/ \
@top_srcdir@/src/simdag \
@top_srcdir@/src/simix \
/** \addtogroup SURF_API
-
+
\section SURF_doc Surf documentation
+ Surf is composed several components:
- \ref SURF_simulation
- \ref SURF_actions
- \ref SURF_resources
- \ref SURF_build_api
+ - \ref SURF_interface
+ - \ref SURF_routing
+ - \ref SURF_cpu_interface
+ - \ref SURF_network_interface
+ - \ref SURF_storage_interface
+ - \ref SURF_workstation_interface
+ - \ref SURF_vm_workstation_interface
+ - \ref SURF_callbacks
+ - \ref SURF_plugin_energy
+
*/
we strongly recommand you to contact us before anyway.
*/
+
+/**
+@defgroup SURF_c_bindings SURF C bindings
+@ingroup SURF_API
+@brief Describes the c bindings of SURF
+
+@htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Surf C bindings" --> @endhtmlonly
+*/
+
+/**
+@defgroup SURF_routing_interface SURF Routing Interface
+@ingroup SURF_API
+@brief Describes the routing interface
+
+@htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Surf Routing" --> @endhtmlonly
+*/
+
+/**
+@defgroup SURF_interface SURF Interface
+@ingroup SURF_API
+@brief Describes the general interface for all components (Cpu, Network, Storage, Workstation, WorkstationVM)
+
+@htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Surf Interface" --> @endhtmlonly
+*/
+
+/**
+@defgroup SURF_cpu_interface SURF Cpu Interface
+@ingroup SURF_API
+@brief Describes the general Cpu interface for all Cpu implementations
+
+@htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Cpu Interface" --> @endhtmlonly
+*/
+
+/**
+@defgroup SURF_network_interface SURF Network Interface
+@ingroup SURF_API
+@brief Describes the general Network interface for all Network implementations
+
+@htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Network Interface" --> @endhtmlonly
+*/
+
+/**
+@defgroup SURF_storage_interface SURF Storage Interface
+@ingroup SURF_API
+@brief Describes the general interface for all Storage implementations
+
+@htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Storage Interface" --> @endhtmlonly
+*/
+
+/**
+@defgroup SURF_workstation_interface SURF Workstation Interface
+@ingroup SURF_API
+@brief Describes the general interface for all Workstation implementations
+
+@htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Workstation Interface" --> @endhtmlonly
+*/
+
+/**
+@defgroup SURF_vm_workstation_interface SURF VM Workstation Interface
+@ingroup SURF_API
+@brief Describes the general interface for all VM Workstation implementations
+
+@htmlonly <!-- DOXYGEN_NAVBAR_LABEL="VM Workstation Interface" --> @endhtmlonly
+*/
+
+/**
+@defgroup SURF_callbacks SURF callbacks
+@ingroup SURF_API
+@brief Describes how to use the SURF callbacks
+
+@htmlonly <!-- DOXYGEN_NAVBAR_LABEL="SURF callbacks" --> @endhtmlonly
+*/
+
+/**
+@defgroup SURF_plugin_energy SURF Energy Plugin
+@ingroup SURF_API
+@brief Describes how to use the energy plugin.
+
+@htmlonly <!-- DOXYGEN_NAVBAR_LABEL="Energy plugin" --> @endhtmlonly
+*/
\ No newline at end of file
#include "msg/msg.h"
#include "xbt/sysdep.h" /* calloc */
+#include "simgrid/plugins.h"
/* Create a log channel to have nice outputs. */
#include "xbt/log.h"
consumed_energy = MSG_get_host_consumed_energy(host);
XBT_INFO("Total energy (Joules): %f", consumed_energy);
-
return 0;
}
int main(int argc, char *argv[])
{
msg_error_t res = MSG_OK;
-
+ sg_energy_plugin_init();
MSG_init(&argc, argv);
if (argc != 3) {
> [ 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
> [ 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
#include "msg/msg.h"
#include "xbt/sysdep.h" /* calloc */
+#include "simgrid/plugins.h"
/* Create a log channel to have nice outputs. */
#include "xbt/log.h"
int main(int argc, char *argv[])
{
msg_error_t res = MSG_OK;
-
+ sg_energy_plugin_init();
MSG_init(&argc, argv);
if (argc != 3) {
p Test smpi bindings for dvfs functions (C example)
-$ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/platform.xml --cfg=smpi/cpu_threshold:-1 ${bindir:=.}/se
+$ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/platform.xml --cfg=smpi/cpu_threshold:-1 ${bindir:=.}/se --cfg=plugin:Energy
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/precision' to '1e-9'
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'SMPI'
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304'
> [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
> [0.000000] [rank 1] Pstates: 1; Powers: 100000000
> [0.000000] [rank 0] Pstates: 3; Powers: 100000000, 50000000, 20000000
> [0.000000] [rank 1] Current pstate: 0; Current power: 100000000
p Test smpi bindings for dvfs functions (Fortran 77 example)
-$ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/platform.xml --cfg=smpi/cpu_threshold:-1 ${bindir:=.}/f77/sef
+$ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/platform.xml --cfg=smpi/cpu_threshold:-1 ${bindir:=.}/f77/sef --cfg=plugin:Energy
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/precision' to '1e-9'
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'SMPI'
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304'
> [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
> [ 0.] [rank 0] 3 pstates available
> [ 0.] [rank 1] 1 pstates available
> [ 0.] [rank 0] Power: 100000000.
p Test smpi bindings for dvfs functions (Fortran 90 example)
-$ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/platform.xml --cfg=smpi/cpu_threshold:-1 ${bindir:=.}/f90/sef90
+$ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/platform.xml --cfg=smpi/cpu_threshold:-1 ${bindir:=.}/f90/sef90 --cfg=plugin:Energy
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'maxmin/precision' to '1e-9'
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'SMPI'
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/TCP_gamma' to '4194304'
> [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)
> [ 0.0000000000000000 ] [rank 0 ] 3 pstates available
> [ 0.0000000000000000 ] [rank 1 ] 1 pstates available
> [ 30.000000000000000 ] [rank 0 ] Energy consumed (Joules): 5400.0000000000000
> [ 30.000000000000000 ] [rank 0 ] Current pstate: 2 ; Current power: 20000000.000000000
> [ 80.000000000000000 ] [rank 0 ] Energy consumed (Joules): 12900.000000000000
+> [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
--- /dev/null
+/* simgrid.h - Public interface all SimGrid APIs */
+
+/* Copyright (c) 2014. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef SIMGRID_H
+#define SIMGRID_H
+
+#include <xbt.h>
+
+#include <simgrid/datatypes.h>
+#include <simgrid/modelchecker.h>
+#include <simgrid/platf_generator.h>
+#include <simgrid/platf.h>
+#include <simgrid/simix.h>
+#include <simgrid/plugins.h>
+
+// SG_BEGIN_DECL()
+// nothing
+// SG_END_DECL()
+
+#endif /* SG_PLATF_H */
XBT_PUBLIC(sg_routing_edge_t) sg_routing_edge_by_name_or_null(const char *name);
-/** Defines whether a given resource is working or not */
+/** @ingroup SURF_interface
+* @brief Defines whether a given resource is working or not */
typedef enum {
SURF_RESOURCE_ON = 1, /**< Up & ready */
SURF_RESOURCE_OFF = 0 /**< Down & broken */
--- /dev/null
+/*
+ * plugins.h
+ *
+ * Created on: Jan 15, 2014
+ * Author: bedaride
+ */
+
+#ifndef PLUGINS_H_
+#define PLUGINS_H_
+
+SG_BEGIN_DECL()
+
+/** \ingroup SURF_plugins
+ * \brief The cpu energy consumption plugin
+ */
+XBT_PUBLIC(void) sg_energy_plugin_init(void);
+
+SG_END_DECL()
+
+#endif /* PLUGINS_H_ */
-/* Copyright (c) 2007-2013. The SimGrid Team.
+/* Copyright (c) 2007-2014. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
//FIXME: End of all the not yet implemented stuff
// smpi functions
+XBT_PUBLIC(int) smpi_global_size(void);
XBT_PUBLIC(MPI_Comm) smpi_process_comm_self(void);
/*
XBT_PUBLIC(void) smpi_exit(int);
-/* Copyright (c) 2011-2013. The SimGrid Team.
+/* Copyright (c) 2011-2014. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
#define SMPI_VARINIT_GLOBAL(name,type) \
type *name = NULL; \
-void __attribute__((weak,constructor)) __preinit_##name(void) { \
+static void __attribute__((constructor)) __preinit_##name(void) { \
if(!name) \
- name = (type*)malloc(smpi_global_size() * sizeof(type)); \
+ name = (type*)calloc(smpi_global_size(), sizeof(type)); \
} \
-void __attribute__((weak,destructor)) __postfini_##name(void) { \
+static void __attribute__((destructor)) __postfini_##name(void) { \
free(name); \
name = NULL; \
}
#define SMPI_VARINIT_GLOBAL_AND_SET(name,type,expr) \
type *name = NULL; \
-void __attribute__((weak,constructor)) __preinit_##name(void) { \
+static void __attribute__((constructor)) __preinit_##name(void) { \
size_t size = smpi_global_size(); \
size_t i; \
type value = expr; \
} \
} \
} \
-void __attribute__((weak,destructor)) __postfini_##name(void) { \
+static void __attribute__((destructor)) __postfini_##name(void) { \
free(name); \
name = NULL; \
}
#define SMPI_VARINIT_STATIC(name,type) \
static type *name = NULL; \
if(!name) { \
- name = (type*)malloc(smpi_global_size() * sizeof(type)); \
+ name = (type*)calloc(smpi_global_size(), sizeof(type)); \
smpi_register_static(name, xbt_free); \
}
-/* Copyright (c) 2007-2013. The SimGrid Team.
+/* Copyright (c) 2007-2014. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
XBT_PUBLIC(int) smpi_process_argc(void);
XBT_PUBLIC(int) smpi_process_getarg(integer* index, char* dst, ftnlen len);
-XBT_PUBLIC(int) smpi_global_size(void);
#define smpi_sample_local__(pi,pt) \
{ \
#include "surf/surf_routing.h"
#include "simgrid/platf_interface.h"
#include "simgrid/datatypes.h"
+#include "simgrid/plugins.h"
SG_BEGIN_DECL()
/* Actions and models are highly connected structures... */
XBT_PUBLIC(void) model_help(const char *category,
s_surf_model_description_t * table);
-/** \ingroup SURF_actions
- * \brief Action states
+/** @ingroup SURF_interface
+ * @brief Action states
*
* Action states.
*
- * \see surf_action_t, surf_action_state_t
+ * @see Action
*/
-
typedef enum {
SURF_ACTION_READY = 0, /**< Ready */
SURF_ACTION_RUNNING, /**< Running */
/**< Not in the system anymore. Why did you ask ? */
} e_surf_action_state_t;
+/** @ingroup SURF_vm_interface
+ *
+ *
+ */
/* FIXME: Where should the VM state be defined? */
typedef enum {
- /* created, but not yet started */
- SURF_VM_STATE_CREATED,
+ SURF_VM_STATE_CREATED, /**< created, but not yet started */
SURF_VM_STATE_RUNNING,
SURF_VM_STATE_MIGRATING,
- /* Suspend/resume does not involve disk I/O, so we assume there is no transition states. */
- SURF_VM_STATE_SUSPENDED,
+ SURF_VM_STATE_SUSPENDED, /**< Suspend/resume does not involve disk I/O, so we assume there is no transition states. */
- /* Save/restore involves disk I/O, so there should be transition states. */
- SURF_VM_STATE_SAVING,
+ SURF_VM_STATE_SAVING, /**< Save/restore involves disk I/O, so there should be transition states. */
SURF_VM_STATE_SAVED,
SURF_VM_STATE_RESTORING,
return xbt_lib_get_elm_or_null(storage_lib, name);
}
+
XBT_PUBLIC(char *) surf_routing_edge_name(sg_routing_edge_t edge);
XBT_PUBLIC(void *) surf_as_cluster_get_backbone(AS_t as);
XBT_PUBLIC(void) surf_as_cluster_set_backbone(AS_t as, void* backbone);
+
+/** @{ @ingroup SURF_c_bindings */
+
+/**
+ * @brief Get the name of a surf model
+ *
+ * @param model A model
+ * @return The name of the model
+ */
XBT_PUBLIC(const char *) surf_model_name(surf_model_t model);
+
+/**
+ * @brief Pop an action from the done actions set
+ *
+ * @param model The model from which the action is extracted
+ * @return An action in done state
+ */
XBT_PUBLIC(surf_action_t) surf_model_extract_done_action_set(surf_model_t model);
+
+/**
+ * @brief Pop an action from the failed actions set
+ *
+ * @param model The model from which the action is extracted
+ * @return An action in failed state
+ */
XBT_PUBLIC(surf_action_t) surf_model_extract_failed_action_set(surf_model_t model);
+
+/**
+ * @brief Pop an action from the ready actions set
+ *
+ * @param model The model from which the action is extracted
+ * @return An action in ready state
+ */
XBT_PUBLIC(surf_action_t) surf_model_extract_ready_action_set(surf_model_t model);
+
+/**
+ * @brief Pop an action from the running actions set
+ *
+ * @param model The model from which the action is extracted
+ * @return An action in running state
+ */
XBT_PUBLIC(surf_action_t) surf_model_extract_running_action_set(surf_model_t model);
+
+/**
+ * @brief Get the size of the running action set of a model
+ *
+ * @param model The model
+ * @return The size of the running action set
+ */
XBT_PUBLIC(int) surf_model_running_action_set_size(surf_model_t model);
+
+/**
+ * @brief Execute a parallel task
+ * @details [long description]
+ *
+ * @param model The model which handle the parallelisation
+ * @param workstation_nb The number of workstations
+ * @param workstation_list The list of workstations on which the task is executed
+ * @param computation_amount The processing amount (in flop) needed to process
+ * @param communication_amount The amount of data (in bytes) needed to transfer
+ * @param rate [description]
+ * @return The action corresponding to the parallele execution task
+ */
XBT_PUBLIC(surf_action_t) surf_workstation_model_execute_parallel_task(surf_workstation_model_t model,
int workstation_nb,
void **workstation_list,
double *computation_amount,
double *communication_amount,
double rate);
+
+/**
+ * @brief Create a communication between two hosts
+ *
+ * @param model The model which handle the communication
+ * @param src The source host
+ * @param dst The destination host
+ * @param size The amount of data (in bytes) needed to transfer
+ * @param rate [description]
+ * @return The action corresponding to the communication
+ */
XBT_PUBLIC(surf_action_t) surf_workstation_model_communicate(surf_workstation_model_t model, surf_resource_t src, surf_resource_t dst, double size, double rate);
+
+/**
+ * @brief Get the route between two hosts
+ * @details [long description]
+ *
+ * @param model The model which handle the routes
+ * @param src The source host
+ * @param dst The destination host
+ * @return The list of [TODO] from the source to the host
+ */
XBT_PUBLIC(xbt_dynar_t) surf_workstation_model_get_route(surf_workstation_model_t model, surf_resource_t src, surf_resource_t dst);
+
+/**
+ * @brief Create a new VM on the specified host
+ *
+ * @param name The name of the workstation
+ * @param ind_phys_host The host on which the VM is created
+ */
XBT_PUBLIC(void) surf_vm_workstation_model_create(const char *name, surf_resource_t ind_phys_host);
+
+/**
+ * @brief Create a communication between two routing edges [TODO]
+ * @details [long description]
+ *
+ * @param model The model which handle the communication
+ * @param src The source host
+ * @param dst The destination host
+ * @param size The amount of data (in bytes) needed to transfer
+ * @param rate [description]
+ * @return The action corresponding to the communication
+ */
XBT_PUBLIC(surf_action_t) surf_network_model_communicate(surf_network_model_t model, sg_routing_edge_t src, sg_routing_edge_t dst, double size, double rate);
+
+/**
+ * @brief Get the name of a surf resource (cpu, workstation, network, …)
+ *
+ * @param resource The surf resource
+ * @return The name of the surf resource
+ */
XBT_PUBLIC(const char * ) surf_resource_name(surf_cpp_resource_t resource);
+
+/**
+ * @brief Get the properties of a surf resource (cpu, workstation, network, …)
+ *
+ * @param resource The surf resource
+ * @return The properties of the surf resource
+ */
XBT_PUBLIC(xbt_dict_t) surf_resource_get_properties(surf_cpp_resource_t resource);
+
+/**
+ * @brief Get the state of a surf resource (cpu, workstation, network, …)
+ *
+ * @param resource The surf resource
+ * @return The state of the surf resource
+ */
XBT_PUBLIC(e_surf_resource_state_t) surf_resource_get_state(surf_cpp_resource_t resource);
+
+/**
+ * @brief Set the state of a surf resource (cpu, workstation, network, …)
+ *
+ * @param resource The surf resource
+ * @param state The new state of the surf resource
+ */
XBT_PUBLIC(void) surf_resource_set_state(surf_cpp_resource_t resource, e_surf_resource_state_t state);
+
+/**
+ * @brief Get the speed of the cpu associtated to a workstation
+ *
+ * @param resource The surf workstation
+ * @param load [description]
+ *
+ * @return [description]
+ */
XBT_PUBLIC(double) surf_workstation_get_speed(surf_resource_t resource, double load);
+
+/**
+ * @brief Get the available speed of cpu associtated to a workstation
+ *
+ * @param resource The surf workstation
+ * @return [description]
+ */
XBT_PUBLIC(double) surf_workstation_get_available_speed(surf_resource_t resource);
+
+/**
+ * @brief Get the number of cores of the cpu associated to a workstation
+ *
+ * @param resource The surf workstation
+ * @return The number of cores
+ */
XBT_PUBLIC(int) surf_workstation_get_core(surf_resource_t resource);
+
+/**
+ * @brief Execute some quantity of computation
+ *
+ * @param resource The surf workstation
+ * @param size The value of the processing amount (in flop) needed to process
+ *
+ * @return The surf action corresponding to the processing
+ */
XBT_PUBLIC(surf_action_t) surf_workstation_execute(surf_resource_t resource, double size);
+
+/**
+ * @brief Make the workstation sleep
+ *
+ * @param resource The surf workstation
+ * @param duration The number of seconds to sleep
+ * @return The surf action corresponding to the sleep
+ */
XBT_PUBLIC(surf_action_t) surf_workstation_sleep(surf_resource_t resource, double duration);
+
+/**
+ * @brief Open a file on a workstation
+ *
+ * @param workstation The surf workstation
+ * @param mount The mount point
+ * @param path The path to the file
+ * @return The surf action corresponding to the openning
+ */
XBT_PUBLIC(surf_action_t) surf_workstation_open(surf_resource_t workstation, const char* mount, const char* path);
+
+/**
+ * @brief Close a file descriptor on a workstation
+ *
+ * @param workstation The surf workstation
+ * @param fd The file descriptor
+ *
+ * @return The surf action corresponding to the closing
+ */
XBT_PUBLIC(surf_action_t) surf_workstation_close(surf_resource_t workstation, surf_file_t fd);
+
+/**
+ * @brief Read a file
+ *
+ * @param resource The surf workstation
+ * @param fd The file descriptor to read
+ * @param size The size in bytes to read
+ * @return The surf action corresponding to the reading
+ */
XBT_PUBLIC(surf_action_t) surf_workstation_read(surf_resource_t resource, surf_file_t fd, sg_size_t size);
+
+/**
+ * @brief Write a file
+ *
+ * @param resource The surf workstation
+ * @param fd The file descriptor to write
+ * @param size The size in bytes to write
+ * @return The surf action corresponding to the writing
+ */
XBT_PUBLIC(surf_action_t) surf_workstation_write(surf_resource_t resource, surf_file_t fd, sg_size_t size);
+
+/**
+ * @brief Get the informations of a file descriptor
+ * @details The returned xbt_dynar_t contains:
+ * - the size of the file,
+ * - the mount point,
+ * - the storage name,
+ * - the storage typeId,
+ * - the storage content type
+ *
+ * @param resource The surf workstation
+ * @param fd The file descriptor
+ * @return An xbt_dynar_t with the file informations
+ */
XBT_PUBLIC(xbt_dynar_t) surf_workstation_get_info(surf_resource_t resource, surf_file_t fd);
+
+/**
+ * @brief Get the available space of the storage at the mount point
+ *
+ * @param resource The surf workstation
+ * @param name The mount point
+ * @return The amount of availble space in bytes
+ */
XBT_PUBLIC(sg_size_t) surf_workstation_get_free_size(surf_resource_t resource, const char* name);
+
+/**
+ * @brief Get the used space of the storage at the mount point
+ *
+ * @param resource The surf workstation
+ * @param name The mount point
+ * @return The amount of used space in bytes
+ */
XBT_PUBLIC(sg_size_t) surf_workstation_get_used_size(surf_resource_t resource, const char* name);
+
+/**
+ * @brief Get the VMs hosted on the workstation
+ *
+ * @param resource The surf workstation
+ * @return The list of VMs on the workstation
+ */
XBT_PUBLIC(xbt_dynar_t) surf_workstation_get_vms(surf_resource_t resource);
+
+/**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param resource [description]
+ * @param params [description]
+ */
XBT_PUBLIC(void) surf_workstation_get_params(surf_resource_t resource, ws_params_t params);
+
+/**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param resource [description]
+ * @param params [description]
+ */
XBT_PUBLIC(void) surf_workstation_set_params(surf_resource_t resource, ws_params_t params);
+
+/**
+ * @brief Destroy a Workstation VM
+ *
+ * @param resource The surf workstation vm
+ */
XBT_PUBLIC(void) surf_vm_workstation_destroy(surf_resource_t resource);
+
+/**
+ * @brief Suspend a Workstation VM
+ *
+ * @param resource The surf workstation vm
+ */
XBT_PUBLIC(void) surf_vm_workstation_suspend(surf_resource_t resource);
+
+/**
+ * @brief Resume a Workstation VM
+ *
+ * @param resource The surf workstation vm
+ */
XBT_PUBLIC(void) surf_vm_workstation_resume(surf_resource_t resource);
+
+/**
+ * @brief Save the Workstation VM (Not yet implemented)
+ *
+ * @param resource The surf workstation vm
+ */
XBT_PUBLIC(void) surf_vm_workstation_save(surf_resource_t resource);
+
+/**
+ * @brief Restore the Workstation VM (Not yet implemented)
+ *
+ * @param resource The surf workstation vm
+ */
XBT_PUBLIC(void) surf_vm_workstation_restore(surf_resource_t resource);
+
+/**
+ * @brief Migrate the VM to the destination host
+ *
+ * @param resource The surf workstation vm
+ * @param ind_vm_ws_dest The destination host
+ */
XBT_PUBLIC(void) surf_vm_workstation_migrate(surf_resource_t resource, surf_resource_t ind_vm_ws_dest);
+
+/**
+ * @brief Get the physical machine hosting the VM
+ *
+ * @param resource The surf workstation vm
+ * @return The physical machine hosting the VM
+ */
XBT_PUBLIC(surf_resource_t) surf_vm_workstation_get_pm(surf_resource_t resource);
+
+/**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param resource [description]
+ * @param bound [description]
+ */
XBT_PUBLIC(void) surf_vm_workstation_set_bound(surf_resource_t resource, double bound);
+
+/**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param resource [description]
+ * @param cpu [description]
+ * @param long [description]
+ */
XBT_PUBLIC(void) surf_vm_workstation_set_affinity(surf_resource_t resource, surf_resource_t cpu, unsigned long mask);
+
+/**
+ * @brief Execute some quantity of computation
+ *
+ * @param cpu The surf cpu
+ * @param size The value of the processing amount (in flop) needed to process
+ * @return The surf action corresponding to the processing
+ */
XBT_PUBLIC(surf_action_t) surf_cpu_execute(surf_resource_t cpu, double size);
+
+/**
+ * @brief Make the cpu sleep for duration (in seconds)
+ * @details [long description]
+ *
+ * @param cpu The surf cpu
+ * @param duration The number of seconds to sleep
+ * @return The surf action corresponding to the sleeping
+ */
XBT_PUBLIC(surf_action_t) surf_cpu_sleep(surf_resource_t cpu, double duration);
+
+/**
+ * @brief Get the workstation power peak
+ * @details [long description]
+ *
+ * @param resource The surf workstation
+ * @return The power peak
+ */
XBT_PUBLIC(double) surf_workstation_get_current_power_peak(surf_resource_t host);
+
+/**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param resource [description]
+ * @param pstate_index [description]
+ *
+ * @return [description]
+ */
XBT_PUBLIC(double) surf_workstation_get_power_peak_at(surf_resource_t host, int pstate_index);
+
+/**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param resource [description]
+ * @return [description]
+ */
XBT_PUBLIC(int) surf_workstation_get_nb_pstates(surf_resource_t host);
+
+/**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param resource [description]
+ * @param pstate_index [description]
+ */
XBT_PUBLIC(void) surf_workstation_set_power_peak_at(surf_resource_t host, int pstate_index);
+
+/**
+ * @brief Get the consumed energy (in joules) of a workstation
+ *
+ * @param resource The surf workstation
+ * @return The consumed energy
+ */
XBT_PUBLIC(double) surf_workstation_get_consumed_energy(surf_resource_t host);
+
+/**
+ * @brief Get the list of storages of a workstation
+ *
+ * @param workstation The surf workstation
+ * @return Dictionary of mount point, Storage
+ */
XBT_PUBLIC(xbt_dict_t) surf_workstation_get_storage_list(surf_resource_t workstation);
+
+/**
+ * @brief Unlink a file descriptor
+ *
+ * @param workstation The surf workstation
+ * @param fd The file descriptor
+ *
+ * @return 0 if failed to unlink, 1 otherwise
+ */
XBT_PUBLIC(int) surf_workstation_unlink(surf_resource_t workstation, surf_file_t fd);
+
+/**
+ * @brief List directory contents of a path
+ * @details [long description]
+ *
+ * @param workstation The surf workstation
+ * @param mount The mount point
+ * @param path The path to the directory
+ * @return The surf action corresponding to the ls action
+ */
XBT_PUBLIC(surf_action_t) surf_workstation_ls(surf_resource_t workstation, const char* mount, const char *path);
+
+/**
+ * @brief Get the size of a file on a workstation
+ *
+ * @param workstation The surf workstation
+ * @param fd The file descriptor
+ *
+ * @return The size in bytes of the file
+ */
XBT_PUBLIC(size_t) surf_workstation_get_size(surf_resource_t workstation, surf_file_t fd);
+
+/**
+ * @brief Get the current position of the file descriptor
+ *
+ * @param workstation The surf workstation
+ * @param fd The file descriptor
+ * @return The current position of the file descriptor
+ */
XBT_PUBLIC(size_t) surf_workstation_file_tell(surf_resource_t workstation, surf_file_t fd);
+
+/**
+ * @brief Set the position indictator assiociated with the file descriptor to a new position
+ * @details [long description]
+ *
+ * @param workstation The surf workstation
+ * @param fd The file descriptor
+ * @param offset The offset from the origin
+ * @param origin Position used as a reference for the offset
+ * - SEEK_SET: beginning of the file
+ * - SEEK_CUR: current position indicator
+ * - SEEK_END: end of the file
+ * @return MSG_OK if successful, otherwise MSG_TASK_CANCELED
+ */
XBT_PUBLIC(int) surf_workstation_file_seek(surf_resource_t workstation, surf_file_t fd, sg_size_t offset, int origin);
+
+/**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param link [description]
+ * @return [description]
+ */
XBT_PUBLIC(int) surf_network_link_is_shared(surf_cpp_resource_t link);
+
+/**
+ * @brief Get the bandwidth of a link in bytes per second
+ *
+ * @param link The surf link
+ * @return The bandwidth in bytes per second
+ */
XBT_PUBLIC(double) surf_network_link_get_bandwidth(surf_cpp_resource_t link);
+
+/**
+ * @brief Get the latency of a link in seconds
+ *
+ * @param link The surf link
+ * @return The latency in seconds
+ */
XBT_PUBLIC(double) surf_network_link_get_latency(surf_cpp_resource_t link);
+
+/**
+ * @brief Get the content of a storage
+ *
+ * @param resource The surf storage
+ * @return A xbt_dict_t with path as keys and size in bytes as values
+ */
XBT_PUBLIC(xbt_dict_t) surf_storage_get_content(surf_resource_t resource);
+
+/**
+ * @brief Get the size in bytes of a storage
+ *
+ * @param resource The surf storage
+ * @return The size in bytes of the storage
+ */
XBT_PUBLIC(sg_size_t) surf_storage_get_size(surf_resource_t resource);
+
+/**
+ * @brief Rename a path
+ *
+ * @param resource The surf storage
+ * @param src The old path
+ * @param dest The new path
+ */
XBT_PUBLIC(void) surf_storage_rename(surf_resource_t resource, const char* src, const char* dest);
+
+/**
+ * @brief Get the data associated to the action
+ *
+ * @param action The surf action
+ * @return The data associated to the action
+ */
XBT_PUBLIC(void*) surf_action_get_data(surf_action_t action);
+
+/**
+ * @brief Set the data associated to the action
+ * @details [long description]
+ *
+ * @param action The surf action
+ * @param data The new data associated to the action
+ */
XBT_PUBLIC(void) surf_action_set_data(surf_action_t action, void *data);
+
+/**
+ * @brief Unreference an action
+ *
+ * @param action The surf action
+ */
XBT_PUBLIC(void) surf_action_unref(surf_action_t action);
+
+/**
+ * @brief Get the start time of an action
+ *
+ * @param action The surf action
+ * @return The start time in seconds from the beginning of the simulation
+ */
XBT_PUBLIC(double) surf_action_get_start_time(surf_action_t action);
+
+/**
+ * @brief Get the finish time of an action
+ *
+ * @param action The surf action
+ * @return The finish time in seconds from the beginning of the simulation
+ */
XBT_PUBLIC(double) surf_action_get_finish_time(surf_action_t action);
+
+/**
+ * @brief Get the remains amount of work to do of an action
+ *
+ * @param action The surf action
+ * @return The remains amount of work to do
+ */
XBT_PUBLIC(double) surf_action_get_remains(surf_action_t action);
+
+/**
+ * @brief Suspend an action
+ *
+ * @param action The surf action
+ */
XBT_PUBLIC(void) surf_action_suspend(surf_action_t action);
+
+/**
+ * @brief Resume an action
+ *
+ * @param action The surf action
+ */
XBT_PUBLIC(void) surf_action_resume(surf_action_t action);
+
+/**
+ * @brief Cancel an action
+ *
+ * @param action The surf action
+ */
XBT_PUBLIC(void) surf_action_cancel(surf_action_t action);
+
+/**
+ * @brief Set the priority of an action
+ * @details [long description]
+ *
+ * @param action The surf action
+ * @param priority The new priority [TODO]
+ */
XBT_PUBLIC(void) surf_action_set_priority(surf_action_t action, double priority);
+
+/**
+ * @brief Set the category of an action
+ * @details [long description]
+ *
+ * @param action The surf action
+ * @param category The new category of the action
+ */
XBT_PUBLIC(void) surf_action_set_category(surf_action_t action, const char *category);
+
+/**
+ * @brief Get the state of an action
+ *
+ * @param action The surf action
+ * @return The state of the action
+ */
XBT_PUBLIC(e_surf_action_state_t) surf_action_get_state(surf_action_t action);
+
+/**
+ * @brief Get the cost of an action
+ *
+ * @param action The surf action
+ * @return The cost of the action
+ */
XBT_PUBLIC(int) surf_action_get_cost(surf_action_t action);
+
+/**
+ * @brief [brief desrciption]
+ * @details [long description]
+ *
+ * @param action The surf cpu action
+ * @param cpu [description]
+ * @param long [description]
+ */
XBT_PUBLIC(void) surf_cpu_action_set_affinity(surf_action_t action, surf_resource_t cpu, unsigned long mask);
+
+/**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param action The surf cpu action
+ * @param bound [description]
+ */
XBT_PUBLIC(void) surf_cpu_action_set_bound(surf_action_t action, double bound);
+
+/**
+ * @brief Get the file associated to a storage action
+ *
+ * @param action The surf storage action
+ * @return The file associated to a storage action
+ */
XBT_PUBLIC(surf_file_t) surf_storage_action_get_file(surf_action_t action);
+
+/**
+ * @brief Get the result dictionary of an ls action
+ *
+ * @param action The surf storage action
+ * @return The dictionry listing a path
+ */
XBT_PUBLIC(xbt_dict_t) surf_storage_action_get_ls_dict(surf_action_t action);
+
XBT_PUBLIC(surf_model_t) surf_resource_model(const void *host, int level);
+/** @} */
+
/**************************************/
/* Implementations of model object */
/**************************************/
-
/** \ingroup SURF_models
* \brief The CPU model object for the physical machine layer
*/
*/
XBT_PUBLIC_DATA(s_surf_model_description_t) surf_optimization_mode_description[];
+/** \ingroup SURF_plugins
+ * \brief The list of all available surf plugins
+ */
+XBT_PUBLIC_DATA(s_surf_model_description_t) surf_plugin_description[];
+
/** \ingroup SURF_models
* \brief The list of all available cpu model models
*/
sg_cfg_exit_early();
}
+/* callback of the plugin variable */
+static void _sg_cfg_cb__plugin(const char *name, int pos)
+{
+ char *val;
+
+ XBT_VERB("PLUGIN");
+ xbt_assert(_sg_cfg_init_status < 2,
+ "Cannot load a plugin after the initialization");
+
+ val = xbt_cfg_get_string(_sg_cfg_set, name);
+
+ if (!strcmp(val, "help")) {
+ model_help("plugin", surf_plugin_description);
+ sg_cfg_exit_early();
+ }
+
+ /* New Module missing */
+ int plugin_id = find_model_description(surf_plugin_description, val);
+ surf_plugin_description[plugin_id].model_init_preparse();
+}
+
/* callback of the workstation/model variable */
static void _sg_cfg_cb__workstation_model(const char *name, int pos)
{
/* Create the configuration support */
if (_sg_cfg_init_status == 0) { /* Only create stuff if not already inited */
+
+ /* Plugins configuration */
+
+ sprintf(description,
+ "The plugins. Possible values: ");
+ p = description;
+ while (*(++p) != '\0');
+ for (i = 0; surf_plugin_description[i].name; i++)
+ p += sprintf(p, "%s%s", (i == 0 ? "" : ", "),
+ surf_plugin_description[i].name);
+ sprintf(p,
+ ".\n (use 'help' as a value to see the long description of each plugin)");
+ xbt_cfg_register(&_sg_cfg_set, "plugin", description,
+ xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__plugin, NULL);
+
sprintf(description,
"The model to use for the CPU. Possible values: ");
p = description;
-/* Copyright (c) 2007-2013. The SimGrid Team.
+/* Copyright (c) 2007-2014. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
}
return 0;
}
+#endif
int smpi_global_size(void)
{
}
return atoi(value);
}
-#endif
smpi_process_data_t smpi_process_data(void)
{
list_add LINKARGS "@libdir@\libsimgrid.dll"
fi
-list_set CMDLINE "${CC}"
-list_add_not_empty CMDLINE "${CFLAGS}"
+list_set CMDARGS
while [ $# -gt 0 ]; do
ARG="$1"
shift
-c)
CMAKE_LINKARGS=""
LINKARGS=""
- list_add CMDLINE "-c"
+ list_add CMDARGS "-c"
;;
*.c)
SRCFILE="$(readlink -f ${ARG} 2>/dev/null)"
if [ -z "$SRCFILE" ] ; then
SRCFILE="$ARG"
fi
- list_add CMDLINE "${SRCFILE}"
+ list_add CMDARGS "${SRCFILE}"
;;
*)
- list_add CMDLINE "${ARG}"
+ list_add CMDARGS "${ARG}"
;;
esac
done
+list_set CMDLINE "${CC}"
+list_add_not_empty CMDLINE "${CFLAGS}"
list_add_not_empty CMDLINE ${INCLUDEARGS}
list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
+list_add_not_empty CMDLINE "${CMDARGS}"
list_add_not_empty CMDLINE "${LINKARGS}"
eval $(list_get CMDLINE)
#include "cpu_cas01.hpp"
#include "cpu_ti.hpp"
+#include "plugins/energy.hpp"
#include "maxmin_private.hpp"
#include "simgrid/sg_config.h"
p_powerPeakList = powerPeak;
m_pstate = pstate;
- p_energy = xbt_new(s_energy_cpu_cas01_t, 1);
- p_energy->total_energy = 0;
- p_energy->power_range_watts_list = getWattsRangeList();
- p_energy->last_updated = surf_get_clock();
-
XBT_DEBUG("CPU create: peak=%f, pstate=%d", m_powerPeak, m_pstate);
m_core = core;
}
CpuCas01::~CpuCas01(){
- unsigned int iter;
- xbt_dynar_t power_tuple = NULL;
- xbt_dynar_foreach(p_energy->power_range_watts_list, iter, power_tuple)
- xbt_dynar_free(&power_tuple);
- xbt_dynar_free(&p_energy->power_range_watts_list);
xbt_dynar_free(&p_powerPeakList);
- xbt_free(p_energy);
}
bool CpuCas01::isUsed()
return action;
}
-xbt_dynar_t CpuCas01::getWattsRangeList()
-{
- xbt_dynar_t power_range_list;
- xbt_dynar_t power_tuple;
- int i = 0, pstate_nb=0;
- xbt_dynar_t current_power_values;
- double min_power, max_power;
-
- if (getProperties() == NULL)
- return NULL;
-
- char* all_power_values_str = (char*)xbt_dict_get_or_null(getProperties(), "power_per_state");
-
- if (all_power_values_str == NULL)
- return NULL;
-
-
- power_range_list = xbt_dynar_new(sizeof(xbt_dynar_t), NULL);
- xbt_dynar_t all_power_values = xbt_str_split(all_power_values_str, ",");
-
- pstate_nb = xbt_dynar_length(all_power_values);
- for (i=0; i< pstate_nb; i++)
- {
- /* retrieve the power values associated with the current pstate */
- current_power_values = xbt_str_split(xbt_dynar_get_as(all_power_values, i, char*), ":");
- xbt_assert(xbt_dynar_length(current_power_values) > 1,
- "Power properties incorrectly defined - could not retrieve min and max power values for host %s",
- getName());
-
- /* min_power corresponds to the idle power (cpu load = 0) */
- /* max_power is the power consumed at 100% cpu load */
- min_power = atof(xbt_dynar_get_as(current_power_values, 0, char*));
- max_power = atof(xbt_dynar_get_as(current_power_values, 1, char*));
-
- power_tuple = xbt_dynar_new(sizeof(double), NULL);
- xbt_dynar_push_as(power_tuple, double, min_power);
- xbt_dynar_push_as(power_tuple, double, max_power);
-
- xbt_dynar_push_as(power_range_list, xbt_dynar_t, power_tuple);
- xbt_dynar_free(¤t_power_values);
- }
- xbt_dynar_free(&all_power_values);
- return power_range_list;
-}
-
-/**
- * Computes the power consumed by the host according to the current pstate and processor load
- *
- */
-double CpuCas01::getCurrentWattsValue(double cpu_load)
-{
- xbt_dynar_t power_range_list = p_energy->power_range_watts_list;
-
- if (power_range_list == NULL)
- {
- XBT_DEBUG("No power range properties specified for host %s", getName());
- return 0;
- }
- xbt_assert(xbt_dynar_length(power_range_list) == xbt_dynar_length(p_powerPeakList),
- "The number of power ranges in the properties does not match the number of pstates for host %s",
- getName());
-
- /* retrieve the power values associated with the current pstate */
- xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, m_pstate, xbt_dynar_t);
-
- /* min_power corresponds to the idle power (cpu load = 0) */
- /* max_power is the power consumed at 100% cpu load */
- double min_power = xbt_dynar_get_as(current_power_values, 0, double);
- double max_power = xbt_dynar_get_as(current_power_values, 1, double);
- double power_slope = max_power - min_power;
-
- double current_power = min_power + cpu_load * power_slope;
-
- XBT_DEBUG("[get_current_watts] min_power=%f, max_power=%f, slope=%f", min_power, max_power, power_slope);
- XBT_DEBUG("[get_current_watts] Current power (watts) = %f, load = %f", current_power, cpu_load);
-
- return current_power;
-}
-
-/**
- * Updates the total energy consumed as the sum of the current energy and
- * the energy consumed by the current action
- */
-void CpuCas01::updateEnergy(double cpu_load)
-{
- double start_time = p_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, m_powerPeak, m_pstate);
- double current_energy = p_energy->total_energy;
- double action_energy = getCurrentWattsValue(cpu_load)*(finish_time-start_time);
-
- p_energy->total_energy = current_energy + action_energy;
- p_energy->last_updated = finish_time;
-
- XBT_DEBUG("[cpu_update_energy] old_energy_value=%f, action_energy_value=%f", current_energy, action_energy);
-}
-
double CpuCas01::getCurrentPowerPeak()
{
return m_powerPeak;
m_powerPeak = new_power_peak;
}
-double CpuCas01::getConsumedEnergy()
-{
- return p_energy->total_energy;
-}
-
/**********
* Action *
**********/
}
lmm_expand(model->getMaxminSystem(), constraint, getVariable(), 1.0);
}
-
-
-/**
- * Update the CPU total energy for a finished action
- *
- */
-void CpuCas01Action::updateEnergy()
-{
- CpuCas01Ptr cpu = static_cast<CpuCas01Ptr>(lmm_constraint_id(lmm_get_cnst_from_var
- (getModel()->getMaxminSystem(),
- getVariable(), 0)));
-
- if(cpu->p_energy->last_updated < surf_get_clock()) {
- double load = lmm_constraint_get_usage(cpu->getConstraint()) / cpu->m_powerPeak;
- cpu->updateEnergy(load);
- }
-}
CpuActionPtr execute(double size);
CpuActionPtr sleep(double duration);
- xbt_dynar_t getWattsRangeList();
- double getCurrentWattsValue(double cpu_load);
- void updateEnergy(double cpu_load);
-
double getCurrentPowerPeak();
double getPowerPeakAt(int pstate_index);
int getNbPstates();
void setPowerPeakAt(int pstate_index);
- double getConsumedEnergy();
bool isUsed();
tmgr_trace_event_t p_powerEvent;
xbt_dynar_t p_powerPeakList; /*< List of supported CPU capacities */
int m_pstate; /*< Current pstate (index in the power_peak_list)*/
- energy_cpu_cas01_t p_energy; /*< Structure with energy-consumption data */
};
/**********
CpuCas01Action(ModelPtr model, double cost, bool failed, double power, lmm_constraint_t constraint);
~CpuCas01Action() {};
- void updateEnergy();
};
CpuModelPtr surf_cpu_model_pm;
CpuModelPtr surf_cpu_model_vm;
+/*************
+ * Callbacks *
+ *************/
+
+CpuPtr getActionCpu(CpuActionPtr action) {
+ return static_cast<CpuPtr>(lmm_constraint_id(lmm_get_cnst_from_var
+ (action->getModel()->getMaxminSystem(),
+ action->getVariable(), 0)));
+}
+surf_callback(void, CpuPtr) createCpuCallbacks;
+surf_callback(void, CpuPtr) deleteCpuCallbacks;
+surf_callback(void, CpuActionPtr) updateCpuActionCallbacks;
+
/*********
* Model *
*********/
action->finish();
XBT_CDEBUG(surf_kernel, "Action %p finished", action);
- action->updateEnergy();
+ surf_callback_emit(updateCpuActionCallbacks, action);
/* set the remains to 0 due to precision problems when updating the remaining amount */
action->setRemains(0);
action->finish();
action->setState(SURF_ACTION_DONE);
}
- action->updateEnergy();
+ surf_callback_emit(updateCpuActionCallbacks, action);
+ //action->updateEnergy();
}
return;
* Resource *
************/
+Cpu::Cpu(){
+ surf_callback_emit(createCpuCallbacks, this);
+}
+
Cpu::Cpu(ModelPtr model, const char *name, xbt_dict_t props,
int core, double powerPeak, double powerScale)
: Resource(model, name, props)
, m_powerScale(powerScale)
, p_constraintCore(NULL)
, p_constraintCoreId(NULL)
-{}
+{
+ surf_callback_emit(createCpuCallbacks, this);
+}
Cpu::Cpu(ModelPtr model, const char *name, xbt_dict_t props,
lmm_constraint_t constraint, int core, double powerPeak, double powerScale)
, m_powerPeak(powerPeak)
, m_powerScale(powerScale)
{
+ surf_callback_emit(createCpuCallbacks, this);
/* At now, we assume that a VM does not have a multicore CPU. */
if (core > 1)
xbt_assert(model == surf_cpu_model_pm);
}
Cpu::~Cpu(){
+ surf_callback_emit(deleteCpuCallbacks, this);
if (p_constraintCoreId){
for (int i = 0; i < m_core; i++) {
xbt_free(p_constraintCoreId[i]);
+/* Copyright (c) 2004-2013. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
#include "surf_interface.hpp"
#include "maxmin_private.hpp"
class CpuAction;
typedef CpuAction *CpuActionPtr;
+class CpuPlugin;
+typedef CpuPlugin *CpuPluginPtr;
+
+/*************
+ * Callbacks *
+ *************/
+CpuPtr getActionCpu(CpuActionPtr action);
+
+/** @ingroup SURF_callbacks
+ * @brief Callbacks handler which emit the callbacks after Cpu creation *
+ * @detail Callback functions have the following signature: `void(CpuPtr)`
+ */
+extern surf_callback(void, CpuPtr) createCpuCallbacks;
+
+/** @ingroup SURF_callbacks
+ * @brief Callbacks handler which emit the callbacks after Cpu destruction *
+ * @detail Callback functions have the following signature: `void(CpuPtr)`
+ */
+extern surf_callback(void, CpuPtr) deleteCpuCallbacks;
+
+/** @ingroup SURF_callbacks
+ * @brief Callbacks handler which emit the callbacks after CpuAction update *
+ * @detail Callback functions have the following signature: `void(CpuActionPtr)`
+ */
+extern surf_callback(void, CpuActionPtr) updateCpuActionCallbacks;
+
/*********
* Model *
*********/
+
+ /** @ingroup SURF_cpu_interface
+ * @brief SURF cpu model interface class
+ * @details A model is an object which handle the interactions between its Resources and its Actions
+ */
class CpuModel : public Model {
public:
+ /**
+ * @brief CpuModel constructor
+ *
+ * @param name The name of the model
+ */
CpuModel(const char *name) : Model(name) {};
+
+ /**
+ * @brief Create a Cpu
+ *
+ * @param name The name of the Cpu
+ *
+ * @return The created Cpu
+ */
CpuPtr createResource(string name);
+
+
void updateActionsStateLazy(double now, double delta);
void updateActionsStateFull(double now, double delta);
/************
* Resource *
************/
+
+/** @ingroup SURF_cpu_interface
+* @brief SURF cpu resource interface class
+* @details A Cpu represent a cpu associated to a workstation
+*/
class Cpu : public Resource {
public:
- Cpu(){};
- /*Cpu(lmm_constraint_t constraint);*/
+ /**
+ * @brief Cpu constructor
+ */
+ Cpu();
+
+ /**
+ * @brief Cpu constructor
+ *
+ * @param model The CpuModel associated to this Cpu
+ * @param name The name of the Cpu
+ * @param props Dictionary of properties associated to this Cpu
+ * @param constraint The lmm constraint associated to this Cpu if it is part of a LMM component
+ * @param core The number of core of this Cpu
+ * @param powerPeak The power peak of this Cpu
+ * @param powerScale The power scale of this Cpu
+ */
Cpu(ModelPtr model, const char *name, xbt_dict_t props,
lmm_constraint_t constraint, int core, double powerPeak, double powerScale);
+
+ /**
+ * @brief Cpu constructor
+ *
+ * @param model The CpuModel associated to this Cpu
+ * @param name The name of the Cpu
+ * @param props Dictionary of properties associated to this Cpu
+ * @param core The number of core of this Cpu
+ * @param powerPeak The power peak of this Cpu in [TODO]
+ * @param powerScale The power scale of this Cpu in [TODO]
+ */
Cpu(ModelPtr model, const char *name, xbt_dict_t props,
int core, double powerPeak, double powerScale);
+
+ /**
+ * @brieaf Cpu destructor
+ */
~Cpu();
+
+ /**
+ * @brief Execute some quantity of computation
+ *
+ * @param size The value of the processing amount (in flop) needed to process
+ * @return The CpuAction corresponding to the processing
+ */
virtual CpuActionPtr execute(double size)=0;
+
+ /**
+ * @brief Make a process sleep for duration (in seconds)
+ *
+ * @param duration The number of seconds to sleep
+ * @return The CpuAction corresponding to the sleeping
+ */
virtual CpuActionPtr sleep(double duration)=0;
+
+ /**
+ * @brief Get the number of cores of the current Cpu
+ *
+ * @return The number of cores of the current Cpu
+ */
virtual int getCore();
+
+ /**
+ * @brief Get the speed of the current Cpu
+ * @details [TODO] load * m_powerPeak
+ *
+ * @param load [TODO]
+ *
+ * @return The speed of the current Cpu
+ */
virtual double getSpeed(double load);
+
+ /**
+ * @brief Get the available speed of the current Cpu
+ * @details [TODO]
+ *
+ * @return The available speed of the current Cpu
+ */
virtual double getAvailableSpeed();
+ /**
+ * @brief Get the current Cpu power peak
+ *
+ * @return The current Cpu power peak
+ */
virtual double getCurrentPowerPeak()=0;
+
+
virtual double getPowerPeakAt(int pstate_index)=0;
+
virtual int getNbPstates()=0;
+
virtual void setPowerPeakAt(int pstate_index)=0;
- virtual double getConsumedEnergy()=0;
void addTraces(void);
int m_core;
/**********
* Action *
**********/
+
+ /** @ingroup SURF_cpu_interface
+ * @brief SURF Cpu action interface class
+ * @details A CpuAction represent the execution of code on a Cpu
+ */
class CpuAction : public Action {
+friend CpuPtr getActionCpu(CpuActionPtr action);
public:
+ /**
+ * @brief CpuAction constructor
+ */
CpuAction(){};
+
+ /**
+ * @brief CpuAction constructor
+ *
+ * @param model The CpuModel associated to this CpuAction
+ * @param cost [TODO]
+ * @param failed [TODO]
+ */
CpuAction(ModelPtr model, double cost, bool failed)
: Action(model, cost, failed) {} //FIXME:REMOVE
+
+ /**
+ * @brief CpuAction constructor
+ *
+ * @param model The CpuModel associated to this CpuAction
+ * @param cost [TODO]
+ * @param failed [TODO]
+ * @param var The lmm variable associated to this CpuAction if it is part of a LMM component
+ */
CpuAction(ModelPtr model, double cost, bool failed, lmm_variable_t var)
: Action(model, cost, failed, var) {}
+
+ /**
+ * @brief Set the affinity of the current CpuAction
+ * @details [TODO]
+ *
+ * @param cpu [TODO]
+ * @param long [TODO]
+ */
virtual void setAffinity(CpuPtr cpu, unsigned long mask);
+
+ /**
+ * @brief Set the bound of current CpuAction
+ * @details [TODO]
+ *
+ * @param bound [TODO]
+ */
virtual void setBound(double bound);
void updateRemainingLazy(double now);
- virtual void updateEnergy()=0;
double m_bound;
};
tmgr_trace_t p_powerTrace;
};
-
/*********
* Model *
*********/
CpuActionPtr sleep(double duration);
double getAvailableSpeed();
- xbt_dynar_t getWattsRangeList() {THROW_UNIMPLEMENTED;};
- double getCurrentWattsValue(double /*cpu_load*/) {THROW_UNIMPLEMENTED;};
- void updateEnergy(double /*cpu_load*/) {THROW_UNIMPLEMENTED;};
-
double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
double getPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
int getNbPstates() {THROW_UNIMPLEMENTED;};
void setPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
- double getConsumedEnergy() {THROW_UNIMPLEMENTED;};
CpuTiTgmrPtr p_availTrace; /*< Structure with data needed to integrate trace file */
tmgr_trace_event_t p_stateEvent; /*< trace file with states events (ON or OFF) */
double getRemains();
void setAffinity(CpuPtr /*cpu*/, unsigned long /*mask*/) {};
void setBound(double /*bound*/) {};
- void updateEnergy() {};
CpuTiPtr p_cpu;
int m_indexHeap;
+++ /dev/null
-/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#ifndef _SURF_MAXMIN_PRIVATE_H
-#define _SURF_MAXMIN_PRIVATE_H
-
-#include "surf/maxmin_.h"
-#include "xbt/swag.h"
-#include "xbt/mallocator.h"
-
-
-
-typedef struct lmm_element {
- /* hookup to constraint */
- s_xbt_swag_hookup_t element_set_hookup;
- s_xbt_swag_hookup_t active_element_set_hookup;
-
- lmm_constraint_t constraint;
- lmm_variable_t variable;
- double value;
-} s_lmm_element_t;
-#define make_elem_active(elem) xbt_swag_insert_at_head(elem,&(elem->constraint->active_element_set))
-#define make_elem_inactive(elem) xbt_swag_remove(elem,&(elem->constraint->active_element_set))
-
-typedef struct lmm_constraint_light {
- double remaining_over_usage;
- lmm_constraint_t cnst;
-} s_lmm_constraint_light_t;
-
-typedef struct lmm_constraint {
- /* hookup to system */
- s_xbt_swag_hookup_t constraint_set_hookup;
- s_xbt_swag_hookup_t active_constraint_set_hookup;
- s_xbt_swag_hookup_t modified_constraint_set_hookup;
- s_xbt_swag_hookup_t saturated_constraint_set_hookup;
-
- s_xbt_swag_t element_set; /* a list of lmm_element_t */
- s_xbt_swag_t active_element_set; /* a list of lmm_element_t */
- double remaining;
- double usage;
- double bound;
- int shared;
- void *id;
- int id_int;
- double lambda;
- double new_lambda;
- lmm_constraint_light_t cnst_light;
-} s_lmm_constraint_t;
-
-typedef struct lmm_variable {
- /* hookup to system */
- s_xbt_swag_hookup_t variable_set_hookup;
- s_xbt_swag_hookup_t saturated_variable_set_hookup;
-
- s_lmm_element_t *cnsts;
- int cnsts_size;
- int cnsts_number;
- double weight;
- double bound;
- double value;
- void *id;
- int id_int;
- unsigned visited; /* used by lmm_update_modified_set */
- /* \begin{For Lagrange only} */
- double mu;
- double new_mu;
- double (*func_f) (struct lmm_variable * var, double x); /* (f) */
- double (*func_fp) (struct lmm_variable * var, double x); /* (f') */
- double (*func_fpi) (struct lmm_variable * var, double x); /* (f')^{-1} */
- /* \end{For Lagrange only} */
-} s_lmm_variable_t;
-
-typedef struct lmm_system {
- int modified;
- int selective_update_active; /* flag to update partially the system only selecting changed portions */
- unsigned visited_counter; /* used by lmm_update_modified_set */
- s_xbt_swag_t variable_set; /* a list of lmm_variable_t */
- s_xbt_swag_t constraint_set; /* a list of lmm_constraint_t */
-
- s_xbt_swag_t active_constraint_set; /* a list of lmm_constraint_t */
- s_xbt_swag_t modified_constraint_set; /* a list of modified lmm_constraint_t */
-
- s_xbt_swag_t saturated_variable_set; /* a list of lmm_variable_t */
- s_xbt_swag_t saturated_constraint_set; /* a list of lmm_constraint_t_t */
-
- xbt_swag_t keep_track;
-
- xbt_mallocator_t variable_mallocator;
-} s_lmm_system_t;
-
-#define extract_variable(sys) xbt_swag_extract(&(sys->variable_set))
-#define extract_constraint(sys) xbt_swag_extract(&(sys->constraint_set))
-#define insert_constraint(sys,cnst) xbt_swag_insert(cnst,&(sys->constraint_set))
-#define remove_variable(sys,var) do {xbt_swag_remove(var,&(sys->variable_set));\
- xbt_swag_remove(var,&(sys->saturated_variable_set));} while(0)
-#define remove_constraint(sys,cnst) do {xbt_swag_remove(cnst,&(sys->constraint_set));\
- xbt_swag_remove(cnst,&(sys->saturated_constraint_set));} while(0)
-#define make_constraint_active(sys,cnst) xbt_swag_insert(cnst,&(sys->active_constraint_set))
-#define make_constraint_inactive(sys,cnst) \
- do { xbt_swag_remove(cnst, &sys->active_constraint_set); \
- xbt_swag_remove(cnst, &sys->modified_constraint_set); } while (0)
-
-void lmm_print(lmm_system_t sys);
-
-extern double (*func_f_def) (lmm_variable_t, double);
-extern double (*func_fp_def) (lmm_variable_t, double);
-extern double (*func_fpi_def) (lmm_variable_t, double);
-
-#endif /* _SURF_MAXMIN_PRIVATE_H */
+++ /dev/null
-/* Copyright (c) 2007-2013. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "network_gtnets_private.h"
-#include "gtnets/gtnets_interface.h"
-#include "xbt/str.h"
-#include "surf/surfxml_parse_values.h"
-
-static double time_to_next_flow_completion = -1;
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_gtnets, surf,
- "Logging specific to the SURF network GTNetS module");
-
-extern routing_platf_t routing_platf;
-
-double sg_gtnets_jitter = 0.0;
-int sg_gtnets_jitter_seed = 10;
-
-static void link_new(const char *name, double bw, double lat, xbt_dict_t props)
-{
- static int link_count = -1;
- network_link_GTNETS_t gtnets_link;
-
- if (xbt_lib_get_or_null(link_lib, name, SURF_LINK_LEVEL)) {
- return;
- }
-
- XBT_DEBUG("Scanning link name %s", name);
-
-
- gtnets_link = xbt_new0(s_network_link_GTNETS_t, 1);
- gtnets_link->generic_resource.name = xbt_strdup(name);
- gtnets_link->generic_resource.properties = props;
- gtnets_link->bw_current = bw;
- gtnets_link->lat_current = lat;
-
- link_count++;
-
- XBT_DEBUG("Adding new link, linkid %d, name %s, latency %g, bandwidth %g",
- link_count, name, lat, bw);
-
- if (gtnets_add_link(link_count, bw, lat)) {
- xbt_die("Cannot create GTNetS link");
- }
- gtnets_link->id = link_count;
-
- xbt_lib_set(link_lib, name, SURF_LINK_LEVEL, gtnets_link);
-}
-
-static void route_new(int src_id, int dst_id, xbt_dynar_t links,
- int nb_link)
-{
- network_link_GTNETS_t link;
- unsigned int cursor;
- int i = 0;
- int *gtnets_links;
-
- XBT_IN("(src_id=%d, dst_id=%d, links=%p, nb_link=%d)",
- src_id, dst_id, links, nb_link);
-
- /* Build the list of gtnets link IDs */
- gtnets_links = xbt_new0(int, nb_link);
- i = 0;
- xbt_dynar_foreach(links, cursor, link) {
- gtnets_links[i++] = link->id;
- }
-
- if (gtnets_add_route(src_id, dst_id, gtnets_links, nb_link)) {
- xbt_die("Cannot create GTNetS route");
- }
- XBT_OUT();
-}
-
-static void route_onehop_new(int src_id, int dst_id,
- network_link_GTNETS_t link)
-{
- if (gtnets_add_onehop_route(src_id, dst_id, link->id)) {
- xbt_die("Cannot create GTNetS route");
- }
-}
-
-/* Parse the XML for a network link */
-static void parse_link_init(sg_platf_link_cbarg_t link)
-{
- XBT_DEBUG("link_gtnets");
-
- if (link->bandwidth_trace)
- XBT_INFO
- ("The GTNetS network model doesn't support bandwidth state traces");
- if (link->latency_trace)
- XBT_INFO("The GTNetS network model doesn't support latency state traces");
- if (link->state_trace)
- XBT_INFO("The GTNetS network model doesn't support link state traces");
-
- if (link->policy == SURF_LINK_FULLDUPLEX)
- {
- link_new(bprintf("%s_UP",link->id), link->bandwidth, link->latency, current_property_set);
- link_new(bprintf("%s_DOWN",link->id), link->bandwidth, link->latency, current_property_set);
-
- }
- else link_new(link->id, link->bandwidth, link->latency, current_property_set);
- current_property_set = NULL;
-}
-
-/* Create the gtnets topology based on routing strategy */
-static void create_gtnets_topology(void)
-{
- XBT_DEBUG("Starting topology generation");
-// FIXME: We should take the list of hosts/routers (in the routing module), number the elements of this list,
-// and then you can use the id to reimplement properly the following GTNets calls
-
- //get the onelinks from the parsed platform
- xbt_dynar_t onelink_routes = routing_platf->get_onelink_routes();
- if (!onelink_routes)
- return;
-
- //save them in trace file
- onelink_t onelink;
- unsigned int iter;
- xbt_dynar_foreach(onelink_routes, iter, onelink) {
- void *link = onelink->link_ptr;
-
- if(onelink->src->id != onelink->dst->id){
- XBT_DEBUG("Link (#%p), src (#%s), dst (#%s), src_id = %d, dst_id = %d",
- link,
- onelink->src->name,
- onelink->dst->name,
- onelink->src->id,
- onelink->dst->id);
- XBT_DEBUG("Calling one link route");
- if(onelink->src->rc_type == SURF_NETWORK_ELEMENT_ROUTER){
- gtnets_add_router(onelink->src->id);
- }
- if(onelink->dst->rc_type == SURF_NETWORK_ELEMENT_ROUTER){
- gtnets_add_router(onelink->dst->id);
- }
- route_onehop_new(onelink->src->id, onelink->dst->id, (network_link_GTNETS_t)(link));
- }
- }
-
- if (XBT_LOG_ISENABLED(surf_network_gtnets, xbt_log_priority_debug)) {
- gtnets_print_topology();
- }
-}
-
-/* Main XML parsing */
-static void define_callbacks(void)
-{
- /* Figuring out the network links */
- sg_platf_link_add_cb (&parse_link_init);
- sg_platf_postparse_add_cb(&create_gtnets_topology);
-}
-
-static int resource_used(void *resource_id)
-{
- xbt_die("The resource_used feature is not implemented in GTNets model");
-}
-
-static int action_unref(surf_action_t action)
-{
- action->refcount--;
- if (!action->refcount) {
- xbt_swag_remove(action, action->state_set);
-#ifdef HAVE_TRACING
- xbt_free(action->category);
-#endif
- surf_action_free(&action);
- return 1;
- }
- return 0;
-}
-
-static void action_cancel(surf_action_t action)
-{
- xbt_die("Cannot cancel GTNetS flow");
- return;
-}
-
-static void action_recycle(surf_action_t action)
-{
- xbt_die("Cannot recycle GTNetS flow");
- return;
-}
-
-static double action_get_remains(surf_action_t action)
-{
- return action->remains;
-}
-
-static void action_state_set(surf_action_t action,
- e_surf_action_state_t state)
-{
- surf_action_state_set(action, state);
-}
-
-static double share_resources(surf_model_t network_model, double now)
-{
- xbt_swag_t running_actions =
- surf_network_model->states.running_action_set;
-
- //get the first relevant value from the running_actions list
- if (!xbt_swag_size(running_actions))
- return -1.0;
-
- xbt_assert(time_to_next_flow_completion,
- "Time to next flow completion not initialized!\n");
-
- XBT_DEBUG("Calling gtnets_get_time_to_next_flow_completion");
- time_to_next_flow_completion = gtnets_get_time_to_next_flow_completion();
- XBT_DEBUG("gtnets_get_time_to_next_flow_completion received %g",
- time_to_next_flow_completion);
-
- return time_to_next_flow_completion;
-}
-
-static void update_actions_state(surf_model_t network_model, double now, double delta)
-{
- surf_action_network_GTNETS_t action = NULL;
- xbt_swag_t running_actions =
- network_model->states.running_action_set;
-
- /* If there are no running flows, just return */
- if (time_to_next_flow_completion < 0.0) {
- return;
- }
-
- /* if delta == time_to_next_flow_completion, too. */
- if (time_to_next_flow_completion <= delta) { /* run until the first flow completes */
- void **metadata;
- int i, num_flows;
-
- num_flows = 0;
-
- if (gtnets_run_until_next_flow_completion(&metadata, &num_flows)) {
- xbt_die("Cannot run GTNetS simulation until next flow completion");
- }
- if (num_flows < 1) {
- xbt_die("GTNetS simulation couldn't find a flow that would complete");
- }
-
- xbt_swag_foreach(action, running_actions) {
- XBT_DEBUG("Action (%p) remains old value: %f", action,
- action->generic_action.remains);
- double sent = gtnets_get_flow_rx(action);
-
- XBT_DEBUG("Sent value returned by GTNetS : %f", sent);
-
-#ifdef HAVE_TRACING
- action->last_remains = action->generic_action.remains;
-#endif
-
- //need to trust this remain value
- if (sent == 0) {
- action->generic_action.remains = 0;
- } else {
- action->generic_action.remains =
- action->generic_action.cost - sent;
- }
-
- // verify that this action is a finishing action.
- int found=0;
- for (i = 0; i < num_flows; i++) {
- if(action == (surf_action_network_GTNETS_t) (metadata[i])){
- found = 1;
- break;
- }
- }
-
- // indeed this action have not yet started
- // because of that we need to fix the remaining to the
- // original total cost
- if(found != 1 && action->generic_action.remains == 0 ){
- action->generic_action.remains = action->generic_action.cost;
- }
-
- XBT_DEBUG("Action (%p) remains new value: %f", action,
- action->generic_action.remains);
-
-#ifdef HAVE_TRACING
- if (TRACE_is_enabled()) {
- double last_amount_sent = (action->generic_action.cost - action->last_remains);
- double amount_sent = (action->generic_action.cost - action->generic_action.remains);
-
- // tracing resource utilization
- xbt_dynar_t route = NULL;
-
- routing_get_route_and_latency (action->src, action->dst, &route, NULL);
-
- unsigned int i;
- for (i = 0; i < xbt_dynar_length (route); i++){
- network_link_GTNETS_t *link = ((network_link_GTNETS_t*)xbt_dynar_get_ptr (route, i));
- TRACE_surf_link_set_utilization ((*link)->generic_resource.name,
- ((surf_action_t) action)->category,
- (amount_sent - last_amount_sent)/(delta),
- now-delta,
- delta);
- }
- }
-#endif
-
-
- }
-
- for (i = 0; i < num_flows; i++) {
- action = (surf_action_network_GTNETS_t) (metadata[i]);
-
-
-
- action->generic_action.finish = now + time_to_next_flow_completion;
- action_state_set((surf_action_t) action, SURF_ACTION_DONE);
- XBT_DEBUG("----> Action (%p) just terminated", action);
-
- }
-
-
- } else { /* run for a given number of seconds */
- if (gtnets_run(delta)) {
- xbt_die("Cannot run GTNetS simulation");
- }
- }
-
- return;
-}
-
-static void update_resource_state(void *id,
- tmgr_trace_event_t event_type,
- double value, double date)
-{
- xbt_die("Cannot update model state for GTNetS simulation");
-}
-
-/* Max durations are not supported */
-static surf_action_t communicate(sg_routing_edge_t src_card,
- sg_routing_edge_t dst_card,
- double size, double rate)
-{
- surf_action_network_GTNETS_t action = NULL;
-
- int src = src_card->id;
- int dst = dst_card->id;
- char *src_name = src_card->name;
- char *dst_name = dst_card->name;
-
- xbt_assert((src >= 0
- && dst >= 0), "Either src or dst have invalid id (id<0)");
-
- XBT_DEBUG("Setting flow src %d \"%s\", dst %d \"%s\"", src, src_name, dst,
- dst_name);
-
- xbt_dynar_t route = NULL;
-
- routing_get_route_and_latency(src_card, dst_card, &route, NULL);
-
- route_new(src, dst, route, xbt_dynar_length(route));
-
- action =
- surf_action_new(sizeof(s_surf_action_network_GTNETS_t), size,
- surf_network_model, 0);
-
-#ifdef HAVE_TRACING
- action->last_remains = 0;
-#endif
-
- /* Add a flow to the GTNets Simulation, associated to this action */
- if (gtnets_create_flow(src, dst, size, (void *) action) < 0) {
- xbt_die("Not route between host %s and host %s", src_name, dst_name);
- }
-#ifdef HAVE_TRACING
- TRACE_surf_gtnets_communicate(action, src_card, dst_card);
-#endif
-
- return (surf_action_t) action;
-}
-
-/* Suspend a flow() */
-static void action_suspend(surf_action_t action)
-{
- THROW_UNIMPLEMENTED;
-}
-
-/* Resume a flow() */
-static void action_resume(surf_action_t action)
-{
- THROW_UNIMPLEMENTED;
-}
-
-/* Test whether a flow is suspended */
-static int action_is_suspended(surf_action_t action)
-{
- return 0;
-}
-
-#ifdef HAVE_TRACING
-static void gtnets_action_set_category(surf_action_t action, const char *category)
-{
- action->category = xbt_strdup (category);
-}
-#endif
-
-static void finalize(surf_model_t network_model)
-{
- gtnets_finalize();
-}
-
-static void surf_network_model_init_internal(void)
-{
- surf_network_model = surf_model_init();
-
- surf_network_model->name = "network GTNetS";
- surf_network_model->type = SURF_MODEL_TYPE_NETWORK;
- surf_network_model->action_unref = action_unref;
- surf_network_model->action_cancel = action_cancel;
- surf_network_model->action_recycle = action_recycle;
- surf_network_model->action_state_set = action_state_set;
- surf_network_model->get_remains = action_get_remains;
-
- surf_network_model->model_private->resource_used = resource_used;
- surf_network_model->model_private->share_resources = share_resources;
- surf_network_model->model_private->update_actions_state =
- update_actions_state;
- surf_network_model->model_private->update_resource_state =
- update_resource_state;
- surf_network_model->model_private->finalize = finalize;
-
- surf_network_model->suspend = action_suspend;
- surf_network_model->resume = action_resume;
- surf_network_model->is_suspended = action_is_suspended;
-#ifdef HAVE_TRACING
- surf_network_model->set_category = gtnets_action_set_category;
-#endif
-
- surf_network_model->extension.network.communicate = communicate;
-
- /* Added the initialization for GTNetS interface */
- if (gtnets_initialize(sg_tcp_gamma)) {
- xbt_die("Impossible to initialize GTNetS interface");
- }
-
- routing_model_create(NULL);
-}
-
-#ifdef HAVE_LATENCY_BOUND_TRACKING
-static int get_latency_limited(surf_action_t action)
-{
- return 0;
-}
-#endif
-
-void surf_network_model_init_GTNETS(void)
-{
- if (surf_network_model)
- return;
-
- surf_network_model_init_internal();
- define_callbacks();
- xbt_dynar_push(model_list, &surf_network_model);
-
-#ifdef HAVE_LATENCY_BOUND_TRACKING
- surf_network_model->get_latency_limited = get_latency_limited;
-#endif
-
- if (sg_gtnets_jitter > 0.0) {
- gtnets_set_jitter(sg_gtnets_jitter);
- gtnets_set_jitter_seed(sg_gtnets_jitter_seed);
- }
-}
+++ /dev/null
-/* Copyright (c) 2007-2012. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#ifndef _SURF_NETWORK_GTNETS_PRIVATE_H
-#define _SURF_NETWORK_GTNETS_PRIVATE_H
-
-#include "surf_private.h"
-#include "xbt/dict.h"
-
-typedef struct network_link_GTNETS {
- s_surf_resource_t generic_resource; /* Must remain first to allow casting */
- /* Using this object with the public part of
- model does not make sense */
- double bw_current;
- double lat_current;
- int id;
-} s_network_link_GTNETS_t, *network_link_GTNETS_t;
-
-typedef struct surf_action_network_GTNETS {
- s_surf_action_t generic_action;
- double latency;
- double lat_current;
-#ifdef HAVE_TRACING
- int last_remains;
-#endif
- lmm_variable_t variable;
- double rate;
- int suspended;
-#ifdef HAVE_TRACING
- sg_routing_edge_t src;
- sg_routing_edge_t dst;
-#endif //HAVE_TRACING
-} s_surf_action_network_GTNETS_t, *surf_action_network_GTNETS_t;
-
-xbt_dict_t network_card_ids;
-
-
-
-#endif /* _SURF_NETWORK_PRIVATE_H */
}
NetworkLink::NetworkLink(NetworkModelPtr model, const char *name, xbt_dict_t props)
-: p_latEvent(NULL)
+: Resource(model, name, props)
+, p_latEvent(NULL)
{}
NetworkLink::NetworkLink(NetworkModelPtr model, const char *name, xbt_dict_t props,
-/*
- * network_interface.hpp
- *
- * Created on: Nov 29, 2013
- * Author: bedaride
- */
+/* Copyright (c) 2004-2013. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
#include "surf_interface.hpp"
#include "surf_routing.hpp"
/*********
* Model *
*********/
+/** @ingroup SURF_network_interface
+ * @brief SURF network model interface class
+ * @details A model is an object which handle the interactions between its Resources and its Actions
+ */
class NetworkModel : public Model {
public:
+ /**
+ * @brief NetworkModel constructor
+ */
NetworkModel() : Model("network") {
};
+
+ /**
+ * @brief NetworkModel constructor
+ *
+ * @param name The name of the NetworkModel
+ */
NetworkModel(const char *name) : Model(name) {
f_networkSolve = lmm_solve;
m_haveGap = false;
};
+
+ /**
+ * @brief The destructor of the NetworkModel
+ */
~NetworkModel() {
if (p_maxminSystem)
lmm_system_free(p_maxminSystem);
delete p_modifiedSet;
}
+ /**
+ * @brief Create a NetworkLink
+ *
+ * @param name The name of the NetworkLink
+ * @param bw_initial The initial bandwidth of the NetworkLink in bytes per second
+ * @param bw_trace The trace associated to the NetworkLink bandwidth [TODO]
+ * @param lat_initial The initial latency of the NetworkLink in seconds
+ * @param lat_trace The trace associated to the NetworkLink latency [TODO]
+ * @param state_initial The initial NetworkLink (state)[e_surf_resource_state_t]
+ * @param state_trace The trace associated to the NetworkLink (state)[e_surf_resource_state_t] [TODO]
+ * @param policy The sharing policy of the NetworkLink
+ * @param properties Dictionary of properties associated to this Resource
+ * @return The created NetworkLink
+ */
virtual NetworkLinkPtr createResource(const char *name,
double bw_initial,
tmgr_trace_t bw_trace,
e_surf_link_sharing_policy_t policy,
xbt_dict_t properties)=0;
+
virtual void gapAppend(double /*size*/, const NetworkLinkPtr /*link*/, NetworkActionPtr /*action*/) {};
+
+ /**
+ * @brief Create a communication between two [TODO]
+ * @details [TODO]
+ *
+ * @param src The source [TODO]
+ * @param dst The destination [TODO]
+ * @param size The size of the communication in bytes
+ * @param rate The
+ * @return The action representing the communication
+ */
virtual ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
double size, double rate)=0;
+
+ /**
+ * @brief Get the route between two RoutingEdge
+ * @details [TODO]
+ *
+ * @param src [TODO]
+ * @param dst [TODO]
+ *
+ * @return A xbt_dynar_t of [TODO]
+ */
virtual xbt_dynar_t getRoute(RoutingEdgePtr src, RoutingEdgePtr dst); //FIXME: kill field? That is done by the routing nowadays
+
+ /**
+ * @brief Function pointer to the function to use to solve the lmm_system_t
+ *
+ * @param system The lmm_system_t to solve
+ */
void (*f_networkSolve)(lmm_system_t);
+
+ /**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param size [description]
+ * @return [description]
+ */
virtual double latencyFactor(double size);
+
+ /**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param size [description]
+ * @return [description]
+ */
virtual double bandwidthFactor(double size);
+
+ /**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param rate [description]
+ * @param bound [description]
+ * @param size [description]
+ * @return [description]
+ */
virtual double bandwidthConstraint(double rate, double bound, double size);
bool m_haveGap;
};
/************
* Resource *
************/
-
+ /** @ingroup SURF_network_interface
+ * @brief SURF network link interface class
+ * @details A NetworkLink represent the link between two [Workstations](\ref Workstation)
+ */
class NetworkLink : public Resource {
public:
+ /**
+ * @brief NetworkLink constructor
+ *
+ * @param model The CpuModel associated to this NetworkLink
+ * @param name The name of the NetworkLink
+ * @param props Dictionary of properties associated to this NetworkLink
+ */
NetworkLink(NetworkModelPtr model, const char *name, xbt_dict_t props);
+
+ /**
+ * @brief NetworkLink constructor
+ *
+ * @param model The CpuModel associated to this NetworkLink
+ * @param name The name of the NetworkLink
+ * @param props Dictionary of properties associated to this NetworkLink
+ * @param constraint The lmm constraint associated to this Cpu if it is part of a LMM component
+ * @param history [TODO]
+ * @param state_trace [TODO]
+ */
NetworkLink(NetworkModelPtr model, const char *name, xbt_dict_t props,
lmm_constraint_t constraint,
tmgr_history_t history,
tmgr_trace_t state_trace);
+
+ /**
+ * @brief Get the bandwidth in bytes per second of current NetworkLink
+ *
+ * @return The bandwith in bytes per second of the current NetworkLink
+ */
virtual double getBandwidth();
+
+ /**
+ * @brief Get the latency in seconds of current NetworkLink
+ *
+ * @return The latency in seconds of the current NetworkLink
+ */
virtual double getLatency();
+
+ /**
+ * @brief Check if the NetworkLink is shared
+ * @details [long description]
+ *
+ * @return true if the current NetwokrLink is shared, false otherwise
+ */
virtual bool isShared();
+
+ /**
+ * @brief Check if the NetworkLink is used
+ *
+ * @return true if the current NetwokrLink is used, false otherwise
+ */
bool isUsed();
/* Using this object with the public part of
/**********
* Action *
**********/
+/** @ingroup SURF_network_interface
+ * @brief SURF network action interface class
+ * @details A NetworkAction represent a communication bettween two [Workstations](\ref Workstation)
+ */
class NetworkAction : public Action {
public:
+ /**
+ * @brief NetworkAction constructor
+ *
+ * @param model The NetworkModel associated to this NetworkAction
+ * @param cost The cost of this NetworkAction in [TODO]
+ * @param failed [description]
+ */
NetworkAction(ModelPtr model, double cost, bool failed)
: Action(model, cost, failed) {}
+
+ /**
+ * @brief NetworkAction constructor
+ *
+ * @param model The NetworkModel associated to this NetworkAction
+ * @param cost The cost of this NetworkAction in [TODO]
+ * @param failed [description]
+ * @param var The lmm variable associated to this Action if it is part of a LMM component
+ */
NetworkAction(ModelPtr model, double cost, bool failed, lmm_variable_t var)
: Action(model, cost, failed, var) {};
+
double m_latency;
double m_latCurrent;
double m_weight;
--- /dev/null
+/* Copyright (c) 2010, 2012-2013. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "energy.hpp"
+#include "../cpu_cas01.hpp"
+
+/** @addtogroup SURF_plugin_energy
+ *
+ *
+ * BlaBla energy
+ */
+
+XBT_LOG_EXTERNAL_CATEGORY(surf_kernel);
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_energy, surf,
+ "Logging specific to the SURF energy plugin");
+
+std::map<CpuPtr, CpuEnergyPtr> *surf_energy=NULL;
+
+static void createCpuCallback(CpuPtr cpu){
+ (*surf_energy)[cpu] = new CpuEnergy(cpu);
+}
+
+static void deleteCpuCallback(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);
+}
+
+static void updateActionEnergyCallback(CpuActionPtr action){
+ CpuPtr cpu = getActionCpu(action);
+ 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);
+
+ cpu_energy->total_energy = current_energy + action_energy;
+ cpu_energy->last_updated = finish_time;
+
+ XBT_DEBUG("[cpu_update_energy] old_energy_value=%f, action_energy_value=%f", current_energy, action_energy);
+ }
+}
+
+/** \ingroup SURF_plugin_energy
+ * \brief Enable energy plugin
+ * \details Enable energy plugin to get joules consumption of each cpu.
+ */
+void sg_energy_plugin_init() {
+ if (surf_energy == NULL) {
+ surf_energy = new std::map<CpuPtr, CpuEnergyPtr>();
+ surf_callback_connect(createCpuCallbacks, createCpuCallback);
+ surf_callback_connect(deleteCpuCallbacks, deleteCpuCallback);
+ surf_callback_connect(updateCpuActionCallbacks, updateActionEnergyCallback);
+ }
+}
+
+/**
+ *
+ */
+CpuEnergy::CpuEnergy(CpuPtr ptr)
+ : cpu(ptr)
+{
+ total_energy = 0;
+ power_range_watts_list = getWattsRangeList();
+ last_updated = surf_get_clock();
+}
+
+CpuEnergy::~CpuEnergy(){
+ unsigned int iter;
+ xbt_dynar_t power_tuple = NULL;
+ xbt_dynar_foreach(power_range_watts_list, iter, power_tuple)
+ xbt_dynar_free(&power_tuple);
+ xbt_dynar_free(&power_range_watts_list);
+}
+
+
+/**
+ * Computes the power consumed by the host according to the current pstate and processor load
+ *
+ */
+double CpuEnergy::getCurrentWattsValue(double cpu_load)
+{
+ xbt_dynar_t power_range_list = power_range_watts_list;
+
+ if (power_range_list == NULL)
+ {
+ XBT_DEBUG("No power range properties specified for host %s", cpu->getName());
+ return 0;
+ }
+ /*xbt_assert(xbt_dynar_length(power_range_list) == xbt_dynar_length(cpu->p_powerPeakList),
+ "The number of power ranges in the properties does not match the number of pstates for host %s",
+ cpu->getName());*/
+
+ /* retrieve the power values associated with the current pstate */
+ xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01Ptr>(cpu)->m_pstate, xbt_dynar_t);
+
+ /* min_power corresponds to the idle power (cpu load = 0) */
+ /* max_power is the power consumed at 100% cpu load */
+ double min_power = xbt_dynar_get_as(current_power_values, 0, double);
+ double max_power = xbt_dynar_get_as(current_power_values, 1, double);
+ double power_slope = max_power - min_power;
+
+ double current_power = min_power + cpu_load * power_slope;
+
+ XBT_DEBUG("[get_current_watts] min_power=%f, max_power=%f, slope=%f", min_power, max_power, power_slope);
+ XBT_DEBUG("[get_current_watts] Current power (watts) = %f, load = %f", current_power, cpu_load);
+
+ return current_power;
+}
+
+double CpuEnergy::getConsumedEnergy()
+{
+ return total_energy;
+}
+
+xbt_dynar_t CpuEnergy::getWattsRangeList()
+{
+ xbt_dynar_t power_range_list;
+ xbt_dynar_t power_tuple;
+ int i = 0, pstate_nb=0;
+ xbt_dynar_t current_power_values;
+ double min_power, max_power;
+
+ if (cpu->getProperties() == NULL)
+ return NULL;
+
+ char* all_power_values_str = (char*)xbt_dict_get_or_null(cpu->getProperties(), "power_per_state");
+
+ if (all_power_values_str == NULL)
+ return NULL;
+
+
+ power_range_list = xbt_dynar_new(sizeof(xbt_dynar_t), NULL);
+ xbt_dynar_t all_power_values = xbt_str_split(all_power_values_str, ",");
+
+ pstate_nb = xbt_dynar_length(all_power_values);
+ for (i=0; i< pstate_nb; i++)
+ {
+ /* retrieve the power values associated with the current pstate */
+ current_power_values = xbt_str_split(xbt_dynar_get_as(all_power_values, i, char*), ":");
+ xbt_assert(xbt_dynar_length(current_power_values) > 1,
+ "Power properties incorrectly defined - could not retrieve min and max power values for host %s",
+ cpu->getName());
+
+ /* min_power corresponds to the idle power (cpu load = 0) */
+ /* max_power is the power consumed at 100% cpu load */
+ min_power = atof(xbt_dynar_get_as(current_power_values, 0, char*));
+ max_power = atof(xbt_dynar_get_as(current_power_values, 1, char*));
+
+ power_tuple = xbt_dynar_new(sizeof(double), NULL);
+ xbt_dynar_push_as(power_tuple, double, min_power);
+ xbt_dynar_push_as(power_tuple, double, max_power);
+
+ xbt_dynar_push_as(power_range_list, xbt_dynar_t, power_tuple);
+ xbt_dynar_free(¤t_power_values);
+ }
+ xbt_dynar_free(&all_power_values);
+ return power_range_list;
+}
--- /dev/null
+/*
+ * callback.hpp
+ *
+ * Created on: Jan 10, 2014
+ * Author: bedaride
+ */
+#include "../cpu_interface.hpp"
+#include <map>
+
+#ifndef CALLBACK_HPP_
+#define CALLBACK_HPP_
+
+class CpuEnergy;
+typedef CpuEnergy *CpuEnergyPtr;
+
+extern std::map<CpuPtr, CpuEnergyPtr> *surf_energy;
+
+class CpuEnergy {
+public:
+ CpuEnergy(CpuPtr ptr);
+ ~CpuEnergy();
+
+ 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 */
+ double total_energy; /*< Total energy consumed by the host */
+ double last_updated; /*< Timestamp of the last energy update event*/
+ CpuPtr cpu;
+};
+
+#endif /* CALLBACK_HPP_ */
+/* Copyright (c) 2004-2013. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
#include "surf_interface.hpp"
#ifndef STORAGE_INTERFACE_HPP_
/*********
* Model *
*********/
+/** @ingroup SURF_storage_interface
+ * @brief SURF storage model interface class
+ * @details A model is an object which handle the interactions between its Resources and its Actions
+ */
class StorageModel : public Model {
public:
+ /**
+ * @brief The storage model constructor
+ */
StorageModel();
+
+ /**
+ * @brief The Storange model destructor
+ */
~StorageModel();
+
+ /**
+ * @brief Create a Storage
+ *
+ * @param id [description]
+ * @param type_id [description]
+ * @param content_name [description]
+ * @param content_type [description]
+ * @param properties [description]
+ * @return The created Storage
+ */
virtual StoragePtr createResource(const char* id, const char* type_id,
const char* content_name, const char* content_type, xbt_dict_t properties)=0;
/************
* Resource *
************/
-
+/** @ingroup SURF_storage_interface
+ * @brief SURF storage interface class
+ * @details A Storage represent a storage unit (e.g.: hard drive, usb key)
+ */
class Storage : public Resource {
public:
+ /**
+ * @brief Storage constructor
+ *
+ * @param model StorageModel associated to this Storage
+ * @param name The name of the Storage
+ * @param props Dictionary of properties associated to this Storage
+ * @param constraint The lmm constraint associated to this Storage if it is part of a LMM component
+ * @param model [description]
+ * @param name [description]
+ * @param props [description]
+ * @param type_id [description]
+ * @param content_name [description]
+ * @param content_type [description]
+ * @param size [description]
+ */
Storage(ModelPtr model, const char *name, xbt_dict_t props,
const char* type_id, char *content_name, char *content_type, sg_size_t size);
+
+ /**
+ * @brief Storage constructor
+ *
+ * @param model StorageModel associated to this Storage
+ * @param name The name of the Storage
+ * @param props Dictionary of properties associated to this Storage
+ * @param constraint The lmm constraint associated to this Storage if it is part of a LMM component
+ * @param maxminSystem [description]
+ * @param bread [description]
+ * @param bwrite [description]
+ * @param bconnection [description]
+ * @param type_id [description]
+ * @param content_name [description]
+ * @param content_type [description]
+ * @param size [description]
+ */
Storage(ModelPtr model, const char *name, xbt_dict_t props,
lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
const char* type_id, char *content_name, char *content_type, sg_size_t size);
+
+ /**
+ * @brief Storage destructor
+ */
~Storage();
+ /**
+ * @brief Check if the Storage is used
+ *
+ * @return true if the current Storage is used, false otherwise
+ */
bool isUsed();
+
+ /**
+ * @brief Update the state of the current Storage
+ *
+ * @param event_type [description]
+ * @param value [description]
+ * @param date [description]
+ */
void updateState(tmgr_trace_event_t event_type, double value, double date);
xbt_dict_t p_content;
sg_size_t m_usedSize;
char * p_typeId;
+ /**
+ * @brief Open a file
+ *
+ * @param mount The mount point
+ * @param path The path to the file
+ *
+ * @return The StorageAction corresponding to the opening
+ */
virtual StorageActionPtr open(const char* mount, const char* path)=0;
+
+ /**
+ * @brief Close a file
+ *
+ * @param fd The file descriptor to close
+ * @return The StorageAction corresponding to the closing
+ */
virtual StorageActionPtr close(surf_file_t fd)=0;
- //virtual StorageActionPtr unlink(surf_file_t fd)=0;
+
+ /**
+ * @brief List directory contents of a path
+ * @details [long description]
+ *
+ * @param path The path to the directory
+ * @return The StorageAction corresponding to the ls action
+ */
virtual StorageActionPtr ls(const char *path)=0;
+
+ /**
+ * @brief Read a file
+ *
+ * @param fd The file descriptor to read
+ * @param size The size in bytes to read
+ * @return The StorageAction corresponding to the reading
+ */
virtual StorageActionPtr read(surf_file_t fd, sg_size_t size)=0;
+
+ /**
+ * @brief Write a file
+ *
+ * @param fd The file descriptor to write
+ * @param size The size in bytes to write
+ * @return The StorageAction corresponding to the writing
+ */
virtual StorageActionPtr write(surf_file_t fd, sg_size_t size)=0;
+
+ /**
+ * @brief Rename a path
+ *
+ * @param src The old path
+ * @param dest The new path
+ */
virtual void rename(const char *src, const char *dest)=0;
+ /**
+ * @brief Get the content of the current Storage
+ *
+ * @return A xbt_dict_t with path as keys and size in bytes as values
+ */
virtual xbt_dict_t getContent();
+
+ /**
+ * @brief Get the size in bytes of the current Storage
+ *
+ * @return The size in bytes of the current Storage
+ */
virtual sg_size_t getSize();
xbt_dict_t parseContent(char *filename);
* Action *
**********/
+/** @ingroup SURF_storage_interface
+ * @brief The possible type of action for the storage component
+ */
typedef enum {
- READ=0, WRITE, STAT, OPEN, CLOSE, LS
+ READ=0, /**< Read a file */
+ WRITE, /**< Write in a file */
+ STAT, /**< Stat a file */
+ OPEN, /**< Open a file */
+ CLOSE, /**< Close a file */
+ LS /**< List directory contents */
} e_surf_action_storage_type_t;
-
+/** @ingroup SURF_storage_interface
+ * @brief SURF storage action interface class
+ */
class StorageAction : public Action {
public:
+ /**
+ * @brief StorageAction constructor
+ */
StorageAction() : m_type(READ) {};//FIXME:REMOVE
+
+ /**
+ * @brief StorageAction constructor
+ *
+ * @param model The StorageModel associated to this StorageAction
+ * @param cost The cost of this NetworkAction in [TODO]
+ * @param failed [description]
+ * @param storage The Storage associated to this StorageAction
+ * @param type [description]
+ */
StorageAction(ModelPtr model, double cost, bool failed,
- StoragePtr storage, e_surf_action_storage_type_t type);
+ StoragePtr storage, e_surf_action_storage_type_t type);
+
+ /**
+ * @brief StorageAction constructor
+ *
+ * @param model The StorageModel associated to this StorageAction
+ * @param cost The cost of this StorageAction in [TODO]
+ * @param failed [description]
+ * @param var The lmm variable associated to this StorageAction if it is part of a LMM component
+ * @param storage The Storage associated to this StorageAction
+ * @param type [description]
+ */
StorageAction(ModelPtr model, double cost, bool failed, lmm_variable_t var,
- StoragePtr storage, e_surf_action_storage_type_t type);
+ StoragePtr storage, e_surf_action_storage_type_t type);
e_surf_action_storage_type_t m_type;
StoragePtr p_storage;
#include "network_interface.hpp"
#include "surf_routing_cluster.hpp"
#include "instr/instr_private.h"
+#include "plugins/energy.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_kernel);
model->getDoneActionSet()->pop_front();
return res;
}
+
surf_action_t surf_model_extract_failed_action_set(surf_model_t model){
if (model->getFailedActionSet()->empty())
return NULL;
model->getFailedActionSet()->pop_front();
return res;
}
+
surf_action_t surf_model_extract_ready_action_set(surf_model_t model){
if (model->getReadyActionSet()->empty())
return NULL;
model->getReadyActionSet()->pop_front();
return res;
}
+
surf_action_t surf_model_extract_running_action_set(surf_model_t model){
if (model->getRunningActionSet()->empty())
return NULL;
}
double surf_workstation_get_consumed_energy(surf_resource_t resource){
- return get_casted_workstation(resource)->getConsumedEnergy();
+ xbt_assert(surf_energy!=NULL, "The Energy plugin is not active.");
+ std::map<CpuPtr, CpuEnergyPtr>::iterator cpuIt = surf_energy->find(get_casted_workstation(resource)->p_cpu);
+ return cpuIt->second->getConsumedEnergy();
}
xbt_dict_t surf_workstation_get_storage_list(surf_resource_t workstation){
xbt_dict_t surf_storage_action_get_ls_dict(surf_action_t action){
return static_cast<StorageActionPtr>(action)->p_lsDict;
}
-
-
+/* Copyright (c) 2004-2014. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
#include "surf_private.h"
#include "surf_interface.hpp"
#include "network_interface.hpp"
xbt_dynar_t host_that_restart = NULL;
xbt_dict_t watched_hosts_lib;
+s_surf_model_description_t surf_plugin_description[] = {
+ {"Energy",
+ "Cpu energy consumption.",
+ sg_energy_plugin_init},
+ {NULL, NULL, NULL} /* this array must be NULL terminated */
+};
+
/* Don't forget to update the option description in smx_config when you change this */
s_surf_model_description_t surf_network_model_description[] = {
{"LV08",
NOW = 0; /* Just in case the user plans to restart the simulation afterward */
}
+
/*********
* Model *
*********/
Model::Model(const char *name)
- : p_name(name), p_maxminSystem(0),
- m_resOnCB(0), m_resOffCB(0),
- m_actCancelCB(0), m_actSuspendCB(0), m_actResumeCB(0)
+ : p_maxminSystem(NULL)
+ , p_name(name)
{
p_readyActionSet = new ActionList();
p_runningActionSet = new ActionList();
double value;
XBT_DEBUG
- ("Before share resources, the size of modified actions set is %d",
+ ("Before share resources, the size of modified actions set is %zd",
p_modifiedSet->size());
lmm_solve(p_maxminSystem);
XBT_DEBUG
- ("After share resources, The size of modified actions set is %d",
+ ("After share resources, The size of modified actions set is %zd",
p_modifiedSet->size());
while(!p_modifiedSet->empty()) {
THROW_UNIMPLEMENTED;
}
-
double Model::shareResourcesMaxMin(ActionListPtr running_actions,
lmm_system_t sys,
void (*solve) (lmm_system_t))
{
- void *_action = NULL;
ActionPtr action = NULL;
double min = -1;
double value = -1;
void Model::updateActionsStateLazy(double /*now*/, double /*delta*/)
{
-
}
void Model::updateActionsStateFull(double /*now*/, double /*delta*/)
{
-
-}
-
-
-void Model::addTurnedOnCallback(ResourceCallback rc)
-{
- m_resOnCB = rc;
-}
-
-void Model::notifyResourceTurnedOn(ResourcePtr r)
-{
- m_resOnCB(r);
-}
-
-void Model::addTurnedOffCallback(ResourceCallback rc)
-{
- m_resOffCB = rc;
-}
-
-void Model::notifyResourceTurnedOff(ResourcePtr r)
-{
- m_resOffCB(r);
-}
-
-void Model::addActionCancelCallback(ActionCallback ac)
-{
- m_actCancelCB = ac;
-}
-
-void Model::notifyActionCancel(ActionPtr a)
-{
- m_actCancelCB(a);
-}
-
-void Model::addActionResumeCallback(ActionCallback ac)
-{
- m_actResumeCB = ac;
-}
-
-void Model::notifyActionResume(ActionPtr a)
-{
- m_actResumeCB(a);
}
-void Model::addActionSuspendCallback(ActionCallback ac)
-{
- m_actSuspendCB = ac;
-}
-
-void Model::notifyActionSuspend(ActionPtr a)
-{
- m_actSuspendCB(a);
-}
-
-
/************
* Resource *
************/
{}
Resource::Resource(surf_model_t model, const char *name, xbt_dict_t props)
- : p_name(xbt_strdup(name)), p_properties(props), p_model(model)
- , m_running(true), m_stateCurrent(SURF_RESOURCE_ON)
+ : m_stateCurrent(SURF_RESOURCE_ON)
+ , p_name(xbt_strdup(name)), p_properties(props), p_model(model)
+ , m_running(true)
{}
Resource::Resource(surf_model_t model, const char *name, xbt_dict_t props, lmm_constraint_t constraint)
- : p_name(xbt_strdup(name)), p_properties(props), p_model(model)
- , m_running(true), m_stateCurrent(SURF_RESOURCE_ON), p_constraint(constraint)
+ : m_stateCurrent(SURF_RESOURCE_ON)
+ , p_name(xbt_strdup(name)), p_properties(props), p_model(model)
+ , m_running(true), p_constraint(constraint)
{}
Resource::Resource(surf_model_t model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit)
- : p_name(xbt_strdup(name)), p_properties(props), p_model(model)
- , m_running(true), m_stateCurrent(stateInit)
+ : m_stateCurrent(stateInit)
+ , p_name(xbt_strdup(name)), p_properties(props), p_model(model)
+ , m_running(true)
{}
+Resource::~Resource() {
+ xbt_free((void*)p_name);
+ xbt_dict_free(&p_properties);
+}
+
e_surf_resource_state_t Resource::getState()
{
return m_stateCurrent;
{
if (!m_running) {
m_running = true;
- getModel()->notifyResourceTurnedOn(this);
}
}
{
if (m_running) {
m_running = false;
- getModel()->notifyResourceTurnedOff(this);
}
}
+ModelPtr Resource::getModel() {
+ return p_model;
+}
+
+const char *Resource::getName() {
+ return p_name;
+}
+
+xbt_dict_t Resource::getProperties() {
+ return p_properties;
+}
+
+lmm_constraint_t Resource::getConstraint() {
+ return p_constraint;
+}
+
/**********
* Action *
**********/
Action::Action(ModelPtr model, double cost, bool failed)
: m_priority(1.0)
- , m_failed(failed)
- , m_start(surf_get_clock()), m_finish(-1.0)
+ , m_refcount(1)
, m_remains(cost)
, m_maxDuration(NO_MAX_DURATION)
+ , m_finish(-1.0)
+ , m_failed(failed)
+ , m_start(surf_get_clock())
, m_cost(cost)
- , p_data(NULL)
, p_model(model)
- , m_refcount(1)
+ , p_data(NULL)
+ , p_variable(NULL)
, m_lastValue(0)
, m_lastUpdate(0)
, m_suspended(false)
- , p_variable(NULL)
{
#ifdef HAVE_TRACING
p_category = NULL;
Action::Action(ModelPtr model, double cost, bool failed, lmm_variable_t var)
: m_priority(1.0)
- , m_failed(failed)
- , m_start(surf_get_clock()), m_finish(-1.0)
+ , m_refcount(1)
, m_remains(cost)
, m_maxDuration(NO_MAX_DURATION)
+ , m_finish(-1.0)
+ , m_failed(failed)
+ , m_start(surf_get_clock())
, m_cost(cost)
- , p_data(NULL)
, p_model(model)
- , m_refcount(1)
+ , p_data(NULL)
+ , p_variable(var)
, m_lastValue(0)
, m_lastUpdate(0)
, m_suspended(false)
- , p_variable(var)
{
#ifdef HAVE_TRACING
p_category = NULL;
-//using namespace generic;
+/* Copyright (c) 2004-2014. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
#ifndef SURF_MODEL_H_
#define SURF_MODEL_H_
#include "simgrid/platf_interface.h"
#include "surf/surf.h"
#include "surf/surf_private.h"
+#include "internal_config.h"
+
+#ifdef LIBSIGC
+#include <sigc++/sigc++.h>
+#define surf_callback(arg1, ...) sigc::signal<arg1,__VA_ARGS__>
+#define surf_callback_connect(callback, fun_ptr) callback.connect(sigc::ptr_fun(fun_ptr))
+#define surf_callback_emit(callback, ...) callback.emit(__VA_ARGS__)
+#else
+#include <boost/signals2.hpp>
+#define surf_callback(arg1, ...) boost::signals2::signal<arg1(__VA_ARGS__)>
+#define surf_callback_connect(callback, fun_ptr) callback.connect(fun_ptr)
+#define surf_callback_emit(callback, ...) callback(__VA_ARGS__)
+#endif
extern tmgr_history_t history;
#define NO_MAX_DURATION -1.0
using namespace std;
-/** \ingroup SURF_simulation
- * \brief Return the current time
- *
- * Return the current time in millisecond.
- */
-
/*********
* Utils *
*********/
//class Resource;
typedef Resource* ResourcePtr;
-typedef boost::function<void (ResourcePtr r)> ResourceCallback;
//class Action;
typedef Action* ActionPtr;
-typedef boost::function<void (ActionPtr a)> ActionCallback;
typedef boost::intrusive::list<Action> ActionList;
typedef ActionList* ActionListPtr;
typedef ActionLmmList* ActionLmmListPtr;
typedef boost::intrusive::list_base_hook<boost::intrusive::tag<lmmTag> > actionLmmHook;
+
enum heap_action_type{
LATENCY = 100,
MAX_DURATION,
XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_bandwidth;
XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_latency;
-
/*********
* Model *
*********/
XBT_PUBLIC_DATA(xbt_dynar_t) model_list;
+/** @ingroup SURF_interface
+ * @brief SURF model interface class
+ * @details A model is an object which handle the interactions between its Resources and its Actions
+ */
class Model {
- const char *p_name;
-
- ActionListPtr p_readyActionSet; /**< Actions in state SURF_ACTION_READY */
- ActionListPtr p_runningActionSet; /**< Actions in state SURF_ACTION_RUNNING */
- ActionListPtr p_failedActionSet; /**< Actions in state SURF_ACTION_FAILED */
- ActionListPtr p_doneActionSet; /**< Actions in state SURF_ACTION_DONE */
-
- ResourceCallback m_resOnCB, m_resOffCB;
- ActionCallback m_actCancelCB, m_actSuspendCB, m_actResumeCB;
-
-protected:
- ActionLmmListPtr p_modifiedSet;
-
- lmm_system_t p_maxminSystem;
- e_UM_t p_updateMechanism;
- int m_selectiveUpdate;
- xbt_heap_t p_actionHeap;
-
public:
+ /**
+ * @brief Model constructor
+ *
+ * @param name the name of the model
+ */
Model(const char *name);
+
+ /**
+ * @brief Model destructor
+ */
virtual ~Model();
+ /**
+ * @brief Get the name of the current Model
+ *
+ * @return The name of the current Model
+ */
const char *getName() {return p_name;}
+
+ /**
+ * @brief Get the set of [actions](@ref Action) in *ready* state
+ *
+ * @return The set of [actions](@ref Action) in *ready* state
+ */
virtual ActionListPtr getReadyActionSet() {return p_readyActionSet;}
+
+ /**
+ * @brief Get the set of [actions](@ref Action) in *running* state
+ *
+ * @return The set of [actions](@ref Action) in *running* state
+ */
virtual ActionListPtr getRunningActionSet() {return p_runningActionSet;}
+
+ /**
+ * @brief Get the set of [actions](@ref Action) in *failed* state
+ *
+ * @return The set of [actions](@ref Action) in *failed* state
+ */
virtual ActionListPtr getFailedActionSet() {return p_failedActionSet;}
+
+ /**
+ * @brief Get the set of [actions](@ref Action) in *done* state
+ *
+ * @return The set of [actions](@ref Action) in *done* state
+ */
virtual ActionListPtr getDoneActionSet() {return p_doneActionSet;}
+
+ /**
+ * @brief Get the set of modified [actions](@ref Action)
+ *
+ * @return The set of modified [actions](@ref Action)
+ */
virtual ActionLmmListPtr getModifiedSet() {return p_modifiedSet;}
+
+ /**
+ * @brief Get the maxmin system of the current Model
+ *
+ * @return The maxmin system of the current Model
+ */
lmm_system_t getMaxminSystem() {return p_maxminSystem;}
+
+ /**
+ * @brief Get the update mechanism of the current Model
+ * @see e_UM_t
+ *
+ * @return [description]
+ */
e_UM_t getUpdateMechanism() {return p_updateMechanism;}
+
+ /**
+ * @brief Get Action heap
+ * @details [TODO]
+ *
+ * @return The Action heap
+ */
xbt_heap_t getActionHeap() {return p_actionHeap;}
- ActionPtr createAction(double _cost, bool _failed);
+ /**
+ * @brief share the resources
+ * @details Share the resources between the actions
+ *
+ * @param
+ * @return the date of the next action will finish
+ */
virtual double shareResources(double now);
virtual double shareResourcesLazy(double now);
virtual double shareResourcesFull(double now);
double shareResourcesMaxMin(ActionListPtr running_actions,
lmm_system_t sys,
void (*solve) (lmm_system_t));
+
+ /**
+ * @brief Update state of actions
+ * @details [TODO]
+ *
+ * @param now [TODO]
+ * @param delta [TODO]
+ */
virtual void updateActionsState(double now, double delta);
virtual void updateActionsStateLazy(double now, double delta);
virtual void updateActionsStateFull(double now, double delta);
- void addTurnedOnCallback(ResourceCallback rc);
- void notifyResourceTurnedOn(ResourcePtr r);
+protected:
+ ActionLmmListPtr p_modifiedSet;
+ lmm_system_t p_maxminSystem;
+ e_UM_t p_updateMechanism;
+ int m_selectiveUpdate;
+ xbt_heap_t p_actionHeap;
- void addTurnedOffCallback(ResourceCallback rc);
- void notifyResourceTurnedOff(ResourcePtr r);
+private:
+ const char *p_name;
- void addActionCancelCallback(ActionCallback ac);
- void notifyActionCancel(ActionPtr a);
- void addActionResumeCallback(ActionCallback ac);
- void notifyActionResume(ActionPtr a);
- void addActionSuspendCallback(ActionCallback ac);
- void notifyActionSuspend(ActionPtr a);
+ ActionListPtr p_readyActionSet; /**< Actions in state SURF_ACTION_READY */
+ ActionListPtr p_runningActionSet; /**< Actions in state SURF_ACTION_RUNNING */
+ ActionListPtr p_failedActionSet; /**< Actions in state SURF_ACTION_FAILED */
+ ActionListPtr p_doneActionSet; /**< Actions in state SURF_ACTION_DONE */
};
/************
* Resource *
************/
-/**
- * Resource which have a metric handled by a maxmin system
+/** @ingroup SURF_interface
+ * @brief Resource which have a metric handled by a maxmin system
*/
typedef struct {
- double scale;
- double peak;
- tmgr_trace_event_t event;
+ double scale; /**< The scale of the metric */
+ double peak; /**< The peak of the metric */
+ tmgr_trace_event_t event; /**< The associated trace event associated to the metric */
} s_surf_metric_t;
+/** @ingroup SURF_interface
+ * @brief SURF resource interface class
+ * @details A resource represent an element of a component (e.g.: a link for the network)
+ */
class Resource {
- void *p_resource;
- const char *p_name;
- ModelPtr p_model;
- xbt_dict_t p_properties;
- bool m_running;
-
-protected:
- e_surf_resource_state_t m_stateCurrent;
-
public:
+ /**
+ * @brief Resource constructor
+ */
Resource();
+
+ /**
+ * @brief Resource constructor
+ *
+ * @param model Model associated to this Resource
+ * @param name The name of the Resource
+ * @param props Dictionary of properties associated to this Resource
+ */
Resource(ModelPtr model, const char *name, xbt_dict_t props);
- Resource(ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint);
- Resource(ModelPtr model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit);
- Resource(ModelPtr model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit, lmm_constraint_t constraint);
- virtual ~Resource() {
- xbt_free((void*)p_name);
- xbt_dict_free(&p_properties);
- };
+ /**
+ * @brief Resource constructor
+ *
+ * @param model Model associated to this Resource
+ * @param name The name of the Resource
+ * @param props Dictionary of properties associated to this Resource
+ * @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
+ */
+ Resource(ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint);
- ModelPtr getModel() {return p_model;};
- const char *getName() {return p_name;};
- virtual xbt_dict_t getProperties() {return p_properties;};
+ /**
+ * @brief Resource constructor
+ *
+ * @param model Model associated to this Resource
+ * @param name The name of the Resource
+ * @param props Dictionary of properties associated to this Resource
+ * @param stateInit the initial state of the Resource
+ */
+ Resource(ModelPtr model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit);
+ /**
+ * @brief Resource destructor
+ */
+ virtual ~Resource();
+
+ /**
+ * @brief Get the Model of the current Resource
+ *
+ * @return The Model of the current Resource
+ */
+ ModelPtr getModel();
+
+ /**
+ * @brief Get the name of the current Resource
+ *
+ * @return The name of the current Resource
+ */
+ const char *getName();
+
+ /**
+ * @brief Get the properties of the current Resource
+ *
+ * @return The properties of the current Resource
+ */
+ virtual xbt_dict_t getProperties();
+
+ /**
+ * @brief Update the state of the current Resource
+ * @details [TODO]
+ *
+ * @param event_type [TODO]
+ * @param value [TODO]
+ * @param date [TODO]
+ */
virtual void updateState(tmgr_trace_event_t event_type, double value, double date)=0;
+
+ /**
+ * @brief Check if the current Resource is used
+ * @return true if the current Resource is used, false otherwise
+ */
virtual bool isUsed()=0;
+
+ /**
+ * @brief Check if the current Resource is active
+ *
+ * @return true if the current Resource is active, false otherwise
+ */
bool isOn();
+
+ /**
+ * @brief Turn on the current Resource
+ */
void turnOn();
+
+ /**
+ * @brief Turn off the current Resource
+ */
void turnOff();
- void setName(string name);
+ /**
+ * @brief Get the [state](\ref e_surf_resource_state_t) of the current Resource
+ *
+ * @return The state of the currenrt Resource
+ */
virtual e_surf_resource_state_t getState();
+
+ /**
+ * @brief Set the [state](\ref e_surf_resource_state_t) of the current Resource
+ *
+ * @param state The new state of the current Resource
+ */
virtual void setState(e_surf_resource_state_t state);
+protected:
+ e_surf_resource_state_t m_stateCurrent;
+
+private:
+ const char *p_name;
+ xbt_dict_t p_properties;
+ ModelPtr p_model;
+ void *p_resource;
+ bool m_running;
+
/* LMM */
+public:
+ /**
+ * @brief Get the lmm constraint associated to this Resource if it is part of a LMM component
+ *
+ * @return The lmm constraint associated to this Resource
+ */
+ lmm_constraint_t getConstraint();
private:
lmm_constraint_t p_constraint;
-public:
- lmm_constraint_t getConstraint() {return p_constraint;};
-
};
/**********
**********/
void surf_action_lmm_update_index_heap(void *action, int i);
+/** @ingroup SURF_interface
+ * @brief SURF action interface class
+ * @details An action is an event generated by a resource (e.g.: a communication for the network)
+ */
class Action : public actionHook, public actionLmmHook {
- ActionLmmListPtr p_modifiedSet;
- xbt_heap_t p_actionHeap;
- int m_selectiveUpdate;
- ModelPtr p_model;
- double m_bound; /**< the capping of the CPU use */
- bool m_failed;
- double m_start; /**< start time */
- char *p_category; /**< tracing category for categorized resource utilization monitoring */
-
- #ifdef HAVE_LATENCY_BOUND_TRACKING
- int m_latencyLimited; /**< Set to 1 if is limited by latency, 0 otherwise */
- #endif
- int m_cost;
- void *p_data; /**< for your convenience */
-
-protected:
- ActionListPtr p_stateSet;
- double m_priority; /**< priority (1.0 by default) */
- int m_refcount;
- double m_remains; /**< How much of that cost remains to be done in the currently running task */
- double m_maxDuration; /*< max_duration (may fluctuate until the task is completed) */
- double m_finish; /**< finish time : this is modified during the run and fluctuates until the task is completed */
-
- ModelPtr getModel() {return p_model;}
-
public:
-
+ /**
+ * @brief Action constructor
+ */
Action();
+
+ /**
+ * @brief Action constructor
+ *
+ * @param model The Model associated to this Action
+ * @param cost The cost of the Action
+ * @param failed If the action is impossible (e.g.: execute something on a switched off workstation)
+ */
Action(ModelPtr model, double cost, bool failed);
+
+ /**
+ * @brief Action constructor
+ *
+ * @param model The Model associated to this Action
+ * @param cost The cost of the Action
+ * @param failed If the action is impossible (e.g.: execute something on a switched off workstation)
+ * @param var The lmm variable associated to this Action if it is part of a LMM component
+ */
Action(ModelPtr model, double cost, bool failed, lmm_variable_t var);
+
+ /**
+ * @brief Action destructor
+ */
virtual ~Action();
+ /**
+ * @brief Finish the action
+ */
void finish();
- s_xbt_swag_hookup_t p_stateHookup;
+ /**
+ * @brief Get the [state](\ref e_surf_action_state_t) of the current Action
+ *
+ * @return The state of the current Action
+ */
e_surf_action_state_t getState(); /**< get the state*/
+
+ /**
+ * @brief Set the [state](\ref e_surf_action_state_t) of the current Action
+ *
+ * @param state The new state of the current Action
+ */
virtual void setState(e_surf_action_state_t state); /**< Change state*/
+
+ /**
+ * @brief Get the bound of the current Action
+ *
+ * @return The bound of the current Action
+ */
double getBound() {return m_bound;}
- double getStartTime(); /**< Return the start time of an action */
- double getFinishTime(); /**< Return the finish time of an action */
+
+ /**
+ * @brief Get the start time of the current action
+ *
+ * @return The start time of the current action
+ */
+ double getStartTime();
+
+ /**
+ * @brief Get the finish time of the current action
+ *
+ * @return The finish time of the current action
+ */
+ double getFinishTime();
+
+ /**
+ * @brief Get the data associated to the current action
+ *
+ * @return The data associated to the current action
+ */
void *getData() {return p_data;}
+
+ /**
+ * @brief Set the data associated to the current action
+ *
+ * @param data The new data associated to the current action
+ */
void setData(void* data);
+
+ /**
+ * @brief Get the maximum duration of the current action
+ *
+ * @return The maximum duration of the current action
+ */
double getMaxDuration() {return m_maxDuration;}
+
+ /**
+ * @brief Get the category associated to the current action
+ *
+ * @return The category associated to the current action
+ */
char *getCategory() {return p_category;}
+
+ /**
+ * @brief Get the cost of the current action
+ *
+ * @return The cost of the current action
+ */
double getCost() {return m_cost;}
+
+ /**
+ * @brief Set the cost of the current action
+ *
+ * @param cost The new cost of the current action
+ */
void setCost(double cost) {m_cost = cost;}
+ /**
+ * @brief Update the maximum duration of the current action
+ *
+ * @param delta [TODO]
+ */
void updateMaxDuration(double delta) {double_update(&m_maxDuration, delta);}
+
+ /**
+ * @brief Update the remaining time of the current action
+ *
+ * @param delta [TODO]
+ */
void updateRemains(double delta) {double_update(&m_remains, delta);}
+
+ /**
+ * @brief Set the remaining time of the current action
+ *
+ * @param value The new remaining time of the current action
+ */
void setRemains(double value) {m_remains = value;}
- void setFinishTime(double value) {m_finish = value;}
+ /**
+ * @brief Set the finish time of the current action
+ *
+ * @param value The new Finush time of the current action
+ */
+ void setFinishTime(double value) {m_finish = value;}
+ /**
+ * @brief Add a reference to the current action
+ */
void ref();
- virtual int unref(); /**< Specify that we don't use that action anymore. Returns true if the action was destroyed and false if someone still has references on it. */
- virtual void cancel(); /**< Cancel a running action */
- virtual void recycle(){}; /**< Recycle an action */
-
- virtual void suspend(); /**< Suspend an action */
- virtual void resume(); /**< Resume a suspended action */
- virtual bool isSuspended(); /**< Return whether an action is suspended */
- virtual void setMaxDuration(double duration); /**< Set the max duration of an action*/
- virtual void setPriority(double priority); /**< Set the priority of an action */
+
+ /**
+ * @brief Remove a reference to the current action
+ * @details If the Action has no more reference, we destroy it
+ *
+ * @return true if the action was destroyed and false if someone still has references on it
+ */
+ virtual int unref();
+
+ /**
+ * @brief Cancel the current Action if running
+ */
+ virtual void cancel();
+
+ /**
+ * @brief Recycle an Action
+ */
+ virtual void recycle(){};
+
+ /**
+ * @brief Suspend the current Action
+ */
+ virtual void suspend();
+
+ /**
+ * @brief Resume the current Action
+ */
+ virtual void resume();
+
+ /**
+ * @brief Check if the current action is running
+ *
+ * @return true if the current Action is suspended, false otherwise
+ */
+ virtual bool isSuspended();
+
+ /**
+ * @brief Set the maximum duration of the current Action
+ *
+ * @param duration The new maximum duration of the current Action
+ */
+ virtual void setMaxDuration(double duration);
+
+ /**
+ * @brief Set the priority of the current Action
+ *
+ * @param priority The new priority of the current Action
+ */
+ virtual void setPriority(double priority);
+
#ifdef HAVE_TRACING
- void setCategory(const char *category); /**< Set the category of an action */
+ /**
+ * @brief Set the category of the current Action
+ *
+ * @param category The new category of the current Action
+ */
+ void setCategory(const char *category);
#endif
- virtual double getRemains(); /**< Get the remains of an action */
+
+ /**
+ * @brief Get the remaining time of the current action after updating the resource
+ *
+ * @return The remaining time
+ */
+ virtual double getRemains();
+
+ /**
+ * @brief Get the remaining time of the current action without updating the resource
+ *
+ * @return The remaining time
+ */
double getRemainsNoUpdate();
#ifdef HAVE_LATENCY_BOUND_TRACKING
- int getLatencyLimited(); /**< Return 1 if action is limited by latency, 0 otherwise */
+ /**
+ * @brief Check if the action is limited by latency.
+ *
+ * @return 1 if action is limited by latency, 0 otherwise
+ */
+ int getLatencyLimited();
#endif
+ /**
+ * @brief Get the priority of the current Action
+ *
+ * @return The priority of the current Action
+ */
double getPriority() {return m_priority;};
+
+ /**
+ * @brief Get the state set in which the action is
+ * @details [TODO]
+ *
+ * @return The state set in which the action is
+ */
ActionListPtr getStateSet() {return p_stateSet;};
+ s_xbt_swag_hookup_t p_stateHookup;
+
+protected:
+ ActionListPtr p_stateSet;
+ double m_priority; /**< priority (1.0 by default) */
+ int m_refcount;
+ double m_remains; /**< How much of that cost remains to be done in the currently running task */
+ double m_maxDuration; /*< max_duration (may fluctuate until the task is completed) */
+ double m_finish; /**< finish time : this is modified during the run and fluctuates until the task is completed */
+
+ ModelPtr getModel() {return p_model;}
+
private:
int resourceUsed(void *resource_id);
- /* Share the resources to the actions and return in how much time
- the next action may terminate */
+
+ /**
+ * @brief Share the resources to the actions
+ * @details [TODO]
+ *
+ * @param now [TODO]
+ * @return in how much time the next action may terminatedescription]
+ */
double shareResources(double now);
- /* Update the actions' state */
+
+ /**
+ * @brief Update the current action state
+ * @details [TODO]
+ *
+ * @param now [TODO]
+ * @param delta [TODO]
+ */
void updateActionsState(double now, double delta);
+
+ /**
+ * @brief Update the [TODO]
+ * @details [TODO]
+ *
+ * @param id [TODO]
+ * @param event_type [TODO]
+ * @param value [TODO]
+ * @param time [TODO]
+ */
void updateResourceState(void *id, tmgr_trace_event_t event_type,
double value, double time);
- /* LMM */
-protected:
- lmm_variable_t p_variable;
- double m_lastUpdate;
- double m_lastValue;
- int m_suspended;
- int m_indexHeap;
- enum heap_action_type m_hat;
+ ActionLmmListPtr p_modifiedSet;
+ xbt_heap_t p_actionHeap;
+ int m_selectiveUpdate;
+ double m_bound; /**< the capping of the CPU use */
+ bool m_failed;
+ double m_start; /**< start time */
+ char *p_category; /**< tracing category for categorized resource utilization monitoring */
+ #ifdef HAVE_LATENCY_BOUND_TRACKING
+ int m_latencyLimited; /**< Set to 1 if is limited by latency, 0 otherwise */
+ #endif
+ int m_cost;
+ ModelPtr p_model;
+ void *p_data; /**< for your convenience */
+
+ /* LMM */
public:
virtual void updateRemainingLazy(double now);
void heapInsert(xbt_heap_t heap, double key, enum heap_action_type hat);
enum heap_action_type getHat() {return m_hat;}
bool is_linked() {return actionLmmHook::is_linked();}
void gapRemove();
+
+protected:
+ lmm_variable_t p_variable;
+ double m_lastValue;
+ double m_lastUpdate;
+ int m_suspended;
+ int m_indexHeap;
+ enum heap_action_type m_hat;
};
#endif /* SURF_MODEL_H_ */
extern const char *surf_action_state_names[6];
+/** @ingroup SURF_interface
+ * @brief Possible update mechanisms
+ */
typedef enum {
- UM_FULL,
- UM_LAZY,
- UM_UNDEFINED
+ UM_FULL, /**< [TODO] */
+ UM_LAZY, /**< [TODO] */
+ UM_UNDEFINED /**< Mechanism not defined */
} e_UM_t;
/* Generic functions common to all models */
/***********
* Classes *
***********/
+
+/* Note: As and RoutingEdge are declard as struct instead of class, to keep
+ compatibility with C files where they are mentioned. */
struct As;
typedef As *AsPtr;
class RoutingPlatf;
typedef RoutingPlatf *RoutingPlatfPtr;
+/** @ingroup SURF_routing_interface
+ * @brief The Autonomous System (AS) routing interface
+ * @details [TODO]
+ */
struct As {
public:
xbt_dynar_t p_indexNetworkElm;
RoutingEdgePtr p_netElem;
xbt_dynar_t p_linkUpDownList;
+ /**
+ * @brief The As constructor
+ */
As(){};
+
+ /**
+ * @brief The As destructor
+ */
virtual ~As(){
xbt_free(p_name);
};
+ /**
+ * @brief Get the route and latency between two RoutingEdgs
+ * @details [long description]
+ *
+ * @param src [description]
+ * @param dst [description]
+ * @param into [description]
+ * @param latency [description]
+ */
virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency)=0;
virtual xbt_dynar_t getOneLinkRoutes()=0;
virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)=0;
virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
};
+/** @ingroup SURF_routing_interface
+ * @brief A routing edge
+ * @details [long description]
+ */
struct RoutingEdge {
public:
~RoutingEdge() { xbt_free(p_name);};
char *p_name;
};
-/*
- * Link of lenght 1, alongside with its source and destination. This is mainly usefull in the bindings to gtnets and ns3
+
+/** @ingroup SURF_routing_interface
+ * @brief Link of lenght 1, alongside with its source and destination. This is mainly usefull in the bindings to gtnets and ns3
*/
class Onelink {
public:
void *p_link;
};
+/** @ingroup SURF_routing_interface
+ * @brief The class representing a whole routing platform
+ */
class RoutingPlatf {
public:
~RoutingPlatf();
WorkstationVMHL13::~WorkstationVMHL13()
{
/* ind_phys_workstation equals to smx_host_t */
- surf_resource_t ind_vm_workstation = xbt_lib_get_elm_or_null(host_lib, getName());
+ // surf_resource_t ind_vm_workstation = xbt_lib_get_elm_or_null(host_lib, getName());
/* Before clearing the entries in host_lib, we have to pick up resources. */
- CpuCas01Ptr cpu = static_cast<CpuCas01Ptr>(surf_cpu_resource_priv(ind_vm_workstation));
+ // CpuCas01Ptr cpu = static_cast<CpuCas01Ptr>(surf_cpu_resource_priv(ind_vm_workstation));
/* We deregister objects from host_lib, without invoking the freeing callback
* of each level.
/* Free the workstation resource of the VM. */
}
-void WorkstationVMHL13::updateState(tmgr_trace_event_t event_type, double value, double date) {
+void WorkstationVMHL13::updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/) {
THROW_IMPOSSIBLE; /* This model does not implement parallel tasks */
}
-/*
- * vm_workstation.hpp
- *
- * Created on: Nov 12, 2013
- * Author: bedaride
- */
+/* Copyright (c) 2004-2013. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
#include "workstation_interface.hpp"
#ifndef VM_WORKSTATION_INTERFACE_HPP_
/*********
* Model *
*********/
-
+/** @ingroup SURF_vm_workstation_interface
+ * @brief SURF workstation VM model interface class
+ * @details A model is an object which handle the interactions between its Resources and its Actions
+ */
class WorkstationVMModel : public WorkstationModel {
public:
+ /**
+ * @brief WorkstationVMModel consrtuctor
+ */
WorkstationVMModel();
+
+ /**
+ * @brief WorkstationVMModel consrtuctor
+ */
~WorkstationVMModel(){};
+
+ /**
+ * @brief Create a new WorkstationVM
+ *
+ * @param name The name of the new WorkstationVM
+ * @param ind_phys_workstation The workstation hosting the VM
+ *
+ */
virtual void createResource(const char *name, void *ind_phys_workstation)=0;
+
+
void adjustWeightOfDummyCpuActions() {};
};
* Resource *
************/
+/** @ingroup SURF_vm_workstation_interface
+ * @brief SURF workstation VM interface class
+ * @details A workstation VM represent an virtual machine
+ */
class WorkstationVM : public Workstation {
public:
+ /**
+ * @brief WorkstationVM consrtructor
+ *
+ * @param model WorkstationModel associated to this Workstation
+ * @param name The name of the Workstation
+ * @param props Dictionary of properties associated to this Workstation
+ * @param netElm The RoutingEdge associated to this Workstation
+ * @param cpu The Cpu associated to this Workstation
+ */
WorkstationVM(ModelPtr model, const char *name, xbt_dict_t props,
RoutingEdgePtr netElm, CpuPtr cpu)
: Workstation(model, name, props, NULL, netElm, cpu) {}
+
+ /**
+ * @brief WdorkstationVM estructor
+ */
~WorkstationVM();
+ /**
+ * @brief Suspend the VM
+ */
virtual void suspend()=0;
+
+ /**
+ * @brief Resume the VM
+ */
virtual void resume()=0;
+ /**
+ * @brief Save the VM (Not yet implemented)
+ */
virtual void save()=0;
+
+ /**
+ * @brief Restore the VM (Not yet implemented)
+ */
virtual void restore()=0;
- virtual void migrate(surf_resource_t ind_vm_ws_dest)=0; // will be vm_ws_migrate()
+ /**
+ * @brief Migrate the VM to the destination host
+ *
+ * @param ind_vm_ws_dest The destination host
+ */
+ virtual void migrate(surf_resource_t ind_vm_ws_dest)=0;
- virtual surf_resource_t getPm()=0; // will be vm_ws_get_pm()
+ /**
+ * @brief Get the physical machine hosting the VM
+ * @return The physical machine hosting the VM
+ */
+ virtual surf_resource_t getPm()=0;
virtual void setBound(double bound)=0;
virtual void setAffinity(CpuPtr cpu, unsigned long mask)=0;
e_surf_vm_state_t p_currentState;
};
-
/**********
* Action *
**********/
p_cpu->setPowerPeakAt(pstate_index);
}
-double Workstation::getConsumedEnergy()
-{
- return p_cpu->getConsumedEnergy();
-}
-
xbt_dict_t Workstation::getProperties()
{
return p_cpu->getProperties();
}
-
StoragePtr Workstation::findStorageOnMountList(const char* mount)
{
StoragePtr st = NULL;
+/* Copyright (c) 2004-2013. The SimGrid Team.
+ * All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
#include "surf_interface.hpp"
#include "storage_interface.hpp"
#include "cpu_interface.hpp"
/*********
* Model *
*********/
+/** @ingroup SURF_workstation_interface
+ * @brief SURF Workstation model interface class
+ * @details A model is an object which handle the interactions between its Resources and its Actions
+ */
class WorkstationModel : public Model {
public:
+ /**
+ * @brief WorkstationModel constructor
+ *
+ * @param name the name of the model
+ */
WorkstationModel(const char *name);
+
+ /**
+ * @brief WorkstationModel constructor
+ */
WorkstationModel();
+
+ /**
+ * @brief WorkstationModel destructor
+ */
~WorkstationModel();
- virtual void adjustWeightOfDummyCpuActions();
+ /**
+ * @brief [brief description]
+ * @details [long description]
+ */
+ virtual void adjustWeightOfDummyCpuActions();
+
+ /**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param workstation_nb [description]
+ * @param workstation_list [description]
+ * @param computation_amount [description]
+ * @param communication_amount [description]
+ * @param rate [description]
+ * @return [description]
+ */
virtual ActionPtr executeParallelTask(int workstation_nb,
void **workstation_list,
double *computation_amount,
double *communication_amount,
double rate)=0;
+
+ /**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param src [description]
+ * @param dst [description]
+ *
+ * @return [description]
+ */
virtual xbt_dynar_t getRoute(WorkstationPtr src, WorkstationPtr dst)=0;
+
+ /**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param src [description]
+ * @param dst [description]
+ * @param size [description]
+ * @param rate [description]
+ * @return [description]
+ */
virtual ActionPtr communicate(WorkstationPtr src, WorkstationPtr dst, double size, double rate)=0;
CpuModelPtr p_cpuModel;
/************
* Resource *
************/
-
+/** @ingroup SURF_workstation_interface
+ * @brief SURF Workstation interface class
+ * @details A workstation VM represent an virtual machine with a aggregation of a Cpu, a NetworkLink and a Storage
+ */
class Workstation : public Resource {
public:
+ /**
+ * @brief Workstation consrtuctor
+ * @details [long description]
+ */
Workstation(){};
+
+ /**
+ * @brief Workstation constructor
+ *
+ * @param model WorkstationModel associated to this Workstation
+ * @param name The name of the Workstation
+ * @param props Dictionary of properties associated to this Workstation
+ * @param storage The Storage associated to this Workstation
+ * @param netElm The RoutingEdge associated to this Workstation
+ * @param cpu The Cpu associated to this Workstation
+ */
Workstation(ModelPtr model, const char *name, xbt_dict_t props,
xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu);
+
+ /**
+ * @brief Workstation constructor
+ *
+ * @param model WorkstationModel associated to this Workstation
+ * @param name The name of the Workstation
+ * @param props Dictionary of properties associated to this Workstation
+ * @param constraint The lmm constraint associated to this Workstation if it is part of a LMM component
+ * @param storage The Storage associated to this Workstation
+ * @param netElm The RoutingEdge associated to this Workstation
+ * @param cpu The Cpu associated to this Workstation
+ */
Workstation(ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint,
xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu);
+ /**
+ * @brief Get the properties of the currenrt Workstation
+ *
+ * @return The properties of the current Workstation
+ */
xbt_dict_t getProperties();
+ /**
+ * @brief Execute some quantity of computation
+ *
+ * @param size The value of the processing amount (in flop) needed to process
+ * @return The CpuAction corresponding to the processing
+ * @see Cpu
+ */
virtual ActionPtr execute(double size)=0;
+
+ /**
+ * @brief Make a process sleep for duration seconds
+ *
+ * @param duration The number of seconds to sleep
+ * @return The CpuAction corresponding to the sleeping
+ * @see Cpu
+ */
virtual ActionPtr sleep(double duration)=0;
+ /**
+ * @brief Get the number of cores of the associated Cpu
+ *
+ * @return The number of cores of the associated Cpu
+ * @see Cpu
+ */
virtual int getCore();
+
+ /**
+ * @brief Get the speed of the associated Cpu
+ *
+ * @param load [TODO]
+ * @return The speed of the associated Cpu
+ * @see Cpu
+ */
virtual double getSpeed(double load);
+
+ /**
+ * @brief Get the available speed of the associated Cpu
+ * @details [TODO]
+ *
+ * @return The available speed of the associated Cpu
+ * @see Cpu
+ */
virtual double getAvailableSpeed();
+
+ /**
+ * @brief Get the associated Cpu power peak
+ *
+ * @return The associated Cpu power peak
+ * @see Cpu
+ */
virtual double getCurrentPowerPeak();
+
virtual double getPowerPeakAt(int pstate_index);
virtual int getNbPstates();
virtual void setPowerPeakAt(int pstate_index);
- virtual double getConsumedEnergy();
+ /**
+ * @brief Return the storage of corresponding mount point
+ *
+ * @param storage The mount point
+ * @return The corresponding Storage
+ */
virtual StoragePtr findStorageOnMountList(const char* storage);
+
+ /**
+ * @brief Get the xbt_dict_t of mount_point: Storage
+ *
+ * @return The xbt_dict_t of mount_point: Storage
+ */
virtual xbt_dict_t getStorageList();
+
+ /**
+ * @brief Open a file
+ *
+ * @param mount The mount point
+ * @param path The path to the file
+ *
+ * @return The StorageAction corresponding to the opening
+ */
virtual ActionPtr open(const char* mount, const char* path);
+
+ /**
+ * @brief Close a file
+ *
+ * @param fd The file descriptor to close
+ * @return The StorageAction corresponding to the closing
+ */
virtual ActionPtr close(surf_file_t fd);
+
+ /**
+ * @brief Unlink a file
+ * @details [long description]
+ *
+ * @param fd [description]
+ * @return [description]
+ */
virtual int unlink(surf_file_t fd);
+
+ /**
+ * @brief List directory contents of a path
+ * @details [long description]
+ *
+ * @param path The path to the directory
+ * @return The StorageAction corresponding to the ls action
+ */
virtual ActionPtr ls(const char* mount, const char *path);
+
+ /**
+ * @brief Get the size in bytes of the file
+ *
+ * @param fd The file descriptor to read
+ * @return The size in bytes of the file
+ */
virtual sg_size_t getSize(surf_file_t fd);
+
+ /**
+ * @brief Read a file
+ *
+ * @param fd The file descriptor to read
+ * @param size The size in bytes to read
+ * @return The StorageAction corresponding to the reading
+ */
virtual ActionPtr read(surf_file_t fd, sg_size_t size);
+
+ /**
+ * @brief Write a file
+ *
+ * @param fd The file descriptor to write
+ * @param size The size in bytes to write
+ * @return The StorageAction corresponding to the writing
+ */
virtual ActionPtr write(surf_file_t fd, sg_size_t size);
- virtual xbt_dynar_t getInfo( surf_file_t fd);
+
+ /**
+ * @brief Get the informations of a file descriptor
+ * @details The returned xbt_dynar_t contains:
+ * - the size of the file,
+ * - the mount point,
+ * - the storage name,
+ * - the storage typeId,
+ * - the storage content type
+ *
+ * @param fd The file descriptor
+ * @return An xbt_dynar_t with the file informations
+ */
+ virtual xbt_dynar_t getInfo(surf_file_t fd);
+
+ /**
+ * @brief Get the current position of the file descriptor
+ *
+ * @param fd The file descriptor
+ * @return The current position of the file descriptor
+ */
virtual sg_size_t fileTell(surf_file_t fd);
+
+ /**
+ * @brief Get the available space of the storage at the mount point
+ *
+ * @param name The mount point
+ * @return The amount of availble space in bytes
+ */
virtual sg_size_t getFreeSize(const char* name);
+
+ /**
+ * @brief Get the used space of the storage at the mount point
+ *
+ * @param name The mount point
+ * @return The amount of used space in bytes
+ */
virtual sg_size_t getUsedSize(const char* name);
+
+ /**
+ * @brief Set the position indictator assiociated with the file descriptor to a new position
+ * @details [long description]
+ *
+ * @param fd The file descriptor
+ * @param offset The offset from the origin
+ * @param origin Position used as a reference for the offset
+ * - SEEK_SET: beginning of the file
+ * - SEEK_CUR: current position indicator
+ * - SEEK_END: end of the file
+ * @return MSG_OK if successful, otherwise MSG_TASK_CANCELED
+ */
virtual int fileSeek(surf_file_t fd, sg_size_t offset, int origin);
xbt_dynar_t p_storage;
CpuPtr p_cpu;
NetworkLinkPtr p_network;
+ /**
+ * @brief Get the list of virtual machines on the current Workstation
+ *
+ * @return The list of VMs
+ */
xbt_dynar_t getVms();
/* common with vm */
+ /**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param params [description]
+ */
void getParams(ws_params_t params);
+
+ /**
+ * @brief [brief description]
+ * @details [long description]
+ *
+ * @param params [description]
+ */
void setParams(ws_params_t params);
s_ws_params_t p_params;
};
/**********
* Action *
**********/
+/** @ingroup SURF_workstation_interface
+ * @brief SURF workstation action interface class
+ */
class WorkstationAction : public Action {
public:
+ /**
+ * @brief WorkstationAction constructor
+ *
+ * @param model The WorkstationModel associated to this WorkstationAction
+ * @param cost The cost of this WorkstationAction in [TODO]
+ * @param failed [description]
+ */
WorkstationAction(ModelPtr model, double cost, bool failed)
: Action(model, cost, failed) {}
+
+ /**
+ * @brief WorkstationAction constructor
+ *
+ * @param model The WorkstationModel associated to this WorkstationAction
+ * @param cost The cost of this WorkstationAction in [TODO]
+ * @param failed [description]
+ * @param var The lmm variable associated to this StorageAction if it is part of a LMM component
+ */
WorkstationAction(ModelPtr model, double cost, bool failed, lmm_variable_t var)
: Action(model, cost, failed, var) {}
XBT_LOG_CONNECT(surf_cpu);
XBT_LOG_CONNECT(surf_cpu_cas);
XBT_LOG_CONNECT(surf_cpu_ti);
+ XBT_LOG_CONNECT(surf_energy);
XBT_LOG_CONNECT(surf_kernel);
XBT_LOG_CONNECT(surf_lagrange);
XBT_LOG_CONNECT(surf_lagrange_dichotomy);
void mmalloc_postexit(void)
{
- /* Do not detach the default mdp or ldl won't be able to free the memory it allocated since we're in memory */
- // mmalloc_detach(__mmalloc_default_mdp);
- xbt_mheap_destroy_no_free(__mmalloc_default_mdp);
+ /* Do not destroy the default mdp or ldl won't be able to free the memory it
+ * allocated since we're in memory */
+ // xbt_mheap_destroy_no_free(__mmalloc_default_mdp);
}
size_t mmalloc_get_bytes_used(xbt_mheap_t heap){
#include "mpi.h"
#include "mpitest.h"
+#include "smpi_cocci.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_SYS_TIME_H
#define MAX_BUF (32 * 1024 * 1024)
#define LOOPS 10
-__thread char * sbuf, * rbuf;
-__thread int * recvcounts, * displs;
-int errs = 0;
+SMPI_VARINIT_GLOBAL(sbuf, char*);
+SMPI_VARINIT_GLOBAL(rbuf, char*);
+SMPI_VARINIT_GLOBAL(recvcounts, int*);
+SMPI_VARINIT_GLOBAL(displs, int*);
+SMPI_VARINIT_GLOBAL_AND_SET(errs, int, 0);
/* #define dprintf printf */
#define dprintf(...)
if (LARGE_BUF * comm_size > MAX_BUF)
goto fn_exit;
- sbuf = (void *) calloc(MAX_BUF, 1);
- rbuf = (void *) calloc(MAX_BUF, 1);
+ SMPI_VARGET_GLOBAL(sbuf) = (void *) calloc(MAX_BUF, 1);
+ SMPI_VARGET_GLOBAL(rbuf) = (void *) calloc(MAX_BUF, 1);
srand(time(NULL));
- recvcounts = (void *) malloc(comm_size * sizeof(int));
- displs = (void *) malloc(comm_size * sizeof(int));
- if (!recvcounts || !displs || !sbuf || !rbuf) {
+ SMPI_VARGET_GLOBAL(recvcounts) = (void *) malloc(comm_size * sizeof(int));
+ SMPI_VARGET_GLOBAL(displs) = (void *) malloc(comm_size * sizeof(int));
+ if (!SMPI_VARGET_GLOBAL(recvcounts) || !SMPI_VARGET_GLOBAL(displs) || !SMPI_VARGET_GLOBAL(sbuf) || !SMPI_VARGET_GLOBAL(rbuf)) {
fprintf(stderr, "Unable to allocate memory:\n");
- if (!sbuf) fprintf(stderr,"\tsbuf of %d bytes\n", MAX_BUF );
- if (!rbuf) fprintf(stderr,"\trbuf of %d bytes\n", MAX_BUF );
- if (!recvcounts) fprintf(stderr,"\trecvcounts of %zd bytes\n", comm_size * sizeof(int) );
- if (!displs) fprintf(stderr,"\tdispls of %zd bytes\n", comm_size * sizeof(int) );
+ if (!SMPI_VARGET_GLOBAL(sbuf)) fprintf(stderr,"\tsbuf of %d bytes\n", MAX_BUF );
+ if (!SMPI_VARGET_GLOBAL(rbuf)) fprintf(stderr,"\trbuf of %d bytes\n", MAX_BUF );
+ if (!SMPI_VARGET_GLOBAL(recvcounts)) fprintf(stderr,"\trecvcounts of %zd bytes\n", comm_size * sizeof(int) );
+ if (!SMPI_VARGET_GLOBAL(displs)) fprintf(stderr,"\tdispls of %zd bytes\n", comm_size * sizeof(int) );
fflush(stderr);
MPI_Abort(MPI_COMM_WORLD, -1);
exit(-1);
comm_tests(comm);
MPI_Comm_free(&comm);
- //free(sbuf);
- //free(rbuf);
- free(recvcounts);
- free(displs);
+ //free(SMPI_VARGET_GLOBAL(sbuf));
+ //free(SMPI_VARGET_GLOBAL(rbuf));
+ free(SMPI_VARGET_GLOBAL(recvcounts));
+ free(SMPI_VARGET_GLOBAL(displs));
fn_exit:
- MTest_Finalize(errs);
+ MTest_Finalize(SMPI_VARGET_GLOBAL(errs));
MPI_Finalize();
return 0;
void comm_tests(MPI_Comm comm)
{
int comm_size, comm_rank;
- double rtime, max_time;
+ double rtime = rtime; /* stop warning about unused variable */
+ double max_time;
long long msg_size;
MPI_Comm_size(comm, &comm_size);
MPI_Comm_size(comm, &comm_size);
MPI_Comm_rank(comm, &comm_rank);
- displs[0] = 0;
+ SMPI_VARGET_GLOBAL(displs)[0] = 0;
for (i = 0; i < comm_size; i++) {
if (test_type == REGULAR)
- recvcounts[i] = msg_size;
+ SMPI_VARGET_GLOBAL(recvcounts)[i] = msg_size;
else if (test_type == BCAST)
- recvcounts[i] = (!i) ? msg_size : 0;
+ SMPI_VARGET_GLOBAL(recvcounts)[i] = (!i) ? msg_size : 0;
else if (test_type == SPIKE)
- recvcounts[i] = (!i) ? (msg_size / 2) : (msg_size / (2 * (comm_size - 1)));
+ SMPI_VARGET_GLOBAL(recvcounts)[i] = (!i) ? (msg_size / 2) : (msg_size / (2 * (comm_size - 1)));
else if (test_type == HALF_FULL)
- recvcounts[i] = (i < (comm_size / 2)) ? (2 * msg_size) : 0;
+ SMPI_VARGET_GLOBAL(recvcounts)[i] = (i < (comm_size / 2)) ? (2 * msg_size) : 0;
else if (test_type == LINEAR_DECREASE) {
tmp = 2 * msg_size * (comm_size - 1 - i) / (comm_size - 1);
if (tmp != (int)tmp) {
MPI_Abort( MPI_COMM_WORLD, 1 );
exit(1);
}
- recvcounts[i] = (int) tmp;
+ SMPI_VARGET_GLOBAL(recvcounts)[i] = (int) tmp;
/* If the maximum message size is too large, don't run */
if (tmp > MAX_BUF) return 0;
for (j = 0; j < i; j++) {
if (i - 1 + j >= comm_size) continue;
tmp = msg_size * comm_size / (log(comm_size) * i);
- recvcounts[i - 1 + j] = (int) tmp;
- displs[i - 1 + j] = 0;
+ SMPI_VARGET_GLOBAL(recvcounts)[i - 1 + j] = (int) tmp;
+ SMPI_VARGET_GLOBAL(displs)[i - 1 + j] = 0;
/* If the maximum message size is too large, don't run */
if (tmp > MAX_BUF) return 0;
}
if (i < comm_size - 1)
- displs[i+1] = displs[i] + recvcounts[i];
+ SMPI_VARGET_GLOBAL(displs)[i+1] = SMPI_VARGET_GLOBAL(displs)[i] + SMPI_VARGET_GLOBAL(recvcounts)[i];
}
/* Test that:
MPI_Barrier(comm);
start = MPI_Wtime();
for (i = 0; i < LOOPS; i++) {
- MPI_Allgatherv(sbuf, recvcounts[comm_rank], MPI_CHAR,
- rbuf, recvcounts, displs, MPI_CHAR, comm);
+ MPI_Allgatherv(SMPI_VARGET_GLOBAL(sbuf), SMPI_VARGET_GLOBAL(recvcounts)[comm_rank], MPI_CHAR,
+ SMPI_VARGET_GLOBAL(rbuf), SMPI_VARGET_GLOBAL(recvcounts), SMPI_VARGET_GLOBAL(displs), MPI_CHAR, comm);
}
end = MPI_Wtime();
MPI_Barrier(comm);
{
int nints, nadds, ntypes, combiner;
- int err, errs = 0;
+ int /* err, */ errs = 0;
- err = MPI_Type_get_envelope(MPI_FLOAT,
+ /* err = */ MPI_Type_get_envelope(MPI_FLOAT,
&nints,
&nadds,
&ntypes,
MPI_Aint *adds = NULL;
MPI_Datatype *types;
- int err, errs = 0;
+ int /* err, */ errs = 0;
/* set up type */
- err = MPI_Type_vector(10,
+ /* err = */ MPI_Type_vector(10,
2,
2,
MPI_INT,
&parent_type);
/* decode */
- err = MPI_Type_get_envelope(parent_type,
+ /* err = */ MPI_Type_get_envelope(parent_type,
&nints,
&nadds,
&ntypes,
if (nadds) adds = malloc(nadds * sizeof(*adds));
types = malloc(ntypes *sizeof(*types));
- err = MPI_Type_get_contents(parent_type,
+ /* err = */ MPI_Type_get_contents(parent_type,
nints,
nadds,
ntypes,
MPI_Aint *adds = NULL;
MPI_Datatype *types;
- int err, errs = 0;
+ int /* err, */ errs = 0;
/* set up type */
- err = MPI_Type_indexed(s_count,
+ /* err = */ MPI_Type_indexed(s_count,
s_blocklengths,
s_displacements,
MPI_INT,
&parent_type);
/* decode */
- err = MPI_Type_get_envelope(parent_type,
+ /* err = */ MPI_Type_get_envelope(parent_type,
&nints,
&nadds,
&ntypes,
if (nadds) adds = malloc(nadds * sizeof(*adds));
types = malloc(ntypes *sizeof(*types));
- err = MPI_Type_get_contents(parent_type,
+ /* err = */ MPI_Type_get_contents(parent_type,
nints,
nadds,
ntypes,
program main
use mpi
- integer errs, ierr, toterr
+ integer errs, ierr
integer maxsize
parameter (maxsize=1024)
integer recvbuf
#include "mpi.h"
#include "mpitestconf.h"
#include "mpitest.h"
+#include "smpi_cocci.h"
#if defined(HAVE_STDIO_H) || defined(STDC_HEADERS)
#include <stdio.h>
#endif
/* Here is where we could put the includes and definitions to enable
memory testing */
-static int dbgflag = 0; /* Flag used for debugging */
-static int wrank = -1; /* World rank */
-static int verbose = 0; /* Message level (0 is none) */
-static int returnWithVal = 0; /* Allow programs to return with a non-zero
- if there was an error (may cause problems
- with some runtime systems) */
-static int usageOutput = 0; /* */
+SMPI_VARINIT_GLOBAL_AND_SET(dbgflag, int, 0); /* Flag used for debugging */
+SMPI_VARINIT_GLOBAL_AND_SET(wrank, int, -1); /* World rank */
+SMPI_VARINIT_GLOBAL_AND_SET(verbose, int, 0); /* Message level (0 is none) */
+SMPI_VARINIT_GLOBAL_AND_SET(returnWithVal, int, 0); /* Allow programs to return
+ with a non-zero if there was an error (may
+ cause problems with some runtime systems) */
+SMPI_VARINIT_GLOBAL_AND_SET(usageOutput, int, 0); /* */
/* Provide backward portability to MPI 1 */
#ifndef MPI_VERSION
}
/* Check for debugging control */
if (getenv( "MPITEST_DEBUG" )) {
- dbgflag = 1;
- MPI_Comm_rank( MPI_COMM_WORLD, &wrank );
+ SMPI_VARGET_GLOBAL(dbgflag) = 1;
+ MPI_Comm_rank( MPI_COMM_WORLD, &SMPI_VARGET_GLOBAL(wrank) );
}
/* Check for verbose control */
}
else {
if (val >= 0) {
- verbose = val;
+ SMPI_VARGET_GLOBAL(verbose) = val;
}
else {
fprintf( stderr, "Warning: %s not valid for MPITEST_VERBOSE\n",
strcmp( envval, "YES" ) == 0 ||
strcmp( envval, "true" ) == 0 ||
strcmp( envval, "TRUE" ) == 0) {
- returnWithVal = 1;
+ SMPI_VARGET_GLOBAL(returnWithVal) = 1;
}
else if (strcmp( envval, "no" ) == 0 ||
strcmp( envval, "NO" ) == 0 ||
strcmp( envval, "false" ) == 0 ||
strcmp( envval, "FALSE" ) == 0) {
- returnWithVal = 0;
+ SMPI_VARGET_GLOBAL(returnWithVal) = 0;
}
else {
fprintf( stderr,
/* Print rusage data if set */
if (getenv( "MPITEST_RUSAGE" )) {
- usageOutput = 1;
+ SMPI_VARGET_GLOBAL(usageOutput) = 1;
}
}
/*
fflush( stdout );
}
- if (usageOutput)
+ if (SMPI_VARGET_GLOBAL(usageOutput))
MTestResourceSummary( stdout );
*/
int MTestReturnValue( int errors )
{
- if (returnWithVal) return errors ? 1 : 0;
+ if (SMPI_VARGET_GLOBAL(returnWithVal)) return errors ? 1 : 0;
return 0;
}
/* ------------------------------------------------------------------------ */
* Indexed - Indexed datatype. Only for a count of 1 instance of the
* datatype
*/
-static int datatype_index = 0;
+SMPI_VARINIT_GLOBAL_AND_SET(datatype_index, int, 0);
/* ------------------------------------------------------------------------ */
/* Datatype routines for contiguous datatypes */
recvtype->count = count;
/* Use datatype_index to choose a datatype to use. If at the end of the
list, return 0 */
- switch (datatype_index) {
+ switch (SMPI_VARGET_GLOBAL(datatype_index)) {
case 0:
sendtype->datatype = MPI_INT;
sendtype->isBasic = 1;
break;
#endif
default:
- datatype_index = -1;
+ SMPI_VARGET_GLOBAL(datatype_index) = -1;
}
if (!sendtype->InitBuf) {
sendtype->CheckBuf = MTestTypeContigCheckbuf;
recvtype->CheckBuf = MTestTypeContigCheckbuf;
}
- datatype_index++;
+ SMPI_VARGET_GLOBAL(datatype_index)++;
- if (dbgflag && datatype_index > 0) {
+ if (SMPI_VARGET_GLOBAL(dbgflag) && SMPI_VARGET_GLOBAL(datatype_index) > 0) {
int typesize;
- fprintf( stderr, "%d: sendtype is %s\n", wrank, MTestGetDatatypeName( sendtype ) );
+ fprintf( stderr, "%d: sendtype is %s\n", SMPI_VARGET_GLOBAL(wrank), MTestGetDatatypeName( sendtype ) );
merr = MPI_Type_size( sendtype->datatype, &typesize );
if (merr) MTestPrintError( merr );
- fprintf( stderr, "%d: sendtype size = %d\n", wrank, typesize );
- fprintf( stderr, "%d: recvtype is %s\n", wrank, MTestGetDatatypeName( recvtype ) );
+ fprintf( stderr, "%d: sendtype size = %d\n", SMPI_VARGET_GLOBAL(wrank), typesize );
+ fprintf( stderr, "%d: recvtype is %s\n", SMPI_VARGET_GLOBAL(wrank), MTestGetDatatypeName( recvtype ) );
merr = MPI_Type_size( recvtype->datatype, &typesize );
if (merr) MTestPrintError( merr );
- fprintf( stderr, "%d: recvtype size = %d\n", wrank, typesize );
+ fprintf( stderr, "%d: recvtype size = %d\n", SMPI_VARGET_GLOBAL(wrank), typesize );
fflush( stderr );
}
- else if (verbose && datatype_index > 0) {
+ else if (SMPI_VARGET_GLOBAL(verbose) && SMPI_VARGET_GLOBAL(datatype_index) > 0) {
printf( "Get new datatypes: send = %s, recv = %s\n",
MTestGetDatatypeName( sendtype ),
MTestGetDatatypeName( recvtype ) );
fflush( stdout );
}
- return datatype_index;
+ return SMPI_VARGET_GLOBAL(datatype_index);
}
/* Reset the datatype index (start from the initial data type.
*/
void MTestResetDatatypes( void )
{
- datatype_index = 0;
+ SMPI_VARGET_GLOBAL(datatype_index) = 0;
}
/* Return the index of the current datatype. This is rarely needed and
is provided mostly to enable debugging of the MTest package itself */
int MTestGetDatatypeIndex( void )
{
- return datatype_index;
+ return SMPI_VARGET_GLOBAL(datatype_index);
}
/* Free the storage associated with a datatype */
simplify the use of the routine */
const char *MTestGetDatatypeName( MTestDatatype *dtype )
{
- static char name[4][MPI_MAX_OBJECT_NAME];
- static int sp=0;
+ typedef char name_type[4][MPI_MAX_OBJECT_NAME];
+ SMPI_VARINIT_STATIC(name, name_type);
+ SMPI_VARINIT_STATIC_AND_SET(sp, int, 0);
int rlen, merr;
- if (sp >= 4) sp = 0;
- merr = MPI_Type_get_name( dtype->datatype, name[sp], &rlen );
+ if (SMPI_VARGET_STATIC(sp) >= 4) SMPI_VARGET_STATIC(sp) = 0;
+ merr = MPI_Type_get_name( dtype->datatype, SMPI_VARGET_STATIC(name)[SMPI_VARGET_STATIC(sp)], &rlen );
if (merr) MTestPrintError( merr );
- return (const char *)name[sp++];
+ return (const char *)SMPI_VARGET_STATIC(name)[SMPI_VARGET_STATIC(sp)++];
}
/* ----------------------------------------------------------------------- */
* that return value as well.
*
*/
-static __thread int interCommIdx = 0;
-static __thread int intraCommIdx = 0;
-static __thread const char *intraCommName = 0;
-static __thread const char *interCommName = 0;
+SMPI_VARINIT_GLOBAL_AND_SET(interCommIdx, int, 0);
+SMPI_VARINIT_GLOBAL_AND_SET(intraCommIdx, int, 0);
+SMPI_VARINIT_GLOBAL_AND_SET(intraCommName, const char *, 0);
+SMPI_VARINIT_GLOBAL_AND_SET(interCommName, const char *, 0);
/*
* Get an intracommunicator with at least min_size members. If "allowSmaller"
MPI_COMM_NULL is always considered large enough */
while (!done) {
isBasic = 0;
- intraCommName = "";
- switch (intraCommIdx) {
+ SMPI_VARGET_GLOBAL(intraCommName) = "";
+ switch (SMPI_VARGET_GLOBAL(intraCommIdx)) {
case 0:
*comm = MPI_COMM_WORLD;
isBasic = 1;
- intraCommName = "MPI_COMM_WORLD";
+ SMPI_VARGET_GLOBAL(intraCommName) = "MPI_COMM_WORLD";
break;
case 1:
/* dup of world */
merr = MPI_Comm_dup(MPI_COMM_WORLD, comm );
if (merr) MTestPrintError( merr );
- intraCommName = "Dup of MPI_COMM_WORLD";
+ SMPI_VARGET_GLOBAL(intraCommName) = "Dup of MPI_COMM_WORLD";
break;
case 2:
/* reverse ranks */
if (merr) MTestPrintError( merr );
merr = MPI_Comm_split( MPI_COMM_WORLD, 0, size-rank, comm );
if (merr) MTestPrintError( merr );
- intraCommName = "Rank reverse of MPI_COMM_WORLD";
+ SMPI_VARGET_GLOBAL(intraCommName) = "Rank reverse of MPI_COMM_WORLD";
break;
case 3:
/* subset of world, with reversed ranks */
merr = MPI_Comm_split( MPI_COMM_WORLD, ((rank < size/2) ? 1 : MPI_UNDEFINED),
size-rank, comm );
if (merr) MTestPrintError( merr );
- intraCommName = "Rank reverse of half of MPI_COMM_WORLD";
+ SMPI_VARGET_GLOBAL(intraCommName) = "Rank reverse of half of MPI_COMM_WORLD";
break;
case 4:
*comm = MPI_COMM_SELF;
isBasic = 1;
- intraCommName = "MPI_COMM_SELF";
+ SMPI_VARGET_GLOBAL(intraCommName) = "MPI_COMM_SELF";
break;
/* These next cases are communicators that include some
int newsize;
merr = MPI_Comm_size( MPI_COMM_WORLD, &size );
if (merr) MTestPrintError( merr );
- newsize = size - (intraCommIdx - 4);
+ newsize = size - (SMPI_VARGET_GLOBAL(intraCommIdx) - 4);
if (allowSmaller && newsize >= min_size) {
merr = MPI_Comm_rank( MPI_COMM_WORLD, &rank );
*comm = MPI_COMM_NULL;
}
else {
- intraCommName = "Split of WORLD";
+ SMPI_VARGET_GLOBAL(intraCommName) = "Split of WORLD";
}
}
else {
/* Act like default */
*comm = MPI_COMM_NULL;
- intraCommIdx = -1;
+ SMPI_VARGET_GLOBAL(intraCommIdx) = -1;
}
}
break;
/* Other ideas: dup of self, cart comm, graph comm */
default:
*comm = MPI_COMM_NULL;
- intraCommIdx = -1;
+ SMPI_VARGET_GLOBAL(intraCommIdx) = -1;
break;
}
done = 1;
}
else {
- intraCommName = "MPI_COMM_NULL";
+ SMPI_VARGET_GLOBAL(intraCommName) = "MPI_COMM_NULL";
isBasic = 1;
done = 1;
}
/* Advance the comm index whether we are done or not, otherwise we could
* spin forever trying to allocate a too-small communicator over and
* over again. */
- intraCommIdx++;
+ SMPI_VARGET_GLOBAL(intraCommIdx)++;
if (!done && !isBasic && *comm != MPI_COMM_NULL) {
/* avoid leaking communicators */
}
}
- return intraCommIdx;
+ return SMPI_VARGET_GLOBAL(intraCommIdx);
}
/*
/* Return the name of an intra communicator */
const char *MTestGetIntracommName( void )
{
- return intraCommName;
+ return SMPI_VARGET_GLOBAL(intraCommName);
}
/*
while (!done) {
*comm = MPI_COMM_NULL;
*isLeftGroup = 0;
- interCommName = "MPI_COMM_NULL";
+ SMPI_VARGET_GLOBAL(interCommName) = "MPI_COMM_NULL";
- switch (interCommIdx) {
+ switch (SMPI_VARGET_GLOBAL(interCommIdx)) {
case 0:
/* Split comm world in half */
merr = MPI_Comm_rank( MPI_COMM_WORLD, &rank );
merr = MPI_Intercomm_create( mcomm, 0, MPI_COMM_WORLD, rleader,
12345, comm );
if (merr) MTestPrintError( merr );
- interCommName = "Intercomm by splitting MPI_COMM_WORLD";
+ SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD";
}
else
*comm = MPI_COMM_NULL;
merr = MPI_Intercomm_create( mcomm, 0, MPI_COMM_WORLD,
rleader, 12346, comm );
if (merr) MTestPrintError( merr );
- interCommName = "Intercomm by splitting MPI_COMM_WORLD into 1, rest";
+ SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD into 1, rest";
}
else
*comm = MPI_COMM_NULL;
merr = MPI_Intercomm_create( mcomm, 0, MPI_COMM_WORLD,
rleader, 12347, comm );
if (merr) MTestPrintError( merr );
- interCommName = "Intercomm by splitting MPI_COMM_WORLD into 2, rest";
+ SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD into 2, rest";
}
else
*comm = MPI_COMM_NULL;
mcomm = *comm;
merr = MPI_Comm_dup(mcomm, comm);
if (merr) MTestPrintError( merr );
- interCommName = "Intercomm by splitting MPI_COMM_WORLD then dup'ing";
+ SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD then dup'ing";
}
else
*comm = MPI_COMM_NULL;
/* this split is effectively a dup but tests the split code paths */
merr = MPI_Comm_split(mcomm, 0, rank, comm);
if (merr) MTestPrintError( merr );
- interCommName = "Intercomm by splitting MPI_COMM_WORLD then then splitting again";
+ SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD then then splitting again";
}
else
*comm = MPI_COMM_NULL;
merr = MPI_Intercomm_create( mcomm, 0, MPI_COMM_WORLD, rleader, 12345, comm );
if (merr) MTestPrintError( merr );
}
- interCommName = "Intercomm by splitting MPI_COMM_WORLD (discarding rank 0 in the left group) then MPI_Intercomm_create'ing";
+ SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD (discarding rank 0 in the left group) then MPI_Intercomm_create'ing";
}
else {
*comm = MPI_COMM_NULL;
merr = MPI_Group_free(&newgroup);
if (merr) MTestPrintError( merr );
- interCommName = "Intercomm by splitting MPI_COMM_WORLD then discarding 0 ranks with MPI_Comm_create";
+ SMPI_VARGET_GLOBAL(interCommName) = "Intercomm by splitting MPI_COMM_WORLD then discarding 0 ranks with MPI_Comm_create";
}
else {
*comm = MPI_COMM_NULL;
default:
*comm = MPI_COMM_NULL;
- interCommIdx = -1;
+ SMPI_VARGET_GLOBAL(interCommIdx) = -1;
break;
}
if (size + remsize >= min_size) done = 1;
}
else {
- interCommName = "MPI_COMM_NULL";
+ SMPI_VARGET_GLOBAL(interCommName) = "MPI_COMM_NULL";
done = 1;
}
/* Advance the comm index whether we are done or not, otherwise we could
* spin forever trying to allocate a too-small communicator over and
* over again. */
- interCommIdx++;
+ SMPI_VARGET_GLOBAL(interCommIdx)++;
if (!done && *comm != MPI_COMM_NULL) {
/* avoid leaking communicators */
}
}
- return interCommIdx;
+ return SMPI_VARGET_GLOBAL(interCommIdx);
}
/* Return the name of an intercommunicator */
const char *MTestGetIntercommName( void )
{
- return interCommName;
+ return SMPI_VARGET_GLOBAL(interCommName);
}
/* Get a communicator of a given minimum size. Both intra and inter
int MTestGetComm( MPI_Comm *comm, int min_size )
{
int idx=0;
- static __thread int getinter = 0;
+ SMPI_VARINIT_STATIC_AND_SET(getinter, int, 0);
- if (!getinter) {
+ if (!SMPI_VARGET_STATIC(getinter)) {
idx = MTestGetIntracomm( comm, min_size );
if (idx == 0) {
- getinter = 1;
+ SMPI_VARGET_STATIC(getinter) = 1;
}
}
- if (getinter) {
+ if (SMPI_VARGET_STATIC(getinter)) {
int isLeft;
idx = MTestGetIntercomm( comm, &isLeft, min_size );
if (idx == 0) {
- getinter = 0;
+ SMPI_VARGET_STATIC(getinter) = 0;
}
}
{
va_list list;
- if (verbose && level >= verbose) {
+ if (SMPI_VARGET_GLOBAL(verbose) && level >= SMPI_VARGET_GLOBAL(verbose)) {
va_start(list,format);
vprintf( format, list );
va_end(list);
{
#ifdef HAVE_GETRUSAGE
struct rusage ru;
- static __thread int pfThreshold = -2;
+ SMPI_VARINIT_STATIC_AND_SET(pfThreshold, int, -2);
int doOutput = 1;
if (getrusage( RUSAGE_SELF, &ru ) == 0) {
/* There is an option to generate output only when a resource
exceeds a threshold. To date, only page faults supported. */
- if (pfThreshold == -2) {
+ if (SMPI_VARGET_STATIC(pfThreshold) == -2) {
char *p = getenv("MPITEST_RUSAGE_PF");
- pfThreshold = -1;
+ SMPI_VARGET_STATIC(pfThreshold) = -1;
if (p) {
- pfThreshold = strtol( p, 0, 0 );
+ SMPI_VARGET_STATIC(pfThreshold) = strtol( p, 0, 0 );
}
}
- if (pfThreshold > 0) {
- doOutput = ru.ru_minflt > pfThreshold;
+ if (SMPI_VARGET_STATIC(pfThreshold) > 0) {
+ doOutput = ru.ru_minflt > SMPI_VARGET_STATIC(pfThreshold);
}
if (doOutput) {
/* Cast values to long in case some system has defined them
/*
* Create MPI Windows
*/
-static __thread int win_index = 0;
-static const char *winName;
+SMPI_VARINIT_GLOBAL_AND_SET(win_index, int, 0);
+SMPI_VARINIT_GLOBAL(winName, const char *);
/* Use an attribute to remember the type of memory allocation (static,
malloc, or MPI_Alloc_mem) */
-static __thread int mem_keyval = MPI_KEYVAL_INVALID;
+SMPI_VARINIT_GLOBAL_AND_SET(mem_keyval, int, MPI_KEYVAL_INVALID);
int MTestGetWin( MPI_Win *win, int mustBePassive )
{
- static char actbuf[1024];
- static char *pasbuf;
+ typedef char actbuf_type[1024];
+ SMPI_VARINIT_STATIC(actbuf, actbuf_type);
+ SMPI_VARINIT_STATIC(pasbuf, char *);
char *buf;
int n, rank, merr;
MPI_Info info;
- if (mem_keyval == MPI_KEYVAL_INVALID) {
+ if (SMPI_VARGET_GLOBAL(mem_keyval) == MPI_KEYVAL_INVALID) {
/* Create the keyval */
merr = MPI_Win_create_keyval( MPI_WIN_NULL_COPY_FN,
MPI_WIN_NULL_DELETE_FN,
- &mem_keyval, 0 );
+ &SMPI_VARGET_GLOBAL(mem_keyval), 0 );
if (merr) MTestPrintError( merr );
}
- switch (win_index) {
+ switch (SMPI_VARGET_GLOBAL(win_index)) {
case 0:
/* Active target window */
- merr = MPI_Win_create( actbuf, 1024, 1, MPI_INFO_NULL, MPI_COMM_WORLD,
+ merr = MPI_Win_create( SMPI_VARGET_STATIC(actbuf), 1024, 1, MPI_INFO_NULL, MPI_COMM_WORLD,
win );
if (merr) MTestPrintError( merr );
- winName = "active-window";
- merr = MPI_Win_set_attr( *win, mem_keyval, (void *)0 );
+ SMPI_VARGET_GLOBAL(winName) = "active-window";
+ merr = MPI_Win_set_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), (void *)0 );
if (merr) MTestPrintError( merr );
break;
case 1:
/* Passive target window */
- merr = MPI_Alloc_mem( 1024, MPI_INFO_NULL, &pasbuf );
+ merr = MPI_Alloc_mem( 1024, MPI_INFO_NULL, &SMPI_VARGET_STATIC(pasbuf) );
if (merr) MTestPrintError( merr );
- merr = MPI_Win_create( pasbuf, 1024, 1, MPI_INFO_NULL, MPI_COMM_WORLD,
+ merr = MPI_Win_create( SMPI_VARGET_STATIC(pasbuf), 1024, 1, MPI_INFO_NULL, MPI_COMM_WORLD,
win );
if (merr) MTestPrintError( merr );
- winName = "passive-window";
- merr = MPI_Win_set_attr( *win, mem_keyval, (void *)2 );
+ SMPI_VARGET_GLOBAL(winName) = "passive-window";
+ merr = MPI_Win_set_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), (void *)2 );
if (merr) MTestPrintError( merr );
break;
case 2:
merr = MPI_Win_create( buf, n, 1, MPI_INFO_NULL, MPI_COMM_WORLD,
win );
if (merr) MTestPrintError( merr );
- winName = "active-all-different-win";
- merr = MPI_Win_set_attr( *win, mem_keyval, (void *)1 );
+ SMPI_VARGET_GLOBAL(winName) = "active-all-different-win";
+ merr = MPI_Win_set_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), (void *)1 );
if (merr) MTestPrintError( merr );
break;
case 3:
if (merr) MTestPrintError( merr );
merr = MPI_Info_free( &info );
if (merr) MTestPrintError( merr );
- winName = "active-nolocks-all-different-win";
- merr = MPI_Win_set_attr( *win, mem_keyval, (void *)1 );
+ SMPI_VARGET_GLOBAL(winName) = "active-nolocks-all-different-win";
+ merr = MPI_Win_set_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), (void *)1 );
if (merr) MTestPrintError( merr );
break;
default:
- win_index = -1;
+ SMPI_VARGET_GLOBAL(win_index) = -1;
}
- win_index++;
- return win_index;
+ SMPI_VARGET_GLOBAL(win_index)++;
+ return SMPI_VARGET_GLOBAL(win_index);
}
/* Return a pointer to the name associated with a window object */
const char *MTestGetWinName( void )
{
- return winName;
+ return SMPI_VARGET_GLOBAL(winName);
}
/* Free the storage associated with a window object */
void MTestFreeWin( MPI_Win *win )
}
if (addr) {
void *val;
- merr = MPI_Win_get_attr( *win, mem_keyval, &val, &flag );
+ merr = MPI_Win_get_attr( *win, SMPI_VARGET_GLOBAL(mem_keyval), &val, &flag );
if (merr) MTestPrintError( merr );
if (flag) {
if (val == (void *)1) {
}
static void MTestRMACleanup( void )
{
- if (mem_keyval != MPI_KEYVAL_INVALID) {
- MPI_Win_free_keyval( &mem_keyval );
+ if (SMPI_VARGET_GLOBAL(mem_keyval) != MPI_KEYVAL_INVALID) {
+ MPI_Win_free_keyval( &SMPI_VARGET_GLOBAL(mem_keyval) );
}
}
#else
+ tools/check_dist_archive
+ tools/check_dist_archive\.exclude
++ tools/normalize-pointers\.py
+ tools/spell/.*