In 32bit I do this and it seems to work OK. Never using Windows virtual memory and not using OOC mode unless the problem is very big:
- Set MKL_PARDISO_OOC_MAX_CORE_SIZE to 1000
- Call pardiso with iparm=1
- If it returns error -2 then reduce MKL_PARDISO_OOC_MAX_CORE_SIZE by 100 and keep trying again until it succeeds or fails with error -9.
But in 64 bit with plenty of RAM and an initial MKL_PARDISO_OOC_MAX_CORE_SIZE of 16000, that method results in it using OOC mode even for relatively small problems where it's not needed and most of the available RAM goes unused. Worse, with 64 bit and not much RAM, large problems don't return any error code but go ahead and solve using in-core mode and Windows virtual memory, which is very very slow.
How can I make it work in a reasonable way regardless of the amount of RAM or problem size? The biggest issue is making sure it doesn't use Windows' virtual memory.