|
@@ -1856,19 +1856,37 @@ _starpu_init_machine_config(struct _starpu_machine_config *config, int no_mp_con
|
|
|
avail_cpus = 0;
|
|
|
int nth_per_core = starpu_get_env_number_default("STARPU_NTHREADS_PER_CORE", 1);
|
|
|
avail_cpus *= nth_per_core;
|
|
|
- ncpu = STARPU_MIN(avail_cpus, STARPU_MAXCPUS);
|
|
|
+
|
|
|
+ if (config->conf.reserve_ncpus > 0)
|
|
|
+ {
|
|
|
+ if (avail_cpus < config->conf.reserve_ncpus)
|
|
|
+ {
|
|
|
+ _STARPU_DISP("Warning: %d CPU cores were requested to be reserved, but only %ld were available,\n", config->conf.reserve_ncpus, avail_cpus);
|
|
|
+ avail_cpus = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ avail_cpus -= config->conf.reserve_ncpus;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ncpu = avail_cpus;
|
|
|
+ if (ncpu > STARPU_MAXCPUS)
|
|
|
+ {
|
|
|
+ _STARPU_DISP("Warning: %d CPU cores detected. Only %d enabled. Use configure option --enable-maxcpus=xxx to update the maximum value of supported CPU devices.\n", ncpu, STARPU_MAXCPUS);
|
|
|
+ ncpu = STARPU_MAXCPUS;
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (ncpu > STARPU_MAXCPUS)
|
|
|
{
|
|
|
- _STARPU_DISP("Warning: %d CPU devices requested. Only %d enabled. Use configure option --enable-maxcpus=xxx to update the maximum value of supported CPU devices.\n", ncpu, STARPU_MAXCPUS);
|
|
|
+ _STARPU_DISP("Warning: %d CPU cores requested. Only %d enabled. Use configure option --enable-maxcpus=xxx to update the maximum value of supported CPU devices.\n", ncpu, STARPU_MAXCPUS);
|
|
|
ncpu = STARPU_MAXCPUS;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
topology->ncpus = ncpu;
|
|
|
STARPU_ASSERT(topology->ncpus + topology->nworkers <= STARPU_NMAXWORKERS);
|
|
|
|