Skip to content

Commit

Permalink
add fd_tile_private_map_boot() to fd_tile.h for later tpool use in fddev
Browse files Browse the repository at this point in the history
  • Loading branch information
llamb-jump committed May 7, 2024
1 parent 82b5c70 commit 40de401
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
4 changes: 4 additions & 0 deletions src/util/tile/fd_tile.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ void
fd_tile_private_boot( int * pargc,
char *** pargv );

void
fd_tile_private_map_boot( ushort * tile_to_cpu,
ulong tile_cnt );

void
fd_tile_private_halt( void );

Expand Down
47 changes: 29 additions & 18 deletions src/util/tile/fd_tile_threads.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -526,24 +526,8 @@ fd_tile_private_cpus_parse( char const * cstr,
static fd_tile_private_cpu_config_t fd_tile_private_cpu_config_save[1];

void
fd_tile_private_boot( int * pargc,
char *** pargv ) {
FD_LOG_INFO(( "fd_tile: boot" ));

/* Extract the tile configuration from the command line */

char const * cpus = fd_env_strip_cmdline_cstr( pargc, pargv, "--tile-cpus", "FD_TILE_CPUS", NULL );
if( !cpus ) FD_LOG_INFO(( "fd_tile: --tile-cpus not specified" ));
else FD_LOG_INFO(( "fd_tile: --tile-cpus \"%s\"", cpus ));
ushort tile_to_cpu[ FD_TILE_MAX ];
ulong tile_cnt = fd_tile_private_cpus_parse( cpus, tile_to_cpu );

if( FD_UNLIKELY( !tile_cnt ) ) {
FD_LOG_INFO(( "fd_tile: no cpus specified; treating thread group as single tile running on O/S assigned cpu(s)" ));
tile_to_cpu[0] = (ushort)65535;
tile_cnt = 1UL;
}

fd_tile_private_map_boot( ushort * tile_to_cpu,
ulong tile_cnt ) {
fd_tile_private_id0 = fd_log_thread_id();
fd_tile_private_id1 = fd_tile_private_id0 + tile_cnt;
fd_tile_private_cnt = tile_cnt;
Expand Down Expand Up @@ -745,6 +729,33 @@ fd_tile_private_boot( int * pargc,
FD_LOG_INFO(( "fd_tile: boot success" ));
}

void
fd_tile_private_boot_str( char const * cpus ) {
ushort tile_to_cpu[ FD_TILE_MAX ];
ulong tile_cnt = fd_tile_private_cpus_parse( cpus, tile_to_cpu );

if( FD_UNLIKELY( !tile_cnt ) ) {
FD_LOG_INFO(( "fd_tile: no cpus specified; treating thread group as single tile running on O/S assigned cpu(s)" ));
tile_to_cpu[0] = (ushort)65535;
tile_cnt = 1UL;
}

fd_tile_private_map_boot( tile_to_cpu, tile_cnt );
}

void
fd_tile_private_boot( int * pargc,
char *** pargv ) {
/* Extract the tile configuration from the command line */

char const * cpus = fd_env_strip_cmdline_cstr( pargc, pargv, "--tile-cpus", "FD_TILE_CPUS", NULL );

if( !cpus ) FD_LOG_INFO(( "fd_tile: --tile-cpus not specified" ));
else FD_LOG_INFO(( "fd_tile: --tile-cpus \"%s\"", cpus ));

fd_tile_private_boot_str( cpus );
}

void
fd_tile_private_halt( void ) {
FD_LOG_INFO(( "fd_tile: halt" ));
Expand Down

0 comments on commit 40de401

Please sign in to comment.