Skip to content

enable tracker in ProxyLib by default #761

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

Merged
merged 5 commits into from
Nov 12, 2024

Conversation

bratpiorka
Copy link
Contributor

@bratpiorka bratpiorka commented Sep 26, 2024

Description

Enable Tracking Provider in the Proxy Lib by default.

Checklist

  • Code compiles without errors locally
  • All tests pass locally
  • CI workflows execute properly
  • New tests added, especially if they will fail without my changes
  • Added/extended example(s) to cover this functionality
  • Extended the README/documentation
  • Logger (with debug/info/... messages) is used

@bratpiorka bratpiorka force-pushed the rrudnick_proxy_tracking_flag branch from c6c79fb to 3636263 Compare October 1, 2024 14:28
@vinser52
Copy link
Contributor

vinser52 commented Oct 2, 2024

Just to note it here:

As we agreed yesterday, the proxy lib should ON the memory tracker for the proxy pool. In general memory tracker (as an essential part of UMF) should be always ON. For the use cases when tracking should be disabled for some reasons the umfPoolCreate already provides an option to disable memory tracking for a particular memory pool by specifying the UMF_POOL_CREATE_FLAG_DISABLE_TRACKING flag.

@bratpiorka bratpiorka force-pushed the rrudnick_proxy_tracking_flag branch 2 times, most recently from 8393472 to 96e05e8 Compare October 2, 2024 14:58
@bratpiorka bratpiorka changed the title add env to enable tracking prov in proxy lib enable tracker in ProxyLib by default Oct 2, 2024
@bratpiorka bratpiorka force-pushed the rrudnick_proxy_tracking_flag branch from 96e05e8 to 1a7c33e Compare October 3, 2024 08:16
@bratpiorka bratpiorka force-pushed the rrudnick_proxy_tracking_flag branch 3 times, most recently from 10a5b7f to 722ad17 Compare October 10, 2024 06:38
@bratpiorka bratpiorka force-pushed the rrudnick_proxy_tracking_flag branch 9 times, most recently from b61e0bf to 0c0e480 Compare October 14, 2024 16:51
@bratpiorka bratpiorka requested a review from ldorau October 15, 2024 08:20
@bratpiorka bratpiorka marked this pull request as ready for review October 15, 2024 08:20
@bratpiorka bratpiorka requested a review from a team as a code owner October 15, 2024 08:20
@bratpiorka bratpiorka requested a review from vinser52 October 15, 2024 08:21
@bratpiorka bratpiorka force-pushed the rrudnick_proxy_tracking_flag branch from 0c0e480 to 180b06b Compare October 18, 2024 07:58
@bratpiorka bratpiorka marked this pull request as draft October 18, 2024 09:32
@bratpiorka bratpiorka force-pushed the rrudnick_proxy_tracking_flag branch 3 times, most recently from 5d76c37 to 9603d32 Compare October 19, 2024 11:33
@bratpiorka bratpiorka force-pushed the rrudnick_proxy_tracking_flag branch 2 times, most recently from dd22268 to 569a2c0 Compare November 7, 2024 09:38
@ldorau
Copy link
Contributor

ldorau commented Nov 7, 2024

@bratpiorka Rebase please

@bratpiorka bratpiorka force-pushed the rrudnick_proxy_tracking_flag branch 4 times, most recently from 6ddabc9 to 536b05b Compare November 7, 2024 13:16
LOG_DEBUG("allocated %p, provider: %p, size: %zu", *ptr,
(void *)p->hUpstream, size);

// check if the allocation was already added to the tracker
Copy link
Contributor

Choose a reason for hiding this comment

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

this logic is not needed anymore, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, removed

@bratpiorka bratpiorka force-pushed the rrudnick_proxy_tracking_flag branch from 536b05b to ac7a88f Compare November 8, 2024 08:32
@bratpiorka bratpiorka requested review from vinser52 and ldorau November 8, 2024 09:30
@bratpiorka bratpiorka marked this pull request as ready for review November 8, 2024 09:31
size_t nbytes = 1;
char *found = NULL;
while (nbytes > 0 && found == NULL) {
memset(buf, 0, nbytes); // erase previous data
Copy link
Contributor

Choose a reason for hiding this comment

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

You should erase the whole buf: nbytes -> size_buf

Copy link
Contributor

Choose a reason for hiding this comment

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

Verified - it was fixed.

char *found = NULL;
while (nbytes > 0 && found == NULL) {
memset(buf, 0, nbytes); // erase previous data
nbytes = read(fd, buf, size_buf);
Copy link
Contributor

Choose a reason for hiding this comment

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

Check for a read error: nbytes == -1

Copy link
Contributor

Choose a reason for hiding this comment

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

Verified - it was fixed.

size_t size = 2137;
void *ptr = malloc(size);
if (ptr == NULL) {
ret = -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Print an error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

Verified.

}

fprintf(stderr, "Allocated memory - %zu\n", size);
unsigned long long val = 144;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not using size_t?

Copy link
Contributor

Choose a reason for hiding this comment

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

Verified - it was fixed.

if(UMF_PROXY_LIB_ENABLED
AND NOT UMF_LINK_HWLOC_STATICALLY
AND NOT UMF_DISABLE_HWLOC)
if(UMF_PROXY_LIB_ENABLED)
Copy link
Contributor

Choose a reason for hiding this comment

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

AND UMF_BUILD_SHARED_LIBRARY?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Verified.


// read the "/proc/self/maps" file until the "libumf_proxy.so" of the maps
// is found or EOF is reached.
const size_t size_buf = 8192;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: uppercase constant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

Verified.

ssize_t len =
send(producer_socket, &ipc_handle_size, sizeof(ipc_handle_size), 0);
if (len < 0) {
fprintf(stderr, "[producer] ERROR: unable to send the message\n");
Copy link
Contributor

Choose a reason for hiding this comment

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

More descriptive: unable to send the ipc_handle_size to the consumer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

Verified.


// send the ipc_handle of ipc_handle_size to the consumer
if (send(producer_socket, ipc_handle, ipc_handle_size, 0) < 0) {
fprintf(stderr, "[producer] ERROR: unable to send the message\n");
Copy link
Contributor

Choose a reason for hiding this comment

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

More descriptive: unable to send the ipc_handle to the consumer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

Verified.

@bratpiorka bratpiorka force-pushed the rrudnick_proxy_tracking_flag branch from ac7a88f to 09ee70e Compare November 12, 2024 09:36
@ldorau ldorau merged commit f8bf899 into oneapi-src:main Nov 12, 2024
74 checks passed
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.

4 participants