From 40de401e298d39be3842a863e90d3477860347bf Mon Sep 17 00:00:00 2001 From: Logan Lamb Date: Mon, 6 May 2024 16:41:02 +0000 Subject: [PATCH] add fd_tile_private_map_boot() to fd_tile.h for later tpool use in fddev --- src/util/tile/fd_tile.h | 4 +++ src/util/tile/fd_tile_threads.cxx | 47 +++++++++++++++++++------------ 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/util/tile/fd_tile.h b/src/util/tile/fd_tile.h index aeba627314..97928f7121 100644 --- a/src/util/tile/fd_tile.h +++ b/src/util/tile/fd_tile.h @@ -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 ); diff --git a/src/util/tile/fd_tile_threads.cxx b/src/util/tile/fd_tile_threads.cxx index a47fe92b9d..e405f6a8ff 100644 --- a/src/util/tile/fd_tile_threads.cxx +++ b/src/util/tile/fd_tile_threads.cxx @@ -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; @@ -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" ));