diff --git a/tests/functional/nccl_message_transfer.c b/tests/functional/nccl_message_transfer.c index c9062e8f8..2ece5c6ec 100644 --- a/tests/functional/nccl_message_transfer.c +++ b/tests/functional/nccl_message_transfer.c @@ -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)", diff --git a/tests/unit/ep_addr_list.c b/tests/unit/ep_addr_list.c index 4fd040e98..7be5dd106 100644 --- a/tests/unit/ep_addr_list.c +++ b/tests/unit/ep_addr_list.c @@ -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); @@ -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"); } } diff --git a/tests/unit/freelist.c b/tests/unit/freelist.c index 2557f9611..572d3f02c 100644 --- a/tests/unit/freelist.c +++ b/tests/unit/freelist.c @@ -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); diff --git a/tests/unit/idpool.c b/tests/unit/idpool.c index e84b3e960..770e98a2c 100644 --- a/tests/unit/idpool.c +++ b/tests/unit/idpool.c @@ -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) */ @@ -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 { @@ -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); @@ -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]); @@ -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); } @@ -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 { diff --git a/tests/unit/scheduler.c b/tests/unit/scheduler.c index 1d535423d..767c92c11 100644 --- a/tests/unit/scheduler.c +++ b/tests/unit/scheduler.c @@ -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); }