XBT_PUBLIC(double) sg_host_speed(sg_host_t host);
XBT_PUBLIC(double) sg_host_get_available_speed(sg_host_t host);
+XBT_PUBLIC(sg_host_t) sg_host_self();
+XBT_PUBLIC(const char*) sg_host_self_get_name();
XBT_PUBLIC(int) sg_host_get_nb_pstates(sg_host_t host);
XBT_PUBLIC(int) sg_host_get_pstate(sg_host_t host);
XBT_PUBLIC(void) sg_host_set_pstate(sg_host_t host,int pstate);
XBT_PUBLIC(void) SIMIX_process_detach();
/*********************************** Host *************************************/
-XBT_PUBLIC(sg_host_t) SIMIX_host_self();
-XBT_PUBLIC(const char*) SIMIX_host_self_get_name();
XBT_PUBLIC(void) SIMIX_host_off(sg_host_t host, smx_actor_t issuer);
XBT_PUBLIC(void) SIMIX_host_self_set_data(void *data);
XBT_PUBLIC(void*) SIMIX_host_self_get_data();
/******************************* Host simcalls ********************************/
XBT_PUBLIC(void) simcall_host_set_data(sg_host_t host, void *data);
-
XBT_PUBLIC(smx_activity_t) simcall_execution_start(const char *name,
double flops_amount,
double priority, double bound);
}
}
-sg_host_t SIMIX_host_self()
+sg_host_t sg_host_self()
{
smx_actor_t process = SIMIX_process_self();
return (process == nullptr) ? nullptr : process->host;
}
/* needs to be public and without simcall for exceptions and logging events */
-const char* SIMIX_host_self_get_name()
+const char* sg_host_self_get_name()
{
- sg_host_t host = SIMIX_host_self();
+ sg_host_t host = sg_host_self();
if (host == nullptr || SIMIX_process_self() == simix_global->maestro_process)
return "";
container_t father;
if (TRACE_smpi_is_grouped()){
- father = PJ_container_get (SIMIX_host_self_get_name());
+ father = PJ_container_get(sg_host_self_get_name());
}else{
father = PJ_container_get_root ();
}
}
//identify neighbours in comm
//get the indexes of all processes sharing the same simix host
- xbt_swag_t process_list = SIMIX_host_self()->extension<simgrid::simix::Host>()->process_list;
- int intra_comm_size = 0;
- int min_index = INT_MAX;//the minimum index will be the leader
- smx_actor_t actor = nullptr;
- xbt_swag_foreach(actor, process_list) {
- int index = actor->pid -1;
-
- if(this->group()->rank(index)!=MPI_UNDEFINED){
- intra_comm_size++;
- //the process is in the comm
- if(index < min_index)
- min_index=index;
- }
+ xbt_swag_t process_list = sg_host_self()->extension<simgrid::simix::Host>()->process_list;
+ int intra_comm_size = 0;
+ int min_index = INT_MAX; // the minimum index will be the leader
+ smx_actor_t actor = nullptr;
+ xbt_swag_foreach(actor, process_list)
+ {
+ int index = actor->pid - 1;
+
+ if (this->group()->rank(index) != MPI_UNDEFINED) {
+ intra_comm_size++;
+ // the process is in the comm
+ if (index < min_index)
+ min_index = index;
+ }
}
XBT_DEBUG("number of processes deployed on my node : %d", intra_comm_size);
MPI_Group group_intra = new Group(intra_comm_size);
*/
double smpi_get_host_power_peak_at(int pstate_index)
{
- return SIMIX_host_self()->getPstateSpeed(pstate_index);
+ return sg_host_self()->getPstateSpeed(pstate_index);
}
/**
*/
double smpi_get_host_current_power_peak()
{
- return SIMIX_host_self()->speed();
+ return sg_host_self()->speed();
}
/**
*/
int smpi_get_host_nb_pstates()
{
- return sg_host_get_nb_pstates(SIMIX_host_self());
+ return sg_host_get_nb_pstates(sg_host_self());
}
/**
*/
void smpi_set_host_pstate(int pstate_index)
{
- sg_host_set_pstate(SIMIX_host_self(), pstate_index);
+ sg_host_set_pstate(sg_host_self(), pstate_index);
}
/** @brief Gets the pstate at which the processor currently running */
int smpi_get_host_pstate() {
- return sg_host_get_pstate(SIMIX_host_self());
+ return sg_host_get_pstate(sg_host_self());
}
/**
* \return Returns the consumed energy
*/
double smpi_get_host_consumed_energy() {
- return sg_host_get_consumed_energy(SIMIX_host_self());
+ return sg_host_get_consumed_energy(sg_host_self());
}
#if SMPI_FORTRAN
int PMPI_Get_processor_name(char *name, int *resultlen)
{
- strncpy(name, SIMIX_host_self()->cname(), strlen(SIMIX_host_self()->cname()) < MPI_MAX_PROCESSOR_NAME - 1
- ? strlen(SIMIX_host_self()->cname()) + 1
- : MPI_MAX_PROCESSOR_NAME - 1);
+ strncpy(name, sg_host_self()->cname(), strlen(sg_host_self()->cname()) < MPI_MAX_PROCESSOR_NAME - 1
+ ? strlen(sg_host_self()->cname()) + 1
+ : MPI_MAX_PROCESSOR_NAME - 1);
*resultlen = strlen(name) > MPI_MAX_PROCESSOR_NAME ? MPI_MAX_PROCESSOR_NAME : strlen(name);
return MPI_SUCCESS;
/* 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 "xbt/sysdep.h"
+#include "simgrid/host.h"
+#include "simgrid/simix.h" /* SIMIX_host_self_get_name */
#include "src/xbt/log_private.h"
-#include "simgrid/simix.h" /* SIMIX_host_self_get_name */
#include "surf/surf.h"
+#include "xbt/sysdep.h"
#include <stdio.h>
extern const char *xbt_log_priority_names[8];
show_string(xbt_log_priority_names[ev->priority]);
break;
case 'h': /* host name; SimGrid extension */
- show_string(SIMIX_host_self_get_name());
+ show_string(sg_host_self_get_name());
break;
case 't': /* thread name; LOG4J compliant */
show_string(SIMIX_process_self_get_name());
/* Display the proc info if available */
procname = xbt_procname();
if (procname && strcmp(procname,"maestro")) {
- len = snprintf(p, rem_size, "%s:%s:(%d) ", SIMIX_host_self_get_name(), procname, xbt_getpid());
+ len = snprintf(p, rem_size, "%s:%s:(%d) ", sg_host_self_get_name(), procname, xbt_getpid());
check_overflow(len);
}
else if (!procname) {
- len = snprintf(p, rem_size, "%s::(%d) ", SIMIX_host_self_get_name(), xbt_getpid());
- check_overflow(len);
+ len = snprintf(p, rem_size, "%s::(%d) ", sg_host_self_get_name(), xbt_getpid());
+ check_overflow(len);
}
/* Display the date */