I have a large, highly parallelized, and pretty efficient process I run for a while using parfor with all my cores (physical and logical) and a few gpus.
Once that process is finished, I need to perform a different process that is memory intensive, and I cannot use all my cores without hitting memory problems. But I can do the process just fine using half my cores.
Is there a way to take an existing pool (about 40 workers) and say "hey for this bit to code (pareval, not parfor) I only want to use 20 of my 40 workers that I have available in my pool without resetting my pool". Resetting the pool takes time that I'd like to avoid if possible. Sort of like parfor (ii = start:stop, nWorkers), but for parfeval.
To clarify, I know I can create a new pool with specified number of works, and the process in question is suited for parfeval, but not parfor. Lets assume for now that my problem is not memory efficiency and reducing the amount of memory, Ill deal with that seperately. This question is just about specifying number of workers in parfeval without deleting my pool and creating a new one.