Fix for big endian machines
This commit is contained in:
@ -291,6 +291,17 @@ int HostThreadTeamData::rendezvous( int64_t * const buffer
|
|||||||
+ ( ( rank & ~mask_byte ) << shift_mem_cycle )
|
+ ( ( rank & ~mask_byte ) << shift_mem_cycle )
|
||||||
+ ( sync_offset << shift_byte );
|
+ ( sync_offset << shift_byte );
|
||||||
|
|
||||||
|
// Switch designated byte if running on big endian machine
|
||||||
|
volatile uint16_t value = 1;
|
||||||
|
volatile uint8_t* byte = (uint8_t*) &value;
|
||||||
|
volatile bool is_big_endian = (!(byte[0] == 1));
|
||||||
|
if (is_big_endian) {
|
||||||
|
int remainder = ((offset) % 8);
|
||||||
|
int base = offset - remainder;
|
||||||
|
int shift = 7 - remainder;
|
||||||
|
offset = base + shift;
|
||||||
|
}
|
||||||
|
|
||||||
// All of this thread's previous memory stores must be complete before
|
// All of this thread's previous memory stores must be complete before
|
||||||
// this thread stores the step value at this thread's designated byte
|
// this thread stores the step value at this thread's designated byte
|
||||||
// in the shared synchronization array.
|
// in the shared synchronization array.
|
||||||
|
|||||||
@ -137,6 +137,17 @@ int rendezvous( volatile int64_t * const buffer
|
|||||||
+ ( ( rank & ~mask_byte ) << shift_mem_cycle )
|
+ ( ( rank & ~mask_byte ) << shift_mem_cycle )
|
||||||
+ ( sync_offset << shift_byte );
|
+ ( sync_offset << shift_byte );
|
||||||
|
|
||||||
|
// Switch designated byte if running on big endian machine
|
||||||
|
volatile uint16_t value = 1;
|
||||||
|
volatile uint8_t* byte = (uint8_t*) &value;
|
||||||
|
volatile bool is_big_endian = (!(byte[0] == 1));
|
||||||
|
if (is_big_endian) {
|
||||||
|
int remainder = ((offset) % 8);
|
||||||
|
int base = offset - remainder;
|
||||||
|
int shift = 7 - remainder;
|
||||||
|
offset = base + shift;
|
||||||
|
}
|
||||||
|
|
||||||
// All of this thread's previous memory stores must be complete before
|
// All of this thread's previous memory stores must be complete before
|
||||||
// this thread stores the step value at this thread's designated byte
|
// this thread stores the step value at this thread's designated byte
|
||||||
// in the shared synchronization array.
|
// in the shared synchronization array.
|
||||||
|
|||||||
Reference in New Issue
Block a user