Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Changes to accommodate restructuring code generation of federated programs #117

Merged
merged 19 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions core/federated/RTI/message_record/message_record.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,13 @@ tag_t get_minimum_in_transit_message_tag(in_transit_message_record_q_t* queue) {
// Empty the transfer queue (which holds messages with equal time but larger microstep) into the main queue.
pqueue_empty_into(&queue->main_queue, &queue->transfer_queue);

LF_PRINT_DEBUG(
"RTI: Minimum tag of all in-transit messages: (%ld, %u).",
head_of_in_transit_messages->tag.time - lf_time_start(),
head_of_in_transit_messages->tag.microstep
);
if (head_of_in_transit_messages != NULL) {
LF_PRINT_DEBUG(
"RTI: Minimum tag of all in-transit messages: (%ld, %u).",
head_of_in_transit_messages->tag.time - lf_time_start(),
head_of_in_transit_messages->tag.microstep
);
}

return minimum_tag;
}
2 changes: 2 additions & 0 deletions core/federated/RTI/rti.c
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,8 @@ int receive_udp_message_and_set_up_clock_sync(int socket_id, uint16_t fed_id) {
if (_RTI.clock_sync_global_status >= clock_sync_init) {// If no initial clock sync, no need perform initial clock sync.
uint16_t federate_UDP_port_number = extract_uint16(&(response[1]));

LF_PRINT_DEBUG("RTI got MSG_TYPE_UDP_PORT %u from federate %d.", federate_UDP_port_number, fed_id);

// A port number of UINT16_MAX means initial clock sync should not be performed.
if (federate_UDP_port_number != UINT16_MAX) {
// Perform the initialization clock synchronization with the federate.
Expand Down
4 changes: 2 additions & 2 deletions core/federated/clock-sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ void reset_socket_stat(struct socket_stat_t* socket_stat) {
* If clock synchronization is set to on, a reserved UDP port number
* will be sent.
*/
ushort setup_clock_synchronization_with_rti() {
ushort port_to_return = USHRT_MAX;
uint16_t setup_clock_synchronization_with_rti() {
uint16_t port_to_return = UINT16_MAX;
#ifdef _LF_CLOCK_SYNC_ON
// Initialize the UDP socket
_lf_rti_socket_UDP = socket(AF_INET, SOCK_DGRAM, 0);
Expand Down
2 changes: 2 additions & 0 deletions core/threaded/scheduler_adaptive.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* This is a non-priority-driven scheduler. See scheduler.h for documentation.
* @author{Peter Donovan <peterdonovan@berkeley.edu>}
*/
#if defined SCHEDULER && SCHEDULER == adaptive
#ifndef NUMBER_OF_WORKERS
#define NUMBER_OF_WORKERS 1
#endif // NUMBER_OF_WORKERS
Expand Down Expand Up @@ -125,3 +126,4 @@ void lf_sched_trigger_reaction(reaction_t* reaction, int worker_number) {
if (!lf_bool_compare_and_swap(&reaction->status, inactive, queued)) return;
worker_assignments_put(reaction);
}
#endif // defined SCHEDULER && SCHEDULER == ADAPTIVE
2 changes: 1 addition & 1 deletion include/core/federated/clock-sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void reset_socket_stat(struct socket_stat_t* socket_stat);
*
* @return port number to be sent to the RTI
*/
unsigned short int setup_clock_synchronization_with_rti(void);
uint16_t setup_clock_synchronization_with_rti(void);

/**
* Synchronize the initial physical clock with the RTI.
Expand Down
6 changes: 6 additions & 0 deletions include/core/reactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ lf_token_t* _lf_initialize_token_with_value(lf_token_t* token, void* value, size

void _lf_set_present(lf_port_base_t* port);

/**
* @brief Forward declaration for the executable preamble;
*
*/
void _lf_executable_preamble();

/**
* Set the specified output (or input of a contained reactor)
* to the specified value.
Expand Down
2 changes: 2 additions & 0 deletions include/core/threaded/data_collection.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ static void data_collection_end_level(size_t level, size_t num_workers) {
}

static size_t restrict_to_range(size_t start_inclusive, size_t end_inclusive, size_t value) {
assert(start_inclusive <= end_inclusive);
if (value < start_inclusive) return start_inclusive;
if (value > end_inclusive) return end_inclusive;
return value;
Expand Down Expand Up @@ -194,6 +195,7 @@ static void compute_number_of_workers(
int minimum_workers = 1;
#ifdef WORKERS_NEEDED_FOR_FEDERATE
// TODO: only apply this constraint on levels containing control reactions
assert(WORKERS_NEEDED_FOR_FEDERATE >= 1);
minimum_workers = WORKERS_NEEDED_FOR_FEDERATE > max_reasonable_num_workers ?
max_reasonable_num_workers : WORKERS_NEEDED_FOR_FEDERATE;
#endif
Expand Down
2 changes: 1 addition & 1 deletion lingua-franca-ref.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e95aedf149fa409ca65eb439b92e499705480882
fed-gen