-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples to use both FSDAX permanent memory and normal DRAM #742
Comments
Hi @jesHrz, UMF is positioned as a replacement for Memkind. While UMF does not provide 1:1 API matching it is targeted to support Memkind use cases. Could you please describe your use case precisely? What do you mean by “use a hybrid memory pool simultaneously”? |
Thanks a lot. Actually, the hybrid memory pool means some objects are allocated from the DRAM and some objects are allocated from the PM. Here is a simple example for my use case. void *allocate_from_pm(size_t size)
{
// allocate from persistent memory via UMF
}
void *allocate_from_dram(size_t size)
{
// allocate from DRAM via UMF
}
int main() {
int N = 100, M = 200;
int *array_a = (int *)allocate_from_dram(sizeof(int) * N);
int *array_b = (int *)allocate_from_pm(sizeof(int) * M);
// access array_a and array_b
free(array_a);
free(array_b);
} |
Hi @jesHrz, I have just added to UMF the support for FSDAX (#746). In order to handle FSDAX, the file memory provider with the memory |
Ref: oneapi-src#742 Signed-off-by: Lukasz Dorau <[email protected]>
Ref: oneapi-src#742 Signed-off-by: Lukasz Dorau <[email protected]>
Ref: oneapi-src#742 Signed-off-by: Lukasz Dorau <[email protected]>
Ref: oneapi-src#742 Signed-off-by: Lukasz Dorau <[email protected]>
Ref: oneapi-src#742 Signed-off-by: Lukasz Dorau <[email protected]>
Ref: oneapi-src#742 Signed-off-by: Lukasz Dorau <[email protected]>
Ref: oneapi-src#742 Signed-off-by: Lukasz Dorau <[email protected]>
Ref: oneapi-src#742 Signed-off-by: Lukasz Dorau <[email protected]>
Ref: oneapi-src#742 Signed-off-by: Lukasz Dorau <[email protected]>
I have submitted the PR #750 with this example. |
Hi @ldorau , much thanks for your effort! BTW, I also want to know if UMF can automatically detect which pool a pointer is allocated from. since memkind can free a pointer with an unknown kind ( |
Yes, there is the function: ///
/// @brief Retrieve memory pool associated with a given ptr. Only memory allocated
/// with the usage of a memory provider is being tracked.
/// @param ptr pointer to memory belonging to a memory pool
/// @return Handle to a memory pool that contains ptr or NULL if pointer does not belong to any UMF pool.
///
umf_memory_pool_handle_t umfPoolByPtr(const void *ptr); |
It is actually what I want, thanks! |
Ref: oneapi-src#742 Signed-off-by: Lukasz Dorau <[email protected]>
Ref: oneapi-src#742 Signed-off-by: Lukasz Dorau <[email protected]>
Details
I'd like to use a hybrid memory pool simultaneously, where I allocate memory either from permanent memory from the FSDAX device or the normal DRAM from anonymous mapping.
I found that libmemkind meets my requirement because I can specify the different allocator via
struct memkind
inmemkind_malloc
.Unfortunately, libmemkind is deprecated now...
I am wondering if I could find the same usage example from UMF as libmemkind does?
The text was updated successfully, but these errors were encountered: