ROOT-Sim core  3.0.0-rc.2
A General-Purpose Multi-threaded Parallel/Distributed Simulation Library
Classes | Macros | Functions | Variables
lp.h File Reference

LP construction functions. More...

#include <arch/platform.h>
#include <core/core.h>
#include <lib/random/random.h>
#include <lp/msg.h>
#include <lp/process.h>
#include <mm/auto_ckpt.h>
#include <mm/model_allocator.h>
Include dependency graph for lp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  lp_ctx
 A complete LP context. More...
 

Macros

#define lid_to_nid(lp_id)   ((nid_t)((lp_id) * n_nodes / global_config.lps))
 Compute the id of the node which hosts a given LP. More...
 
#define lid_to_rid(lp_id)   ((rid_t)(((lp_id) - lid_node_first) * global_config.n_threads / n_lps_node))
 Compute the id of the thread which hosts a given LP. More...
 
#define lp_initialized_set()   (lp_initialized = true)
 

Functions

void lp_global_init (void)
 Initialize the global data structures for the LPs.
 
void lp_global_fini (void)
 Finalize the global data structures for the LPs.
 
void lp_init (void)
 Initialize the data structures of the LPs hosted in the calling thread.
 
void lp_fini (void)
 Finalize the data structures of the LPs hosted in the calling thread.
 

Variables

uint64_t lid_node_first
 The lowest LP id between the ones hosted on this node.
 
__thread uint64_t lid_thread_first
 The lowest LP id between the ones hosted on this thread.
 
__thread uint64_t lid_thread_end
 One plus the highest LP id between the ones hosted on this thread.
 
__thread struct lp_ctxcurrent_lp
 A pointer to the currently processed LP context.
 
struct lp_ctxlps
 A pointer to the LP contexts array. More...
 
bool lp_initialized
 

Detailed Description

LP construction functions.

LP construction functions

Macro Definition Documentation

◆ lid_to_nid

#define lid_to_nid (   lp_id)    ((nid_t)((lp_id) * n_nodes / global_config.lps))

Compute the id of the node which hosts a given LP.

Parameters
lp_idthe id of the LP
Returns
the id of the node which hosts the LP identified by lp_id

◆ lid_to_rid

#define lid_to_rid (   lp_id)    ((rid_t)(((lp_id) - lid_node_first) * global_config.n_threads / n_lps_node))

Compute the id of the thread which hosts a given LP.

Parameters
lp_idthe id of the LP
Returns
the id of the thread which hosts the LP identified by lp_id

Horrible things may happen if lp_id is not locally hosted (use lid_to_nid() to make sure of that!)

Variable Documentation

◆ lps

struct lp_ctx* lps
extern

A pointer to the LP contexts array.

Valid entries are contained between lid_node_first and lid_node_first + n_lps_node - 1, limits included