1 /** 2 * Copyright (C) Mellanox Technologies Ltd. 2001-2017. ALL RIGHTS RESERVED. 3 * 4 * See file LICENSE for terms. 5 */ 6 7 #ifndef UCT_TEST_P2P_MIX_H 8 #define UCT_TEST_P2P_MIX_H 9 10 #include "uct_p2p_test.h" 11 12 class uct_p2p_mix_test : public uct_p2p_test { 13 public: 14 15 typedef ucs_status_t 16 (uct_p2p_mix_test::* send_func_t)(const mapped_buffer &sendbuf, 17 const mapped_buffer &recvbuf, 18 uct_completion_t *comp); 19 20 static const uint8_t AM_ID = 1; 21 static const size_t MAX_SIZE = 256; 22 23 uct_p2p_mix_test(); 24 25 protected: 26 static ucs_status_t am_callback(void *arg, void *data, size_t length, 27 unsigned flags); 28 29 static void completion_callback(uct_completion_t *comp, ucs_status_t status); 30 31 template <typename T, uct_atomic_op_t OP> 32 ucs_status_t atomic_fop(const mapped_buffer &sendbuf, 33 const mapped_buffer &recvbuf, 34 uct_completion_t *comp); 35 36 ucs_status_t cswap64(const mapped_buffer &sendbuf, 37 const mapped_buffer &recvbuf, 38 uct_completion_t *comp); 39 40 ucs_status_t put_short(const mapped_buffer &sendbuf, 41 const mapped_buffer &recvbuf, 42 uct_completion_t *comp); 43 44 ucs_status_t put_bcopy(const mapped_buffer &sendbuf, 45 const mapped_buffer &recvbuf, 46 uct_completion_t *comp); 47 48 ucs_status_t am_short(const mapped_buffer &sendbuf, 49 const mapped_buffer &recvbuf, 50 uct_completion_t *comp); 51 52 ucs_status_t am_zcopy(const mapped_buffer &sendbuf, 53 const mapped_buffer &recvbuf, 54 uct_completion_t *comp); 55 56 void random_op(const mapped_buffer &sendbuf, const mapped_buffer &recvbuf); 57 58 void run(unsigned count); 59 60 virtual void init(); 61 62 virtual void cleanup(); 63 64 private: 65 std::vector<send_func_t> m_avail_send_funcs; 66 size_t m_send_size; 67 static uint32_t am_pending; 68 }; 69 70 #endif 71