Skip to content
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

Changes to support mmap reads on Broker #57

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hariharan-devarajan
Copy link
Collaborator

Changes to support mmaped reads on broker.

Comment on lines 24 to 29
void * allocate_aligned(size_t size) {
size_t alignment = getpagesize();
int malloc_offset = (size + alignment) % alignment;
void* mem = malloc(size + alignment);
return (char*) mem + malloc_offset;
}
Copy link
Contributor

@JaeseungYeom JaeseungYeom Dec 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that this will guarantee that the address is a multiple of alignment, while the size of the usable block is. In addition, i am wondering if it would be safe to use such an address with munmap().
We can instead rely on posix_memalign()

Copy link
Contributor

@JaeseungYeom JaeseungYeom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments but I know you will be on vacation. So, I can make changes if you agree with my comments.

@@ -37,8 +46,13 @@ ssize_t write_all (int fd, const void *buf, size_t len)
return count;
}

ssize_t read_all (int fd, void **bufp)
ssize_t read_all (const char* filename, void **bufp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interface probably should take a page aligned memory address as an input for the UCX managed memory. So, the allocation would happen outside of this function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the buffer bufp. Once we do the UCX, we can move allocation there.

@JaeseungYeom JaeseungYeom marked this pull request as draft January 21, 2024 04:14
@hariharan-devarajan
Copy link
Collaborator Author

@JaeseungYeom do u want me to work on this?

@ilumsden
Copy link
Collaborator

Need to check the following before continuing:

  • Is UCX-allocated memory page aligned?
  • Is UCX-allocated memory with POSIX mmap?
  • For client (i.e., producer/consumer), is UCX compatible with GPU memory allocators (e.g., hipMalloc on El Cap)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants