/*
* Copyright (C) Mellanox Technologies Ltd. 2001-2017. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
#ifndef UCP_COMPAT_H_
#define UCP_COMPAT_H_
#include <ucp/api/ucp_def.h>
#include <ucs/sys/compiler_def.h>
BEGIN_C_DECLS
/** @file ucp_compat.h */
/**
* @ingroup UCP_WORKER
* @deprecated Replaced by @ref ucp_listener_conn_handler_t.
*/
typedef struct ucp_listener_accept_handler {
ucp_listener_accept_callback_t cb; /**< Endpoint creation callback */
void *arg; /**< User defined argument for the
callback */
} ucp_listener_accept_handler_t;
/**
* @ingroup UCP_COMM
* @deprecated Replaced by @ref ucp_request_test.
*/
int ucp_request_is_completed(void *request);
/**
* @ingroup UCP_ENDPOINT
* @deprecated Replaced by @ref ucp_request_free.
*/
void ucp_request_release(void *request);
/**
* @ingroup UCP_ENDPOINT
* @deprecated Replaced by @ref ucp_ep_close_nb.
*/
void ucp_ep_destroy(ucp_ep_h ep);
/**
* @ingroup UCP_ENDPOINT
* @deprecated Replaced by @ref ucp_ep_close_nb.
*/
ucs_status_ptr_t ucp_disconnect_nb(ucp_ep_h ep);
/**
* @ingroup UCP_ENDPOINT
* @deprecated Replaced by @ref ucp_tag_recv_request_test and
* @ref ucp_request_check_status depends on use case.
*
* @note Please use @ref ucp_request_check_status for cases that only need to
* check the completion status of an outstanding request.
* @ref ucp_request_check_status can be used for any type of request.
* @ref ucp_tag_recv_request_test should only be used for requests
* returned by @ref ucp_tag_recv_nb (or request allocated by user for
* @ref ucp_tag_recv_nbr) for which additional information
* (returned via the @a info pointer) is needed.
*/
ucs_status_t ucp_request_test(void *request, ucp_tag_recv_info_t *info);
/**
* @ingroup UCP_ENDPOINT
* @deprecated Replaced by @ref ucp_ep_flush_nb.
*/
ucs_status_t ucp_ep_flush(ucp_ep_h ep);
/**
* @ingroup UCP_WORKER
*
* @brief Flush outstanding AMO and RMA operations on the @ref ucp_worker_h
* "worker"
* @deprecated Replaced by @ref ucp_worker_flush_nb. The following example
* implements the same functionality using @ref ucp_worker_flush_nb :
* @code
* ucs_status_t worker_flush(ucp_worker_h worker)
* {
* void *request = ucp_worker_flush_nb(worker);
* if (request == NULL) {
* return UCS_OK;
* } else if (UCS_PTR_IS_ERR(request)) {
* return UCS_PTR_STATUS(request);
* } else {
* ucs_status_t status;
* do {
* ucp_worker_progress(worker);
* status = ucp_request_check_status(request);
* } while (status == UCS_INPROGRESS);
* ucp_request_release(request);
* return status;
* }
* }
* @endcode
*
*
* This routine flushes all outstanding AMO and RMA communications on the
* @ref ucp_worker_h "worker". All the AMO and RMA operations issued on the
* @a worker prior to this call are completed both at the origin and at the
* target when this call returns.
*
* @note For description of the differences between @ref ucp_worker_flush
* "flush" and @ref ucp_worker_fence "fence" operations please see
* @ref ucp_worker_fence "ucp_worker_fence()"
*
* @param [in] worker UCP worker.
*
* @return Error code as defined by @ref ucs_status_t
*/
ucs_status_t ucp_worker_flush(ucp_worker_h worker);
/**
* @ingroup UCP_COMM
* @brief Blocking remote memory put operation.
* @deprecated Replaced by @ref ucp_put_nb. The following example implements
* the same functionality using @ref ucp_put_nb :
* @code
* void empty_callback(void *request, ucs_status_t status)
* {
* }
*
* ucs_status_t put(ucp_ep_h ep, const void *buffer, size_t length,
* uint64_t remote_addr, ucp_rkey_h rkey)
* {
* void *request = ucp_put_nb(ep, buffer, length, remote_addr, rkey,
* empty_callback),
* if (request == NULL) {
* return UCS_OK;
* } else if (UCS_PTR_IS_ERR(request)) {
* return UCS_PTR_STATUS(request);
* } else {
* ucs_status_t status;
* do {
* ucp_worker_progress(worker);
* status = ucp_request_check_status(request);
* } while (status == UCS_INPROGRESS);
* ucp_request_release(request);
* return status;
* }
* }
* @endcode
*
* This routine stores contiguous block of data that is described by the
* local address @a buffer in the remote contiguous memory region described by
* @a remote_addr address and the @ref ucp_rkey_h "memory handle" @a rkey. The
* routine returns when it is safe to reuse the source address @e buffer.
*
* @param [in] ep Remote endpoint handle.
* @param [in] buffer Pointer to the local source address.
* @param [in] length Length of the data (in bytes) stored under the
* source address.
* @param [in] remote_addr Pointer to the destination remote address
* to write to.
* @param [in] rkey Remote memory key associated with the
* remote address.
*
* @return Error code as defined by @ref ucs_status_t
*/
ucs_status_t ucp_put(ucp_ep_h ep, const void *buffer, size_t length,
uint64_t remote_addr, ucp_rkey_h rkey);
/**
* @ingroup UCP_COMM
* @brief Blocking remote memory get operation.
* @deprecated Replaced by @ref ucp_get_nb. @see ucp_put.
*
* This routine loads contiguous block of data that is described by the remote
* address @a remote_addr and the @ref ucp_rkey_h "memory handle" @a rkey in
* the local contiguous memory region described by @a buffer address. The
* routine returns when remote data is loaded and stored under the local address
* @e buffer.
*
*
* @param [in] ep Remote endpoint handle.
* @param [in] buffer Pointer to the local source address.
* @param [in] length Length of the data (in bytes) stored under the
* source address.
* @param [in] remote_addr Pointer to the destination remote address
* to write to.
* @param [in] rkey Remote memory key associated with the
* remote address.
*
* @return Error code as defined by @ref ucs_status_t
*/
ucs_status_t ucp_get(ucp_ep_h ep, void *buffer, size_t length,
uint64_t remote_addr, ucp_rkey_h rkey);
/**
* @ingroup UCP_COMM
* @brief Blocking atomic add operation for 32 bit integers
* @deprecated Replaced by @ref ucp_atomic_post with opcode UCP_ATOMIC_POST_OP_ADD.
* @see ucp_put.
*
* This routine performs an add operation on a 32 bit integer value atomically.
* The remote integer value is described by the combination of the remote
* memory address @a remote_addr and the @ref ucp_rkey_h "remote memory handle"
* @a rkey. The @a add value is the value that is used for the add operation.
* When the operation completes the sum of the original remote value and the
* operand value (@a add) is stored in remote memory.
* The call to the routine returns immediately, independent of operation
* completion.
*
* @note The remote address must be aligned to 32 bit.
*
* @param [in] ep Remote endpoint handle.
* @param [in] add Value to add.
* @param [in] remote_addr Pointer to the destination remote address
* of the atomic variable.
* @param [in] rkey Remote memory key associated with the
* remote address.
*
* @return Error code as defined by @ref ucs_status_t
*/
ucs_status_t ucp_atomic_add32(ucp_ep_h ep, uint32_t add,
uint64_t remote_addr, ucp_rkey_h rkey);
/**
* @ingroup UCP_COMM
* @brief Blocking atomic add operation for 64 bit integers
* @deprecated Replaced by @ref ucp_atomic_post with opcode UCP_ATOMIC_POST_OP_ADD.
* @see ucp_put.
*
* This routine performs an add operation on a 64 bit integer value atomically.
* The remote integer value is described by the combination of the remote
* memory address @a remote_addr and the @ref ucp_rkey_h "remote memory handle"
* @a rkey. The @a add value is the value that is used for the add operation.
* When the operation completes the sum of the original remote value and the
* operand value (@a add) is stored in remote memory.
* The call to the routine returns immediately, independent of operation
* completion.
*
* @note The remote address must be aligned to 64 bit.
*
* @param [in] ep Remote endpoint handle.
* @param [in] add Value to add.
* @param [in] remote_addr Pointer to the destination remote address
* of the atomic variable.
* @param [in] rkey Remote memory key associated with the
* remote address.
*
* @return Error code as defined by @ref ucs_status_t
*/
ucs_status_t ucp_atomic_add64(ucp_ep_h ep, uint64_t add,
uint64_t remote_addr, ucp_rkey_h rkey);
/**
* @ingroup UCP_COMM
* @brief Blocking atomic fetch and add operation for 32 bit integers
* @deprecated Replaced by @ref ucp_atomic_fetch_nb with opcode UCP_ATOMIC_FETCH_OP_FADD.
* @see ucp_put.
*
* This routine performs an add operation on a 32 bit integer value atomically.
* The remote integer value is described by the combination of the remote
* memory address @a remote_addr and the @ref ucp_rkey_h "remote memory handle"
* @a rkey. The @a add value is the value that is used for the add operation.
* When the operation completes, the original remote value is stored in the
* local memory @a result, and the sum of the original remote value and the
* operand value is stored in remote memory.
* The call to the routine returns when the operation is completed and the
* @a result value is updated.
*
* @note The remote address must be aligned to 32 bit.
*
* @param [in] ep Remote endpoint handle.
* @param [in] add Value to add.
* @param [in] remote_addr Pointer to the destination remote address
* of the atomic variable.
* @param [in] rkey Remote memory key associated with the
* remote address.
* @param [out] result Pointer to the address that is used to store
* the previous value of the atomic variable described
* by the @a remote_addr
*
* @return Error code as defined by @ref ucs_status_t
*/
ucs_status_t ucp_atomic_fadd32(ucp_ep_h ep, uint32_t add, uint64_t remote_addr,
ucp_rkey_h rkey, uint32_t *result);
/**
* @ingroup UCP_COMM
* @brief Blocking atomic fetch and add operation for 64 bit integers
* @deprecated Replaced by @ref ucp_atomic_fetch_nb with opcode UCP_ATOMIC_FETCH_OP_FADD.
* @see ucp_put.
*
* This routine performs an add operation on a 64 bit integer value atomically.
* The remote integer value is described by the combination of the remote
* memory address @a remote_addr and the @ref ucp_rkey_h "remote memory handle"
* @a rkey. The @a add value is the value that is used for the add operation.
* When the operation completes, the original remote value is stored in the
* local memory @a result, and the sum of the original remote value and the
* operand value is stored in remote memory.
* The call to the routine returns when the operation is completed and the
* @a result value is updated.
*
* @note The remote address must be aligned to 64 bit.
*
* @param [in] ep Remote endpoint handle.
* @param [in] add Value to add.
* @param [in] remote_addr Pointer to the destination remote address
* of the atomic variable.
* @param [in] rkey Remote memory key associated with the
* remote address.
* @param [out] result Pointer to the address that is used to store
* the previous value of the atomic variable described
* by the @a remote_addr
*
* @return Error code as defined by @ref ucs_status_t
*/
ucs_status_t ucp_atomic_fadd64(ucp_ep_h ep, uint64_t add, uint64_t remote_addr,
ucp_rkey_h rkey, uint64_t *result);
/**
* @ingroup UCP_COMM
* @brief Blocking atomic swap operation for 32 bit values
* @deprecated Replaced by @ref ucp_atomic_fetch_nb with opcode UCP_ATOMIC_FETCH_OP_SWAP.
* @see ucp_put.
*
* This routine swaps a 32 bit value between local and remote memory.
* The remote value is described by the combination of the remote
* memory address @a remote_addr and the @ref ucp_rkey_h "remote memory handle"
* @a rkey. The @a swap value is the value that is used for the swap operation.
* When the operation completes, the remote value is stored in the
* local memory @a result, and the operand value (@a swap) is stored in remote
* memory. The call to the routine returns when the operation is completed and
* the @a result value is updated.
*
* @note The remote address must be aligned to 32 bit.
*
* @param [in] ep Remote endpoint handle.
* @param [in] swap Value to swap.
* @param [in] remote_addr Pointer to the destination remote address
* of the atomic variable.
* @param [in] rkey Remote memory key associated with the
* remote address.
* @param [out] result Pointer to the address that is used to store
* the previous value of the atomic variable described
* by the @a remote_addr
*
* @return Error code as defined by @ref ucs_status_t
*/
ucs_status_t ucp_atomic_swap32(ucp_ep_h ep, uint32_t swap, uint64_t remote_addr,
ucp_rkey_h rkey, uint32_t *result);
/**
* @ingroup UCP_COMM
* @brief Blocking atomic swap operation for 64 bit values
* @deprecated Replaced by @ref ucp_atomic_fetch_nb with opcode UCP_ATOMIC_FETCH_OP_SWAP.
* @see ucp_put.
*
* This routine swaps a 64 bit value between local and remote memory.
* The remote value is described by the combination of the remote
* memory address @a remote_addr and the @ref ucp_rkey_h "remote memory handle"
* @a rkey. The @a swap value is the value that is used for the swap operation.
* When the operation completes, the remote value is stored in the
* local memory @a result, and the operand value (@a swap) is stored in remote
* memory. The call to the routine returns when the operation is completed and
* the @a result value is updated.
*
* @note The remote address must be aligned to 64 bit.
*
* @param [in] ep Remote endpoint handle.
* @param [in] swap Value to swap.
* @param [in] remote_addr Pointer to the destination remote address
* of the atomic variable.
* @param [in] rkey Remote memory key associated with the
* remote address.
* @param [out] result Pointer to the address that is used to store
* the previous value of the atomic variable described
* by the @a remote_addr
*
* @return Error code as defined by @ref ucs_status_t
*/
ucs_status_t ucp_atomic_swap64(ucp_ep_h ep, uint64_t swap, uint64_t remote_addr,
ucp_rkey_h rkey, uint64_t *result);
/**
* @ingroup UCP_COMM
* @brief Blocking atomic conditional swap (cswap) operation for 32 bit values.
* @deprecated Replaced by @ref ucp_atomic_fetch_nb with opcode UCP_ATOMIC_FETCH_OP_CSWAP.
* @see ucp_put.
*
* This routine conditionally swaps a 32 bit value between local and remote
* memory. The swap occurs only if the condition value (@a continue) is equal
* to the remote value, otherwise the remote memory is not modified. The
* remote value is described by the combination of the remote memory address @p
* remote_addr and the @ref ucp_rkey_h "remote memory handle" @a rkey. The @p
* swap value is the value that is used to update the remote memory if the
* condition is true. The call to the routine returns when the operation is
* completed and the @a result value is updated.
*
* @note The remote address must be aligned to 32 bit.
*
* @param [in] ep Remote endpoint handle.
* @param [in] compare Value to compare to.
* @param [in] swap Value to swap.
* @param [in] remote_addr Pointer to the destination remote address
* of the atomic variable.
* @param [in] rkey Remote memory key associated with the
* remote address.
* @param [out] result Pointer to the address that is used to store
* the previous value of the atomic variable described
* by the @a remote_addr
*
* @return Error code as defined by @ref ucs_status_t
*/
ucs_status_t ucp_atomic_cswap32(ucp_ep_h ep, uint32_t compare, uint32_t swap,
uint64_t remote_addr, ucp_rkey_h rkey,
uint32_t *result);
/**
* @ingroup UCP_COMM
* @brief Blocking atomic conditional swap (cswap) operation for 64 bit values.
* @deprecated Replaced by @ref ucp_atomic_fetch_nb with opcode UCP_ATOMIC_FETCH_OP_CSWAP.
* @see ucp_put.
*
* This routine conditionally swaps a 64 bit value between local and remote
* memory. The swap occurs only if the condition value (@a continue) is equal
* to the remote value, otherwise the remote memory is not modified. The
* remote value is described by the combination of the remote memory address @p
* remote_addr and the @ref ucp_rkey_h "remote memory handle" @a rkey. The @p
* swap value is the value that is used to update the remote memory if the
* condition is true. The call to the routine returns when the operation is
* completed and the @a result value is updated.
*
* @note The remote address must be aligned to 64 bit.
*
* @param [in] ep Remote endpoint handle.
* @param [in] compare Value to compare to.
* @param [in] swap Value to swap.
* @param [in] remote_addr Pointer to the destination remote address
* of the atomic variable.
* @param [in] rkey Remote memory key associated with the
* remote address.
* @param [out] result Pointer to the address that is used to store
* the previous value of the atomic variable described
* by the @a remote_addr
*
* @return Error code as defined by @ref ucs_status_t
*/
ucs_status_t ucp_atomic_cswap64(ucp_ep_h ep, uint64_t compare, uint64_t swap,
uint64_t remote_addr, ucp_rkey_h rkey,
uint64_t *result);
/**
* @ingroup UCP_ENDPOINT
* @brief Modify endpoint parameters.
*
* @deprecated Use @ref ucp_listener_conn_handler_t instead of @ref
* ucp_listener_accept_handler_t, if you have other use case please
* submit an issue on https://github.com/openucx/ucx or report to
* ucx-group@elist.ornl.gov
*
* This routine modifies @ref ucp_ep_h "endpoint" created by @ref ucp_ep_create
* or @ref ucp_listener_accept_callback_t. For example, this API can be used
* to setup custom parameters like @ref ucp_ep_params_t::user_data or
* @ref ucp_ep_params_t::err_handler to endpoint created by
* @ref ucp_listener_accept_callback_t.
*
* @param [in] ep A handle to the endpoint.
* @param [in] params User defined @ref ucp_ep_params_t configurations
* for the @ref ucp_ep_h "UCP endpoint".
*
* @return NULL - The endpoint is modified successfully.
* @return UCS_PTR_IS_ERR(_ptr) - The reconfiguration failed and an error code
* indicates the status. However, the @a endpoint
* is not modified and can be used further.
* @return otherwise - The reconfiguration process is started, and can be
* completed at any point in time. A request handle
* is returned to the application in order to track
* progress of the endpoint modification.
* The application is responsible for releasing the
* handle using the @ref ucp_request_free routine.
*
* @note See the documentation of @ref ucp_ep_params_t for details, only some of
* the parameters can be modified.
*/
ucs_status_ptr_t ucp_ep_modify_nb(ucp_ep_h ep, const ucp_ep_params_t *params);
END_C_DECLS
#endif