| 581 | } |
| 582 | |
| 583 | idx_t DBConfig::GetSystemMaxThreads(FileSystem &fs) { |
| 584 | #ifdef DUCKDB_NO_THREADS |
| 585 | return 1; |
| 586 | #else |
| 587 | idx_t physical_cores = std::thread::hardware_concurrency(); |
| 588 | #ifdef __linux__ |
| 589 | if (const char *slurm_cpus = getenv("SLURM_CPUS_ON_NODE")) { |
| 590 | idx_t slurm_threads; |
| 591 | if (TryCast::Operation<string_t, idx_t>(string_t(slurm_cpus), slurm_threads)) { |
| 592 | return MaxValue<idx_t>(slurm_threads, 1); |
| 593 | } |
| 594 | } |
| 595 | return MaxValue<idx_t>(CGroups::GetCPULimit(fs, physical_cores), 1); |
| 596 | #else |
| 597 | return MaxValue<idx_t>(physical_cores, 1); |
| 598 | #endif |
| 599 | #endif |
| 600 | } |
| 601 | |
| 602 | idx_t DBConfig::GetSystemAvailableMemory(FileSystem &fs) { |
| 603 | // System memory detection |
no test coverage detected