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

add memspace filter functions #743

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

lplewa
Copy link
Contributor

@lplewa lplewa commented Sep 19, 2024

Description

Checklist

  • Code compiles without errors locally
  • All tests pass locally
  • CI workflows execute properly
  • CI workflows, not executed per PR (e.g. Nightly), 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
  • All newly added source files have a license
  • All newly added source files are referenced in CMake files
  • Logger (with debug/info/... messages) is used

@lplewa lplewa requested a review from a team as a code owner September 19, 2024 15:37
@lplewa lplewa force-pushed the filter branch 3 times, most recently from 5bd462c to e20ea81 Compare September 19, 2024 15:53
include/umf/memtarget.h Outdated Show resolved Hide resolved
src/memspace.c Outdated Show resolved Hide resolved
src/memspace.c Outdated Show resolved Hide resolved
src/memspace.c Outdated Show resolved Hide resolved
src/memspace.c Outdated Show resolved Hide resolved
src/memspace.c Show resolved Hide resolved
src/memspace.c Show resolved Hide resolved
src/memspace.c Outdated Show resolved Hide resolved
src/memspace.c Show resolved Hide resolved
src/memspace.c Outdated Show resolved Hide resolved
umf_result_t umfMemspaceClone(umf_const_memspace_handle_t hMemspace,
umf_memspace_handle_t *hNewMemspace);

/// \brief custom filter function for umfMemspaceUserFilter
Copy link
Contributor

Choose a reason for hiding this comment

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

Custom

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

Comment on lines 145 to 147
/// \param hMemspace handle to memspace
/// \param hMemtarget handle to memory target
/// \param args - user provided arguments
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use dashes - always or never in all places

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

umf_result_t umfMemspaceFilterById(umf_memspace_handle_t hMemspace,
unsigned *ids, size_t size);

/// \brief Filters out memory targets that capacity is less than specified size.
Copy link
Contributor

Choose a reason for hiding this comment

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

so maybe umfMemspaceFilterByCapacityLT ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i don't know..... I do not like this LT. Looks to much like assert.

umfMemtargetGetCapacity
umfMemspaceFilterByCapacity
umfMemspaceFilterById
umfMemspaceNew
Copy link
Contributor

Choose a reason for hiding this comment

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

umfMemspaceNew should be moved after umfMemspaceMemtargetRemove

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

umfMemspaceCreateFromNumaArray;
umfMemspaceDestroy;
umfMemspaceFilterByCapacity;
umfMemspaceFilterById;
umfMemspaceNew;
Copy link
Contributor

Choose a reason for hiding this comment

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

.

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

src/memspace.c Outdated
}

size_t *targetCapacity = args;
return capacity >= *targetCapacity ? 1 : 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe (capacity >= *targetCapacity) ? 1 : 0; ?

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

src/memspace.c Outdated
filter_by_id_args_t args = {ids, size};
int ret = umfMemspaceFilterHelper(memspace, &filterById, &args);

// if umfMemspaceFilter() returned negative umf_result change it to positive
Copy link
Contributor

Choose a reason for hiding this comment

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

umf_result_t

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


TEST_F(numaNodesCapacityTest, CapacityFilter) {
if (capacities.size() <= 1) {
GTEST_SKIP() << "Not enough numa nodes";
Copy link
Contributor

Choose a reason for hiding this comment

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

"Not enough numa nodes - skipping the test ... "

Copy link
Contributor Author

@lplewa lplewa Sep 24, 2024

Choose a reason for hiding this comment

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

done


TEST_F(numaNodesTest, idfilter) {
if (nodeIds.size() <= 1) {
GTEST_SKIP() << "Not enough numa nodes";
Copy link
Contributor

Choose a reason for hiding this comment

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

.

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


TEST_F(numaNodesTest, customfilter) {
if (nodeIds.size() <= 1) {
GTEST_SKIP() << "Not enough numa nodes";
Copy link
Contributor

Choose a reason for hiding this comment

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

.

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

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