I am using gmp to to precise floating point arithmetic.
i also created a 20GB swap partition
what i want to know is how can i declare 4 mpf_t variable in swap space instead of ram and still be able to do all arithmetic functions on the mpf_t variables
I know it will be a lot slower but i care more about precision than speed
Swap is automatically used by the operating system to store memory pages that don't fit into physical memory.
However, what you can do is to map a 20 GB file into memory and tell GMP to use a custom allocator that allocates memory from that region.
i know it isnt but it can allow me to allocate more bits to use in the mpf_t variables which gives me more precision
Swap is automatically used by the operating system to store memory pages that don't fit into physical memory.
However, what you can do is to map a 20 GB file into memory and tell GMP to use a custom allocator that allocates memory from that region.
You're right on about mp_set_memory_functions, that leaves writing the actual allocator and deallocator.
Having a simple allocation bitmap (vector<bool>) indicating whether a particular block is free (the block size should probably be >=1 MB) and performing a linear search for the first large enough free region will probably suffice in this case.