+ SimGrid (3.22) NOT RELEASED (Release Target: December 21. 2018, 22:23 UTC)
+
+ SimGrid (3.21) October 3. 2018
+
+ The Restarting Documentation (TRD) Release.
+
+ Documentation:
+ - Convert the user manual to Sphinx for improved usability.
+ Unstable version now hosted on https://simgrid.frama.io/simgrid
+ Many glitches remain; stay tuned.
+ - Restrict the Doxygen reference API to the installed header files.
+ (documenting all internals this way is overkill + doxygen scales badly)
+ - New tutorial on S4U (highly inspired from the old MSG one, but with
+ a git repository to fork as a starting point, and a docker image)
+ - Started but not finished a SMPI tutorial inspired from the JLPC'14 one.
+ - The Developper manual is still to be converted (not compiled until then)
+ - Some parts are still missing in this conversion (such as the
+ platform and deployment sections) while others were blindly converted
+ and would need more love (such as the configuration flags).
+ Things will certainly further improve in the future releases.
+
+ S4U new features:
+ - Fully reimplement auto_restart mechanism that was utterly broken
+ (fix #22, #131 and #281 that were all very related)
+ - Implement semaphores (fix #303 and #291)
+ - When creating an actor from a function and its parameters,
+ move-only parameters are not allowed anymore, as it would prevent
+ the actor to be restartable if its parameters are consumed on run.
+ - s4u::Io: IOs go asynchronous as activities. New methods in s4u::Storage:
+ - io_init(sg_size_t, s4u::Io::OpType) to create a READ or WRITE asynchronous
+ IO operations that can be started, waited for, or canceled as a regular
+ activity.
+ - read_async(sg_size_t) and write_async(sg_size_t) which are wrappers on
+ io_init() + start()
+
+ Tracing:
+ - Rename 'power' and 'power_used' variables into 'speed' and 'speed_used'
+ - New host variable: 'core_count'
+
+ XBT:
+ - Remove xbt_os_thread_specific features
+ - Remove portability wrapper to condition variables
+ - Remove xbt_os_thread_yield()
+
+ SMPI:
+ - MPICH collective selector now mimics MPICH 3.3b
+ - OpenMPI collective selector now mimics OpenMPI 3.1.2 (default "tuned" setting)
+ - MPI_Init(NULL,NULL) is now allowed
+ - smpi/wtime option now injects time in gettimeofday or clock_gettime calls
+ - Command-line arguments should now be handled properly in Fortran simulations
+ - MPI Attributes and related callbacks should work in Fortran
+ - Apps using C + Fortran should now work
+ - MPI_* calls now check for non MPI_SUCCESS return values and emit warnings
+ - Support MPI_Error_String
+
+ Java:
+ - Due to an internal bug, Msg.run() must now be your last line.
+ We hope to fix it in a future release, and we are sorry for the inconvenience.
++ - Expose host load plugin (i.e. loadInit, getCurrentLoad, getComputedFlops,getAvgLoad)
+
+ Fixed bugs:
+ - #22: Process autorestart seem to only work with CAS01 cpus
+ - #56: Feature request: dynamic SMPI replay
+ - #93: simgrid should not eat --help
+ - #111: How to change the loopback link characteristics?
+ - #116: Platform cluster radical
+ - #117: Platform cluster/host order
+ - #129: Replay_multiple on steroid
+ - #131: Java : autostart does not work
+ - #143: Setting a breakpoint at a given time
+ - #235: Network energy models should be integrated
+ - #264: Add ptask L07 resource tracing
+ - #271: Dynamic and manual replay of SMPI traces
+ - #279: Breakpoints option uses time deltas instead of absolute time
+ - #281: Daemonized actor no longer daemonized after an auto-restart
+ - #282: TIT convertor erase traces when using absolute path in the trace list file
+ - #285: segfault when a s4u actor kills itself with msg process tracing activated
+ - #286: Pajé traces are not exposing the number of cores
+ - #287: Command-line parsing should stop when encountering '--'
+ - #288: MPI_Init(NULL, NULL)
+ - #289: Improve documentation of Actor::on_destruction and this_actor::on_exit()
+ - #290: Method to check if a mailbox has a message ready to be consumed
+ - #291: [s4u] semaphores do not seem available yet
+ - #294: Alltoall collective implementation of mpich
+ - #295: Starting a Host as OFF is not supported
+ - #296: DTD too permissive
+ - #299: Add a s4u barrier example
+
+ ----------------------------------------------------------------------------
+
SimGrid (3.20) Released June 24. 2018
The proxy snake_case() release.
- #258: daemonized actors hang after all non-daemonized actors have completed
- #267: Linker error on unit_tmgr
- #269: SMPI: tracing of MPI_Wait/all/any broken
- - SMPI: Fix various crashes with combined use of MPI_PROC_NULL and MPI_IGNORE_STATUS
+ - SMPI: Fix various crashes with combined use of MPI_PROC_NULL and MPI_IGNORE_STATUS
----------------------------------------------------------------------------
set(process-startkilltime_files Main Sleeper)
set(process-suspend_files Main DreamMaster LazyGuy)
set(task-priority_files Main Test)
+set(hostload_files Main LoadRunner)
+ if(enable_java)
+ add_custom_target(java-all
+ COMMENT "Building all Java examples..."
+ )
+ endif()
+
foreach (example app-bittorrent app-centralizedmutex app-masterworker app-pingpong app-tokenring async-yield async-waitall async-dsend
-- cloud-migration cloud-masterworker dht-chord dht-kademlia energy-consumption energy-pstate energy-vm io-file io-storage
- process-kill process-migration process-startkilltime process-suspend task-priority trace-pingpong hostload)
++ cloud-migration cloud-masterworker dht-chord dht-kademlia energy-consumption energy-pstate energy-vm hostload io-file io-storage
+ process-kill process-migration process-startkilltime process-suspend task-priority trace-pingpong)
string (REPLACE "-" "/" example_dir ${example})
set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}/${example_dir})
foreach (filename ${${example}_files} )
COMMAND ${CMAKE_COMMAND} -E touch ${example_dir}/java-${example}_compiled
)
add_custom_target(java-${example} ALL DEPENDS ${example_dir}/java-${example}_compiled)
+ add_dependencies(java-all java-${example})
endif()
set(examples_src ${examples_src} ${${example}_sources})
set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example_dir}/${example}.tesh)
if(enable_java)
foreach (example app-bittorrent app-centralizedmutex app-masterworker app-pingpong app-tokenring async-yield async-waitall async-dsend
-- cloud-migration cloud-masterworker dht-chord dht-kademlia energy-consumption energy-pstate energy-vm io-file io-storage
- process-kill process-migration process-startkilltime process-suspend task-priority trace-pingpong hostload)
++ cloud-migration cloud-masterworker dht-chord dht-kademlia energy-consumption energy-pstate energy-vm hostload io-file io-storage
+ process-kill process-migration process-startkilltime process-suspend task-priority trace-pingpong)
string (REPLACE "-" "/" example_dir ${example})
ADD_TESH(java-${example} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/java --setenv LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib --setenv classpath=${TESH_CLASSPATH} --cd ${CMAKE_BINARY_DIR}/examples/java/${example_dir} ${CMAKE_HOME_DIRECTORY}/examples/java/${example_dir}/${example}.tesh)
endforeach()
--- /dev/null
- super(host, s);
- }
-
- public void display(){
- Msg.info("Computed Flops "+ getHost().getComputedFlops());
- Msg.info("Current Load "+ getHost().getCurrentLoad());
- Msg.info("GetLoad "+ getHost().getLoad());
- Msg.info("AvgLoad "+ getHost().getAvgLoad());
- }
- @Override
- public void main(String[] strings) throws MsgException {
- double workload = 100E6;
- Host host = getHost();
- display();
- // Run a task
- Task task1 = new Task("t1", workload, 0);
- task1.execute();
- display();
- double taskTime = Msg.getClock();
- Msg.info("Task1 simulation time: "+ taskTime);
-
- // Run a second task
- new Task("t1", workload, 0).execute();
-
- taskTime = Msg.getClock() - taskTime;
- Msg.info("Task2 simulation time: "+ taskTime);
- display();
-
- }
-
-
- }
-
+/* Copyright (c) 2016-2018. The SimGrid Team. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+package hostload;
+
+import org.simgrid.msg.*;
+import org.simgrid.msg.Process;
+
+
+public class LoadRunner extends Process {
+
+ public LoadRunner(Host host, String s) {
++ super(host, s);
++ }
++
++ public void display(){
++ Msg.info("Speed="+getHost().getSpeed()+" flop/s");
++ Msg.info("Computed Flops "+ getHost().getComputedFlops());
++ Msg.info("AvgLoad "+ getHost().getAvgLoad());
++ }
++ @Override
++ public void main(String[] strings) throws MsgException {
++ Host host = getHost();
++ display();
++ Msg.info("Sleep for 10 seconds");
++ waitFor(10);
++ display();
++
++ // Run a task
++ Task task1 = new Task("t1", 200E6, 0);
++ task1.execute();
++ display();
++ double taskTime = Msg.getClock();
++ Msg.info("Task1 simulation time: "+ taskTime);
++
++ // Run a second task
++ new Task("t1", 200E6, 0).execute();
++
++ taskTime = Msg.getClock() - taskTime;
++ Msg.info("Task2 simulation time: "+ taskTime);
++ display();
++
++ }
++
++
++}
--- /dev/null
- > [Boivin::(1) 0.000000] [java/INFO] Current Load 0.0
- > [Boivin::(1) 0.000000] [java/INFO] GetLoad 0.0
+#!/usr/bin/env tesh
+
+$ java -classpath ${classpath:=.} hostload/Main ${srcdir:=.}/../platforms/small_platform.xml
+> [0.000000] [java/INFO] Using regular java threads.
++> [Boivin::(1) 0.000000] [java/INFO] Speed=9.8095E7 flop/s
+> [Boivin::(1) 0.000000] [java/INFO] Computed Flops 0.0
- > [Boivin::(1) 1.019420] [java/INFO] Computed Flops 1.0E8
- > [Boivin::(1) 1.019420] [java/INFO] Current Load 1.0
- > [Boivin::(1) 1.019420] [java/INFO] GetLoad 0.0
- > [Boivin::(1) 1.019420] [java/INFO] AvgLoad 1.0
- > [Boivin::(1) 1.019420] [java/INFO] Task1 simulation time: 1.0194199500484225
- > [Boivin::(1) 2.038840] [java/INFO] Task2 simulation time: 1.0194199500484225
- > [Boivin::(1) 2.038840] [java/INFO] Computed Flops 2.0E8
- > [Boivin::(1) 2.038840] [java/INFO] Current Load 1.0
- > [Boivin::(1) 2.038840] [java/INFO] GetLoad 0.0
- > [Boivin::(1) 2.038840] [java/INFO] AvgLoad 1.0
- > [2.038840] [java/INFO] MSG_main finished; Cleaning up the simulation...
+> [Boivin::(1) 0.000000] [java/INFO] AvgLoad 0.0
++> [Boivin::(1) 0.000000] [java/INFO] Sleep for 10 seconds
++> [Boivin::(1) 10.000000] [java/INFO] Speed=9.8095E7 flop/s
++> [Boivin::(1) 10.000000] [java/INFO] Computed Flops 0.0
++> [Boivin::(1) 10.000000] [java/INFO] AvgLoad 0.0
++> [Boivin::(1) 12.038840] [java/INFO] Speed=9.8095E7 flop/s
++> [Boivin::(1) 12.038840] [java/INFO] Computed Flops 2.0E8
++> [Boivin::(1) 12.038840] [java/INFO] AvgLoad 0.1693551801515729
++> [Boivin::(1) 12.038840] [java/INFO] Task1 simulation time: 12.038839900096844
++> [Boivin::(1) 14.077680] [java/INFO] Task2 simulation time: 2.0388399000968445
++> [Boivin::(1) 14.077680] [java/INFO] Speed=9.8095E7 flop/s
++> [Boivin::(1) 14.077680] [java/INFO] Computed Flops 4.0E8
++> [Boivin::(1) 14.077680] [java/INFO] AvgLoad 0.2896556718201238
++> [14.077680] [java/INFO] MSG_main finished; Terminating the simulation...
XBT_PUBLIC sg_host_t* sg_host_list();
- /** \ingroup m_host_management
- * \brief Return the current number of hosts.
+ /** @ingroup m_host_management
+ * @brief Return the current number of hosts.
*/
XBT_PUBLIC size_t sg_host_count();
- /** \ingroup m_host_management
- * \brief Return a dynar containing all the hosts declared at a given point of time (including VMs)
- * \remark The host order in the returned array is generally different from the host creation/declaration order in the
+ /** @ingroup m_host_management
+ * @brief Return a dynar containing all the hosts declared at a given point of time (including VMs)
+ * @remark The host order in the returned array is generally different from the host creation/declaration order in the
* XML platform (we use a hash table internally)
*/
XBT_PUBLIC xbt_dynar_t sg_hosts_as_dynar();
XBT_PUBLIC size_t sg_host_extension_create(void (*deleter)(void*));
XBT_PUBLIC void* sg_host_extension_get(sg_host_t host, size_t rank);
- /** \ingroup m_host_management
- * \brief Finds a sg_host_t using its name.
+ /** @ingroup m_host_management
+ * @brief Finds a sg_host_t using its name.
*
* This is a name directory service
- * \param name the name of an host.
- * \return the corresponding host
+ * @param name the name of an host.
+ * @return the corresponding host
*/
XBT_PUBLIC sg_host_t sg_host_by_name(const char* name);
- /** \ingroup m_host_management
+ /** @ingroup m_host_management
*
- * \brief Return the name of the #sg_host_t. */
+ * @brief Return the name of the #sg_host_t. */
XBT_PUBLIC const char* sg_host_get_name(sg_host_t host);
// ========== User Data ==============
- /** \ingroup m_host_management
+ /** @ingroup m_host_management
*
- * \brief Return the user data of a #sg_host_t.
+ * @brief Return the user data of a #sg_host_t.
*
- * This functions returns the user data associated to \a host if it is possible.
+ * This functions returns the user data associated to @a host if it is possible.
*/
XBT_PUBLIC void* sg_host_user(sg_host_t host);
- /** \ingroup m_host_management
+ /** @ingroup m_host_management
*
- * \brief Set the user data of a #sg_host_t.
+ * @brief Set the user data of a #sg_host_t.
*
- * This functions attach \a data to \a host if it is possible.
+ * This functions attach @a data to @a host if it is possible.
*/
XBT_PUBLIC void sg_host_user_set(sg_host_t host, void* userdata);
XBT_PUBLIC void sg_host_user_destroy(sg_host_t host);
// ========= storage related functions ============
- /** \ingroup m_host_management
- * \brief Return the list of mount point names on an host.
- * \param host a host
- * \return a dict containing all mount point on the host (mount_name => sg_storage_t)
+ /** @ingroup m_host_management
+ * @brief Return the list of mount point names on an host.
+ * @param host a host
+ * @return a dict containing all mount point on the host (mount_name => sg_storage_t)
*/
XBT_PUBLIC xbt_dict_t sg_host_get_mounted_storage_list(sg_host_t host);
- /** \ingroup m_host_management
- * \brief Return the list of storages attached to an host.
- * \param host a host
- * \return a dynar containing all storages (name) attached to the host
+ /** @ingroup m_host_management
+ * @brief Return the list of storages attached to an host.
+ * @param host a host
+ * @return a dynar containing all storages (name) attached to the host
*/
XBT_PUBLIC xbt_dynar_t sg_host_get_attached_storage_list(sg_host_t host);
// =========== user-level functions ===============
- /** \ingroup m_host_management
- * \brief Return the speed of the processor (in flop/s), regardless of the current load on the machine.
+ /** @ingroup m_host_management
+ * @brief Return the speed of the processor (in flop/s), regardless of the current load on the machine.
*/
XBT_PUBLIC double sg_host_speed(sg_host_t host);
XBT_PUBLIC double sg_host_get_pstate_speed(sg_host_t host, int pstate_index);
XBT_PUBLIC int sg_host_core_count(sg_host_t host);
- /** \ingroup m_host_management
- * \brief Returns the current computation load (in flops per second).
++/** @ingroup m_host_management
++ * @brief Returns the current computation load (in flops per second).
++ * @param host a host
+ */
+XBT_PUBLIC double sg_host_load(sg_host_t host);
+
- /** \ingroup m_process_management
- * \brief Return the location on which a process is running.
- * \return the sg_host_t corresponding to the location on which \a process is running.
+ /** @ingroup m_process_management
+ * @brief Return the location on which a process is running.
+ * @return the sg_host_t corresponding to the location on which @a process is running.
*/
XBT_PUBLIC sg_host_t sg_host_self();
XBT_PUBLIC const char* sg_host_self_get_name();
- /** \ingroup m_host_management
- * \brief Return the total count of pstates defined for a host. See also @ref plugin_energy.
+ /** @ingroup m_host_management
+ * @brief Return the total count of pstates defined for a host. See also @ref plugin_energy.
*
- * \param host host to test
+ * @param host host to test
*/
XBT_PUBLIC int sg_host_get_nb_pstates(sg_host_t host);
XBT_PUBLIC int sg_host_is_on(sg_host_t host);
XBT_PUBLIC int sg_host_is_off(sg_host_t host);
- /** \ingroup m_host_management
- * \brief Returns a xbt_dict_t consisting of the list of properties assigned to this host
+ /** @ingroup m_host_management
+ * @brief Returns a xbt_dict_t consisting of the list of properties assigned to this host
*
- * \param host a host
- * \return a dict containing the properties
+ * @param host a host
+ * @return a dict containing the properties
*/
XBT_PUBLIC xbt_dict_t sg_host_get_properties(sg_host_t host);
- /** \ingroup m_host_management
- * \brief Returns the value of a given host property
+ /** @ingroup m_host_management
+ * @brief Returns the value of a given host property
*
- * \param host a host
- * \param name a property name
- * \return value of a property (or nullptr if property not set)
+ * @param host a host
+ * @param name a property name
+ * @return value of a property (or nullptr if property not set)
*/
XBT_PUBLIC const char* sg_host_get_property_value(sg_host_t host, const char* name);
- /** \ingroup m_host_management
- * \brief Change the value of a given host property
+ /** @ingroup m_host_management
+ * @brief Change the value of a given host property
*
- * \param host a host
- * \param name a property name
- * \param value what to change the property to
+ * @param host a host
+ * @param name a property name
+ * @param value what to change the property to
*/
XBT_PUBLIC void sg_host_set_property_value(sg_host_t host, const char* name, const char* value);
+
/* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
#define SIMGRID_MSG_H
#include <simgrid/actor.h>
+ #include <simgrid/barrier.h>
#include <simgrid/engine.h>
#include <simgrid/forward.h>
#include <simgrid/host.h>
typedef struct msg_Comm sg_msg_Comm;
#endif
- SG_BEGIN_DECL()
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
/* *************************** Network Zones ******************************** */
#define msg_as_t msg_netzone_t /* portability macro */
+
typedef sg_netzone_t msg_netzone_t;
XBT_PUBLIC msg_netzone_t MSG_zone_get_root();
XBT_PUBLIC void MSG_zone_get_hosts(msg_netzone_t zone, xbt_dynar_t whereto);
/* ******************************** Hosts ************************************ */
+ /** @brief Host datatype.
+ *
+ * A <em>location</em> (or <em>host</em>) is any possible place where a process may run. Thus it is represented as a
+ * <em>physical resource with computing capabilities</em>, some <em>mailboxes</em> to enable running process to
+ * communicate with remote ones, and some <em>private data</em> that can be only accessed by local process.
+ */
typedef sg_host_t msg_host_t;
- XBT_PUBLIC size_t MSG_get_host_number();
+ /** @brief Finds a msg_host_t using its name. */
XBT_PUBLIC sg_host_t MSG_get_host_by_name(const char* name);
+ /** @brief Finds a msg_host_t using its name. */
XBT_PUBLIC sg_host_t MSG_host_by_name(const char* name);
+ /** @brief Returns the amount of host found in the platform */
+ XBT_PUBLIC size_t MSG_get_host_number();
+ /** @brief Returns a dynar with all existing hosts
+ *
+ * The host order in the returned array is generally different from the host creation/declaration order in the XML
+ * platform (we use a hash table internally).
+ */
XBT_PUBLIC xbt_dynar_t MSG_hosts_as_dynar();
+ /** @brief Returns the name of this host */
XBT_PUBLIC const char* MSG_host_get_name(sg_host_t host);
+ /** @brief Returns the user data of this host */
XBT_PUBLIC void* MSG_host_get_data(sg_host_t host);
+ /** @brief Sets the user data of this host */
XBT_PUBLIC void MSG_host_set_data(sg_host_t host, void* data);
XBT_PUBLIC xbt_dict_t MSG_host_get_mounted_storage_list(sg_host_t host);
XBT_PUBLIC xbt_dynar_t MSG_host_get_attached_storage_lists(sg_host_t host);
XBT_PUBLIC int MSG_host_get_nb_pstates(sg_host_t host);
XBT_PUBLIC int MSG_host_get_pstate(sg_host_t host);
XBT_PUBLIC void MSG_host_set_pstate(sg_host_t host, int pstate);
+ /** @brief Start the host if it is off
+ *
+ * See also #MSG_host_is_on() and #MSG_host_is_off() to test the current state of the host and @ref SURF_plugin_energy
+ * for more info on DVFS.
+ */
XBT_PUBLIC void MSG_host_on(sg_host_t h);
+ /** @brief Stop the host if it is on
+ *
+ * See also #MSG_host_is_on() and #MSG_host_is_off() to test the current state of the host and @ref SURF_plugin_energy
+ * for more info on DVFS.
+ */
XBT_PUBLIC void MSG_host_off(sg_host_t h);
XBT_PUBLIC int MSG_host_is_on(sg_host_t h);
XBT_PUBLIC int MSG_host_is_off(sg_host_t h);
XBT_PUBLIC void MSG_host_set_property_value(sg_host_t host, const char* name, const char* value);
XBT_PUBLIC void MSG_host_get_process_list(sg_host_t host, xbt_dynar_t whereto);
+ /** @brief Return the location on which the current process is executed */
XBT_PUBLIC sg_host_t MSG_host_self();
+XBT_PUBLIC double MSG_host_get_load(sg_host_t host);
/* ******************************** VMs ************************************* */
typedef sg_vm_t msg_vm_t;
- XBT_ATTRIB_DEPRECATED_v322("Use sg_vm_create_migratable() from the live migration plugin: "
- "v3.22 will drop MSG_vm_create() completely.") XBT_PUBLIC sg_vm_t
- MSG_vm_create(sg_host_t ind_pm, const char* name, int coreAmount, int ramsize, int mig_netspeed, int dp_intensity);
-
XBT_PUBLIC msg_vm_t MSG_vm_create_core(msg_host_t pm, const char* name);
XBT_PUBLIC msg_vm_t MSG_vm_create_multicore(msg_host_t pm, const char* name, int coreAmount);
XBT_PUBLIC int MSG_process_get_PID(msg_process_t process);
XBT_PUBLIC int MSG_process_get_PPID(msg_process_t process);
+ /** @brief Return a #msg_process_t from its PID.
+ *
+ * Note that the PID are uniq in the whole simulation, not only on a given host.
+ *
+ * @returns NULL if no host is found
+ */
XBT_PUBLIC sg_actor_t MSG_process_from_PID(int pid);
XBT_PUBLIC const char* MSG_process_get_name(msg_process_t process);
XBT_PUBLIC sg_host_t MSG_process_get_host(msg_process_t process);
XBT_PUBLIC void MSG_process_resume(msg_process_t process);
XBT_PUBLIC int MSG_process_is_suspended(msg_process_t process);
XBT_PUBLIC void MSG_process_restart(msg_process_t process);
+ /** @brief Sets the "auto-restart" flag of the process.
+ *
+ * If the flag is set, the process will be automatically restarted when its host comes back up.
+ */
XBT_PUBLIC void MSG_process_auto_restart_set(msg_process_t process, int auto_restart);
+ /** @brief Indicates that this process should not prevent the simulation from ending
+ *
+ * SimGrid simulations run until all non-daemon processes are stopped.
+ */
XBT_PUBLIC void MSG_process_daemonize(msg_process_t process);
+ /** @brief Imediately changes the host on which this process runs */
XBT_PUBLIC void MSG_process_migrate(msg_process_t process, msg_host_t host);
+ /** @brief Wait for the completion of a #msg_process_t.
+ *
+ * @param process the process to wait for
+ * @param timeout wait until the process is over, or the timeout occurs
+ */
XBT_PUBLIC void MSG_process_join(msg_process_t process, double timeout);
+ /** @brief Kills a process */
XBT_PUBLIC void MSG_process_kill(msg_process_t process);
+ /** @brief Kill all running process */
XBT_PUBLIC void MSG_process_killall();
+ /** @breif Specifies the time at which the process should be automatically killed */
XBT_PUBLIC void MSG_process_set_kill_time(msg_process_t process, double kill_time);
+ /** @brief Yield the current actor; let the other actors execute first */
XBT_PUBLIC void MSG_process_yield();
-
- /**
- * \brief @brief Communication action.
- * \ingroup msg_task_usage
+ /** @brief Object representing an ongoing communication between processes.
*
- * Object representing an ongoing communication between processes. Such beast is usually obtained by using #MSG_task_isend, #MSG_task_irecv or friends.
+ * \rst
+ * Such beast is usually obtained by using :cpp:func:`MSG_task_isend`, :cpp:func:`MSG_task_irecv` or friends.
+ * \endrst
*/
typedef sg_msg_Comm* msg_comm_t;
} s_msg_task_t;
/** @brief Task datatype.
- @ingroup m_task_management
-
- A <em>task</em> may then be defined by a <em>computing
- amount</em>, a <em>message size</em> and some <em>private
- data</em>.
+ *
+ * Since most scheduling algorithms rely on a concept of task that can be either <em>computed</em> locally or
+ * <em>transferred</em> on another processor, it seems to be the right level of abstraction for our purposes.
+ * A <em>task</em> may then be defined by a <em>computing amount</em>, a <em>message size</em> and
+ * some <em>private data</em>.
*/
typedef struct msg_task* msg_task_t;
- /** \brief Default value for an uninitialized #msg_task_t.
- \ingroup m_task_management
- */
+ /** @brief Default value for an uninitialized #msg_task_t. */
#define MSG_TASK_UNINITIALIZED NULL
/** @brief Return code of most MSG functions
/** @} */
/************************** Global ******************************************/
+ /** @brief set a configuration variable
+ *
+ * Do --help on any simgrid binary to see the list of currently existing configuration variables, and see Section @ref
+ * options.
+ *
+ * Example:
+ * MSG_config("host/model","ptask_L07");
+ */
XBT_PUBLIC void MSG_config(const char* key, const char* value);
- /** \ingroup msg_simulation
- * \brief Initialize the MSG internal data.
- * \hideinitializer
+ /** @ingroup msg_simulation
+ * @brief Initialize the MSG internal data.
+ * @hideinitializer
*
* It also check that the link-time and compile-time versions of SimGrid do
* match, so you should use this version instead of the #MSG_init_nocheck
*
* We allow to link against compiled versions that differ in the patch level.
*/
- #define MSG_init(argc,argv) do { \
- sg_version_check(SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH);\
- MSG_init_nocheck(argc,argv); \
+ #define MSG_init(argc, argv) \
+ do { \
+ sg_version_check(SIMGRID_VERSION_MAJOR, SIMGRID_VERSION_MINOR, SIMGRID_VERSION_PATCH); \
+ MSG_init_nocheck(argc, argv); \
} while (0)
XBT_PUBLIC void MSG_init_nocheck(int* argc, char** argv);
+ /** @brief Launch the MSG simulation */
XBT_PUBLIC msg_error_t MSG_main();
+ /** @brief Registers the main function of a process in a global table.
+ *
+ * This table is then used by #MSG_launch_application.
+ * @param name the reference name of the function.
+ * @param code the function (must have the same prototype than the main function of any C program: int ..(int argc, char
+ * *argv[]))
+ */
XBT_PUBLIC void MSG_function_register(const char* name, xbt_main_func_t code);
+ /** @brief Registers a code function as being the default value.
+ *
+ * This function will get used by MSG_launch_application() when there is no registered function of the requested name
+ * in.
+ *
+ * @param code the function (must have the same prototype than the main function of any C program: int ..(int argc, char
+ * *argv[]))
+ */
XBT_PUBLIC void MSG_function_register_default(xbt_main_func_t code);
+ /** @brief Creates a new platform, including hosts, links and the routing_table */
XBT_PUBLIC void MSG_create_environment(const char* file);
+ /** @brief Creates the application described in the provided file */
XBT_PUBLIC void MSG_launch_application(const char* file);
- /*Bypass the parser */
+ /** @brief register functions bypassing the parser */
XBT_PUBLIC void MSG_set_function(const char* host_id, const char* function_name, xbt_dynar_t arguments);
+ /** @brief A clock (in second). */
XBT_PUBLIC double MSG_get_clock();
+ /** @brief Returns the amount of messages sent since the simulation start */
XBT_PUBLIC unsigned long int MSG_get_sent_msg();
/************************** Process handling *********************************/
XBT_PUBLIC msg_task_t MSG_comm_get_task(msg_comm_t comm);
XBT_PUBLIC msg_error_t MSG_comm_get_status(msg_comm_t comm);
+ /** @brief Check if there is a communication going on in a mailbox.
+ *
+ * @param alias the name of the mailbox to be considered
+ *
+ * @return Returns 1 if there is a communication, 0 otherwise
+ */
XBT_PUBLIC int MSG_task_listen(const char* alias);
XBT_PUBLIC msg_error_t MSG_task_send_with_timeout(msg_task_t task, const char* alias, double timeout);
XBT_PUBLIC msg_error_t MSG_task_send_with_timeout_bounded(msg_task_t task, const char* alias, double timeout,
/************************** Mailbox handling ************************************/
- /* @brief MSG_mailbox_set_async - set a mailbox as eager
- * Sets the mailbox to a permanent receiver mode. Messages sent to this mailbox will then be sent just after the send
- * is issued, without waiting for the corresponding receive.
+ /* @brief set a mailbox in eager mode.
+ * All messages sent to this mailbox will be transferred to the receiver without waiting for the receive call.
+ * The receive call will still be necessary to use the received data.
+ * If there is a need to receive some messages asynchronously, and some not, two different mailboxes should be used.
+ *
* This call should be done before issuing any receive, and on the receiver's side only
- * @param alias The alias of the mailbox to modify.
*/
XBT_PUBLIC void MSG_mailbox_set_async(const char* alias);
XBT_PUBLIC void MSG_sem_destroy(msg_sem_t sem);
XBT_PUBLIC int MSG_sem_would_block(msg_sem_t sem);
- /** @brief Opaque type representing a barrier identifier
- * @ingroup msg_synchro
- * @hideinitializer
- */
-
- #define MSG_BARRIER_SERIAL_PROCESS -1
- typedef struct s_msg_bar_t* msg_bar_t;
+ /** @brief Opaque type representing a barrier identifier */
+ typedef sg_bar_t msg_bar_t;
+ /** @brief Initializes a barier, with count elements */
XBT_PUBLIC msg_bar_t MSG_barrier_init(unsigned int count);
+ /** @brief Destroys barrier */
XBT_PUBLIC void MSG_barrier_destroy(msg_bar_t bar);
+ /** @brief Performs a barrier already initialized */
XBT_PUBLIC int MSG_barrier_wait(msg_bar_t bar);
/* ****************************************************************************************** */
XBT_ATTRIB_DEPRECATED_v323("MSG_process_get_smx_ctx is deprecated. Please contact us if you need it.")
MSG_process_get_smx_ctx(msg_process_t process);
- SG_END_DECL()
+ #ifdef __cplusplus
+ }
+ #endif
#ifdef __cplusplus
- XBT_PUBLIC msg_process_t MSG_process_create_from_stdfunc(const char* name, std::function<void()> code, void* data,
+ XBT_PUBLIC msg_process_t MSG_process_create_from_stdfunc(std::string name, std::function<void()> code, void* data,
msg_host_t host,
std::unordered_map<std::string, std::string>* properties);
#endif
XBT_PUBLIC double sg_host_get_current_load(sg_host_t host);
XBT_PUBLIC double sg_host_get_avg_load(sg_host_t host);
XBT_PUBLIC double sg_host_get_idle_time(sg_host_t host);
+ XBT_PUBLIC double sg_host_get_total_idle_time(sg_host_t host);
XBT_PUBLIC double sg_host_get_computed_flops(sg_host_t host);
XBT_PUBLIC void sg_host_load_reset(sg_host_t host);
#define MSG_host_load_plugin_init() sg_host_load_plugin_init()
#define MSG_host_get_current_load(host) sg_host_get_current_load(host)
#define MSG_host_get_computed_flops(host) sg_host_get_computed_flops(host)
+#define MSG_host_get_avg_load(host) sg_host_get_avg_load(host)
SG_END_DECL()
#include <clocale>
#include <string>
+ #include "simgrid/Exception.hpp"
#include "simgrid/msg.h"
#include "simgrid/plugins/energy.h"
#include "simgrid/plugins/file_system.h"
#include "simgrid/plugins/live_migration.h"
+#include "simgrid/plugins/load.h"
#include "simgrid/simix.h"
#include "simgrid/s4u/Host.hpp"
#include "JavaContext.hpp"
- #include <xbt/ex.hpp>
/* Shut up some errors in eclipse online compiler. I wish such a pimple wouldn't be needed */
#ifndef JNIEXPORT
{
using simgrid::kernel::context::JavaContext;
JavaContext* ctx = static_cast<JavaContext*>(xbt_os_thread_get_extra_data());
- return ctx->jenv;
+ return ctx->jenv_;
}
void jmsg_throw_status(JNIEnv *env, msg_error_t status) {
jxbt_check_res("MSG_main()", rv, MSG_OK,
xbt_strdup("unexpected error : MSG_main() failed .. please report this bug "));
- XBT_INFO("MSG_main finished; Cleaning up the simulation...");
+ XBT_INFO("MSG_main finished; Terminating the simulation...");
/* Cleanup java hosts */
xbt_dynar_t hosts = MSG_hosts_as_dynar();
for (unsigned long index = 0; index < xbt_dynar_length(hosts) - 1; index++) {
jobject jhost = (jobject) msg_host->extension(JAVA_HOST_LEVEL);
if (jhost)
jhost_unref(env, jhost);
-
}
xbt_dynar_free(&hosts);
/* Cleanup java storages */
for (auto const& elm : java_storage_map)
jstorage_unref(env, elm.second);
+
+ /* FIXME: don't be of such an EXTREM BRUTALITY to stop the jvm. Sorry I don't get it working otherwise.
+ * See the comment in ActorImpl.cpp::SIMIX_process_kill() */
+ exit(0);
}
JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_createEnvironment(JNIEnv * env, jclass cls, jstring jplatformFile)
sg_storage_file_system_init();
}
-
+JNIEXPORT void JNICALL Java_org_simgrid_msg_Msg_loadInit() {
+ sg_host_load_plugin_init();
+}
/** Run a Java org.simgrid.msg.Process
*
* If needed, this waits for the process starting time.
jdouble startTime = env->GetDoubleField(jprocess, jprocess_field_Process_startTime);
if (startTime > MSG_get_clock())
MSG_process_sleep(startTime - MSG_get_clock());
+
//Execution of the "run" method.
jmethodID id = jxbt_get_smethod(env, "org/simgrid/msg/Process", "run", "()V");
- xbt_assert((id != nullptr), "Method run() not found...");
+ xbt_assert((id != nullptr), "Method Process.run() not found...");
+
env->CallVoidMethod(jprocess, id);
}
//bind the process to the context
msg_process_t process = MSG_process_self();
- context->jprocess = jprocess;
+ context->jprocess_ = jprocess;
/* sets the PID and the PPID of the process */
env->SetIntField(jprocess, jprocess_field_Process_pid, static_cast<jint>(MSG_process_get_PID(process)));
env->SetIntField(jprocess, jprocess_field_Process_ppid, static_cast<jint>(MSG_process_get_PPID(process)));
jprocess_bind(jprocess, process, env);
- run_jprocess(env, context->jprocess);
+ run_jprocess(env, context->jprocess_);
return 0;
}
{
JNIEnv *env = get_current_thread_env();
simgrid::kernel::context::JavaContext* context = static_cast<simgrid::kernel::context::JavaContext*>(SIMIX_context_self());
- context->jprocess = jprocess;
- jprocess_bind(context->jprocess, MSG_process_self(), env);
+ context->jprocess_ = jprocess;
+ jprocess_bind(context->jprocess_, MSG_process_self(), env);
- run_jprocess(env, context->jprocess);
+ run_jprocess(env, context->jprocess_);
}
}}}
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "simgrid/plugins/energy.h"
+#include "simgrid/plugins/load.h"
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/Storage.hpp"
msg_host_t host = jhost_get_native(env, jhost);
return MSG_host_get_power_peak_at(host, pstate);
}
-
-
+
+JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getLoad(JNIEnv* env, jobject jhost)
+{
+ msg_host_t host = jhost_get_native(env, jhost);
+ return MSG_host_get_load(host);
+}
+
-
+JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getCurrentLoad (JNIEnv *env, jobject jhost)
+{
+ msg_host_t host = jhost_get_native(env, jhost);
+
+ if (not host) {
+ jxbt_throw_notbound(env, "host", jhost);
+ return 0;
+ }
+
+ return MSG_host_get_current_load(host);
+}
+
-
-
+JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getComputedFlops (JNIEnv *env, jobject jhost)
+{
+ msg_host_t host = jhost_get_native(env, jhost);
+
+ if (not host) {
+ jxbt_throw_notbound(env, "host", jhost);
+ return 0;
+ }
+
+ return MSG_host_get_computed_flops(host);
+}
+
+JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getAvgLoad (JNIEnv *env, jobject jhost)
+{
+ msg_host_t host = jhost_get_native(env, jhost);
+
+ if (not host) {
+ jxbt_throw_notbound(env, "host", jhost);
+ return 0;
+ }
+
+ return MSG_host_get_avg_load(host);
+}
* the value will be updated in kernel mode before returning the control to the requesting actor.
*/
public native double getConsumedEnergy();
-
+
++ /** Returns the current load of the host */
+ public native double getCurrentLoad();
-
++ /** Returns the number of flops computed of the host */
+ public native double getComputedFlops();
-
++ /** Returns the average load of the host */
+ public native double getAvgLoad();
-
/** Returns the current pstate */
public native int getPstate();
/** Changes the current pstate */
public native double getCurrentPowerPeak();
/** Returns the speed of the processor (in flop/s) at a given pstate. See also @ref plugin_energy. */
public native double getPowerPeakAt(int pstate);
-
+
+ /** Returns the current computation load (in flops per second) */
+ public native double getLoad();
/** Class initializer, to initialize various JNI stuff */
private static native void nativeInit();
/** Tell the kernel that you want to use the energy plugin */
public static final native void energyInit();
++
++ /** Tell the kernel that you want to use the filesystem plugin. */
public static final native void fileSystemInit();
+
++ /** Initializes the HostLoad plugin.
++ *
++ * The HostLoad plugin provides an API to get the current load of each host.
++ */
+ public static final native void loadInit();
+
/** Run the MSG simulation.
*
* After the simulation, you can freely retrieve the information that you want..
/* ************************** Engine *************************** */
void MSG_create_environment(const char* filename)
{
- sg_engine_load_platform(filename);
+ simgrid_load_platform(filename);
}
void MSG_launch_application(const char* filename)
{
- sg_engine_load_deployment(filename);
+ simgrid_load_deployment(filename);
}
msg_error_t MSG_main()
{
- sg_engine_run();
+ simgrid_run();
return MSG_OK;
}
void MSG_function_register(const char* name, xbt_main_func_t code)
{
- sg_engine_register_function(name, code);
+ simgrid_register_function(name, code);
}
void MSG_function_register_default(xbt_main_func_t code)
{
- sg_engine_register_default(code);
+ simgrid_register_default(code);
}
double MSG_get_clock()
{
- return sg_engine_get_clock();
+ return simgrid_get_clock();
}
/* ************************** Mailboxes ************************ */
{
return sg_host_self();
}
+
+double MSG_host_get_load(sg_host_t host)
+{
+ return sg_host_load(host);
+}
/* ************************** Virtual Machines *************************** */
sg_vm_t MSG_vm_create_core(sg_host_t pm, const char* name)
{
{
sg_vm_destroy(vm);
}
+ /********* barriers ************/
+ sg_bar_t MSG_barrier_init(unsigned int count)
+ {
+ return sg_barrier_init(count);
+ }
+
+ void MSG_barrier_destroy(sg_bar_t bar)
+ {
+ sg_barrier_destroy(bar);
+ }
+
+ int MSG_barrier_wait(sg_bar_t bar)
+ {
+ return sg_barrier_wait(bar);
+ }
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "simgrid/kernel/routing/NetPoint.hpp"
+ #include "simgrid/s4u/Actor.hpp"
#include "simgrid/s4u/Engine.hpp"
- #include "src/simix/smx_host_private.hpp"
+ #include "simgrid/s4u/Exec.hpp"
#include "src/surf/HostImpl.hpp"
#include <string>
simgrid::xbt::signal<void(Host&)> Host::on_state_change;
simgrid::xbt::signal<void(Host&)> Host::on_speed_change;
- Host::Host(const char* name) : name_(name)
+ Host::Host(std::string name) : name_(name)
{
- xbt_assert(Host::by_name_or_null(name) == nullptr, "Refusing to create a second host named '%s'.", name);
+ xbt_assert(Host::by_name_or_null(name) == nullptr, "Refusing to create a second host named '%s'.", name.c_str());
Engine::get_instance()->host_register(std::string(name_), this);
new simgrid::surf::HostImpl(this);
}
{
return Engine::get_instance()->host_by_name(name);
}
- Host* Host::by_name(const char* name)
- {
- return Engine::get_instance()->host_by_name(std::string(name));
- }
- Host* Host::by_name_or_null(const char* name)
- {
- return Engine::get_instance()->host_by_name_or_null(std::string(name));
- }
Host* Host::by_name_or_null(std::string name)
{
return Engine::get_instance()->host_by_name_or_null(name);
smx_actor_t smx_proc = SIMIX_process_self();
if (smx_proc == nullptr)
xbt_die("Cannot call Host::current() from the maestro context");
- return smx_proc->host;
+ return smx_proc->host_;
}
void Host::turn_on()
{
if (is_off()) {
simgrid::simix::simcall([this] {
- this->extension<simgrid::simix::Host>()->turnOn();
this->pimpl_cpu->turn_on();
+ this->pimpl_->turn_on();
on_state_change(*this);
});
}
void Host::turn_off()
{
if (is_on()) {
- smx_actor_t self = SIMIX_process_self();
- simgrid::simix::simcall([this, self] {
- simgrid::simix::Host* host = this->extension<simgrid::simix::Host>();
-
- xbt_assert((host != nullptr), "Invalid parameters");
-
+ simgrid::simix::simcall([this] {
this->pimpl_cpu->turn_off();
-
- /* Clean Simulator data */
- if (not host->process_list.empty()) {
- for (auto& process : host->process_list) {
- SIMIX_process_kill(&process, self);
- XBT_DEBUG("Killing %s@%s on behalf of %s which turned off that host.", process.get_cname(),
- process.host->get_cname(), self->get_cname());
- }
- }
+ this->pimpl_->turn_off();
on_state_change(*this);
});
}
}
- bool Host::is_on()
+ bool Host::is_on() const
{
return this->pimpl_cpu->is_on();
}
}
/**
- * \brief Return a copy of the list of actors that are executing on this host.
+ * @brief Return a copy of the list of actors that are executing on this host.
*
* Daemons and regular actors are all mixed in this list.
*/
std::vector<ActorPtr> Host::get_all_actors()
{
- std::vector<ActorPtr> res;
- for (auto& actor : this->extension<simgrid::simix::Host>()->process_list)
- res.push_back(actor.ciface());
- return res;
+ return pimpl_->get_all_actors();
}
/** @brief Returns how many actors (daemonized or not) have been launched on this host */
int Host::get_actor_count()
{
- return this->extension<simgrid::simix::Host>()->process_list.size();
+ return pimpl_->get_actor_count();
}
/** @deprecated */
void Host::getProcesses(std::vector<ActorPtr>* list)
{
- for (auto& actor : this->extension<simgrid::simix::Host>()->process_list) {
- list->push_back(actor.iface());
- }
+ auto actors = get_all_actors();
+ for (auto& actor : actors)
+ list->push_back(actor);
}
/** @deprecated */
void Host::actorList(std::vector<ActorPtr>* whereto)
{
- for (auto& actor : this->extension<simgrid::simix::Host>()->process_list) {
- whereto->push_back(actor.ciface());
- }
+ auto actors = get_all_actors();
+ for (auto& actor : actors)
+ whereto->push_back(actor);
}
/**
- * \brief Find a route toward another host
+ * @brief Find a route toward another host
*
- * \param dest [IN] where to
- * \param links [OUT] where to store the list of links (must exist, cannot be nullptr).
- * \param latency [OUT] where to store the latency experienced on the path (or nullptr if not interested)
+ * @param dest [IN] where to
+ * @param links [OUT] where to store the list of links (must exist, cannot be nullptr).
+ * @param latency [OUT] where to store the latency experienced on the path (or nullptr if not interested)
* It is the caller responsibility to initialize latency to 0 (we add to provided route)
- * \pre links!=nullptr
+ * @pre links!=nullptr
*
* walk through the routing components tree and find a route between hosts
* by calling each "get_route" function in each routing component.
}
/** Retrieve the property value (or nullptr if not set) */
- const char* Host::get_property(const char* key)
+ const char* Host::get_property(std::string key) const
{
return this->pimpl_->get_property(key);
}
}
/** @brief Get the peak processor speed (in flops/s), at the specified pstate */
- double Host::get_pstate_speed(int pstate_index)
+ double Host::get_pstate_speed(int pstate_index) const
{
return simgrid::simix::simcall([this, pstate_index] { return this->pimpl_cpu->get_pstate_peak_speed(pstate_index); });
}
* The amount of flops per second available for computing depends on several things:
* - The current pstate determines the maximal peak computing speed (use @ref get_pstate_speed() to retrieve the
* computing speed you would get at another pstate)
- * - If you declared an external load, then this reduces the available computing speed (see @ref set_speed_trace())
+ * - If you declared an external load, then this reduces the available computing speed
+ * (see @ref simgrid::surf::Cpu::set_speed_trace())
*
* The remaining speed is then shared between the executions located on this host.
* You can retrieve the amount of tasks currently running on this host with @ref get_load().
*
* Finally, executions of priority 2 get twice the amount of flops than executions of priority 1.
*/
- double Host::get_speed()
+ double Host::get_speed() const
{
return this->pimpl_cpu->get_speed(1.0);
}
/** @brief Returns the current computation load (in flops per second)
* The external load (coming from an availability trace) is not taken in account.
*/
- double Host::get_load()
+ double Host::get_load() const
{
return this->pimpl_cpu->get_load();
}
/** @brief Get the available speed ratio, between 0 and 1.
*
- * This accounts for external load (see @ref set_speed_trace()).
+ * This accounts for external load (see @ref simgrid::surf::Cpu::set_speed_trace()).
*/
- double Host::get_available_speed()
+ double Host::get_available_speed() const
{
return this->pimpl_cpu->get_speed_ratio();
}
/** @brief Returns the number of core of the processor. */
- int Host::get_core_count()
+ int Host::get_core_count() const
{
return this->pimpl_cpu->get_core_count();
}
simgrid::simix::simcall([this, pstate_index] { this->pimpl_cpu->set_pstate(pstate_index); });
}
/** @brief Retrieve the pstate at which the host is currently running */
- int Host::get_pstate()
+ int Host::get_pstate() const
{
return this->pimpl_cpu->get_pstate();
}
/**
- * \ingroup simix_storage_management
- * \brief Returns the list of storages attached to an host.
- * \return a vector containing all storages attached to the host
+ * @ingroup simix_storage_management
+ * @brief Returns the list of storages attached to an host.
+ * @return a vector containing all storages attached to the host
*/
- std::vector<const char*> Host::get_attached_storages()
+ std::vector<const char*> Host::get_attached_storages() const
{
return simgrid::simix::simcall([this] { return this->pimpl_->get_attached_storages(); });
}
return *mounts_;
}
+ ExecPtr Host::exec_async(double flops)
+ {
+ return this_actor::exec_init(flops)->set_host(this);
+ }
+
void Host::execute(double flops)
{
execute(flops, 1.0 /* priority */);
}
void Host::execute(double flops, double priority)
{
- smx_activity_t s = simcall_execution_start(nullptr, flops, 1 / priority /*priority*/, 0. /*bound*/, this);
- simcall_execution_wait(s);
+ this_actor::exec_init(flops)->set_host(this)->set_priority(1 / priority)->start()->wait();
}
} // namespace s4u
*
* Uses sg_host_count() to know the array size.
*
- * \return an array of \ref sg_host_t containing all the hosts in the platform.
- * \remark The host order in this array is generally different from the
+ * @return an array of @ref sg_host_t containing all the hosts in the platform.
+ * @remark The host order in this array is generally different from the
* creation/declaration order in the XML platform (we use a hash table
* internally).
- * \see sg_host_count()
+ * @see sg_host_count()
*/
sg_host_t* sg_host_list()
{
return host->get_speed();
}
- /** \brief Return the speed of the processor (in flop/s) at a given pstate. See also @ref plugin_energy.
+ /** @brief Return the speed of the processor (in flop/s) at a given pstate. See also @ref plugin_energy.
*
- * \param host host to test
- * \param pstate_index pstate to test
- * \return Returns the processor speed associated with pstate_index
+ * @param host host to test
+ * @param pstate_index pstate to test
+ * @return Returns the processor speed associated with pstate_index
*/
double sg_host_get_pstate_speed(sg_host_t host, int pstate_index)
{
return host->get_pstate_speed(pstate_index);
}
- /** \ingroup m_host_management
- * \brief Return the number of cores.
+ /** @ingroup m_host_management
+ * @brief Return the number of cores.
*
- * \param host a host
- * \return the number of cores
+ * @param host a host
+ * @return the number of cores
*/
int sg_host_core_count(sg_host_t host)
{
host->set_pstate(pstate);
}
- /** \ingroup m_host_management
+ /** @ingroup m_host_management
*
- * \brief Start the host if it is off
+ * @brief Start the host if it is off
*
* See also #sg_host_is_on() and #sg_host_is_off() to test the current state of the host and @ref plugin_energy
* for more info on DVFS.
host->turn_on();
}
- /** \ingroup m_host_management
+ /** @ingroup m_host_management
*
- * \brief Stop the host if it is on
+ * @brief Stop the host if it is on
*
* See also #MSG_host_is_on() and #MSG_host_is_off() to test the current state of the host and @ref plugin_energy
* for more info on DVFS.
return as_dict;
}
- /** \ingroup m_host_management
- * \brief Returns the value of a given host property
+ /** @ingroup m_host_management
+ * @brief Returns the value of a given host property
*
- * \param host a host
- * \param name a property name
- * \return value of a property (or nullptr if property not set)
- */
+ * @param host a host
+ * @param name a property name
+ * @return value of a property (or nullptr if property not set)
+ */
const char* sg_host_get_property_value(sg_host_t host, const char* name)
{
return host->get_property(name);
}
/**
- * \brief Find a route between two hosts
+ * @brief Find a route between two hosts
*
- * \param from where from
- * \param to where to
- * \param links [OUT] where to store the list of links (must exist, cannot be nullptr).
+ * @param from where from
+ * @param to where to
+ * @param links [OUT] where to store the list of links (must exist, cannot be nullptr).
*/
void sg_host_route(sg_host_t from, sg_host_t to, xbt_dynar_t links)
{
xbt_dynar_push(links, &link);
}
/**
- * \brief Find the latency of the route between two hosts
+ * @brief Find the latency of the route between two hosts
*
- * \param from where from
- * \param to where to
+ * @param from where from
+ * @param to where to
*/
double sg_host_route_latency(sg_host_t from, sg_host_t to)
{
return res;
}
/**
- * \brief Find the bandwitdh of the route between two hosts
+ * @brief Find the bandwitdh of the route between two hosts
*
- * \param from where from
- * \param to where to
+ * @param from where from
+ * @param to where to
*/
double sg_host_route_bandwidth(sg_host_t from, sg_host_t to)
{
}
}
- /** \brief Return the list of actors attached to an host.
+ /** @brief Return the list of actors attached to an host.
*
- * \param host a host
- * \param whereto a dynar in which we should push actors living on that host
+ * @param host a host
+ * @param whereto a dynar in which we should push actors living on that host
*/
void sg_host_get_actor_list(sg_host_t host, xbt_dynar_t whereto)
{
- for (auto& actor : host->extension<simgrid::simix::Host>()->process_list) {
- s4u_Actor* p = actor.ciface();
- xbt_dynar_push(whereto, &p);
- }
+ auto actors = host->get_all_actors();
+ for (auto& actor : actors)
+ xbt_dynar_push(whereto, &actor);
}
sg_host_t sg_host_self()
{
smx_actor_t process = SIMIX_process_self();
- return (process == nullptr) ? nullptr : process->host;
+ return (process == nullptr) ? nullptr : process->host_;
}
+
+double sg_host_load(sg_host_t host)
+{
+ return host->get_load();
+}