Line data Source code
1 1 : /** 2 : * @file lp/lp.h 3 : * 4 : * @brief LP construction functions 5 : * 6 : * LP construction functions 7 : * 8 : * SPDX-FileCopyrightText: 2008-2021 HPDCS Group <rootsim@googlegroups.com> 9 : * SPDX-License-Identifier: GPL-3.0-only 10 : */ 11 : #pragma once 12 : 13 : #include <core/core.h> 14 : #include <gvt/termination.h> 15 : #include <lib/lib.h> 16 : #include <lp/msg.h> 17 : #include <lp/process.h> 18 : #include <mm/model_allocator.h> 19 : 20 : /// A complete LP context 21 1 : struct lp_ctx { 22 : /// The termination time of this LP, handled by the termination module 23 1 : simtime_t t_d; 24 : /// The additional libraries context of this LP 25 1 : struct lib_ctx *lib_ctx_p; 26 : /// The message processing context of this LP 27 : struct process_data p; 28 : /// The memory allocator state of this LP 29 : struct mm_state mm_state; 30 : }; 31 : 32 0 : #define lid_to_nid(lp_id) ((nid_t)((lp_id) * n_nodes / n_lps)) 33 0 : #define lid_to_rid(lp_id) ((rid_t)(((lp_id) - lid_node_first) * n_threads / n_lps_node)) 34 : 35 0 : extern uint64_t lid_node_first; 36 0 : extern __thread uint64_t lid_thread_first; 37 0 : extern __thread uint64_t lid_thread_end; 38 : 39 1 : extern uint64_t n_lps_node; 40 0 : extern __thread struct lp_ctx *current_lp; 41 0 : extern struct lp_ctx *lps; 42 : 43 0 : extern void lp_global_init(void); 44 0 : extern void lp_global_fini(void); 45 : 46 0 : extern void lp_init(void); 47 0 : extern void lp_fini(void); 48 : 49 0 : extern void lp_cleanup(void); 50 : 51 0 : __attribute__ ((pure)) extern lp_id_t lp_id_get_mt(void); 52 0 : __attribute__ ((pure)) extern struct lib_ctx *lib_ctx_get_mt(void);