From: Frederic Suter Date: Tue, 2 May 2017 08:07:16 +0000 (+0200) Subject: Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid X-Git-Tag: v3.16~274^2~41^2~9 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/bad8d4d70e0bd55b86f8f1f5a3379eb1bb7eba97?hp=121e1dc6ee0462b6f6f1f1570b0f48c61ee4ff9a Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid --- diff --git a/doc/doxygen/deployment.doc b/doc/doxygen/deployment.doc index 5d24f7600c..cd1ef5d030 100644 --- a/doc/doxygen/deployment.doc +++ b/doc/doxygen/deployment.doc @@ -1,5 +1,7 @@ /*! @page deployment Deploy the simulation +@tableofcontents + Once you've specified your @ref platform "virtual platform" and the @ref application "application" you want to study, you must describe the mapping of the application onto the platform. This page says how @@ -16,13 +18,13 @@ XML file. You should really logically separate your application from the deployment, as it will ease your experimental campain afterward. How exactly you organize your work remains up to you. -@section deploy_s4u +@section deploy_s4u Deployment with S4U The following example shows the several ways of doing so in the S4U interface: @ref examples/s4u/actor-create/s4u_actor-create.cpp. Associated XML file: @ref examples/s4u/actor-create/s4u_actor-create_d.xml -@section deploy_msg +@section deploy_msg Deployment with MSG If you're stuck with the MSG interface, then you should simply use one of the following functions to start new actors onto your virtual @@ -30,51 +32,94 @@ hosts: @ref MSG_process_create, @ref MSG_process_create_with_arguments or @ref MSG_process_create_with_environment. These functions are used in many of the provided example, just grep for them. -@section deploy_xml - -This section presents how to deploy from an XML file, as it is -classically done. You will find a huge amount of examples of this in -the @c examples directory. - -The deployment file looks just like a @ref platform "platform" file, except that in -this case, only two different tags are used: @c process and @c argument, whereas -the latter is just used to supply additional configuration options to the process; the -order in which the @c argument tags are given is important and depends on the application. - -### The process tag ### - -#### Attribute list #### - -As already written above, the @c process tag is the tag that defines which host -executes which function (from your application). Hence, the @c host and @c function -attributes are mandatory; however, there are some optional attributes to the process tag. Here is a list of all attributes of this tag: - -| Attribute name | Mandatory | Values | Description | -| --------------- | --------- | ---------------------- | ----------- | -| host | yes | String | Describes which host will be used to run this process. The host must be defined in the platform file! | -| function | yes | String | Name of a function that will be executed on this host; this function is written in userland code, for instance, C code. Valid values are functions that were registered by MSG_function_register() | -| start_time | no | int (Default: -1.0) | The simulated time when this function will start to be computed. | -| kill_time | no | int (Default: -1.0) | The simulated time when this function will end to be computed. By default, it stops only when it's done. | -| on_failure | no | DIE\|RESTART (Default: "DIE") | What should be done when the process fails. | - -#### Examples #### - -Almost any @ref msg_examples include a deployment file. - -### The argument tag ### - -This tag must always be contained by a @c process tag - it doesn't make sense -without it. - -The way this works is that the order of arguments must be pre-defined by the user: -It is totally up to you what your code expects as arguments and in which -order. The arguments will be passed to your code (that is: to the function -executed by this process) in the order you declare them. - -#### Attribute list #### - -| Attribute name | Mandatory | Values | Description | -| --------------- | --------- | ---------------------- | ----------- | -| value | yes | String | Contains the value for this parameter | +@section deploy_xml Deployment with XML + +Deploying processes from XML is easy. This section presents a complete +example and the reference guide of the involved tags. + +The deployment file looks just like a @ref platform "platform" file, +with only 3 tags used: + + - @c <process> starts a new actor on a given host; + - @c <argument> passes a given argument in the argv of an actor + (the list of arguments is ordered); + - @c <prop> adds a property to the actor. + +@subsection deploy_xml_ex Examples + +To make them easy to find, almost all deployment files in the archive +are named @c ***_d_xml. + +@verbatim + + + + + + + + + + + + + + + + + + + +@endverbatim + +@subsection deploy_xml_process The process tag + +<process> starts a new actor on a given host. It specifies which +function (from your application) gets executed on the host. Hence, the +@c host and @c function attributes are mandatory, but this tag accepts +some optional attributes too. + +| Attribute name | Mandatory | Values | Description | +| --------------- | --------- | ------------ | ----------- | +| host | yes | String | This must match the name of an host defined in the platform file. | +| function | yes | String | Name of the function (from your own code) that will be executed. See @ref deploy_xml_functions. | +| start_time | no | int | The simulated time when this actor will be started (Default: ASAP). | +| kill_time | no | int | The simulated time when this actor will be forcefully stopped (Default: never). | +| on_failure | no | DIE\|RESTART | What should be done when the process fails (Default: die). | + +@subsection deploy_xml_argument The argument tag + +This tag (which must be enclosed in a @c <process> tag) adds a +new string to the parameter list received by your actor (either its @c +argv array in MSG or its @c args vector in S4U). Naturally, the +semantic of these parameters completely depend on your program. + +| Attribute name | Mandatory | Values | Description | +| --------------- | --------- | ---------------------- | ----------- | +| value | yes | String | Value of this parameter | + +@subsection deploy_xml_prop The prop tag + +This tag (which must be enclosed in a @c <process> tag) adds a +new property to your actor. + +(either its @c +argv array in MSG or its @c args vector in S4U). Naturally, the +semantic of these parameters completely depend on your program. + +| Attribute name | Mandatory | Values | Description | +| --------------- | --------- | ---------------------- | ----------- | +| id | yes | String | Name of the defined property | +| value | yes | String | Value of this property | + +@subsection deploy_xml_functions Declaring startable functions + +You need to connect your code to the names that you use in the XML +deployment file. Depends on the interface you use, this is done with +MSG_process_create() or simgrid::s4u::Engine::registerFunction(). +There is nothing to do in your **Java code** since SimGrid uses +the Java introspection abilities to retrieve the classes from their +names. In your XML file, you must then use the full class name +(including the package name). */ diff --git a/src/bindings/lua/lua_host.cpp b/src/bindings/lua/lua_host.cpp index c83873f610..71484a4251 100644 --- a/src/bindings/lua/lua_host.cpp +++ b/src/bindings/lua/lua_host.cpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2010, 2012-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2010-2017. 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. */ @@ -7,8 +6,7 @@ /* SimGrid Lua bindings */ #include "lua_private.h" -#include -#include +#include "simgrid/s4u/Host.hpp" extern "C" { #include } diff --git a/src/smpi/smpi_global.cpp b/src/smpi/smpi_global.cpp index 39d769a62e..0ae9822500 100644 --- a/src/smpi/smpi_global.cpp +++ b/src/smpi/smpi_global.cpp @@ -95,7 +95,10 @@ int smpi_process_count() simgrid::smpi::Process* smpi_process() { - simgrid::MsgActorExt* msgExt = static_cast(SIMIX_process_self()->data); + smx_actor_t me = SIMIX_process_self(); + if (me == nullptr) // This happens sometimes (eg, when linking against NS3 because it pulls openMPI...) + return nullptr; + simgrid::MsgActorExt* msgExt = static_cast(me->data); return static_cast(msgExt->data); } diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 6bc87ef269..e27db353d1 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2017. 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. */ @@ -10,18 +10,14 @@ #include "ns3/core-module.h" #include "ns3/node.h" -#include "ns3/ns3_interface.h" #include "ns3/ns3_simulator.h" #include "network_ns3.hpp" -#include "simgrid/sg_config.h" #include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals #include "src/kernel/routing/NetPoint.hpp" -#include "src/surf/HostImpl.hpp" -#include "src/surf/surf_private.h" +#include "simgrid/s4u/Engine.hpp" #include "simgrid/s4u/NetZone.hpp" -#include "simgrid/s4u/engine.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ns3, surf, "Logging specific to the SURF network NS3 module"); diff --git a/src/surf/ns3/ns3_interface.h b/src/surf/ns3/ns3_interface.h index e667adec78..1366932289 100644 --- a/src/surf/ns3/ns3_interface.h +++ b/src/surf/ns3/ns3_interface.h @@ -6,7 +6,7 @@ #ifndef NS3_INTERFACE_H #define NS3_INTERFACE_H -#include +#include "simgrid/s4u/Host.hpp" namespace simgrid { namespace surf {