Skip to content

Commit

Permalink
fix(test): fix typing issues (aws#587)
Browse files Browse the repository at this point in the history
Signed-off-by: Nicholas Sielicki <[email protected]>
  • Loading branch information
aws-nslick committed Sep 26, 2024
1 parent 65ec529 commit 985cbfa
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tests/functional/nccl_message_transfer.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ int main(int argc, char* argv[])
inflight_reqs--;
req_completed[idx] = 1;

if (received_size !=
if ((size_t)received_size !=
NCCL_OFI_MIN(send_sizes[szidx], recv_sizes[szidx])) {
NCCL_OFI_WARN(
"Wrong received size %d (send size: %zu recv size %zu)",
Expand Down
7 changes: 3 additions & 4 deletions tests/unit/ep_addr_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

static void insert_addresses(nccl_ofi_ep_addr_list_t *ep_addr_list, size_t num_addr, int ep_num)
{
for (int i = 0; i < num_addr; ++i) {

for (size_t i = 0; i < num_addr; ++i) {
nccl_net_ofi_ep_t *ep = NULL;
int ret = nccl_ofi_ep_addr_list_get(ep_addr_list, &i, sizeof(i),
&ep);
Expand All @@ -34,10 +33,10 @@ static void insert_addresses(nccl_ofi_ep_addr_list_t *ep_addr_list, size_t num_a
}
} else {
if (!ep) {
NCCL_OFI_WARN("No ep returned when expected. addr %d, ep_num %d", i, ep_num);
NCCL_OFI_WARN("No ep returned when expected. addr %ld, ep_num %d", i, ep_num);
exit(1);
}
if ((uintptr_t)ep != ep_num) {
if ((uintptr_t)ep != (uintptr_t)ep_num) {
NCCL_OFI_WARN("Unexpected ep returned");
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/freelist.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ int main(int argc, char *argv[])
exit(1);
}

if ((char *)item - (char *)simple_base != item->reginfo.base_offset) {
if ((uintptr_t)item - (long unsigned int)simple_base != item->reginfo.base_offset) {
NCCL_OFI_WARN("base_offset was wrong %p %p %lu %lu",
item, simple_base, (char *)item - (char *)simple_base,
item->reginfo.base_offset);
Expand Down
14 changes: 7 additions & 7 deletions tests/unit/idpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main(int argc, char *argv[]) {
(void) ret; // Avoid unused-variable warning
size_t sizes[] = {0, 5, 63, 64, 65, 127, 128, 129, 255};

for (int t = 0; t < sizeof(sizes) / sizeof(size_t); t++) {
for (long unsigned int t = 0; t < sizeof(sizes) / sizeof(size_t); t++) {
size_t size = sizes[t];

/* Scale pool size to number of 64-bit uints (rounded up) */
Expand All @@ -32,7 +32,7 @@ int main(int argc, char *argv[]) {
assert(idpool->size == size);

/* Test that all bits are set */
for (int i = 0; i < num_long_elements; i++) {
for (size_t i = 0; i < num_long_elements; i++) {
if (i == num_long_elements - 1 && size % (sizeof(uint64_t) * 8)) {
assert((1ULL << (size % (sizeof(uint64_t) * 8))) - 1 == idpool->ids[i]);
} else {
Expand All @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
(void) id; // Avoid unused-variable warning
for (uint64_t i = 0; i < size; i++) {
id = nccl_ofi_idpool_allocate_id(idpool);
assert(id == i);
assert((uint64_t)id == i);
}
id = nccl_ofi_idpool_allocate_id(idpool);
assert(-ENOMEM == id);
Expand All @@ -54,14 +54,14 @@ int main(int argc, char *argv[]) {
if (size) {
int holes[] = {(int)(size/3), (int)(size/2)}; // Must be in increasing order

for (int i = 0; i < sizeof(holes) / sizeof(int); i++) {
for (size_t i = 0; i < sizeof(holes) / sizeof(int); i++) {
if (0 == i || holes[i] != holes[i-1]) {
ret = nccl_ofi_idpool_free_id(idpool, holes[i]);
assert(0 == ret);
}
}

for (int i = 0; i < sizeof(holes) / sizeof(int); i++) {
for (size_t i = 0; i < sizeof(holes) / sizeof(int); i++) {
if (0 == i || holes[i] != holes[i-1]) {
id = nccl_ofi_idpool_allocate_id(idpool);
assert(id == holes[i]);
Expand All @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) {
ret = nccl_ofi_idpool_free_id(idpool, (int)size);
assert(-EINVAL == ret);

for (int i = 0; i < size; i++) {
for (size_t i = 0; i < size; i++) {
ret = nccl_ofi_idpool_free_id(idpool, i);
assert(0 == ret);
}
Expand All @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) {
}

/* Test that all bits are set */
for (int i = 0; i < num_long_elements; i++) {
for (size_t i = 0; i < num_long_elements; i++) {
if (i == num_long_elements - 1 && size % (sizeof(uint64_t) * 8)) {
assert((1ULL << (size % (sizeof(uint64_t) * 8))) - 1 == idpool->ids[i]);
} else {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int verify_schedule(nccl_net_ofi_schedule_t *schedule, nccl_net_ofi_schedule_t *
return 1;
}

for (int info_id = 0; info_id != schedule->num_xfer_infos; ++info_id) {
for (size_t info_id = 0; info_id != schedule->num_xfer_infos; ++info_id) {
ret |= verify_xfer_info(&schedule->rail_xfer_infos[info_id],
&ref_schedule->rail_xfer_infos[info_id], info_id);
}
Expand Down

0 comments on commit 985cbfa

Please sign in to comment.