Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Various minor comp instr fixes #1795

Merged
merged 2 commits into from
Dec 9, 2024
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
9 changes: 7 additions & 2 deletions mcstas-comps/misc/MCPL_input_once.comp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ TRACE

if (current_index >= maximum_index){
// go back to the start of this worker's particles, rather than accessing out-of-range data
#pragma acc atomic write
current_index = 0;
#ifndef OPENACC
if (!preload){
Expand Down Expand Up @@ -208,15 +209,19 @@ TRACE
if (!times_replayed) used_neutrons++;
} else {
#endif
ptr = particles + current_index++;
#ifndef OPENACC
ptr = particles + (_particle->_uid % maximum_index);
#ifdef OPENACC
#pragma acc atomic
current_index++; // track how many particles have been accessed, to ensure we don't exceed our slice of the file
#else OPENACC
}
#endif
// copy from the component particle struct to the particle ray struct:
if (ptr == NULL) {
fprintf(stderr, "ERROR (%s): component particle struct pointer not set! Crash before out-of-bounds memory access.\n", NAME_CURRENT_COMP);
exit(-1);
}
#pragma acc atomic
emitted_neutrons++;
// this could be done via memcpy if we ensure equal memory layout with the ray's struct
x = ptr->_x;
Expand Down
3 changes: 2 additions & 1 deletion mcstas-comps/union/Union_abs_logger_1D_space_event.comp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ SHARE
#error "The Union_init component must be included before this Union_abs_logger_1D_space_event component"
#endif

%include "monitor_nd-lib" // Internally avoids double import
// Internally avoids double import
%include "monitor_nd-lib"

struct temp_abs_1D_event_data_element_struct {
double x_pos;
Expand Down
3 changes: 2 additions & 1 deletion mcstas-comps/union/Union_abs_logger_event.comp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ SHARE
#error "The Union_init component must be included before this Union_abs_logger_event component"
#endif

%include "monitor_nd-lib" // Internally avoids double import
// Internally avoids double import
%include "monitor_nd-lib"

struct temp_abs_event_data_element_struct {
double x_pos;
Expand Down