Skip to content

Commit

Permalink
Fix build warnings and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pentschev committed Nov 29, 2024
1 parent c22954e commit 39c3a9f
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion cpp/include/ucxx/delayed_submission.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class BaseDelayedSubmissionCollection {
toProcess = _collection.size();
}

for (auto i = 0; i < toProcess; ++i) {
for (size_t i = 0; i < toProcess; ++i) {
std::pair<ItemIdType, T> item;
{
std::lock_guard<std::mutex> lock(_mutex);
Expand Down
14 changes: 7 additions & 7 deletions cpp/include/ucxx/request.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ namespace ucxx {
*/
class Request : public Component {
protected:
ucs_status_t _status{UCS_INPROGRESS}; ///< Requests status
std::string _status_msg{}; ///< Human-readable status message
void* _request{nullptr}; ///< Pointer to UCP request
std::shared_ptr<Future> _future{nullptr}; ///< Future to notify upon completion
RequestCallbackUserFunction _callback{nullptr}; ///< Completion callback
RequestCallbackUserData _callbackData{nullptr}; ///< Completion callback data
ucs_status_t _status{UCS_INPROGRESS}; ///< Requests status
std::string _status_msg{}; ///< Human-readable status message
void* _request{nullptr}; ///< Pointer to UCP request
std::shared_ptr<Future> _future{nullptr}; ///< Future to notify upon completion
std::shared_ptr<Worker> _worker{
nullptr}; ///< Worker that generated request (if not from endpoint)
std::shared_ptr<Endpoint> _endpoint{
nullptr}; ///< Endpoint that generated request (if not from worker)
std::string _ownerString{
"undetermined owner"}; ///< String to print owner (endpoint or worker) when logging
std::recursive_mutex _mutex{}; ///< Mutex to prevent checking status while it's being set
data::RequestData _requestData{}; ///< The operation-specific data to be used in the request
std::string _operationName{
"request_undefined"}; ///< Human-readable operation name, mostly used for log messages
std::recursive_mutex _mutex{}; ///< Mutex to prevent checking status while it's being set
bool _enablePythonFuture{true}; ///< Whether Python future is enabled for this request
RequestCallbackUserFunction _callback{nullptr}; ///< Completion callback
RequestCallbackUserData _callbackData{nullptr}; ///< Completion callback data

/**
* @brief Protected constructor of an abstract `ucxx::Request`.
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/delayed_submission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ void GenericDelayedSubmissionCollection::processItem(ItemIdType id,
}

DelayedSubmissionCollection::DelayedSubmissionCollection(bool enableDelayedRequestSubmission)
: _enableDelayedRequestSubmission(enableDelayedRequestSubmission),
_requests(RequestDelayedSubmissionCollection{"request", enableDelayedRequestSubmission})
: _requests(RequestDelayedSubmissionCollection{"request", enableDelayedRequestSubmission}),
_enableDelayedRequestSubmission(enableDelayedRequestSubmission)
{
}

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/memory_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ MemoryHandle::MemoryHandle(std::shared_ptr<Context> context,
_size = attr.length;
_memoryType = attr.mem_type;

ucxx_trace("MemoryHandle created: %p, UCP handle: %p, base address: 0x%lx, size: %lu, type: %lu",
ucxx_trace("MemoryHandle created: %p, UCP handle: %p, base address: 0x%lx, size: %lu, type: %d",
this,
_handle,
_baseAddress,
Expand All @@ -61,7 +61,7 @@ MemoryHandle::~MemoryHandle()
{
ucp_mem_unmap(std::dynamic_pointer_cast<Context>(getParent())->getHandle(), _handle);
ucxx_trace(
"ucxx::MemoryHandle destroyed: %p, UCP handle: %p, base address: 0x%lx, size: %lu, type: %lu",
"ucxx::MemoryHandle destroyed: %p, UCP handle: %p, base address: 0x%lx, size: %lu, type: %d",
this,
_handle,
_baseAddress,
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/remote_key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ RemoteKey::~RemoteKey()
// Only destroy remote key if this was created from a `SerializedRemoteKey`, i.e., the
// buffer is remote.
ucp_rkey_destroy(_remoteKey);
ucxx_trace("ucxx::RemoteKey destroyed (deserialized): %p, UCP handle: %p", _remoteKey);
ucxx_trace("ucxx::RemoteKey destroyed (deserialized): %p, UCP handle: %p", this, _remoteKey);
}
}

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/request_am.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ ucs_status_t RequestAm::recvCallback(void* arg,
try {
return amData->_receiverCallbacks.at(amHeader.receiverCallbackInfo->owner)
.at(amHeader.receiverCallbackInfo->id);
} catch (std::out_of_range) {
} catch (const std::out_of_range& e) {
ucxx_error("No AM receiver callback registered for owner '%s' with id %lu",
std::string(amHeader.receiverCallbackInfo->owner).data(),
amHeader.receiverCallbackInfo->id);
Expand Down
2 changes: 0 additions & 2 deletions cpp/src/request_endpoint_close.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ void RequestEndpointClose::request()
_request = request;
}

static void logPopulateDelayedSubmission() {}

void RequestEndpointClose::populateDelayedSubmission()
{
if (_endpoint != nullptr && _endpoint->getHandle() == nullptr) {
Expand Down
2 changes: 0 additions & 2 deletions cpp/src/request_flush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ void RequestFlush::request()
_request = request;
}

static void logPopulateDelayedSubmission() {}

void RequestFlush::populateDelayedSubmission()
{
if (_endpoint != nullptr && _endpoint->getHandle() == nullptr) {
Expand Down
2 changes: 0 additions & 2 deletions cpp/src/request_mem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ void RequestMem::request()
_request = request;
}

static void logPopulateDelayedSubmission() {}

void RequestMem::populateDelayedSubmission()
{
bool terminate =
Expand Down
4 changes: 3 additions & 1 deletion cpp/src/utils/sockaddr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ std::unique_ptr<struct addrinfo, void (*)(struct addrinfo*)> get_addrinfo(const
// Except, port is numeric, address may be NULL meaning the
// returned address is the wildcard.
hints.ai_flags = AI_NUMERICSERV | AI_PASSIVE;
if (::snprintf(ports, sizeof(ports), "%u", port) > sizeof(ports))

int portsLength = ::snprintf(ports, sizeof(ports), "%u", port);
if (portsLength < 0 || static_cast<size_t>(portsLength) > sizeof(ports))
throw ucxx::Error(std::string("Invalid port"));
if (::getaddrinfo(ip_address, ports, &hints, &result))
throw ucxx::Error(std::string("Invalid IP address or hostname"));
Expand Down

0 comments on commit 39c3a9f

Please sign in to comment.