Skip to content

Commit 5dc6155

Browse files
authored
Use correct variable for threads auto (#44747)
--threads=auto uses jl_effective_threads to determine the number of threads to use, so make sure the tests do too, otherwise this test will fail on our new cpu-restricted runners.
1 parent ea82910 commit 5dc6155

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

src/jl_exported_funcs.inc

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
XX(jl_copy_ast) \
104104
XX(jl_copy_code_info) \
105105
XX(jl_cpu_threads) \
106+
XX(jl_effective_threads) \
106107
XX(jl_crc32c_sw) \
107108
XX(jl_create_system_image) \
108109
XX(jl_cstr_to_string) \

src/julia.h

+1
Original file line numberDiff line numberDiff line change
@@ -1635,6 +1635,7 @@ JL_DLLEXPORT int jl_errno(void) JL_NOTSAFEPOINT;
16351635
JL_DLLEXPORT void jl_set_errno(int e) JL_NOTSAFEPOINT;
16361636
JL_DLLEXPORT int32_t jl_stat(const char *path, char *statbuf) JL_NOTSAFEPOINT;
16371637
JL_DLLEXPORT int jl_cpu_threads(void) JL_NOTSAFEPOINT;
1638+
JL_DLLEXPORT int jl_effective_threads(void) JL_NOTSAFEPOINT;
16381639
JL_DLLEXPORT long jl_getpagesize(void) JL_NOTSAFEPOINT;
16391640
JL_DLLEXPORT long jl_getallocationgranularity(void) JL_NOTSAFEPOINT;
16401641
JL_DLLEXPORT int jl_is_debugbuild(void) JL_NOTSAFEPOINT;

src/sys.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ JL_DLLEXPORT int jl_cpu_threads(void) JL_NOTSAFEPOINT
436436
#endif
437437
}
438438

439-
int jl_effective_threads(void) JL_NOTSAFEPOINT
439+
JL_DLLEXPORT int jl_effective_threads(void) JL_NOTSAFEPOINT
440440
{
441441
int cpu = jl_cpu_threads();
442442
int masksize = uv_cpumask_size();

test/cmdlineargs.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no`
218218

219219
# -t, --threads
220220
code = "print(Threads.nthreads())"
221-
cpu_threads = ccall(:jl_cpu_threads, Int32, ())
221+
cpu_threads = ccall(:jl_effective_threads, Int32, ())
222222
@test string(cpu_threads) ==
223223
read(`$exename --threads auto -e $code`, String) ==
224224
read(`$exename --threads=auto -e $code`, String) ==

0 commit comments

Comments
 (0)