with smpi/comp-adjustment-file.
- sleep events are now correctly traced/replayed.
- Default for trace-call-location is now to use file names and not full paths.
- To revert to previous behaviour (in case of collision of filenames), option
+ To revert to previous behavior (in case of collision of filenames), option
"smpi/trace-call-use-absolute-path" can be set to yes.
Model-Checker:
MSG_environment_as_get_property_value().
- Removed MSG_as_router_*propert*() functions
- Added MSG_environment_as_set_property_value() for consistency
- * xbt heterogeneous dictionnaries (created with xbt_dict_new()).
+ * xbt heterogeneous dictionaries (created with xbt_dict_new()).
Well, they are still there for now, but deprecated with a warning.
Please switch to xbt_dict_new_homogeneous() before this is removed
for real.
* New module: org.simgrid.msg.File (SimGrid File management functions)
* New Module: org.simgrid.msg.VM (SimGrid interface to mimick IAAS clouds)
* Change the meaning of Process.restart: now restart the process from
- the begining, like MSG_process_restart in C.
+ the beginning, like MSG_process_restart in C.
* Add Process.setAutoRestart: handling of process restart when failed
host comes back.
* Add Process.getProperty, Host.getProperty, Host.getProperty: allows
* Fix a bug preventing the tasks from begin garbage collected.
MSG
- * Fix a bug occuring when a host involved in a communication fails.
+ * Fix a bug occurring when a host involved in a communication fails.
This was not detected properly by the other peer involved in the
communication. Now, it's reported as a network error.
o network_model -> network/model
o workstation_model -> workstation/model
* New configuration variables:
- o network/bandwidth_factor: correction to bandwith
+ o network/bandwidth_factor: correction to bandwidth
o network/latency_factor: correction to latency
o netwotk/weight_S: correction to the weight of competing streams
* Add a long description to the models, that users can see with such
- SD_task_create_comm_e2e() for end-to-end communication
- SD_task_create_comp_seq() for sequential computation
Use SD_task_schedulev() / SD_task_schedulel() to schedule them.
- * new function SD_task_dump() for debuging display
+ * new function SD_task_dump() for debugging display
* new function SD_task_dotty(task,FILE*) writing to file the info
about the task in dotty format
* SD_task_dependency_exists() can now cope with having one of its
kind of action while the second one parses a trace file and
triggers the corresponding actions within the system.
For now, only a toy example is provided in examples/msg/actions
- * Add an exemple of process migration in examples/msg/migration
+ * Add an example of process migration in examples/msg/migration
* Fix a bug in task exchange which broke MSG_task_get_sender()
Add a teshsuite regression test for that.
[Bug: if MSG_task_get_sender() is called after sender exit,
**************************************
*DO NOT MIX 3.2 RESULTS WITH 3.3 ONES* Simix may changes simulations!
**************************************
- The point is that events occuring at the exact same timestamp are
+ The point is that events occurring at the exact same timestamp are
not scheduled in the same order with the old and new version. This
may be enough to completely change the execution of simulations in
some cases. Sorry for the inconvenience.
. Lesson 8: Handling errors through exceptions
. Lesson 9: Exchanging simple data
. Lesson 10: Remote Procedure Calling (RPC)
- . Lesson 11: Explicitely waiting for messages
+ . Lesson 11: Explicitly waiting for messages
. Recapping of message passing features in GRAS
- A HOWTO section containing:
o HOWTO design a GRAS application
in progress and the API is not considered to be frozen yet). [AL]
* Display more information on backtraces: source line & function names are
now displayed just like valgrind does (rely on addr2line tool) [MQ]
- * New function: xbt_backtrace_display(). Sweet while debuging [MQ]
+ * New function: xbt_backtrace_display(). Sweet while debugging [MQ]
* Reworked a little bit some #include statements to load only required
headers. Some user code that relied on SimGrid to include stdlib or
stdio may need to include it by themselves. [AL]
- reduces the amount of exchanged data (the size)
- allows to retrieve all arrived data on receiver side, if we don't need
it right now (subsequent read will peek the buffer)
- - allows the receiver to proceed with the begining of the stream before
+ - allows the receiver to proceed with the beginning of the stream before
everything is arrived
- make it possible to build an iov transport (using readv/writev)
Extra difficulty:
- s_toto is a structure needing 'struct' keyword to be used
- e_toto_t is an enum
- toto_t is an 'object' (struct*)
- Exemple:
+ Example:
typedef struct s_toto {} s_toto_t, *toto_t;
typedef enum {} e_toto_t;
Moreover, only toto_t (and e_toto_t) are public. The rest (mainly
- In composed data description (struct, ref and so on), stop foolness of
keeping the subtype's ID, but store the type itself. This keeps sets out
of the critical path, which is good since they rely on dynar and
- dictionnaries. The only loose of that is that we cannot detect the
+ dictionaries. The only loose of that is that we cannot detect the
redeclaration of a structure/union with another content (but I'm not sure
the code detected well this error before anyway). We still can detect
the redefinition discrepancy for the other types.
for now.
[Transport]
[File plugin]
- - Bugfix when using a filename explicitely (instead of '-')
+ - Bugfix when using a filename explicitly (instead of '-')
2004-04-09 Martin Quinson
[Transport plugins]
include src/bindings/java/jmsg_host.h
include src/bindings/java/jmsg_process.cpp
include src/bindings/java/jmsg_process.h
-include src/bindings/java/jmsg_rngstream.cpp
-include src/bindings/java/jmsg_rngstream.h
include src/bindings/java/jmsg_storage.cpp
include src/bindings/java/jmsg_storage.h
include src/bindings/java/jmsg_synchro.cpp
include src/surf/network_ns3.hpp
include src/surf/network_smpi.cpp
include src/surf/network_smpi.hpp
+include src/surf/network_wifi.cpp
+include src/surf/network_wifi.hpp
include src/surf/ns3/ns3_simulator.cpp
include src/surf/ns3/ns3_simulator.hpp
include src/surf/ptask_L07.cpp
{
xbt_dict_t mydict = get_dict();
FILE* fpInput = fopen(inputfile, "r");
- if (fpInput == NULL)
- printf("Error while opening the inputfile");
+ xbt_assert(fpInput != NULL, "Error while opening the inputfile");
fseek(fpInput, 0, 0);
char line[200];
people exchanging small messages. We also reworked the route
descriptions to allow more compact descriptions.
-That is why the XML files are versionned using the 'version' attribute
+That is why the XML files are versioned using the 'version' attribute
of the root tag. Currently, it should read:
@verbatim
<platform version="4">
Some functions of the @ref SURF_host_interface and similar can give
you some information about:
- a host: get_speed(), get_available_speed();
- - a network link: get_link_name(), get_link_latency(), get_link_bandwith();
+ - a network link: get_link_name(), get_link_latency(), get_link_bandwidth();
- a route: get_route(), get_route_size().
During the simulation, call @a surf_host_model->execute() to schedule a
@{ */
/** @defgroup XBT_dynar Dynar: generic dynamic array */
- /** @defgroup XBT_dict Dict: generic dictionnary */
+ /** @defgroup XBT_dict Dict: generic dictionary */
/** @} */
| @ref pf_routing_model_dijkstra "Dijkstra" | Dijkstra routing data. Calculates routes only when needed |
| @ref pf_routing_model_dijkstracache "DijkstraCache" | Dijkstra routing data. Handles some cache for already calculated routes. |
-All those shortest-path models are instanciated in the same way and are
+All those shortest-path models are instantiated in the same way and are
completely interchangeable. Here are some examples:
@anchor pf_routing_model_floyd
the <a href="http://grid5000.fr/">Grid'5000</a> experimental platform.
But it's hard to come up with generic models. Don't take these files
too seriously. Actually, you should always challenge our models and
-your instanciation if the accuracy really matters to you (see <a
+your instantiation if the accuracy really matters to you (see <a
href="https://hal.inria.fr/hal-00907887">this discussion</a>).
But such advices only hold if you have a real platform and a real
sendChoked(peerChoked.mailbox);
activePeers.remove(e.getKey());
}
- Connection peerChoosed = null;
+ Connection peerChosen = null;
//Separate the case from when the peer is seeding.
if (pieces == Common.FILE_PIECES) {
//Find the last unchoked peer.
double unchokeTime = deadline + 1;
for (Connection connection : peers.values()) {
if (connection.lastUnchoke < unchokeTime && connection.interested) {
- peerChoosed = connection;
+ peerChosen = connection;
unchokeTime = connection.lastUnchoke;
}
}
int idChosen = rand.nextInt(peers.size());
for (Connection connection : peers.values()) {
if (i == idChosen) {
- peerChoosed = connection;
+ peerChosen = connection;
break;
}
i++;
} //TODO: Not really the best way ever
- if (peerChoosed != null && !peerChoosed.interested) {
- peerChoosed = null;
+ if (peerChosen != null && !peerChosen.interested) {
+ peerChosen = null;
}
j++;
- } while (peerChoosed == null && j < Common.MAXIMUM_PEERS);
+ } while (peerChosen == null && j < Common.MAXIMUM_PEERS);
} else {
Connection fastest = null;
double fastestSpeed = 0;
fastestSpeed = c.peerSpeed;
}
}
- peerChoosed = fastest;
+ peerChosen = fastest;
}
}
- if (peerChoosed != null) {
- activePeers.put(peerChoosed.id,peerChoosed);
- peerChoosed.chokedUpload = false;
- peerChoosed.lastUnchoke = Msg.getClock();
- sendUnchoked(peerChoosed.mailbox);
+ if (peerChosen != null) {
+ activePeers.put(peerChosen.id,peerChosen);
+ peerChosen.chokedUpload = false;
+ peerChosen.lastUnchoke = Msg.getClock();
+ sendUnchoked(peerChosen.mailbox);
}
}
#include <xbt/dynar.h>
#include "routing_table.h"
-/* Node query anwser. contains the elements closest to the id given. */
+/* Node query answer. contains the elements closest to the id given. */
typedef struct s_node_answer {
unsigned int destination_id;
xbt_dynar_t nodes; //Dynar of node_contact_t
if (!xbt_dynar_is_empty(parents)) {
unsigned int i;
double data_available = 0.;
- double redist_time = 0;
double last_data_available;
/* compute last_data_available */
SD_task_t parent;
if (SD_task_get_kind(parent) == SD_TASK_COMM_E2E) {
sg_host_t * parent_host= SD_task_get_workstation_list(parent);
/* Estimate the redistribution time from this parent */
+ double redist_time;
if (SD_task_get_amount(parent) <= 1e-6){
redist_time= 0;
} else {
-
- This models the big links constituting the backbone of the internet,
- that users cannot saturate.
- - Users' bandwidth is mostly limited by their outgoing connexion,
+ - Users' bandwidth is mostly limited by their outgoing connection,
- not by the network backbone.
-->
print "<!-- This platform was automatically converted from the OptorSim platform.\n";
print "\n";
-print " OptorSim files only describes information of the cluster interconnexion.\n";
+print " OptorSim files only describes information of the cluster interconnection.\n";
print " In a sense, it reflects the topology of a National Research and Education\n";
print " Network (NREN), but not of a full-fledged computational platform.\n";
print " The caracteristics of each cluster have been artificially added.\n";
- **Basic execution:**
The computations done in your program are not reported to the
- simulated world, unless you explicitely request the simulator to pause
+ simulated world, unless you explicitly request the simulator to pause
the actor until a given amount of flops gets computed on its simulated
host. Some executions can be given an higher priority so that they
get more resources.
This platform file contains the energy profile of each links and
hosts, which is necessary to get energy consumption predictions.
As usual, you should not trust our example, and you should strive
- to double-check that your instanciation matches your target platform.
+ to double-check that your instantiation matches your target platform.
|br| `examples/platforms/energy_platform.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/energy_platform.xml>`_
- **Consumption due to the CPU:**
* function in the Actor::on_termination signal, that is shared between
* all actors. Callbacks to this signal are executed for each terminating
* actors, no matter what. This is useful in many cases, in particular
- * when developping SimGrid plugins.
+ * when developing SimGrid plugins.
*
* Finally, you can attach callbacks to the Actor::on_destruction signal.
* It is also shared between all actors, and gets fired when the actors
mutex->lock();
XBT_INFO("Hello s4u, I'm ready to compute after a regular lock");
- // And finaly add it to the results
+ // And finally add it to the results
result += 1;
XBT_INFO("I'm done, good bye");
action_fun previous_send;
static void overriding_send(simgrid::xbt::ReplayAction& args)
{
- previous_send(args); // Just call the overriden symbol. That's a toy example.
+ previous_send(args); // Just call the overridden symbol. That's a toy example.
}
int main(int argc, char* argv[])
This is done to avoid SMPI actors to start at actor_id=0.
3. For each job:
1. Sleep until job's starting time is reached (if needed)
- 2. Launch the replay of the corresponding time-indepent trace.
+ 2. Launch the replay of the corresponding time-independent trace.
3. Create inter-process noise, by spawning useless actors.
4. Wait for completion (via s4u::Engine's run method)
*/
status_ = FutureStatus::ready;
if (continuation_) {
// We unregister the continuation before executing it.
- // We need to do this becase the current implementation of the
+ // We need to do this because the current implementation of the
// continuation has a shared_ptr to the FutureState.
auto continuation = std::move(continuation_);
this->schedule(std::move(continuation));
/** Shared state for future and promises
*
* You are not expected to use them directly but to create them
- * implicitely through a @ref simgrid::kernel::Promise.
+ * implicitly through a @ref simgrid::kernel::Promise.
* Alternatively kernel operations could inherit or contain FutureState
* if they are managed with std::shared_ptr.
**/
/** Result of some (probably) asynchronous operation in the SimGrid kernel
*
* @ref simgrid::simix::Future and @ref simgrid::simix::Future provide an
- * abstration for asynchronous stuff happening in the SimGrid kernel. They
+ * abstraction for asynchronous stuff happening in the SimGrid kernel. They
* are based on C++1z futures.
*
* The future represents a value which will be available at some point when this
- * asynchronous operaiont is finished. Alternatively, if this operations fails,
+ * asynchronous operation is finished. Alternatively, if this operations fails,
* the result of the operation might be an exception.
*
* As the operation is possibly no terminated yet, we cannot get the result
* * inside the `.then()`, `.get()` can be used;
*
* * `.get()` can only be used when `.is_ready()` (as everything happens in
- * a single-thread, the future would be guaranted to deadlock if `.get()`
+ * a single-thread, the future would be guaranteed to deadlock if `.get()`
* is called when the future is not ready);
*
* * there is no future chaining support for now (`.then().then()`);
* promise.set_value(value);
* }
* catch (...) {
- * // If an error occured, we can set an exception which
+ * // If an error occurred, we can set an exception which
* // will be thrown by future.get():
* promise.set_exception(std::current_exception());
* }
* @param now The current time of the simulation
* @return The delta of time till the next action will finish
*/
- virtual double next_occuring_event(double now);
- virtual double next_occuring_event_lazy(double now);
- virtual double next_occuring_event_full(double now);
+ virtual double next_occurring_event(double now);
+ virtual double next_occurring_event_lazy(double now);
+ virtual double next_occurring_event_full(double now);
+
+ XBT_ATTRIB_DEPRECATED_v329("Please use next_occurring_event()") double next_occuring_event(double now)
+ {
+ return next_occurring_event(now);
+ }
+ XBT_ATTRIB_DEPRECATED_v329("Please use next_occurring_event_lazy()") double next_occuring_event_lazy(double now)
+ {
+ return next_occurring_event_lazy(now);
+ }
+ XBT_ATTRIB_DEPRECATED_v329("Please use next_occurring_event_full()") double next_occuring_event_full(double now)
+ {
+ return next_occurring_event_full(now);
+ }
private:
Action* extract_action(Action::StateSet* list);
* The only model that is not is ns-3: computing the next timestamp moves the model up to that point,
* so we need to call it only when the next timestamp of other sources is computed.
*/
- virtual bool next_occuring_event_is_idempotent() { return true; }
+ virtual bool next_occurring_event_is_idempotent() { return true; }
+
+ XBT_ATTRIB_DEPRECATED_v329("Please use next_occurring_event_is_idempotent()") bool next_occuring_event_is_idempotent()
+ {
+ return next_occurring_event_is_idempotent();
+ }
private:
std::unique_ptr<lmm::System> maxmin_system_;
namespace routing {
/** @ingroup ROUTING_API
- * @brief NetZone with an explicit routing computed on need with Dijsktra
+ * @brief NetZone with an explicit routing computed on need with Dijkstra
*
* The path between components is computed each time you request it,
* using the Dijkstra algorithm. A cache can be used to reduce the computation.
* 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 */
+/** @brief Immediately 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 process.
*
/** @brief Opaque type representing a barrier identifier */
typedef sg_bar_t msg_bar_t;
-/** @brief Initializes a barier, with count elements */
+/** @brief Initializes a barrier, 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);
*
* They are located on @ref simgrid::s4u::Storage that are accessed from a given @ref simgrid::s4u::Host through
* mountpoints.
- * For now, you cannot change the mountpoints programatically, and must declare them from your platform file.
+ * For now, you cannot change the mountpoints programmatically, and must declare them from your platform file.
*/
class XBT_PUBLIC File {
public:
class XBT_PUBLIC Host : public xbt::Extendable<Host> {
friend vm::VMModel; // Use the pimpl_cpu to compute the VM sharing
friend vm::VirtualMachineImpl; // creates the the pimpl_cpu
+ friend kernel::routing::NetZoneImpl;
public:
explicit Host(const std::string& name);
/** Host destruction logic */
protected:
virtual ~Host();
+ void set_netpoint(kernel::routing::NetPoint* netpoint) { pimpl_netpoint_ = netpoint; }
private:
bool currently_destroying_ = false;
/** Retrieves the name of that host as a C string */
const char* get_cname() const { return name_.c_str(); }
+ kernel::routing::NetPoint* get_netpoint() const { return pimpl_netpoint_; }
+
int get_actor_count();
std::vector<ActorPtr> get_all_actors();
/** Get an associative list [mount point]->[Storage] of all local mount points.
*
- * This is defined in the platform file, and cannot be modified programatically (yet).
+ * This is defined in the platform file, and cannot be modified programmatically (yet).
*/
std::unordered_map<std::string, Storage*> const& get_mounted_storages();
private:
xbt::string name_{"noname"};
std::unordered_map<std::string, Storage*>* mounts_ = nullptr; // caching
+ kernel::routing::NetPoint* pimpl_netpoint_ = nullptr;
public:
#ifndef DOXYGEN
kernel::resource::Cpu* pimpl_cpu = nullptr;
// TODO, this could be a unique_ptr
surf::HostImpl* pimpl_ = nullptr;
- /** DO NOT USE DIRECTLY (@todo: these should be protected, once our code is clean) */
- kernel::routing::NetPoint* pimpl_netpoint = nullptr;
#endif
};
} // namespace s4u
XBT_PUBLIC e_smx_state_t simcall_process_sleep(double duration);
SG_END_DECL()
-/************************** Comunication simcalls *****************************/
+/************************** Communication simcalls ****************************/
#ifdef __cplusplus
XBT_PUBLIC void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
*
* It is highly inspired from the syscalls in a regular operating system, allowing the user code to get some specific
* code executed in the kernel context. But here, there is almost no security involved. Parameters get checked for
- * finitness but that's all. The main goal remain to ensure reproductible ordering of uncomparable events (in [parallel]
- * simulation) and observability of events (in model-checking).
+ * finiteness but that's all. The main goal remain to ensure reproducible ordering of uncomparable events (in
+ * [parallel] simulation) and observability of events (in model-checking).
*
* The code passed as argument is supposed to terminate at the exact same simulated timestamp.
* Do not use it if your code may block waiting for a subsequent event, e.g. if you lock a mutex,
template <class F> typename std::result_of<F()>::type simcall(F&& code, mc::SimcallInspector* t = nullptr)
{
// If we are in the maestro, we take the fast path and execute the
- // code directly without simcall mashalling/unmarshalling/dispatch:
+ // code directly without simcall marshalling/unmarshalling/dispatch:
if (SIMIX_is_maestro())
return std::forward<F>(code)();
/** Execute some code (that does not return immediately) in kernel context
*
* This is very similar to simcall() right above, but the calling actor will not get rescheduled until
- * actor->simcall_answer() is called explicitely.
+ * actor->simcall_answer() is called explicitly.
*
* Since the return value does not come from the lambda directly, its type cannot be guessed automatically and must
* be provided as template parameter.
template <class R, class F> R simcall_blocking(F&& code, mc::SimcallInspector* t = nullptr)
{
// If we are in the maestro, we take the fast path and execute the
- // code directly without simcall mashalling/unmarshalling/dispatch:
+ // code directly without simcall marshalling/unmarshalling/dispatch:
if (SIMIX_is_maestro())
return std::forward<F>(code)();
# define _GNU_SOURCE
#endif
-// Teach the compiler that some code path is unreacheable:
+// Teach the compiler that some code path is unreachable:
#if defined(__has_builtin)
# if __has_builtin(__builtin_unreachable)
# define XBT_UNREACHABLE() __builtin_unreachable()
*
* These are the SimGrid version of the dynamically size arrays, which all C programmer recode one day or another.
*
- * For performance concerns, the content of DynArr must be homogeneous (in contrary to dictionnaries -- see the
+ * For performance concerns, the content of DynArr must be homogeneous (in contrary to dictionaries -- see the
* @ref XBT_dict section). You thus have to provide the function which will be used to free the content at
* structure creation (of type void_f_pvoid_t).
*
/** @addtogroup XBT_ex_c
* @brief Exceptions support (C)
*
- * Those fonctions are used to throw C++ exceptions from C code. This feature
+ * Those functions are used to throw C++ exceptions from C code. This feature
* should probably be removed in the future because C and exception do not
* exactly play nicely together.
*/
* @param cat the category (not only its name, but the variable)
* @param thresholdPriority the priority
*
- * Programatically alters a category's threshold priority (don't use).
+ * Programmatically alters a category's threshold priority (don't use).
*/
XBT_PUBLIC void xbt_log_threshold_set(xbt_log_category_t cat, e_xbt_log_priority_t thresholdPriority);
* @param cat the category (not only its name, but the variable)
* @param app the appender
*
- * Programatically sets the category's appender. (the preferred interface is through xbt_log_control_set())
+ * Programmatically sets the category's appender. (the preferred interface is through xbt_log_control_set())
*/
XBT_PUBLIC void xbt_log_appender_set(xbt_log_category_t cat, xbt_log_appender_t app);
/**
* @param cat the category (not only its name, but the variable)
* @param lay the layout
*
- * Programatically sets the category's layout. (the preferred interface is through xbt_log_control_set())
+ * Programmatically sets the category's layout. (the preferred interface is through xbt_log_control_set())
*/
XBT_PUBLIC void xbt_log_layout_set(xbt_log_category_t cat, xbt_log_layout_t lay);
* @param cat the category (not only its name, but the variable)
* @param additivity whether logging actions must be passed to parent.
*
- * Programatically sets whether the logging actions must be passed to the parent category.
+ * Programmatically sets whether the logging actions must be passed to the parent category.
* (the preferred interface is through xbt_log_control_set())
*/
XBT_PUBLIC void xbt_log_additivity_set(xbt_log_category_t cat, int additivity);
/** @brief Releases the given mutex variable */
XBT_ATTRIB_DEPRECATED_v328("Please use sg_mutex_unlock") XBT_PUBLIC void xbt_mutex_release(xbt_mutex_t mutex);
-/** @brief Destroyes the given mutex variable */
+/** @brief Destroys the given mutex variable */
XBT_ATTRIB_DEPRECATED_v328("Please use sg_mutex_destroy") XBT_PUBLIC void xbt_mutex_destroy(xbt_mutex_t mutex);
/** @brief Thread condition data type (opaque object)
# Disable some rules on some files
sonar.issue.ignore.multicriteria=j1,j2,j3,j4,j5,jni1,jni2,c1,c2a,c2b,c3,c4a,c4b,c5a,c5b,c6a,c6b,c7,c8,c9,c10,f1,p1,s1,s2,s3,s4
-# The Object.finalize() method should not be overriden
+# The Object.finalize() method should not be overridden
# But we need to clean the native memory with JNI
sonar.issue.ignore.multicriteria.j1.ruleKey=squid:ObjectFinalizeOverridenCheck
sonar.issue.ignore.multicriteria.j1.resourceKey=**/*.java
if (not host->extension(JAVA_HOST_LEVEL)) {
/* the native host not yet associated with the java host instance */
- /* instanciate a new java host instance */
+ /* instantiate a new java host instance */
jhost = jhost_new_instance(env);
if (not jhost) {
void jxbt_throw_host_not_found(JNIEnv* env, const std::string& invalid_name);
/** Thrown when looking for a host from name does not lead to anything */
void jxbt_throw_process_not_found(JNIEnv* env, const std::string& invalid_name);
-/** Thrown when a transfer failure accure while Sending task */
+/** Thrown when a transfer failure occurs while Sending task */
void jxbt_throw_transfer_failure(JNIEnv* env, const std::string& detail);
/** Thrown when a host failure occurs while Sending a task*/
void jxbt_throw_host_failure(JNIEnv* env, const std::string& details);
* This value has to be ≥ 0.
*
* @param bytesAmount A value of amount of data (in bytes) needed to transfert this task.
- * If 0, then it cannot be transfered with the get() and put() methods.
+ * If 0, then it cannot be transferred with the get() and put() methods.
* This value has to be ≥ 0.
*/
public Task(String name, double flopsAmount, double bytesAmount) {
* to process the task. If 0, then it cannot be executed
* with the execute() method. This value has to be >= 0.
* @param bytesAmount A value of amount of data (in bytes) needed to transfert
- * this task. If 0, then it cannot be transfered this task.
- * If 0, then it cannot be transfered with the get() and put()
+ * this task. If 0, then it cannot be transferred this task.
+ * If 0, then it cannot be transferred with the get() and put()
* methods. This value has to be >= 0.
* @exception IllegalArgumentException if compute duration <0 or message size <0
*/
* @param host Host node
* @param name name of the machine
* @param ramSize size of the RAM that should be allocated (in MBytes)
- * @param migNetSpeed (network bandwith allocated for migrations in MB/s, if you don't know put zero ;))
+ * @param migNetSpeed (network bandwidth allocated for migrations in MB/s, if you don't know put zero ;))
* @param dpIntensity (dirty page percentage according to migNetSpeed, [0-100], if you don't know put zero ;))
*/
public VM(Host host, String name, int ramSize, int migNetSpeed, int dpIntensity){
* @param name name of the machine
* @param coreAmount the amount of cores of the VM
* @param ramSize size of the RAM that should be allocated (in MBytes)
- * @param migNetSpeed (network bandwith allocated for migrations in MB/s, if you don't know put zero ;))
+ * @param migNetSpeed (network bandwidth allocated for migrations in MB/s, if you don't know put zero ;))
* @param dpIntensity (dirty page percentage according to migNetSpeed, [0-100], if you don't know put zero ;))
*/
public VM(Host host, String name, int coreAmount, int ramSize, int migNetSpeed, int dpIntensity){
/**
* Natively implemented method create the VM.
* @param ramSize size of the RAM that should be allocated (in MB)
- * @param migNetSpeed (network bandwith allocated for migrations in MB/s, if you don't know put zero ;))
+ * @param migNetSpeed (network bandwidth allocated for migrations in MB/s, if you don't know put zero ;))
* @param dpIntensity (dirty page intensity, a percentage of migNetSpeed [0-100], if you don't know put zero ;))
*/
private native void create(Host host, String name, int coreAmount, int ramSize, int migNetSpeed, int dpIntensity);
* process. It thus works by redefining all the classical memory management functions (malloc and friends) with an
* extra first argument: the heap in which the memory is to be taken.
*
- * The heap structure itself is an opaque object that shouldnt be messed with.
+ * The heap structure itself is an opaque object that shouldn't be messed with.
*/
typedef struct mdesc s_xbt_mheap_t;
typedef s_xbt_mheap_t* xbt_mheap_t;
void TRACE_global_init()
{
- static bool is_initialised = false;
- if (is_initialised)
+ static bool is_initialized = false;
+ if (is_initialized)
return;
- is_initialised = true;
+ is_initialized = true;
/* name of the tracefile */
simgrid::config::declare_flag<std::string>("tracing/filename", "Trace file created by the instrumented SimGrid.",
*/
void TRACE_declare_mark(const char *mark_type)
{
- /* safe switchs. tracing has to be activated and if platform is not traced, we can't deal with marks */
+ /* safe switches. tracing has to be activated and if platform is not traced, we can't deal with marks */
if (not TRACE_is_enabled() || not TRACE_needs_platform())
return;
{
xbt_assert(father, "Only the Root container has no father");
- netpoint_ = host.pimpl_netpoint;
+ netpoint_ = host.get_netpoint();
xbt_assert(netpoint_, "Element '%s' not found", host.get_cname());
trivaNodeTypes.insert(type_->get_name());
explicit TIData(const std::string& name) : name_(name){};
// CPuTI: compute, sleep (+ waitAny and waitall out of laziness)
explicit TIData(const std::string& name, double amount) : name_(name), amount_(amount){};
- // Pt2PtTI: send, isend, sssend, issend, recv, irecv
+ // Pt2PtTI: send, isend, ssend, issend, recv, irecv
explicit TIData(const std::string& name, int endpoint, int size, const std::string& datatype)
: name_(name), endpoint(endpoint), send_size(size), send_type(datatype){};
// CollTI: bcast, reduce, allreduce, gather, scatter, allgather, alltoall
/* The lib unwind library (for MC and backtrace display) */
#cmakedefine01 HAVE_LIBUNWIND
/* The boost_stacktrace_backtrace library */
-#cmakedefine01 HAVE_BOOST_STACKTRACE_BACKTRACE /* prefered */
+#cmakedefine01 HAVE_BOOST_STACKTRACE_BACKTRACE /* preferred */
#cmakedefine01 HAVE_BOOST_STACKTRACE_ADDR2LINE /* fallback */
size_t count = simcall_comm_waitany__get__count(simcall);
for (size_t i = 0; i < count; i++) {
- // Remove the first occurence of simcall:
+ // Remove the first occurrence of simcall:
auto* comm = comms[i];
auto j = boost::range::find(comm->simcalls_, simcall);
if (j != comm->simcalls_.end())
actor::ActorImplPtr src_actor_ = nullptr;
actor::ActorImplPtr dst_actor_ = nullptr;
- /* Data to be transfered */
+ /* Data to be transferred */
unsigned char* src_buff_ = nullptr;
unsigned char* dst_buff_ = nullptr;
size_t src_buff_size_ = 0;
} else {
simcall->timeout_cb_ = simgrid::simix::Timer::set(SIMIX_get_clock() + timeout, [simcall, execs, count]() {
for (size_t i = 0; i < count; i++) {
- // Remove the first occurence of simcall:
+ // Remove the first occurrence of simcall:
auto* exec = execs[i];
auto j = boost::range::find(exec->simcalls_, simcall);
if (j != exec->simcalls_.end())
size_t count = simcall_execution_waitany_for__get__count(simcall);
for (size_t i = 0; i < count; i++) {
- // Remove the first occurence of simcall:
+ // Remove the first occurrence of simcall:
auto* exec = execs[i];
auto j = boost::range::find(exec->simcalls_, simcall);
if (j != exec->simcalls_.end())
virtual void suspend() = 0;
// Retrieving the self() context
- /** @brief Retrives the current context of this thread */
+ /** @brief Retrieves the current context of this thread */
static Context* self();
/** @brief Sets the current context of this thread */
static void set_current(Context* self);
this->uc_.uc_stack.ss_sp = sg_makecontext_stack_addr(get_stack());
this->uc_.uc_stack.ss_size = sg_makecontext_stack_size(smx_context_stack_size);
// Makecontext expects integer arguments; we want to pass a pointer.
- // This context address is decomposed into a serie of integers, which are passed as arguments to makecontext.
+ // This context address is decomposed into a series of integers, which are passed as arguments to makecontext.
int ctx_addr[CTX_ADDR_LEN]{};
UContext* arg = this;
{
// Ignore element with weight less than one (e.g. cross-traffic)
return (consumption_weight >= 1) ? 1 : 0;
- // There are other alternatives, but they will change the behaviour of the model..
+ // There are other alternatives, but they will change the behavior of the model..
// So do not use it unless you want to make a new model.
// If you do, remember to change the variables concurrency share to reflect it.
// Potential examples are:
modified_ = true;
// Check if this variable already has an active element in this constraint
- // If it does, substract it from the required slack
+ // If it does, subtract it from the required slack
int current_share = 0;
if (var->concurrency_share_ > 1) {
for (Element& elem : var->cnsts_) {
XBT_DEBUG("Min usage: %f, Var(%d).penalty: %f, Var(%d).value: %f ", min_usage, var.rank_, var.sharing_penalty_,
var.rank_, var.value_);
- /* Update the usage of contraints where this variable is involved */
+ /* Update the usage of constraints where this variable is involved */
for (Element& elem : var.cnsts_) {
Constraint* cnst = elem.constraint;
if (cnst->sharing_policy_ != s4u::Link::SharingPolicy::FATPIPE) {
// In effect, the var->visited value will no more be equal to visited counter
// To be clean, when visited counter has wrapped around, we force these var->visited values so that variables that
// were in the modified a long long time ago are not wrongly skipped here, which would lead to very nasty bugs
- // (i.e. not readibily reproducible, and requiring a lot of run time before happening).
+ // (i.e. not readily reproducible, and requiring a lot of run time before happening).
if (++visited_counter_ == 1) {
/* the counter wrapped around, reset each variable->visited */
for (Variable& var : variable_set)
* the corresponding action will enable it (at least this is the idea).
* \li Enabled elements which variable's weight is non-zero. They are utilized in some LMM functions.
* \li Active elements which variable's weight is non-zero (i.e. it is enabled) AND its element value is non-zero.
- * LMM_solve iterates over active elements during resolution, dynamically making them active or unactive.
+ * LMM_solve iterates over active elements during resolution, dynamically making them active or inactive.
*/
class XBT_PUBLIC Constraint {
public:
ConstraintLight* cnst_light_;
private:
- static int next_rank_; // To give a separate rank_ to each contraint
+ static int next_rank_; // To give a separate rank_ to each constraint
int concurrency_limit_; /* The maximum number of variables that may be enabled at any time (stage variables if
* necessary) */
resource::Resource* id_;
/*
* Multiple constraint systems can be solved with shared variables
- * on unshair constraints.
+ * on unshared constraints.
*
* In details:
* o System: a1 * p1 * \rho1 + a2 * p2 * \rho2 < C1
maxmin_system_.reset(system);
}
-double Model::next_occuring_event(double now)
+double Model::next_occurring_event(double now)
{
// FIXME: set the good function once and for all
if (update_algorithm_ == Model::UpdateAlgo::LAZY)
- return next_occuring_event_lazy(now);
+ return next_occurring_event_lazy(now);
else if (update_algorithm_ == Model::UpdateAlgo::FULL)
- return next_occuring_event_full(now);
+ return next_occurring_event_full(now);
else
xbt_die("Invalid cpu update mechanism!");
}
-double Model::next_occuring_event_lazy(double now)
+double Model::next_occurring_event_lazy(double now)
{
XBT_DEBUG("Before share resources, the size of modified actions set is %zu", maxmin_system_->modified_set_->size());
maxmin_system_->lmm_solve();
}
}
-double Model::next_occuring_event_full(double /*now*/)
+double Model::next_occurring_event_full(double /*now*/)
{
maxmin_system_->solve();
* - #simgrid::kernel::profile::Event: links a given trace to a given SimGrid resource.
* A Cpu for example has 2 kinds of events: state (ie, is it ON/OFF) and speed,
* while a link has 3 iterators: state, bandwidth and latency.
- * - #simgrid::kernel::profile::FutureEvtSet: makes it easy to find the next occuring event of all profiles
+ * - #simgrid::kernel::profile::FutureEvtSet: makes it easy to find the next occurring event of all profiles
*/
class XBT_PUBLIC DatedValue {
public:
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster, surf, "Routing part of surf");
/* This routing is specifically setup to represent clusters, aka homogeneous sets of machines
- * Note that a router is created, easing the interconnexion with the rest of the world. */
+ * Note that a router is created, easing the interconnection with the rest of the world. */
namespace simgrid {
namespace kernel {
if (hierarchy_ == RoutingMode::unset)
hierarchy_ = RoutingMode::base;
- res->pimpl_netpoint = new NetPoint(name, NetPoint::Type::Host, this);
+ res->set_netpoint(new NetPoint(name, NetPoint::Type::Host, this));
surf_cpu_model_pm->create_cpu(res, speed_per_pstate, coreAmount);
*/
/*
- * Arrays that hold the coordinates of the current node andthe target; comparing the values at the i-th position of
+ * Arrays that hold the coordinates of the current node and the target; comparing the values at the i-th position of
* both arrays, we can easily assess whether we need to route into this dimension or not.
*/
const unsigned int dsize = dimensions_.size();
bool ModelChecker::handle_message(char* buffer, ssize_t size)
{
s_mc_message_t base_message;
- if (size < (ssize_t) sizeof(base_message))
- xbt_die("Broken message");
+ xbt_assert(size >= (ssize_t)sizeof(base_message), "Broken message");
memcpy(&base_message, buffer, sizeof(base_message));
switch(base_message.type) {
case MC_MESSAGE_IGNORE_HEAP:
{
s_mc_message_ignore_heap_t message;
- if (size != sizeof(message))
- xbt_die("Broken messsage");
+ xbt_assert(size == sizeof(message), "Broken messsage");
memcpy(&message, buffer, sizeof(message));
IgnoredHeapRegion region;
case MC_MESSAGE_UNIGNORE_HEAP:
{
s_mc_message_ignore_memory_t message;
- if (size != sizeof(message))
- xbt_die("Broken messsage");
+ xbt_assert(size == sizeof(message), "Broken messsage");
memcpy(&message, buffer, sizeof(message));
process().unignore_heap((void*)(std::uintptr_t)message.addr, message.size);
break;
case MC_MESSAGE_IGNORE_MEMORY:
{
s_mc_message_ignore_memory_t message;
- if (size != sizeof(message))
- xbt_die("Broken messsage");
+ xbt_assert(size == sizeof(message), "Broken messsage");
memcpy(&message, buffer, sizeof(message));
this->process().ignore_region(message.addr, message.size);
break;
case MC_MESSAGE_STACK_REGION:
{
s_mc_message_stack_region_t message;
- if (size != sizeof(message))
- xbt_die("Broken messsage");
+ xbt_assert(size == sizeof(message), "Broken messsage");
memcpy(&message, buffer, sizeof(message));
this->process().stack_areas().push_back(message.stack_region);
}
case MC_MESSAGE_REGISTER_SYMBOL:
{
s_mc_message_register_symbol_t message;
- if (size != sizeof(message))
- xbt_die("Broken message");
+ xbt_assert(size == sizeof(message), "Broken message");
memcpy(&message, buffer, sizeof(message));
- if (message.callback)
- xbt_die("Support for client-side function proposition is not implemented.");
+ xbt_assert(not message.callback, "Support for client-side function proposition is not implemented.");
XBT_DEBUG("Received symbol: %s", message.name);
if (simgrid::mc::property_automaton == nullptr)
if (pid == -1) {
if (errno == ECHILD) {
// No more children:
- if (this->process().running())
- xbt_die("Inconsistent state");
- else
- break;
+ xbt_assert(not this->process().running(), "Inconsistent state");
+ break;
} else {
XBT_ERROR("Could not wait for pid");
throw simgrid::xbt::errno_error();
// From PTRACE_O_TRACEEXIT:
#ifdef __linux__
if (status>>8 == (SIGTRAP | (PTRACE_EVENT_EXIT<<8))) {
- if (ptrace(PTRACE_GETEVENTMSG, this->process().pid(), 0, &status) == -1)
- xbt_die("Could not get exit status");
+ xbt_assert(ptrace(PTRACE_GETEVENTMSG, this->process().pid(), 0, &status) != -1, "Could not get exit status");
if (WIFSIGNALED(status)) {
MC_report_crash(status);
mc_model_checker->exit(SIMGRID_MC_EXIT_PROGRAM_CRASH);
#elif defined BSD
ptrace(PT_CONTINUE, this->process().pid(), (caddr_t)1, WSTOPSIG(status));
#endif
- if (errno != 0)
- xbt_die("Could not PTRACE_CONT");
+ xbt_assert(errno == 0, "Could not PTRACE_CONT");
}
else if (WIFSIGNALED(status)) {
bool ModelChecker::checkDeadlock()
{
- int res;
- if ((res = this->process().get_channel().send(MC_MESSAGE_DEADLOCK_CHECK)))
- xbt_die("Could not check deadlock state");
+ int res = this->process().get_channel().send(MC_MESSAGE_DEADLOCK_CHECK);
+ xbt_assert(res == 0, "Could not check deadlock state");
s_mc_message_int_t message;
ssize_t s = mc_model_checker->process().get_channel().receive(message);
- if (s == -1)
- xbt_die("Could not receive message");
- if (s != sizeof(message) || message.type != MC_MESSAGE_DEADLOCK_CHECK_REPLY)
- xbt_die("Received unexpected message %s (%i, size=%i) "
- "expected MC_MESSAGE_DEADLOCK_CHECK_REPLY (%i, size=%i)",
- MC_message_type_name(message.type), (int) message.type, (int) s,
- (int) MC_MESSAGE_DEADLOCK_CHECK_REPLY, (int) sizeof(message)
- );
+ xbt_assert(s != -1, "Could not receive message");
+ xbt_assert(s == sizeof(message) && message.type == MC_MESSAGE_DEADLOCK_CHECK_REPLY,
+ "Received unexpected message %s (%i, size=%i) "
+ "expected MC_MESSAGE_DEADLOCK_CHECK_REPLY (%i, size=%i)",
+ MC_message_type_name(message.type), (int)message.type, (int)s, (int)MC_MESSAGE_DEADLOCK_CHECK_REPLY,
+ (int)sizeof(message));
return message.value != 0;
}
void CommunicationDeterminismChecker::deterministic_comm_pattern(int process, simgrid::mc::PatternCommunication* comm,
int backtracking)
{
- simgrid::mc::PatternCommunicationList& list = initial_communications_pattern[process];
-
if (not backtracking) {
+ simgrid::mc::PatternCommunicationList& list = initial_communications_pattern[process];
e_mc_comm_pattern_difference_t diff = compare_comm_pattern(list.list[list.index_comm].get(), comm);
if (diff != NONE_DIFF) {
*/
virtual void arm() {}
- /** Some simcalls may only be observable under some circomstances.
+ /** Some simcalls may only be observable under some circumstances.
* Most simcalls are not visible from the MC because they don't have an inspector at all. */
virtual bool is_visible() { return true; }
virtual std::string to_string() = 0;
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-/** \file compare.cpp Memory snapshooting and comparison */
+/** \file compare.cpp Memory snapshotting and comparison */
#include "src/mc/mc_config.hpp"
#include "src/mc/mc_private.hpp"
int fragment_ = 0;
HeapLocation() = default;
- HeapLocation(int block, int fragment = 0) : block_(block), fragment_(fragment) {}
+ explicit HeapLocation(int block, int fragment = 0) : block_(block), fragment_(fragment) {}
bool operator==(HeapLocation const& that) const
{
ssize_t ignore2 = heap_comparison_ignore_size(state.processStates[1].to_ignore, (const char*)real_area2 + i);
if (ignore2 == ignore1) {
if (ignore1 == 0) {
- check_ignore--;
return false;
} else {
i = i + ignore2;
const simgrid::mc::Snapshot& snapshot2, HeapLocationPairs* previous,
simgrid::mc::Type* type, int area_size, int check_ignore, int pointer_level)
{
- // HACK: This should not happen but in pratice, there are some
+ // HACK: This should not happen but in practice, there are some
// DW_TAG_typedef without an associated DW_AT_type:
//<1><538832>: Abbrev Number: 111 (DW_TAG_typedef)
// <538833> DW_AT_name : (indirect string, offset: 0x2292f3): gregset_t
const simgrid::mc::Snapshot& snapshot)
{
- // Beginning of the block, the infered variable type if the type of the block:
+ // Beginning of the block, the inferred variable type if the type of the block:
if (offset == 0)
return type;
* (there is no offset) i.e.
* \f$\text{virtual address} = \{dwarf address}\f$
*
- * For a shared object, the addresses are offset from the begining
+ * For a shared object, the addresses are offset from the beginning
* of the shared object (the base address of the mapped shared
* object must be used as offset
* i.e. \f$\text{virtual address} = \text{shared object base address}
*
* More precisely we check if this is an ET_EXE ELF. These ELF files
* use fixed addresses instead of base-address relative addresses.
- * Position independant executables are in fact ET_DYN.
+ * Position independent executables are in fact ET_DYN.
*/
bool executable() const { return this->flags & simgrid::mc::ObjectInformation::Executable; }
* does not use ptrace() to read the target process memory by
* `process_vm_readv()` or `/dev/${pid}/mem` if possible.
*
- * Does not support any MC-specific behaviour (privatization, snapshots)
+ * Does not support any MC-specific behavior (privatization, snapshots)
* and `ucontext_t`.
*
* It works with `void*` contexts allocated with `_UPT_create(pid)`.
* Most requests are always enabled but WAIT and WAITANY
* are not always enabled: a WAIT where the communication does not
* have both a source and a destination yet is not enabled
- * (unless timeout is enabled in the wait and enabeld in SimGridMC).
+ * (unless timeout is enabled in the wait and enabled in SimGridMC).
*/
XBT_PRIVATE bool actor_is_enabled(smx_actor_t process);
/** Refresh the information about the process
*
- * Do not use direclty, this is used by the getters when appropriate
+ * Do not use directly, this is used by the getters when appropriate
* in order to have fresh data.
* */
void RemoteClient::refresh_malloc_info()
{
// First lookup the variable in the executable shared object.
// A global variable used directly by the executable code from a library
- // is reinstanciated in the executable memory .data/.bss.
+ // is reinstantiated in the executable memory .data/.bss.
// We need to look up the variable in the executable first.
if (this->binary_info) {
std::shared_ptr<simgrid::mc::ObjectInformation> const& info = this->binary_info;
// Check if expanding worked
if (new_memory != (char*)this->memory_ + old_bytesize) {
// New memory segment could not be put at the end of this->memory_,
- // so cancel this one and try to rellocate everything and copy data
+ // so cancel this one and try to relocate everything and copy data
munmap(new_memory, new_bytesize - old_bytesize);
new_memory =
mmap(nullptr, new_bytesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0);
/** @brief Restore a region from a snapshot */
void restore();
- /** @brief Read memory that was snapshoted in this region
+ /** @brief Read memory that was snapshotted in this region
*
* @param target Buffer to store contiguously the value if it spans over several pages
* @param addr Process (non-snapshot) address of the data
} else
return this->process()->read_bytes(buffer, size, address, options);
}
-/** @brief Find the snapshoted region from a pointer
+/** @brief Find the snapshotted region from a pointer
*
* @param addr Pointer
* */
return nullptr;
}
-/** @brief Find the snapshoted region from a pointer, with a hinted_region */
+/** @brief Find the snapshotted region from a pointer, with a hinted_region */
Region* Snapshot::get_region(const void* addr, Region* hinted_region) const
{
if (hinted_region->contain(simgrid::mc::remote(addr)))
// Restore regions
for (std::unique_ptr<simgrid::mc::Region> const& region : snapshot_regions_) {
- if (region) // privatized variables are not snapshoted
+ if (region) // privatized variables are not snapshotted
region.get()->restore();
}
* @param flop_amount a value of the processing amount (in flop) needed to process this new task.
* If 0, then it cannot be executed with MSG_task_execute(). This value has to be >=0.
* @param message_size a value of the amount of data (in bytes) needed to transfer this new task. If 0, then it cannot
- * be transfered with MSG_task_send() and MSG_task_recv(). This value has to be >=0.
+ * be transferred with MSG_task_send() and MSG_task_recv(). This value has to be >=0.
* @param data a pointer to any data may want to attach to the new object. It is for user-level information and can
* be nullptr. It can be retrieved with the function @ref MSG_task_get_data.
* @return The new corresponding object.
/** @brief Cancel the given task
*
- * If it was currently executed or transfered, the working process is stopped.
+ * If it was currently executed or transferred, the working process is stopped.
*/
msg_error_t MSG_task_cancel(msg_task_t task)
{
if (sg_storage_get_size_used(local_storage_) >= sg_storage_get_size(local_storage_))
return 0;
if (write_inside == 0) {
- /* Substract the part of the file that might disappear from the used sized on the storage element */
+ /* Subtract the part of the file that might disappear from the used sized on the storage element */
local_storage_->extension<FileSystemStorageExt>()->decr_used_size(size_ - current_position_);
write_size = local_storage_->write(size);
local_storage_->extension<FileSystemStorageExt>()->incr_used_size(write_size);
if (sg_disk_get_size_used(local_disk_) >= sg_disk_get_size(local_disk_))
return 0;
if (write_inside == 0) {
- /* Substract the part of the file that might disappear from the used sized on the storage element */
+ /* Subtract the part of the file that might disappear from the used sized on the storage element */
local_disk_->extension<FileSystemDiskExt>()->decr_used_size(size_ - current_position_);
write_size = local_disk_->write(size);
local_disk_->extension<FileSystemDiskExt>()->incr_used_size(write_size);
*
* > The CPUfreq governor "conservative", much like the "ondemand"
* > governor, sets the CPU frequency depending on the current usage. It
- * > differs in behaviour in that it gracefully increases and decreases the
+ * > differs in behavior in that it gracefully increases and decreases the
* > CPU speed rather than jumping to max speed the moment there is any load
- * > on the CPU. This behaviour is more suitable in a battery powered
+ * > on the CPU. This behavior is more suitable in a battery powered
* > environment.
*/
class Conservative : public Governor {
} else {
p_epsilon = p_one_core - ((p_full - p_one_core) / (host_->get_core_count() - 1));
}
- } else { // consuption given with idle and full only
+ } else { // consumption given with idle and full only
p_full = xbt_str_parse_double((current_power_values.at(1)).c_str(),
"Invalid obsolete XML file. Fix your watt_per_state property.");
if (host_->get_core_count() == 1) {
kernel::activity::ActivityImpl::on_suspended.connect(remove_active_activity);
}
-double VMModel::next_occuring_event(double now)
+double VMModel::next_occurring_event(double now)
{
/* TODO: update action's cost with the total cost of processes on the VM. */
}
/* 2. Ready. Get the next occurring event */
- return surf_cpu_model_vm->next_occuring_event(now);
+ return surf_cpu_model_vm->next_occurring_event(now);
}
/************
std::string pm_name_dst = destination->get_name();
/* update net_elm with that of the destination physical host */
- piface_->pimpl_netpoint = destination->pimpl_netpoint;
+ piface_->set_netpoint(destination->get_netpoint());
physical_host_ = destination;
public:
VMModel();
- double next_occuring_event(double now) override;
+ double next_occurring_event(double now) override;
void update_actions_state(double /*now*/, double /*delta*/) override{};
};
}
};
class MigrationRx {
- /* The miration_rx process uses mbox_ctl to let the caller of do_migration() know the completion of the migration. */
+ /* The migration_rx process uses mbox_ctl to let the caller of do_migration() know the completion of the migration.
+ */
s4u::Mailbox* mbox_ctl;
/* The migration_rx and migration_tx processes use mbox to transfer migration data. */
s4u::Mailbox* mbox;
XBT_DEBUG("Create VM %s", get_cname());
/* Currently, a VM uses the network resource of its physical host */
- pimpl_netpoint = physical_host->pimpl_netpoint;
+ set_netpoint(physical_host->get_netpoint());
// Create a VCPU for this VM
std::vector<double> speeds;
XBT_DEBUG("destroy %s", get_cname());
/* Don't free these things twice: they are the ones of my physical host */
- pimpl_netpoint = nullptr;
+ set_netpoint(nullptr);
}
void VirtualMachine::start()
xbt_assert(currently_destroying_, "Please call h->destroy() instead of manually deleting it.");
delete pimpl_;
- if (pimpl_netpoint != nullptr) // not removed yet by a children class
- Engine::get_instance()->netpoint_unregister(pimpl_netpoint);
+ if (pimpl_netpoint_ != nullptr) // not removed yet by a children class
+ Engine::get_instance()->netpoint_unregister(pimpl_netpoint_);
delete pimpl_cpu;
delete mounts_;
}
/** @brief Just like Host::routeTo, but filling an array of link implementations */
void Host::route_to(Host* dest, std::vector<kernel::resource::LinkImpl*>& links, double* latency)
{
- kernel::routing::NetZoneImpl::get_global_route(pimpl_netpoint, dest->pimpl_netpoint, links, latency);
+ kernel::routing::NetZoneImpl::get_global_route(pimpl_netpoint_, dest->get_netpoint(), links, latency);
if (XBT_LOG_ISENABLED(surf_route, xbt_log_priority_debug)) {
XBT_CDEBUG(surf_route, "Route from '%s' to '%s' (latency: %f):", get_cname(), dest->get_cname(),
(latency == nullptr ? -1 : *latency));
/** @brief Returns the networking zone englobing that host */
NetZone* Host::get_englobing_zone()
{
- return pimpl_netpoint->get_englobing_zone()->get_iface();
+ return pimpl_netpoint_->get_englobing_zone()->get_iface();
}
void Host::send_to(Host* dest, double byte_amount)
std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
auto last = std::remove_if(begin(list), end(list), [](const simgrid::s4u::Host* host) {
- return not host || not host->pimpl_netpoint || not host->pimpl_netpoint->is_host();
+ return not host || not host->get_netpoint() || not host->get_netpoint()->is_host();
});
std::sort(begin(list), last,
[](const simgrid::s4u::Host* a, const simgrid::s4u::Host* b) { return a->get_name() < b->get_name(); });
return res;
}
/**
- * @brief Find the bandwitdh of the route between two hosts
+ * @brief Find the bandwidth of the route between two hosts
*
* @param from where from
* @param to where to
* The size attribute of a node describes:
* - for a compute task: the amount of flops to execute
* - for a communication task : the amount of bytes to transfer
- * If this attribute is ommited, the default value is zero.
+ * If this attribute is omitted, the default value is zero.
*/
xbt_dynar_t SD_dotload(const char *filename) {
return SD_dotload_generic(filename, true, false);
-/* src/simgrid/version.h - internal versionning info */
+/* src/simgrid/version.h - internal versioning info */
/* Copyright (c) 2009-2019. The SimGrid Team. All rights reserved. */
SIMIX_context_mod_init();
// Either create a new context with maestro or create
- // a context object with the current context mestro):
+ // a context object with the current context maestro):
simgrid::kernel::actor::create_maestro(maestro_code);
/* Prepare to display some more info when dying on Ctrl-C pressing */
std::unique_ptr<unsigned char[]> tmp_sendbuf;
if (sendbuf == MPI_IN_PLACE) {
tmp_sendbuf.reset(new unsigned char[recvcount * comm->size() * recvtype->size()]);
- // memcpy(??,nullptr,0) is actually undefined behavor, even if harmless.
+ // memcpy(??,nullptr,0) is actually undefined behavior, even if harmless.
if (recvbuf != nullptr)
memcpy(tmp_sendbuf.get(), recvbuf, recvcount * comm->size() * recvtype->size());
real_sendbuf = tmp_sendbuf.get();
if(retval != MPI_ERR_REQUEST) {
int my_proc_id = simgrid::s4u::this_actor::get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Startall"));
- MPI_Request req = MPI_REQUEST_NULL;
if (not TRACE_smpi_view_internals())
for (int i = 0; i < count; i++) {
- req = requests[i];
+ MPI_Request req = requests[i];
if (req->flags() & MPI_REQ_SEND)
TRACE_smpi_send(my_proc_id, my_proc_id, getPid(req->comm(), req->dst()), req->tag(), req->size());
}
if (not TRACE_smpi_view_internals())
for (int i = 0; i < count; i++) {
- req = requests[i];
+ MPI_Request req = requests[i];
if (req->flags() & MPI_REQ_RECV)
TRACE_smpi_recv(getPid(req->comm(), req->src()), my_proc_id, req->tag());
}
} else if (*request == MPI_REQUEST_NULL) {
retval = MPI_SUCCESS;
} else {
- //for tracing, save the handle which might get overriden before we can use the helper on it
+ // for tracing, save the handle which might get overridden before we can use the helper on it
MPI_Request savedreq = *request;
if (savedreq != MPI_REQUEST_NULL && not(savedreq->flags() & MPI_REQ_FINISHED)
&& not(savedreq->flags() & MPI_REQ_GENERALIZED))
return MPI_SUCCESS;
smpi_bench_end();
- //for tracing, save the handles which might get overriden before we can use the helper on it
+ // for tracing, save the handles which might get overridden before we can use the helper on it
std::vector<MPI_Request> savedreqs(requests, requests + count);
for (MPI_Request& req : savedreqs) {
if (req != MPI_REQUEST_NULL && not(req->flags() & MPI_REQ_FINISHED))
{
smpi_bench_end();
- //for tracing, save the handles which might get overriden before we can use the helper on it
+ // for tracing, save the handles which might get overridden before we can use the helper on it
std::vector<MPI_Request> savedreqs(requests, requests + count);
for (MPI_Request& req : savedreqs) {
if (req != MPI_REQUEST_NULL && not(req->flags() & MPI_REQ_FINISHED))
* Descp: takes a number and tries to find a factoring of x, y mesh out of it
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
#ifndef TWOD
#define TWOD
* algorithm. Allgather ommunication occurs first in the x dimension then in
* the y dimension. The communication in each dimension follows
* "simple"
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* algorithm. Allgather ommunication occurs first in the x dimension, y
* dimension, and then in the z dimension. Communication in each dimension
* follows "simple"
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
namespace smpi{
namespace simgrid{
namespace smpi{
-
-// Allgather-Non-Topoloty-Scecific-Logical-Ring algorithm
+// Allgather-Non-Topology-Specific-Logical-Ring algorithm
int
Coll_allgather_NTSLR_NB::allgather(const void *sbuf, int scount, MPI_Datatype stype,
void *rbuf, int rcount, MPI_Datatype rtype,
namespace simgrid{
namespace smpi{
-
-
-// Allgather-Non-Topoloty-Scecific-Logical-Ring algorithm
+// Allgather-Non-Topology-Specific-Logical-Ring algorithm
int
Coll_allgather_NTSLR::allgather(const void *sbuf, int scount, MPI_Datatype stype,
void *rbuf, int rcount, MPI_Datatype rtype,
*****************************************************************************/
-
/*****************************************************************************
* Function: allgather_bruck
* return: int
* comm: communication
* Descrp: Function realizes the allgather operation using the bruck
* algorithm.
- * Auther: MPICH
+ * Author: MPICH
* Comment: Original bruck algorithm from MPICH is slightly modified by
* Ahmad Faraj.
****************************************************************************/
* comm: communication
* Descrp: Function works when P is power of two. In each phase of P - 1
* phases, nodes in pair communicate their data.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* recv_type: data type of elements being received
* comm: communication
* Descrp: Function works in P - 1 steps. In step i, node j - i -> j -> j+ i.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* order of communications for node i is i -> i + 1, i -> i + 2, ...,
* i -> (i + p -1) % P.
*
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* comm: communication
* Descrp: Function works when P is power of two. In each phase of P - 1
* phases, nodes in pair communicate their data.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* recv_type: data type of elements being received
* comm: communication
* Descrp: Function works in P - 1 steps. In step i, node j - i -> j -> j+ i.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
#include "../colls_private.hpp"
/* IMPLEMENTED BY PITCH PATARASUK
- Non-topoloty-specific all-reduce operation designed bandwidth optimally
+ Non-topology-specific all-reduce operation designed bandwidth optimally
Bug fixing by Xin Yuan, 04/04/2008
*/
COLL_TAG_ALLREDUCE, comm);
/* temporarily set the rank to -1 so that this
- process does not pariticipate in recursive
+ process does not participate in recursive
doubling */
newrank = -1;
} else {
- wait on block (r + 1)
- compute on block (r + 1)
- send block (r + 1) to rank (r + 1)
- Note that we must be careful when computing the begining of buffers and
+ Note that we must be careful when computing the beginning of buffers and
for send operations and computation we must compute the exact block size.
*/
send_to = (rank + 1) % size;
Request::send(rbuff, count, dtype, rank + 1, tag, comm);
// temporarily set the rank to -1 so that this
- // process does not pariticipate in recursive
+ // process does not participate in recursive
// doubling
newrank = -1;
} else // odd
Request::send(rbuff, count, dtype, rank + 1, tag, comm);
// temporarily set the rank to -1 so that this
- // process does not pariticipate in recursive
+ // process does not participate in recursive
// doubling
newrank = -1;
} else // odd
// recvbuf contains data accumulated so far
// op is commutative OR the order is already right
- // we assume it is commuttive op
+ // we assume it is commutative op
// if (op -> op_commute || (dst < rank))
if ((dst < rank)) {
if(op!=MPI_OP_NULL) op->apply( tmp_buf, rbuff, &count, dtype);
#include "../colls_private.hpp"
/* IMPLEMENTED BY PITCH PATARASUK
- Non-topoloty-specific (however, number of cores/node need to be changed)
+ Non-topology-specific (however, number of cores/node need to be changed)
all-reduce operation designed for smp clusters
It uses 2-layer communication: binomial for both intra-communication
inter-communication
The communication are done in a pipeline fashion */
-
-
/* this is a default segment size for pipelining,
but it is typically passed as a command line argument */
int allreduce_smp_binomial_pipeline_segment_size = 4096;
#include "../colls_private.hpp"
/* IMPLEMENTED BY PITCH PATARASUK
- Non-topoloty-specific (however, number of cores/node need to be changed)
+ Non-topology-specific (however, number of cores/node need to be changed)
all-reduce operation designed for smp clusters
It uses 2-layer communication: binomial for both intra-communication
inter-communication*/
-
/* ** NOTE **
Use -DMPICH2 if this code does not compile.
MPICH1 code also work on MPICH2 on our cluster and the performance are similar.
#include "../colls_private.hpp"
/* IMPLEMENTED BY PITCH PATARASUK
- Non-topoloty-specific (however, number of cores/node need to be changed)
+ Non-topology-specific (however, number of cores/node need to be changed)
all-reduce operation designed for smp clusters
It uses 2-layer communication: binomial for intra-communication
and rdb for inter-communication*/
-
/* ** NOTE **
Use -DMPICH2 if this code does not compile.
MPICH1 code also work on MPICH2 on our cluster and the performance are similar.
then in the y dimension. Each node then extracts the needed data.
The communication in each dimension follows "simple."
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
static int alltoall_check_is_2dmesh(int num, int *i, int *j)
y dimension, then in z dimension. Each node then extracts the
needed data. The communication in all dimension is simple.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
static int alltoall_check_is_3dmesh(int num, int *i, int *j, int *k)
* Descrp: Function realizes the alltoall operation using the bruck algorithm.
- * Auther: MPICH / modified by Ahmad Faraj
+ * Author: MPICH / modified by Ahmad Faraj
****************************************************************************/
with node i ^ j. Light barriers are inserted between
communications in different phases.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
phases, nodes in pair communicate their data. MPI barriers are
inserted between each two phases.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* Descrp: Function works when P is power of two. In each phase of P - 1
phases, nodes in pair communicate their data.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* Descrp: Function works when P is power of two. In each phase of P - 1
phases, nodes in pair communicate their data.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* Descrp: Function realizes the allgather operation using the recursive
doubling algorithm.
- * Auther: MPICH / slightly modified by Ahmad Faraj.
+ * Author: MPICH / slightly modified by Ahmad Faraj.
****************************************************************************/
namespace simgrid{
Light barriers are inserted between communications in different
phases.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* Descrp: Function works in P - 1 steps. In step i, node j - i -> j -> j + i.
MPI barriers are added between each two phases.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* Descrp: Function works in P - 1 steps. In step i, node j - i -> j -> j + i.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* Descrp: Function works in P - 1 steps. In step i, node j - i -> j -> j + i.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
with node i ^ j. Light barriers are inserted between
communications in different phases.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
phases, nodes in pair communicate their data. MPI barriers are
inserted between each two phases.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* Descrp: Function works when P is power of two. In each phase of P - 1
phases, nodes in pair communicate their data.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* Descrp: Function works when P is power of two. In each phase of P - 1
phases, nodes in pair communicate their data.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
Light barriers are inserted between communications in different
phases.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* Descrp: Function works in P - 1 steps. In step i, node j - i -> j -> j + i.
MPI barriers are added between each two phases.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* Descrp: Function works in P - 1 steps. In step i, node j - i -> j -> j + i.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
* Descrp: Function works in P - 1 steps. In step i, node j - i -> j -> j + i.
- * Auther: Ahmad Faraj
+ * Author: Ahmad Faraj
****************************************************************************/
namespace simgrid{
/*
* Simple double ring version of barrier
*
- * synchronous gurantee made by last ring of sends are synchronous
+ * synchronous guarantee made by last ring of sends are synchronous
*
*/
namespace simgrid{
Request::recv(buf, count, datatype, from, tag, comm, &status);
}
- /* case: intermidiate node with only left child ==> relay message */
+ /* case: intermediate node with only left child ==> relay message */
else if (to_right == -1) {
Request::recv(buf, count, datatype, from, tag, comm, &status);
Request::send(buf, count, datatype, to_left, tag, comm);
}
- /* case: intermidiate node with both left and right children ==> relay message */
+ /* case: intermediate node with both left and right children ==> relay message */
else {
Request::recv(buf, count, datatype, from, tag, comm, &status);
Request::send(buf, count, datatype, to_left, tag, comm);
Request::waitall((pipe_length), recv_request_array, recv_status_array);
}
- /* case: intermidiate node with only left child ==> relay message */
+ /* case: intermediate node with only left child ==> relay message */
else if (to_right == -1) {
for (i = 0; i < pipe_length; i++) {
recv_request_array[i] = Request::irecv((char *) buf + (i * increment), segment, datatype, from,
Request::waitall(pipe_length, send_request_array, send_status_array);
}
- /* case: intermidiate node with both left and right children ==> relay message */
+ /* case: intermediate node with both left and right children ==> relay message */
else {
for (i = 0; i < pipe_length; i++) {
recv_request_array[i] = Request::irecv((char *) buf + (i * increment), segment, datatype, from,
* Descrp: broadcasts using a bionomial tree.
- * Auther: MPIH / modified by Ahmad Faraj
+ * Author: MPIH / modified by Ahmad Faraj
****************************************************************************/
namespace simgrid{
/* intermediate nodes code */
else if( tree->tree_nextsize > 0 ) {
- /* Intermediate nodes:
- * It will receive segments only from one half of the data.
- * Which one is determined by whether the node belongs to the "left" or "right"
- * subtree. Topoloby building function builds binary tree such that
- * odd "shifted ranks" ((rank + size - root)%size) are on the left subtree,
- * and even on the right subtree.
- *
- * Create the pipeline. We first post the first receive, then in the loop we
- * post the next receive and after that wait for the previous receive to complete
- * and we disseminating the data to all children.
- */
- sendcount[lr] = segcount[lr];
- base_req=Request::irecv(tmpbuf[lr], sendcount[lr], datatype,
- tree->tree_prev, COLL_TAG_BCAST,
- comm);
+ /* Intermediate nodes:
+ * It will receive segments only from one half of the data.
+ * Which one is determined by whether the node belongs to the "left" or "right"
+ * subtree. Topology building function builds binary tree such that
+ * odd "shifted ranks" ((rank + size - root)%size) are on the left subtree,
+ * and even on the right subtree.
+ *
+ * Create the pipeline. We first post the first receive, then in the loop we
+ * post the next receive and after that wait for the previous receive to complete
+ * and we disseminating the data to all children.
+ */
+ sendcount[lr] = segcount[lr];
+ base_req = Request::irecv(tmpbuf[lr], sendcount[lr], datatype, tree->tree_prev, COLL_TAG_BCAST, comm);
+
+ for (segindex = 1; segindex < num_segments[lr]; segindex++) {
+ /* determine how many elements to expect in this round */
+ if (segindex == (num_segments[lr] - 1))
+ sendcount[lr] = counts[lr] - segindex * segcount[lr];
+ /* post new irecv */
+ new_req = Request::irecv(tmpbuf[lr] + realsegsize[lr], sendcount[lr], datatype, tree->tree_prev, COLL_TAG_BCAST,
+ comm);
+
+ /* wait for and forward current segment */
+ Request::waitall(1, &base_req, MPI_STATUSES_IGNORE);
+ for (i = 0; i < tree->tree_nextsize; i++) { /* send data to children (segcount[lr]) */
+ Request::send(tmpbuf[lr], segcount[lr], datatype, tree->tree_next[i], COLL_TAG_BCAST, comm);
+ } /* end of for each child */
- for( segindex = 1; segindex < num_segments[lr]; segindex++ ) {
- /* determine how many elements to expect in this round */
- if( segindex == (num_segments[lr] - 1))
- sendcount[lr] = counts[lr] - segindex*segcount[lr];
- /* post new irecv */
- new_req = Request::irecv( tmpbuf[lr] + realsegsize[lr], sendcount[lr],
- datatype, tree->tree_prev, COLL_TAG_BCAST,
- comm);
-
- /* wait for and forward current segment */
- Request::waitall( 1, &base_req, MPI_STATUSES_IGNORE );
- for( i = 0; i < tree->tree_nextsize; i++ ) { /* send data to children (segcount[lr]) */
- Request::send( tmpbuf[lr], segcount[lr], datatype,
- tree->tree_next[i], COLL_TAG_BCAST,
- comm);
- } /* end of for each child */
-
- /* upate the base request */
- base_req = new_req;
- /* go to the next buffer (ie. the one corresponding to the next recv) */
- tmpbuf[lr] += realsegsize[lr];
+ /* upate the base request */
+ base_req = new_req;
+ /* go to the next buffer (ie. the one corresponding to the next recv) */
+ tmpbuf[lr] += realsegsize[lr];
} /* end of for segindex */
/* wait for the last segment and forward current segment */
* Descrp: broadcasts using a scatter followed by LR allgather.
- * Auther: MPIH / modified by Ahmad Faraj
+ * Author: MPIH / modified by Ahmad Faraj
****************************************************************************/
namespace simgrid{
return NULL;
}
- tree->tree_root = MPI_UNDEFINED;
- tree->tree_nextsize = MPI_UNDEFINED;
-
- /*
- * Set root
- */
- tree->tree_root = root;
-
/*
* Initialize tree
*/
return NULL;
}
- tree->tree_root = MPI_UNDEFINED;
- tree->tree_nextsize = MPI_UNDEFINED;
-
/*
* Initialize tree
*/
ompi_coll_tuned_topo_build_bmtree( MPI_Comm comm,
int root )
{
- int childs = 0;
+ int children = 0;
int rank;
int size;
int mask = 1;
if( remote >= size ) remote -= size;
bmtree->tree_prev = remote;
}
- /* And now let's fill my childs */
+ /* And now let's fill my children */
while( mask < size ) {
remote = (index ^ mask);
if( remote >= size ) break;
remote += root;
if( remote >= size ) remote -= size;
- if (childs==MAXTREEFANOUT) {
- XBT_DEBUG("coll:tuned:topo:build_bmtree max fanout incorrect %d needed %d", MAXTREEFANOUT, childs);
+ if (children==MAXTREEFANOUT) {
+ XBT_DEBUG("coll:tuned:topo:build_bmtree max fanout incorrect %d needed %d", MAXTREEFANOUT, children);
delete bmtree;
return NULL;
}
- bmtree->tree_next[childs] = remote;
+ bmtree->tree_next[children] = remote;
mask <<= 1;
- childs++;
+ children++;
}
- bmtree->tree_nextsize = childs;
+ bmtree->tree_nextsize = children;
bmtree->tree_root = root;
return bmtree;
}
*/
ompi_coll_tree_t* ompi_coll_tuned_topo_build_in_order_bmtree(MPI_Comm comm, int root)
{
- int childs = 0;
+ int children = 0;
int rank, vrank;
int size;
int mask = 1;
bmtree->tree_prev = (remote + root) % size;
break;
} else if (remote < size) {
- bmtree->tree_next[childs] = (remote + root) % size;
- childs++;
- if (childs == MAXTREEFANOUT) {
- XBT_DEBUG("coll:tuned:topo:build_bmtree max fanout incorrect %d needed %d", MAXTREEFANOUT, childs);
+ bmtree->tree_next[children] = (remote + root) % size;
+ children++;
+ if (children == MAXTREEFANOUT) {
+ XBT_DEBUG("coll:tuned:topo:build_bmtree max fanout incorrect %d needed %d", MAXTREEFANOUT, children);
delete bmtree;
return NULL;
}
}
mask <<= 1;
}
- bmtree->tree_nextsize = childs;
+ bmtree->tree_nextsize = children;
bmtree->tree_root = root;
return bmtree;
fflush(stdout);
return NULL;
}
- chain->tree_root = MPI_UNDEFINED;
- chain->tree_nextsize = -1;
for(i=0;i<fanout;i++) chain->tree_next[i] = -1;
/*
ptrdiff_t true_extent, real_segment_size;
true_extent=datatype->get_extent();
- /* handle non existant recv buffer (i.e. its NULL) and
+ /* handle non existent recv buffer (i.e. its NULL) and
protect the recv buffer on non-root nodes */
accumbuf = static_cast<unsigned char*>(recvbuf);
if (nullptr == accumbuf || root != rank) {
}
/* If this is a non-commutative operation we must copy
- sendbuf to the accumbuf, in order to simplfy the loops */
+ sendbuf to the accumbuf, in order to simplify the loops */
if ((op != MPI_OP_NULL && not op->is_commutative())) {
Datatype::copy(sendtmpbuf, original_count, datatype, accumbuf, original_count, datatype);
}
* reduce_intra_in_order_binary
*
* Function: Logarithmic reduce operation for non-commutative operations.
- * Acecpts: same as MPI_Reduce()
+ * Accepts: same as MPI_Reduce()
* Returns: MPI_SUCCESS or error code
*/
int Coll_reduce_ompi_in_order_binary::reduce(const void *sendbuf, void *recvbuf,
/* Fast reduce and allreduce algorithm for longer buffers and predefined
operations.
- This algorithm is explaned with the example of 13 nodes.
+ This algorithm is explained with the example of 13 nodes.
The nodes are numbered 0, 1, 2, ... 12.
The sendbuf content is a, b, c, ... m.
The buffer array is notated with ABCDEFGH, this means that
Exa.: size=13 ==> n=3, r=5 (i.e. size == 13 == 2**n+r == 2**3 + 5)
- The algoritm needs for the execution of one Colls::reduce
+ The algorithm needs for the execution of one Colls::reduce
- for r==0
exec_time = n*(L1+L2) + buf_lng * (1-1/2**n) * (T1 + T2 + O/d)
2) This line shows the limit for the count argument.
If count < limit then the vendor protocol is used,
otherwise the new protocol is used (see variable Ldb).
- 3) These lines show the bandwidth (=bufer length / execution time)
+ 3) These lines show the bandwidth (= buffer length / execution time)
for both protocols.
4) This line shows that the limit is choosen well if the ratio is
between 0.95 (loosing 5% for buffer length near and >=limit)
# endif
n = 0; x_size = 1;
while (2*x_size <= size) { n++; x_size = x_size * 2; }
- /* x_sixe == 2**n */
+ /* x_size == 2**n */
r = size - x_size;
/*...step 2 */
- wait on block (r)
- compute on block (r)
- copy block (r) to rbuf
- Note that we must be careful when computing the begining of buffers and
+ Note that we must be careful when computing the beginning of buffers and
for send operations and computation we must compute the exact block size.
*/
send_to = (rank + 1) % size;
range++;
}
/* Search for corresponding inter-leader function */
- /* skip mcast poiters if mcast is not available */
+ /* skip mcast pointers if mcast is not available */
if(mv2_allreduce_thresholds_table[range].mcast_enabled != 1){
while ((range_threshold < (mv2_allreduce_thresholds_table[range].size_inter_table - 1))
&& ((mv2_allreduce_thresholds_table[range].
int is_uniform_;
int* non_uniform_map_; // set if smp nodes have a different number of processes allocated
int is_blocked_; // are ranks allocated on the same smp node contiguous ?
- int is_smp_comm_; // set to 0 in case this is already an intra-comm or a leader-comm to avoid recursivity
+ int is_smp_comm_; // set to 0 in case this is already an intra-comm or a leader-comm to avoid recursion
std::list<MPI_Win> rma_wins_; // attached windows for synchronization.
std::string name_;
MPI_Info info_;
constexpr unsigned DT_FLAG_DESTROYED = 0x0001; /**< user destroyed but some other layers still have a reference */
constexpr unsigned DT_FLAG_COMMITED = 0x0002; /**< ready to be used for a send/recv operation */
constexpr unsigned DT_FLAG_CONTIGUOUS = 0x0004; /**< contiguous datatype */
-constexpr unsigned DT_FLAG_OVERLAP = 0x0008; /**< datatype is unpropper for a recv operation */
+constexpr unsigned DT_FLAG_OVERLAP = 0x0008; /**< datatype is unproper for a recv operation */
constexpr unsigned DT_FLAG_USER_LB = 0x0010; /**< has a user defined LB */
constexpr unsigned DT_FLAG_USER_UB = 0x0020; /**< has a user defined UB */
constexpr unsigned DT_FLAG_PREDEFINED = 0x0040; /**< cannot be removed: initial and predefined datatypes */
if((my_chunk_start>=min_offsets[i] && my_chunk_start < max_offsets[i])||
((my_chunk_end<=max_offsets[i]) && my_chunk_end> min_offsets[i])){
send_sizes[i]=(std::min(max_offsets[i]-1, my_chunk_end-1)-std::max(min_offsets[i], my_chunk_start));
- //store min and max offest to actually read
+ // store min and max offset to actually read
min_offset=std::min(min_offset, min_offsets[i]);
total_sent+=send_sizes[i];
XBT_CDEBUG(smpi_pmpi, "will have to send %d bytes to %d", send_sizes[i], i);
SharedMallocType smpi_cfg_shared_malloc = SharedMallocType::GLOBAL;
double smpi_total_benched_time = 0;
-// Private execute_flops used by smpi_execute and spmi_execute_benched
+// Private execute_flops used by smpi_execute and smpi_execute_benched
void private_execute_flops(double flops) {
xbt_assert(flops >= 0, "You're trying to execute a negative amount of flops (%f)!", flops);
XBT_DEBUG("Handle real computation time: %f flops", flops);
0, // count
true // benching (if we have no data, we need at least one)
});
- LocalData& data = insert.first->second;
if (insert.second) {
XBT_DEBUG("XXXXX First time ever on benched nest %s.", loc.c_str());
xbt_assert(threshold > 0 || iters > 0,
"You should provide either a positive amount of iterations to bench, or a positive maximal stderr (or both)");
} else {
+ LocalData& data = insert.first->second;
if (data.iters != iters || data.threshold != threshold) {
XBT_ERROR("Asked to bench block %s with different settings %d, %f is not %d, %f. "
"How did you manage to give two numbers at the same line??",
auto sample = samples.find(loc);
if (sample == samples.end())
xbt_die("Y U NO use SMPI_SAMPLE_* macros? Stop messing directly with smpi_sample_* functions!");
- LocalData& data = sample->second;
if (smpi_process()->sampling()){//end of loop, but still sampling needed
- smpi_process()->set_sampling(0);
- smpi_execute(data.mean*iter_count);
- smpi_bench_begin();
+ LocalData& data = sample->second;
+ smpi_process()->set_sampling(0);
+ smpi_execute(data.mean * iter_count);
+ smpi_bench_begin();
}
}
return 0;
};
}
-typedef std::tuple</*sender*/ int, /* reciever */ int, /* tag */int> req_key_t;
+typedef std::tuple</*sender*/ int, /* receiver */ int, /* tag */ int> req_key_t;
typedef std::unordered_map<req_key_t, MPI_Request, hash_tuple::hash<std::tuple<int,int,int>>> req_storage_t;
void log_timed_action(simgrid::xbt::ReplayAction& action, double clock)
if (action.size() > 5 + comm_size)
datatype2 = simgrid::smpi::Datatype::decode(action[5 + comm_size]);
} else {
- int datatype_index = 0;
int disp_index = 0;
/* The 3 comes from "0 gather <sendcount>", which must always be present.
* The + comm_size is the recvcounts array, which must also be present
*/
if (action.size() > 3 + comm_size + comm_size) { /* datatype + disp are specified */
- datatype_index = 3 + comm_size;
+ int datatype_index = 3 + comm_size;
disp_index = datatype_index + 1;
datatype1 = simgrid::smpi::Datatype::decode(action[datatype_index]);
datatype2 = simgrid::smpi::Datatype::decode(action[datatype_index]);
3 + comm_size + 2) { /* disps specified; datatype is not specified; use the default one */
disp_index = 3 + comm_size;
} else if (action.size() > 3 + comm_size) { /* only datatype, no disp specified */
- datatype_index = 3 + comm_size;
+ int datatype_index = 3 + comm_size;
datatype1 = simgrid::smpi::Datatype::decode(action[datatype_index]);
datatype2 = simgrid::smpi::Datatype::decode(action[datatype_index]);
}
// we need to switch as the called function may silently touch global variables
smpi_switch_data_segment(s4u::Actor::self());
}
- //identify neighbours in comm
+ // identify neighbors in comm
MPI_Comm comm_intra = find_intra_comm(&leader);
int Group::incl(int n, const int* ranks, MPI_Group* newgroup)
{
- int i=0;
if (n == 0) {
*newgroup = MPI_GROUP_EMPTY;
} else if (n == size_) {
this->ref();
} else {
*newgroup = new Group(n);
- for (i = 0; i < n; i++) {
+ for (int i = 0; i < n; i++) {
s4u::Actor* actor = this->actor(ranks[i]); // ranks[] was passed as a param!
(*newgroup)->set_mapping(actor, i);
}
}
}
}
- // This part handles the problem of non-contiguous memory (for the unserialisation at the reception)
+ // This part handles the problem of non-contiguous memory (for the unserialization at the reception)
old_buf_ = old_buf;
size_ = datatype->size() * count;
datatype->ref();
if (req->detached_)
ref->detached_sender_=req; //tie the sender to the receiver, as it is detached and has to be freed in the receiver
if(req->cancelled_==0)
- req->cancelled_=-1;//mark as uncancellable
+ req->cancelled_ = -1; // mark as uncancelable
XBT_DEBUG("match succeeded");
return 1;
}else return 0;
if (ref->detached_)
req->detached_sender_=ref; //tie the sender to the receiver, as it is detached and has to be freed in the receiver
if(req->cancelled_==0)
- req->cancelled_=-1;//mark as uncancellable
+ req->cancelled_ = -1; // mark as uncancelable
XBT_DEBUG("match succeeded");
return 1;
} else
int Request::testsome(int incount, MPI_Request requests[], int *count, int *indices, MPI_Status status[])
{
- int ret = MPI_SUCCESS;
int error=0;
int count_dead = 0;
int flag = 0;
*count = 0;
for (int i = 0; i < incount; i++) {
if (requests[i] != MPI_REQUEST_NULL && not (requests[i]->flags_ & MPI_REQ_FINISHED)) {
- ret = test(&requests[i], pstat, &flag);
+ int ret = test(&requests[i], pstat, &flag);
if(ret!=MPI_SUCCESS)
error = 1;
if(flag) {
MPI_Status *pstat = status == MPI_STATUSES_IGNORE ? MPI_STATUS_IGNORE : &stat;
int flag;
int error = 0;
- int ret=MPI_SUCCESS;
*outflag = 1;
for(int i=0; i<count; i++){
if (requests[i] != MPI_REQUEST_NULL && not(requests[i]->flags_ & MPI_REQ_PREPARED)) {
- ret = test(&requests[i], pstat, &flag);
+ int ret = test(&requests[i], pstat, &flag);
if (flag){
flag=0;
requests[i]=MPI_REQUEST_NULL;
}
if(datatype->flags() & DT_FLAG_DERIVED){
- // This part handles the problem of non-contignous memory the unserialization at the reception
+ // This part handles the problem of non-contiguous memory the unserialization at the reception
if ((req->flags_ & MPI_REQ_RECV) && datatype->size() != 0)
datatype->unserialize(req->buf_, req->old_buf_, req->real_size_/datatype->size() , req->op_);
xbt_free(req->buf_);
bar_->wait();
mut_->lock();
// This (simulated) mutex ensures that no process pushes to the vector of requests during the waitall.
- // Without this, the vector could get redimensionned when another process pushes.
+ // Without this, the vector could get redimensioned when another process pushes.
// This would result in the array used by Request::waitall() to be invalidated.
// Another solution would be to copy the data and cleanup the vector *before* Request::waitall
std::vector<MPI_Request> *reqs = requests_;
void* recv_addr = static_cast<void*>(static_cast<char*>(recv_win->base_) + target_disp * recv_win->disp_unit_);
XBT_DEBUG("Entering MPI_Accumulate to %d", target_rank);
- //As the tag will be used for ordering of the operations, substract count from it (to avoid collisions with other SMPI tags, SMPI_RMA_TAG is set below all the other ones we use )
- //prepare send_request
+ // As the tag will be used for ordering of the operations, subtract count from it (to avoid collisions with other
+ // SMPI tags, SMPI_RMA_TAG is set below all the other ones we use)
+ // prepare send_request
MPI_Request sreq = Request::rma_send_init(origin_addr, origin_count, origin_datatype, comm_->rank(), target_rank,
SMPI_RMA_TAG - 3 - count_, comm_, op);
-np <numprocs> # use that amount of processes from the hostfile.
# By default, all processes of the hostfile are used.
-no-privatize # Disable the globals privatization, that is activated by default
- -trace-ti # activate time independant tracing (for replay, default in smpi_simgrid.txt)
+ -trace-ti # activate time independent tracing (for replay, default in smpi_simgrid.txt)
-trace # activate tracing (Paje, default in smpi_simgrid.trace)
-trace-comment <comment> # put a comment on the top of the trace file
-trace-comment-file <file> # put file contents on the top of the trace file as comment
# * The job is launched in the background in order to be able to handle signals.
#
# * The FD 3 is used to temporarily store FD 1. This is because the shell connects FD 1 to /dev/null when the command
-# is launched in the background: this can be overriden in bash but not in standard bourne shell.
+# is launched in the background: this can be overridden in bash but not in standard bourne shell.
exec 3<&0
${WRAPPER} "@SMPIMAIN@" ${EXEC} ${PRIVATIZE} ${TRACEOPTIONS} ${SIMOPTS} ${PLATFORMTMP} ${APPLICATIONTMP} <&3 3>&- &
pid=$!
return new CpuTi(this, host, speed_per_pstate, core);
}
-double CpuTiModel::next_occuring_event(double now)
+double CpuTiModel::next_occurring_event(double now)
{
double min_action_duration = -1;
/* Dynamic */
double last_time_ = 0.0; /*< Integral interval last point (discrete time) */
- double total_ = 0.0; /*< Integral total between 0 and last_pointn */
+ double total_ = 0.0; /*< Integral total between 0 and last point */
std::unique_ptr<CpuTiProfile> profile_ = nullptr;
profile::Profile* speed_profile_ = nullptr;
CpuTiModel& operator=(const CpuTiModel&) = delete;
~CpuTiModel() override;
Cpu* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate, int core) override;
- double next_occuring_event(double now) override;
+ double next_occurring_event(double now) override;
void update_actions_state(double now, double delta) override;
CpuTiList modified_cpus_;
return new DiskS19(this, id, get_maxmin_system(), read_bw, write_bw);
}
-double DiskS19Model::next_occuring_event(double now)
+double DiskS19Model::next_occurring_event(double now)
{
- return DiskModel::next_occuring_event_full(now);
+ return DiskModel::next_occurring_event_full(now);
}
void DiskS19Model::update_actions_state(double /*now*/, double delta)
public:
DiskS19Model();
DiskImpl* createDisk(const std::string& id, double read_bw, double write_bw) override;
- double next_occuring_event(double now) override;
+ double next_occurring_event(double now) override;
void update_actions_state(double now, double delta) override;
};
{
all_existing_models.push_back(this);
}
-double HostCLM03Model::next_occuring_event(double now)
+double HostCLM03Model::next_occurring_event(double now)
{
- double min_by_cpu = surf_cpu_model_pm->next_occuring_event(now);
+ double min_by_cpu = surf_cpu_model_pm->next_occurring_event(now);
double min_by_net =
- surf_network_model->next_occuring_event_is_idempotent() ? surf_network_model->next_occuring_event(now) : -1;
- double min_by_sto = surf_storage_model->next_occuring_event(now);
- double min_by_dsk = surf_disk_model->next_occuring_event(now);
+ surf_network_model->next_occurring_event_is_idempotent() ? surf_network_model->next_occurring_event(now) : -1;
+ double min_by_sto = surf_storage_model->next_occurring_event(now);
+ double min_by_dsk = surf_disk_model->next_occurring_event(now);
XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_sto %f, %s min_by_dsk %f", this,
typeid(surf_cpu_model_pm).name(), min_by_cpu, typeid(surf_network_model).name(), min_by_net,
class XBT_PRIVATE HostCLM03Model : public HostModel {
public:
HostCLM03Model();
- double next_occuring_event(double now) override;
+ double next_occurring_event(double now) override;
void update_actions_state(double now, double delta) override;
};
}
/* 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_cm02.hpp"
+#include "src/surf/network_cm02.hpp"
#include "simgrid/s4u/Host.hpp"
#include "simgrid/sg_config.hpp"
#include "src/kernel/resource/profile/Event.hpp"
+#include "src/surf/network_wifi.hpp"
#include "src/surf/surf_interface.hpp"
#include "surf/surf.hpp"
LinkImpl* NetworkCm02Model::create_link(const std::string& name, const std::vector<double>& bandwidths, double latency,
s4u::Link::SharingPolicy policy)
{
- if (policy == s4u::Link::SharingPolicy::WIFI) {
- return (new NetworkWifiLink(this, name, bandwidths, policy, get_maxmin_system()));
- }
- xbt_assert(bandwidths.size() == 1, "Non WIFI links must use only 1 bandwidth.");
+ if (policy == s4u::Link::SharingPolicy::WIFI)
+ return new NetworkWifiLink(this, name, bandwidths, get_maxmin_system());
+
+ xbt_assert(bandwidths.size() == 1, "Non-WIFI links must use only 1 bandwidth.");
return new NetworkCm02Link(this, name, bandwidths[0], latency, policy, get_maxmin_system());
}
if (link->get_sharing_policy() == s4u::Link::SharingPolicy::WIFI) {
NetworkWifiLink* wifi_link = static_cast<NetworkWifiLink*>(link);
- double src_rate = wifi_link->get_host_rate(src);
- double dst_rate = wifi_link->get_host_rate(dst);
- xbt_assert(
- !(src_rate == -1 && dst_rate == -1),
- "Some Stations are not associated to any Access Point. Make sure to call set_host_rate on all Stations.");
- if (src_rate != -1)
- get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0 / src_rate);
- else
- get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0 / dst_rate);
+ double rate = wifi_link->get_host_rate(src);
+ if (rate == -1)
+ rate = wifi_link->get_host_rate(dst);
+ xbt_assert(rate != -1,
+ "None of the source (%s) or destination (%s) is connected to the Access Point '%s'. "
+ "Please use set_host_rate() on all stations.",
+ src->get_cname(), dst->get_cname(), link->get_cname());
+ get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0 / rate);
} else {
get_maxmin_system()->expand(link->get_constraint(), action->get_variable(), 1.0);
} else if (triggered == state_event_) {
if (value > 0)
turn_on();
- else {
+ else
turn_off();
- }
tmgr_trace_event_unref(&state_event_);
} else {
xbt_die("Unknown event!\n");
}
}
-NetworkWifiLink::NetworkWifiLink(NetworkCm02Model* model, const std::string& name, std::vector<double> bandwidths,
- s4u::Link::SharingPolicy policy, lmm::System* system)
- : NetworkCm02Link(
- model, name, 1 / sg_bandwidth_factor, 0, policy,
- system) // Since link use bw*sg_bandwidth_factor we should divise in order to as 1 as bound in the lmm system
-{
- for (auto bandwidth : bandwidths) {
- bandwidths_.push_back({bandwidth, 1.0, nullptr});
- }
-}
-
-void NetworkWifiLink::set_host_rate(s4u::Host* host, int rate_level)
-{
- auto insert_done = host_rates_.insert(std::make_pair(host->get_name(), rate_level));
- if (insert_done.second == false)
- insert_done.first->second = rate_level;
-}
-
-double NetworkWifiLink::get_host_rate(sg_host_t host)
-{
- std::map<xbt::string, int>::iterator host_rates_it;
- host_rates_it = host_rates_.find(host->get_name());
-
- if (host_rates_it == host_rates_.end())
- return -1;
-
- int rate_id = host_rates_it->second;
- xbt_assert(rate_id >= 0 && rate_id < (int)bandwidths_.size(), "Host \"%s\" has an invalid rate \"%d\"",
- host->get_name().c_str(), rate_id);
-
- Metric rate = bandwidths_[rate_id];
- return rate.peak * rate.scale;
-}
-
-s4u::Link::SharingPolicy NetworkWifiLink::get_sharing_policy()
-{
- return s4u::Link::SharingPolicy::WIFI;
-}
-
/**********
* Action *
**********/
void set_latency(double value) override;
};
-class NetworkWifiLink : public NetworkCm02Link {
- /** @brief Hold every rates association between host and links (host name, rates id) */
- std::map<xbt::string, int> host_rates_;
-
- /** @brief A link can have several bandwith attach to it (mostly use by wifi model) */
- std::vector<Metric> bandwidths_;
-
-public:
- NetworkWifiLink(NetworkCm02Model* model, const std::string& name, std::vector<double> bandwidths,
- s4u::Link::SharingPolicy policy, lmm::System* system);
-
- void set_host_rate(s4u::Host* host, int rate_level);
- /** @brief Get the AP rate associated to the host (or -1 if not associated to the AP) */
- double get_host_rate(s4u::Host* host);
- s4u::Link::SharingPolicy get_sharing_policy() override;
-};
-
/**********
* Action *
**********/
return nullptr;
}
-double NetworkConstantModel::next_occuring_event(double /*now*/)
+double NetworkConstantModel::next_occurring_event(double /*now*/)
{
double min = -1.0;
for (kernel::resource::Action const& action : *get_started_action_set()) {
public:
NetworkConstantModel();
Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
- double next_occuring_event(double now) override;
+ double next_occurring_event(double now) override;
void update_actions_state(double now, double delta) override;
LinkImpl* create_link(const std::string& name, const std::vector<double>& bws, double lat,
return rate;
}
-double NetworkModel::next_occuring_event_full(double now)
+double NetworkModel::next_occurring_event_full(double now)
{
- double minRes = Model::next_occuring_event_full(now);
+ double minRes = Model::next_occurring_event_full(now);
for (Action const& action : *get_started_action_set()) {
const NetworkAction& net_action = static_cast<const NetworkAction&>(action);
* @return The new bandwidth.
*/
virtual double get_bandwidth_constraint(double rate, double bound, double size);
- double next_occuring_event_full(double now) override;
+ double next_occurring_event_full(double now) override;
LinkImpl* loopback_ = nullptr;
};
latency changes due to external load). Trace must contain
absolute values */
- Metric latency_ = {1.0, 0, nullptr};
+ Metric latency_ = {0.0, 0, nullptr};
Metric bandwidth_ = {1.0, 0, nullptr};
};
simgrid::xbt::Extension<simgrid::kernel::routing::NetPoint, NetPointNs3> NetPointNs3::EXTENSION_ID;
-NetPointNs3::NetPointNs3()
+NetPointNs3::NetPointNs3() : ns3_node_(ns3::CreateObject<ns3::Node>(0))
{
- ns3_node_ = ns3::CreateObject<ns3::Node>(0);
stack.Install(ns3_node_);
nodes.Add(ns3_node_);
node_num = number_of_nodes++;
// Create private link
std::string host_id = cluster.prefix + std::to_string(i) + cluster.suffix;
- auto* host_src = simgrid::s4u::Host::by_name(host_id)->pimpl_netpoint->extension<NetPointNs3>();
+ auto* host_src = simgrid::s4u::Host::by_name(host_id)->get_netpoint()->extension<NetPointNs3>();
xbt_assert(host_src, "Cannot find a ns-3 host of name %s", host_id.c_str());
// Any ns-3 route is symmetrical
return new NetworkNS3Action(this, size, src, dst);
}
-double NetworkNS3Model::next_occuring_event(double now)
+double NetworkNS3Model::next_occurring_event(double now)
{
double time_to_next_flow_completion = 0.0;
- XBT_DEBUG("ns3_next_occuring_event");
+ XBT_DEBUG("ns3_next_occurring_event");
//get the first relevant value from the running_actions list
SgFlow* sgFlow = elm.second;
NetworkNS3Action * action = sgFlow->action_;
XBT_DEBUG("Processing socket %p (action %p)",sgFlow,action);
- // Because NS3 stops as soon as a flow is finished, the other flows that ends at the same time may remains in an inconsistant state
- // (i.e. remains_ == 0 but finished_ == false).
+ // Because NS3 stops as soon as a flow is finished, the other flows that ends at the same time may remains in an
+ // inconsistent state (i.e. remains_ == 0 but finished_ == false).
// However, SimGrid considers sometimes that an action with remains_ == 0 is finished.
// Thus, to avoid inconsistencies between SimGrid and NS3, set remains to 0 only when the flow is finished in NS3
int remains = action->get_cost() - sgFlow->sent_bytes_;
static int port_number = 1025; // Port number is limited from 1025 to 65 000
- unsigned int node1 = src->pimpl_netpoint->extension<NetPointNs3>()->node_num;
- unsigned int node2 = dst->pimpl_netpoint->extension<NetPointNs3>()->node_num;
+ unsigned int node1 = src->get_netpoint()->extension<NetPointNs3>()->node_num;
+ unsigned int node2 = dst->get_netpoint()->extension<NetPointNs3>()->node_num;
- ns3::Ptr<ns3::Node> src_node = src->pimpl_netpoint->extension<NetPointNs3>()->ns3_node_;
- ns3::Ptr<ns3::Node> dst_node = dst->pimpl_netpoint->extension<NetPointNs3>()->ns3_node_;
+ ns3::Ptr<ns3::Node> src_node = src->get_netpoint()->extension<NetPointNs3>()->ns3_node_;
+ ns3::Ptr<ns3::Node> dst_node = dst->get_netpoint()->extension<NetPointNs3>()->ns3_node_;
xbt_assert(node2 < IPV4addr.size(), "Element %s is unknown to ns-3. Is it connected to any one-hop link?",
- dst->pimpl_netpoint->get_cname());
+ dst->get_netpoint()->get_cname());
std::string& addr = IPV4addr[node2];
xbt_assert(not addr.empty(), "Element %s is unknown to ns-3. Is it connected to any one-hop link?",
- dst->pimpl_netpoint->get_cname());
+ dst->get_netpoint()->get_cname());
XBT_DEBUG("ns3: Create flow of %.0f Bytes from %u to %u with Interface %s", totalBytes, node1, node2, addr.c_str());
ns3::PacketSinkHelper sink("ns3::TcpSocketFactory", ns3::InetSocketAddress(ns3::Ipv4Address::GetAny(), port_number));
LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidth, double latency,
s4u::Link::SharingPolicy policy) override;
Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
- double next_occuring_event(double now) override;
- bool next_occuring_event_is_idempotent() override { return false; }
+ double next_occurring_event(double now) override;
+ bool next_occurring_event_is_idempotent() override { return false; }
void update_actions_state(double now, double delta) override;
};
--- /dev/null
+/* Copyright (c) 2019. 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_wifi.hpp"
+#include "simgrid/s4u/Host.hpp"
+#include "src/surf/surf_interface.hpp"
+
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network);
+
+namespace simgrid {
+namespace kernel {
+namespace resource {
+
+/************
+ * Resource *
+ ************/
+
+NetworkWifiLink::NetworkWifiLink(NetworkCm02Model* model, const std::string& name, std::vector<double> bandwidths,
+ lmm::System* system)
+ : LinkImpl(model, name, system->constraint_new(this, 1))
+{
+ for (auto bandwidth : bandwidths)
+ bandwidths_.push_back({bandwidth, 1.0, nullptr});
+
+ simgrid::s4u::Link::on_creation(this->piface_);
+}
+
+void NetworkWifiLink::set_host_rate(s4u::Host* host, int rate_level)
+{
+ auto insert_done = host_rates_.insert(std::make_pair(host->get_name(), rate_level));
+ if (insert_done.second == false)
+ insert_done.first->second = rate_level;
+}
+
+double NetworkWifiLink::get_host_rate(sg_host_t host)
+{
+ std::map<xbt::string, int>::iterator host_rates_it;
+ host_rates_it = host_rates_.find(host->get_name());
+
+ if (host_rates_it == host_rates_.end())
+ return -1;
+
+ int rate_id = host_rates_it->second;
+ xbt_assert(rate_id >= 0 && rate_id < (int)bandwidths_.size(), "Host '%s' has an invalid rate '%d' on wifi link '%s'",
+ host->get_name().c_str(), rate_id, this->get_cname());
+
+ Metric rate = bandwidths_[rate_id];
+ return rate.peak * rate.scale;
+}
+
+s4u::Link::SharingPolicy NetworkWifiLink::get_sharing_policy()
+{
+ return s4u::Link::SharingPolicy::WIFI;
+}
+
+} // namespace resource
+} // namespace kernel
+} // namespace simgrid
--- /dev/null
+/* Copyright (c) 2019. 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_WIFI_HPP_
+#define SURF_NETWORK_WIFI_HPP_
+
+#include <xbt/base.h>
+
+#include "network_cm02.hpp"
+#include "xbt/string.hpp"
+
+/***********
+ * Classes *
+ ***********/
+
+namespace simgrid {
+namespace kernel {
+namespace resource {
+
+class NetworkWifiLink : public LinkImpl {
+ /** @brief Hold every rates association between host and links (host name, rates id) */
+ std::map<xbt::string, int> host_rates_;
+
+ /** @brief A link can have several bandwith attach to it (mostly use by wifi model) */
+ std::vector<Metric> bandwidths_;
+
+public:
+ NetworkWifiLink(NetworkCm02Model* model, const std::string& name, std::vector<double> bandwidths,
+ lmm::System* system);
+
+ void set_host_rate(s4u::Host* host, int rate_level);
+ /** @brief Get the AP rate associated to the host (or -1 if not associated to the AP) */
+ double get_host_rate(s4u::Host* host);
+
+ s4u::Link::SharingPolicy get_sharing_policy() override;
+ void apply_event(kernel::profile::Event*, double) override { THROW_UNIMPLEMENTED; }
+ void set_bandwidth(double) override { THROW_UNIMPLEMENTED; }
+ void set_latency(double) override { THROW_UNIMPLEMENTED; }
+};
+
+} // namespace resource
+} // namespace kernel
+} // namespace simgrid
+#endif /* SURF_NETWORK_WIFI_HPP_ */
set_maxmin_system(nullptr);
}
-double HostL07Model::next_occuring_event(double now)
+double HostL07Model::next_occurring_event(double now)
{
- double min = HostModel::next_occuring_event_full(now);
+ double min = HostModel::next_occurring_event_full(now);
for (kernel::resource::Action const& action : *get_started_action_set()) {
const L07Action& net_action = static_cast<const L07Action&>(action);
if (net_action.latency_ > 0 && (min < 0 || net_action.latency_ < min)) {
HostL07Model& operator=(const HostL07Model&) = delete;
~HostL07Model() override;
- double next_occuring_event(double now) override;
+ double next_occurring_event(double now) override;
void update_actions_state(double now, double delta) override;
kernel::resource::CpuAction* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
const double* bytes_amount, double rate) override;
if (args->pstate != 0)
host->set_pstate(args->pstate);
if (not args->coord.empty())
- new simgrid::kernel::routing::vivaldi::Coords(host->pimpl_netpoint, args->coord);
+ new simgrid::kernel::routing::vivaldi::Coords(host->get_netpoint(), args->coord);
}
/** @brief Add a "router" to the network element list */
speed_per_pstate.push_back(peer->speed);
simgrid::s4u::Host* host = as->create_host(peer->id.c_str(), speed_per_pstate, 1, nullptr);
- as->set_peer_link(host->pimpl_netpoint, peer->bw_in, peer->bw_out, peer->coord);
+ as->set_peer_link(host->get_netpoint(), peer->bw_in, peer->bw_out, peer->coord);
/* Change from the defaults */
if (peer->state_trace)
/** @brief Add a link connecting a host to the rest of its AS (which must be cluster or vivaldi) */
void sg_platf_new_hostlink(simgrid::kernel::routing::HostLinkCreationArgs* hostlink)
{
- simgrid::kernel::routing::NetPoint* netpoint = simgrid::s4u::Host::by_name(hostlink->id)->pimpl_netpoint;
+ simgrid::kernel::routing::NetPoint* netpoint = simgrid::s4u::Host::by_name(hostlink->id)->get_netpoint();
xbt_assert(netpoint, "Host '%s' not found!", hostlink->id.c_str());
xbt_assert(dynamic_cast<simgrid::kernel::routing::ClusterZone*>(current_routing),
"Only hosts from Cluster and Vivaldi ASes can get a host_link.");
attach);
}
-double StorageN11Model::next_occuring_event(double now)
+double StorageN11Model::next_occurring_event(double now)
{
- return StorageModel::next_occuring_event_full(now);
+ return StorageModel::next_occurring_event_full(now);
}
void StorageN11Model::update_actions_state(double /*now*/, double delta)
StorageN11Model();
StorageImpl* createStorage(const std::string& id, const std::string& type_id, const std::string& content_name,
const std::string& attach) override;
- double next_occuring_event(double now) override;
+ double next_occurring_event(double now) override;
void update_actions_state(double now, double delta) override;
};
double surf_solve(double max_date)
{
double time_delta = -1.0; /* duration */
- double model_next_action_end = -1.0;
double value = -1.0;
simgrid::kernel::resource::Resource* resource = nullptr;
simgrid::kernel::profile::Event* event = nullptr;
/* Physical models MUST be resolved first */
XBT_DEBUG("Looking for next event in physical models");
- double next_event_phy = surf_host_model->next_occuring_event(NOW);
+ double next_event_phy = surf_host_model->next_occurring_event(NOW);
if ((time_delta < 0.0 || next_event_phy < time_delta) && next_event_phy >= 0.0) {
time_delta = next_event_phy;
}
if (surf_vm_model != nullptr) {
XBT_DEBUG("Looking for next event in virtual models");
- double next_event_virt = surf_vm_model->next_occuring_event(NOW);
+ double next_event_virt = surf_vm_model->next_occurring_event(NOW);
if ((time_delta < 0.0 || next_event_virt < time_delta) && next_event_virt >= 0.0)
time_delta = next_event_virt;
}
for (auto const& model : all_existing_models) {
if (model != surf_host_model && model != surf_vm_model && model != surf_network_model &&
model != surf_storage_model && model != surf_disk_model) {
- double next_event_model = model->next_occuring_event(NOW);
+ double next_event_model = model->next_occurring_event(NOW);
if ((time_delta < 0.0 || next_event_model < time_delta) && next_event_model >= 0.0)
time_delta = next_event_model;
}
double next_event_date = simgrid::kernel::profile::future_evt_set.next_date();
XBT_DEBUG("Next TRACE event: %f", next_event_date);
- if (not surf_network_model->next_occuring_event_is_idempotent()) { // NS3, I see you
+ if (not surf_network_model->next_occurring_event_is_idempotent()) { // NS3, I see you
if (next_event_date != -1.0) {
time_delta = std::min(next_event_date - NOW, time_delta);
} else {
XBT_DEBUG("Run the NS3 network at most %fs", time_delta);
// run until min or next flow
- model_next_action_end = surf_network_model->next_occuring_event(time_delta);
+ double model_next_action_end = surf_network_model->next_occurring_event(time_delta);
XBT_DEBUG("Min for network : %f", model_next_action_end);
if (model_next_action_end >= 0.0)
while ((event = simgrid::kernel::profile::future_evt_set.pop_leq(next_event_date, &value, &resource))) {
if (resource->is_used() || (watched_hosts.find(resource->get_cname()) != watched_hosts.end())) {
time_delta = next_event_date - NOW;
- XBT_DEBUG("This event invalidates the next_occuring_event() computation of models. Next event set to %f", time_delta);
+ XBT_DEBUG("This event invalidates the next_occurring_event() computation of models. Next event set to %f",
+ time_delta);
}
// FIXME: I'm too lame to update NOW live, so I change it and restore it so that the real update with surf_min will work
double round_start = NOW;
/** @ingroup SURF_models
* @brief Same as network model 'LagrangeVelho', only with different correction factors.
*
- * This model impelments a variant of the contention model on Infinband networks based on
+ * This model implements a variant of the contention model on Infiniband networks based on
* the works of Jérôme Vienne : http://mescal.imag.fr/membres/jean-marc.vincent/index.html/PhD/Vienne.pdf
*
* @see surf_host_model_init_IB()
/** @ingroup SURF_models
* @brief Initializes the platform with the network model CM02
*
- * You sould call this function by yourself only if you plan using surf_host_model_init_compound.
+ * You should call this function by yourself only if you plan using surf_host_model_init_compound.
* See comments in the code for more information.
*/
XBT_PUBLIC void surf_network_model_init_CM02();
/** @ingroup SURF_models
* @brief Initializes the platform with the current best network and cpu models at hand
*
- * This platform model seperates the host model and the network model.
+ * This platform model separates the host model and the network model.
* The host model will be initialized with the model compound, the network model with the model LV08 (with cross
* traffic support) and the CPU model with the model Cas01.
* Such model is subject to modification with warning in the ChangeLog so monitor it!
- PLATFORM_DESCRIPTION -> PLATFORM
* New in DTD version 1 (in SimGrid 3.3):
- - DTD is now versionned with the version attribute of platform
+ - DTD is now versioned with the version attribute of platform
- Unit change:
- Link bandwidth: from Mb/s to b/s
- CPU speed: from MFlop/s to Flop/s
* - ROUTE_ELEMENT -> LINK:CTN (changed again in v3)
* - PLATFORM_DESCRIPTION -> PLATFORM
* * New in DTD version 1 (in SimGrid 3.3):
- * - DTD is now versionned with the version attribute of platform
+ * - DTD is now versioned with the version attribute of platform
* - Unit change:
* - Link bandwidth: from Mb/s to b/s
* - CPU speed: from MFlop/s to Flop/s
this->aliases.insert({aliasname, element});
}
-/** @brief Dump a config set for debuging purpose
+/** @brief Dump a config set for debugging purpose
*
* @param name The name to give to this config set
* @param indent what to write at the beginning of each line (right number of spaces)
int ival = simgrid::config::get_value<int>("speed");
REQUIRE(ival == 42); // Unexpected value for speed
- INFO("Access to a non-existant entry");
+ INFO("Access to a non-existent entry");
REQUIRE_THROWS_AS(simgrid::config::set_parse("color:blue"), std::out_of_range);
* @param data the data to add in the dict
* @param free_ctn unused parameter (kept for compatibility)
*
- * set the @a data in the structure under the @a key, which is anull terminated string.
+ * set the @a data in the structure under the @a key, which is a null terminated string.
*/
void xbt_dict_set(xbt_dict_t dict, const char *key, void *data, void_f_pvoid_t free_ctn)
{
-/* dict_elm - elements of generic dictionnaries */
+/* dict_elm - elements of generic dictionaries */
/* This file is not to be loaded from anywhere but dict.cpp */
/* Copyright (c) 2004-2019. The SimGrid Team. All rights reserved. */
xbt_dict_free(&head);
}
- SECTION("Test dictionnary with int keys")
+ SECTION("Test dictionary with int keys")
{
xbt_dict_t dict = xbt_dict_new_homogeneous(nullptr);
int count = 500;
INFO("Insert elements");
for (int i = 0; i < count; ++i)
xbt_dict_set_ext(dict, (char*)&i, sizeof(i), (void*)(intptr_t)i, nullptr);
- REQUIRE(xbt_dict_size(dict) == (unsigned)count); // Bad number of elements in the dictionnary
+ REQUIRE(xbt_dict_size(dict) == (unsigned)count); // Bad number of elements in the dictionary
INFO("Check elements");
for (int i = 0; i < count; ++i) {
/** @brief Count of dynar's elements
*
- * @param dynar the dynar we want to mesure
+ * @param dynar the dynar we want to measure
*/
unsigned long xbt_dynar_length(const xbt_dynar_t dynar)
{
xbt_dynar_remove_at(dynar, dynar->used - 1, dst);
}
-/** @brief Add an element at the begining of the dynar.
+/** @brief Add an element at the beginning of the dynar.
*
* This is less efficient than xbt_dynar_push()
*/
for (int i = 0; i < NB_ELEM / 2; i++) {
int val;
xbt_dynar_shift(d, &val);
- REQUIRE(val == i); // The retrieved value is not the same than the injected one at the begining
+ REQUIRE(val == i); // The retrieved value is not the same than the injected one at the beginning
}
for (int i = 999; i >= 0; i--) {
int val;
for (int i = 0; i < 2500; i++) {
d1 = (double)i;
xbt_dynar_shift(d, &d2);
- REQUIRE(d1 == d2); // The retrieved value is not the same than the injected one at the begining
+ REQUIRE(d1 == d2); // The retrieved value is not the same than the injected one at the beginning
}
for (int i = 999; i >= 0; i--) {
d1 = (double)i;
* @param cat the category (not only its name, but the variable)
* @param parent the parent cat
*
- * Programatically alter a category's parent (don't use).
+ * Programmatically alter a category's parent (don't use).
*/
XBT_PUBLIC void xbt_log_parent_set(xbt_log_category_t cat, xbt_log_category_t parent);
* mallocator is empty
* @param free_f function to free an object of your datatype, called in @a xbt_mallocator_release() when the stack is
* full, and when the mallocator is freed.
- * @param reset_f function to reinitialise an object of your datatype, called when you extract an object from the
+ * @param reset_f function to reinitialize an object of your datatype, called when you extract an object from the
* mallocator (can be NULL)
*
* Create and initialize a new mallocator for a given datatype.
-/* Initialization for acces s to a mmap'd malloc managed region. */
+/* Initialization for access to a mmap'd malloc managed region. */
/* Copyright (c) 2012-2019. The SimGrid Team.
* All rights reserved. */
starting at the specified address BASEADDR in the process address
space.
- The provided BASEADDR should be choosed carefully in order to avoid
+ The provided BASEADDR should be chosen carefully in order to avoid
bumping into existing mapped regions or future mapped regions.
On success, returns a "malloc descriptor" which is used in subsequent
return (result);
}
-/** Initialise heapinfo about the heapinfo pages :)
+/** Initialize heapinfo about the heapinfo pages :)
*
*/
static void initialize_heapinfo_heapinfo(xbt_mheap_t mdp)
malloc_info* newinfo = (malloc_info*)align(mdp, newsize * sizeof(malloc_info));
memcpy(newinfo, oldinfo, mdp->heapsize * sizeof(malloc_info));
- /* Initialise the new blockinfo : */
+ /* Initialize the new blockinfo : */
memset((char*) newinfo + mdp->heapsize * sizeof(malloc_info), 0,
(newsize - mdp->heapsize)* sizeof(malloc_info));
mdp->heapstats.bytes_used += nblocks * BLOCKSIZE;
}
-/* Spliting mmalloc this way is mandated by a trick in mrealloc, that gives
+/* Splitting mmalloc this way is mandated by a trick in mrealloc, that gives
back the memory of big blocks to the system before reallocating them: we don't
want to loose the beginning of the area when this happens */
void *mmalloc_no_memset(xbt_mheap_t mdp, size_t size)
? 0 \
: off)
-/** @brief Add memoty to this heap
+/** @brief Add memory to this heap
*
* Get core for the memory region specified by MDP, using SIZE as the
* amount to either add to or subtract from the existing region. Works
#define BLOCKIFY(SIZE) (((SIZE) + BLOCKSIZE - 1) / BLOCKSIZE)
/* We keep fragment-specific meta-data for introspection purposes, and these
- * information are kept in fixed lenght arrays. Here is the computation of
+ * information are kept in fixed length arrays. Here is the computation of
* that size.
*
* Never make SMALLEST_POSSIBLE_MALLOC smaller than sizeof(list) because we
/* @brief List of all blocks containing free fragments of a given size.
*
- * The array indice is the log2 of requested size.
+ * The array index is the log2 of requested size.
* Actually only the sizes 8->11 seem to be used, but who cares? */
s_xbt_swag_t fraghead[BLOCKLOG];
size_t requested_size = size; // The amount of memory requested by user, for real
- /* Work even if the user was stupid enough to ask a ridicullously small block (even 0-length),
+ /* Work even if the user was stupid enough to ask a ridiculously small block (even 0-length),
* ie return a valid block that can be realloced and freed.
* glibc malloc does not use this trick but return a constant pointer, but we need to enlist the free fragments later on.
*/
}
/*
- * @param obj the objet to insert in the swag
+ * @param obj the object to insert in the swag
* @param swag a swag
*
* insert (at the tail... you probably had a very good reason to do that, I hope you know what you're doing) @a obj in
}
/*
- * @param obj the objet to remove from the swag
+ * @param obj the object to remove from the swag
* @param swag a swag
* @return @a obj if it was in the @a swag and NULL otherwise
*
enum { ABORT, ASSERT, PRINTF } behavior;
-/** A fake application with a bug occuring for some random values */
+/** A fake application with a bug occurring for some random values */
static void app()
{
int x = MC_random(0, 5);
// update the current round
peer->round = (peer->round + 1) % 3;
char* key;
- char* key_choked = NULL;
- connection_t peer_choosed = NULL;
- connection_t peer_choked = NULL;
+ char* key_choked = NULL;
+ connection_t peer_chosen = NULL;
+ connection_t peer_choked = NULL;
// remove a peer from the list
xbt_dict_cursor_t cursor = NULL;
xbt_dict_cursor_first(peer->active_peers, &cursor);
if (connection->last_unchoke < unchoke_time && (connection->interested != 0) &&
(connection->choked_upload != 0)) {
unchoke_time = connection->last_unchoke;
- peer_choosed = connection;
+ peer_chosen = connection;
}
}
} else {
connection_t connection;
xbt_dict_foreach (peer->peers, cursor, key, connection) {
if (i == id_chosen) {
- peer_choosed = connection;
+ peer_chosen = connection;
break;
}
i++;
}
xbt_dict_cursor_free(&cursor);
- xbt_assert(peer_choosed != NULL, "A peer should have been selected at this point");
- if ((peer_choosed->interested == 0) || (peer_choosed->choked_upload == 0))
- peer_choosed = NULL;
+ xbt_assert(peer_chosen != NULL, "A peer should have been selected at this point");
+ if ((peer_chosen->interested == 0) || (peer_chosen->choked_upload == 0))
+ peer_chosen = NULL;
else
XBT_DEBUG("Nothing to do, keep going");
j++;
- } while (peer_choosed == NULL && j < MAXIMUM_PEERS);
+ } while (peer_chosen == NULL && j < MAXIMUM_PEERS);
} else {
// Use the "fastest download" policy.
connection_t connection;
xbt_dict_foreach (peer->peers, cursor, key, connection) {
if (connection->peer_speed > fastest_speed && (connection->choked_upload != 0) &&
(connection->interested != 0)) {
- peer_choosed = connection;
+ peer_chosen = connection;
fastest_speed = connection->peer_speed;
}
}
}
}
- if (peer_choosed != NULL)
- XBT_DEBUG("(%d) update_choked peers unchoked (%d) ; int (%d) ; choked (%d) ", peer->id, peer_choosed->id,
- peer_choosed->interested, peer_choosed->choked_upload);
+ if (peer_chosen != NULL)
+ XBT_DEBUG("(%d) update_choked peers unchoked (%d) ; int (%d) ; choked (%d) ", peer->id, peer_chosen->id,
+ peer_chosen->interested, peer_chosen->choked_upload);
- if (peer_choked != peer_choosed) {
+ if (peer_choked != peer_chosen) {
if (peer_choked != NULL) {
xbt_assert((!peer_choked->choked_upload), "Tries to choked a choked peer");
peer_choked->choked_upload = 1;
XBT_DEBUG("(%d) Sending a CHOKE to %d", peer->id, peer_choked->id);
send_choked(peer, peer_choked->mailbox);
}
- if (peer_choosed != NULL) {
- xbt_assert((peer_choosed->choked_upload), "Tries to unchoked an unchoked peer");
- peer_choosed->choked_upload = 0;
- xbt_dict_set_ext(peer->active_peers, (char*)&peer_choosed->id, sizeof(int), peer_choosed, NULL);
- peer_choosed->last_unchoke = MSG_get_clock();
- XBT_DEBUG("(%d) Sending a UNCHOKE to %d", peer->id, peer_choosed->id);
- update_active_peers_set(peer, peer_choosed);
- send_unchoked(peer, peer_choosed->mailbox);
+ if (peer_chosen != NULL) {
+ xbt_assert((peer_chosen->choked_upload), "Tries to unchoked an unchoked peer");
+ peer_chosen->choked_upload = 0;
+ xbt_dict_set_ext(peer->active_peers, (char*)&peer_chosen->id, sizeof(int), peer_chosen, NULL);
+ peer_chosen->last_unchoke = MSG_get_clock();
+ XBT_DEBUG("(%d) Sending a UNCHOKE to %d", peer->id, peer_chosen->id);
+ update_active_peers_set(peer, peer_chosen);
+ send_unchoked(peer, peer_chosen->mailbox);
}
}
}
}
test = 3;
- // Create a process running sucessive sleeps on a host and turn the host off during the execution of the process.
+ // Create a process running successive sleeps on a host and turn the host off during the execution of the process.
if (xbt_dynar_search_or_negative(tests, &test) != -1) {
xbt_die("Test 3 is superseeded by activity-lifecycle");
}
XBT_INFO("Try to read %llu from '%s'", MSG_file_get_size(file), filename);
sg_size_t read = MSG_file_read(file, MSG_file_get_size(file));
XBT_INFO("Have read %llu from '%s'. Offset is now at: %llu", read, filename, MSG_file_tell(file));
- XBT_INFO("Seek back to the begining of the stream...");
+ XBT_INFO("Seek back to the beginning of the stream...");
MSG_file_seek(file, 0, SEEK_SET);
XBT_INFO("Offset is now at: %llu", MSG_file_tell(file));
> File Descriptor Id: 0
> [ 0.000000] (4@ dave) Try to read 48868 from '/tmp/doc/simgrid/examples/simdag/dax/Montage_50.xml'
> [ 0.001062] (4@ dave) Have read 48868 from '/tmp/doc/simgrid/examples/simdag/dax/Montage_50.xml'. Offset is now at: 48868
-> [ 0.001062] (4@ dave) Seek back to the begining of the stream...
+> [ 0.001062] (4@ dave) Seek back to the beginning of the stream...
> [ 0.001062] (4@ dave) Offset is now at: 0
> [ 0.001062] (4@ dave) Opened file '/tmp/doc/simgrid/examples/simdag/scheduling/Montage_25.xml'
> [ 0.001062] (4@ dave) Try to write 22 MiB to '/tmp/doc/simgrid/examples/simdag/scheduling/Montage_25.xml'
> [ 0.050039] (1@alice) Have read 1624671 from '/tmp/doc/simgrid/examples/msg/chord/chord10k.xml'. Offset is now at: 1624671
-> [ 0.050039] (1@alice) Seek back to the begining of the stream...
+> [ 0.050039] (1@alice) Seek back to the beginning of the stream...
> [ 0.050039] (1@alice) Offset is now at: 0
> [ 0.276315] (3@ carl) Have read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'. Offset is now at: 12710497
-> [ 0.276315] (3@ carl) Seek back to the begining of the stream...
+> [ 0.276315] (3@ carl) Seek back to the beginning of the stream...
> [ 0.276315] (3@ carl) Offset is now at: 0
> [ 0.387036] (2@ bob) Have read 12710497 from '/scratch/lib/libsimgrid.so.3.6.2'. Offset is now at: 12710497
-> [ 0.387036] (2@ bob) Seek back to the begining of the stream...
+> [ 0.387036] (2@ bob) Seek back to the beginning of the stream...
> [ 0.387036] (2@ bob) Offset is now at: 0
> [ 0.387036] (2@ bob) Opened file '/scratch/doc/simgrid/examples/platforms/g5k.xml'
> [ 0.387036] (2@ bob) Try to write 16 MiB to '/scratch/doc/simgrid/examples/platforms/g5k.xml'
XBT_INFO("== Try to get a process property that does not exist");
value = MSG_process_get_property_value(MSG_process_self(), noexist);
- xbt_assert(!value, "The property is defined (it shouldnt)");
+ xbt_assert(!value, "The property is defined (it shouldn't)");
xbt_dict_free(&props);
return 0;
/* Bug report: https://github.com/simgrid/simgrid/issues/40
*
* Task.listen used to be on async mailboxes as it always returned false.
- * This occures in Java and C, but is only tested here in C.
+ * This occurs in Java and C, but is only tested here in C.
*/
#include "simgrid/s4u.hpp"
for (unsigned int it_src = 0; it_src < totalHosts; it_src++) { // Routes from host
simgrid::s4u::Host* host1 = hosts[it_src];
- simgrid::kernel::routing::NetPoint* src = host1->pimpl_netpoint;
+ simgrid::kernel::routing::NetPoint* src = host1->get_netpoint();
for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
simgrid::s4u::Host* host2 = hosts[it_dst];
std::vector<simgrid::kernel::resource::LinkImpl*> route;
- simgrid::kernel::routing::NetPoint* dst = host2->pimpl_netpoint;
+ simgrid::kernel::routing::NetPoint* dst = host2->get_netpoint();
simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
if (not route.empty()) {
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->get_cname(), host2->get_cname());
simgrid::s4u::Host* host2 = hosts[it_dst];
std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->get_cname(), host2->get_cname());
std::vector<simgrid::kernel::resource::LinkImpl*> route;
- simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
+ simgrid::kernel::routing::NetPoint* netcardDst = host2->get_netpoint();
simgrid::kernel::routing::NetZoneImpl::get_global_route(value1, netcardDst, route, nullptr);
for (auto const& link : route)
std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
int it;
sg_host_t host;
xbt_dynar_foreach(hosts, it, host) {
- simgrid::kernel::routing::NetPoint* nc = host->pimpl_netpoint;
+ simgrid::kernel::routing::NetPoint* nc = host->get_netpoint();
const char *type = "buggy";
if (nc->is_router())
type = "router";
<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
<platform version="4.1">
<!-- THIS FILE IS INVALID.
- It declares a storage attached to a nonexistant host (plouf). See bogus_disk_attachment.tesh -->
+ It declares a storage attached to a nonexistent host (plouf). See bogus_disk_attachment.tesh -->
<zone id="AS0" routing="Full">
<storage_type id="single_HDD" model="SSD" size="4kB">
<model_prop id="Bwrite" value="30MBps" />
XBT_INFO("Exception caught: %s", e.what());
}
- // Synchronize on a successul Future<int> and get the value:
+ // Synchronize on a successful Future<int> and get the value:
int res = simgrid::simix::kernel_sync([] {
return kernel_wait_until(30).then([](simgrid::kernel::Future<void> f) {
f.get();
});
XBT_INFO("kernel_sync with value returned with %i", res);
- // Synchronize on a successul Future<int> and get the value:
+ // Synchronize on a successful Future<int> and get the value:
simgrid::simix::Future<int> future = simgrid::simix::kernel_async([] {
return kernel_wait_until(50).then([](simgrid::kernel::Future<void> f) {
f.get();
res = future.get();
XBT_INFO("kernel_async with value returned with %i", res);
- // Synchronize on a successul Future<int> and get the value:
+ // Synchronize on a successful Future<int> and get the value:
future = simgrid::simix::kernel_async([] {
return kernel_wait_until(60).then([](simgrid::kernel::Future<void> f) {
f.get();
a[i][j] = i * SIZE + j;
}
- /* only one column is send this is an exemple for non-contignous data*/
+ /* only one column is sent this is an example for non-contiguous data*/
MPI_Bcast(a, 1, columntype, 0, MPI_COMM_WORLD);
for (int i = 0; i < SIZE; i++) {
a[i][j] = i*SIZE+j;
}
- /* only one column is send this is an exemple for non-contignous data*/
+ /* only one column is sent this is an example for non-contiguous data*/
MPI_Bcast(a, 1, columntype, 0, MPI_COMM_WORLD);
for (int i = 0; i < SIZE; i++) {
#include "xbt/log.h"
#include "simgrid/msg.h"
-#include "src/surf/network_cm02.hpp"
+#include "src/surf/network_wifi.hpp"
#include <exception>
#include <iostream>
#include <random>
sub build_cat_tree {
my($root,$Cat)=@_;
- my(@childs)=();
+ my(@children)=();
my($cat);
foreach $cat (keys %$Cat) {
if($$Cat{$cat}{father} eq $root) {
- push @childs, build_cat_tree($cat,$Cat);
+ push @children, build_cat_tree($cat,$Cat);
}
# print "$$Cat{$cat}{name}\t\t $Cat{$cat}{father}\n";
}
- return [$root,@childs];
+ return [$root,@children];
}
sub build_cat_list {
src/surf/network_ns3.hpp
src/surf/network_smpi.hpp
src/surf/network_ib.hpp
+ src/surf/network_wifi.hpp
src/surf/ns3/ns3_simulator.hpp
src/surf/xml/simgrid.dtd
src/surf/xml/simgrid_dtd.h
src/surf/network_cm02.cpp
src/surf/network_constant.cpp
src/surf/network_interface.cpp
+ src/surf/network_wifi.cpp
src/surf/PropertyHolder.cpp
src/surf/sg_platf.cpp
src/surf/StorageImpl.cpp
################################################################
## Build a sain "make dist" target to build a source package ###
-## containing only the files that I explicitely state ###
+## containing only the files that I explicitly state ###
## (instead of any cruft laying on my disk as CPack does) ###
################################################################
${S4U_SRC}
${NS3_SRC}
${PLUGINS_SRC}
- ${RNGSTREAM_SRC}
${SIMDAG_SRC}
${SIMGRID_SRC}
${SIMIX_SRC}
#
# find_package(PAPI)
#
-# Variables used by this module, they can change the default behaviour and need
+# Variables used by this module, they can change the default behavior and need
# to be set before calling find_package:
#
# PAPI_PREFIX Set this variable to the root installation of
#include <stdlib.h>
#include <ucontext.h>
+unsigned char *stack[64 * 1024];
ucontext_t uc_child;
ucontext_t uc_main;
int main(int argc, char *argv[])
{
- void *stack = malloc(64 * 1024);
-
/* configure a child user-space context */
- if (stack == NULL)
- exit(3);
if (getcontext(&uc_child) != 0)
exit(4);
uc_child.uc_link = NULL;
- uc_child.uc_stack.ss_sp = (char *) stack + (32 * 1024);
+ uc_child.uc_stack.ss_sp = stack + (32 * 1024);
uc_child.uc_stack.ss_size = 32 * 1024;
uc_child.uc_stack.ss_flags = 0;
makecontext(&uc_child, child, 0);
callgrind
calloc
cfg
+CMake
+cmake
comm
const
cplusplus
ModelChecker
modelchecker
MPI
+MPICH
msg
mutex
+NetZone
nullptr
ok
Paje
SMPI
smpi
smx
+snprintf
src
+StarPU
std
+stdint
+stderr
+stdout
strerror
strlen
+strtok
struct
syscall
syscalls
todo
TODO
valgrind
+vasprintf
VM
VMs
waitany