-
Notifications
You must be signed in to change notification settings - Fork 395
Closed
Labels
I: Internal APIChanges were introduced in basic internal workings of the simulator that developers need to knowChanges were introduced in basic internal workings of the simulator that developers need to knowS: NormalHandle this with default priorityHandle this with default priorityT: EnhancementNew functionality, model or documentationNew functionality, model or documentationstaleAutomatic marker for inactivity, please have another look hereAutomatic marker for inactivity, please have another look here
Description
This issue is a follow-up to #2215.
After a thorough discussion during the Hackathon we came to the following conclusions:
- Typedefs (except
weightand partiallydelay) are only used to index into containers. Therefore,size_tis the suitable POD where currentlytypedefsindex,thread,port,rport, ... are used. - Typedefs do not provide any type safety in C++.
- Where we use signed types through
typedefs today (int,long), we only use value -1 from the negative range, wasting value range. Use ofsize_twould avoid this. - Named type solutions seem too complicated, as do implementing our own classes for, e.g.,
Thread,Delay, .... - We therefore concluded that we will explore replacing all
typedefed types with PODs, using unsigned PODs throughout. - For marking invalid values, three approaches can be used, as suitable in the situation
- Return a
std::pair<>combining the value and a boolean flag indicating validity. - Use
std::numeric_limits<POD>::max()as the invalid value. - Raise exceptions instead of returning invalid values.
- Return a
- Certain quantities have implicitly limited value ranges because they need to be transmitted in bitfields of limited size in MPI communication (). Where these values are set (e.g., when the number of threads is changed or new synapse models are created), we need to check if new values are in the permissible range.
nest-simulator/nestkernel/nest_types.h
Lines 81 to 105 in e49be2a
#if TARGET_BITS_SPLIT == TARGET_BITS_SPLIT_STANDARD constexpr uint8_t NUM_BITS_RANK = 18U; constexpr uint8_t NUM_BITS_TID = 9U; constexpr uint8_t NUM_BITS_SYN_ID = 9U; #elif TARGET_BITS_SPLIT == TARGET_BITS_SPLIT_HPC constexpr uint8_t NUM_BITS_RANK = 20U; constexpr uint8_t NUM_BITS_TID = 10U; constexpr uint8_t NUM_BITS_SYN_ID = 6U; #endif constexpr uint8_t NUM_BITS_LCID = 27U; constexpr uint8_t NUM_BITS_PROCESSED_FLAG = 1U; constexpr uint8_t NUM_BITS_MARKER_SPIKE_DATA = 2U; constexpr uint8_t NUM_BITS_LAG = 14U; constexpr uint8_t NUM_BITS_DELAY = 21U; constexpr uint8_t NUM_BITS_NODE_ID = 62U; /* * Maximally allowed values for bitfields */ constexpr uint64_t MAX_LCID = generate_max_value( NUM_BITS_LCID ); constexpr int64_t MAX_RANK = generate_max_value( NUM_BITS_RANK ); constexpr int64_t MAX_TID = generate_max_value( NUM_BITS_TID ); constexpr uint64_t MAX_SYN_ID = generate_max_value( NUM_BITS_SYN_ID ); constexpr uint64_t DISABLED_NODE_ID = generate_max_value( NUM_BITS_NODE_ID ); constexpr uint64_t MAX_NODE_ID = DISABLED_NODE_ID - 1;
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
I: Internal APIChanges were introduced in basic internal workings of the simulator that developers need to knowChanges were introduced in basic internal workings of the simulator that developers need to knowS: NormalHandle this with default priorityHandle this with default priorityT: EnhancementNew functionality, model or documentationNew functionality, model or documentationstaleAutomatic marker for inactivity, please have another look hereAutomatic marker for inactivity, please have another look here
Type
Projects
Status
Done