Skip to content

Commit d669dfe

Browse files
committed
Remove addition of LPF mutexes (split off into GitHub MT #55)
1 parent a355972 commit d669dfe

File tree

9 files changed

+0
-349
lines changed

9 files changed

+0
-349
lines changed

include/lpf/core.h

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,68 +2336,6 @@ lpf_err_t lpf_resize_memory_register( lpf_t ctx, size_t max_regs );
23362336
extern _LPFLIB_API
23372337
lpf_err_t lpf_resize_message_queue( lpf_t ctx, size_t max_msgs );
23382338

2339-
/**
2340-
* This call blockingly locks a destination slot #dst_slot, relying
2341-
* on IBVerbs Compare-and-Swap atomics.
2342-
* For an example, check tests/functional/func_lpf_compare_and_swap.ibverbs.c
2343-
* It is only implemented for the zero backend (on Infiniband)
2344-
* \param[in] ctx The LPF context
2345-
* \param[in] src_slot Local slot used as source for the
2346-
* operation to lock the destination slot, registered via lpf_register_local()
2347-
* \param[in] src_offset Source offset to use (0 in most cases)
2348-
* \param[in] dst_pid The process ID of the destination process
2349-
* \param[in] dst_slot The memory slot of the remote destination memory area
2350-
* registered via lpf_register_global().
2351-
* \param[in] dst_offset Destinaton offset (0 in most cases)
2352-
* \param[in] size The number of bytes to copy from the source memory area to
2353-
* the destination memory area (#lpf_memslot_t in most cases)
2354-
* \param[in] attr A #lpf_sync_attr_t value (use #LPF_MSG_DEFAULT)
2355-
* \returns #LPF_SUCCESS
2356-
* When this process successfully locks the slot
2357-
*/
2358-
extern _LPFLIB_API
2359-
lpf_err_t lpf_lock_slot(
2360-
lpf_t ctx,
2361-
lpf_memslot_t src_slot,
2362-
size_t src_offset,
2363-
lpf_pid_t dst_pid,
2364-
lpf_memslot_t dst_slot,
2365-
size_t dst_offset,
2366-
size_t size,
2367-
lpf_msg_attr_t attr
2368-
);
2369-
2370-
/**
2371-
* This call blockingly unlocks a destination slot #dst_slot, relying
2372-
* on IBVerbs Compare-and-Swap atomics.
2373-
* For an example, check tests/functional/func_lpf_compare_and_swap.ibverbs.c
2374-
* It is only implemented for the zero backend (on Infiniband)
2375-
* \param[in] ctx The LPF context
2376-
* \param[in] src_slot Local slot used as source for the
2377-
* operation to lock the destination slot, registered via lpf_register_local()
2378-
* \param[in] src_offset Source offset to use (0 in most cases)
2379-
* \param[in] dst_pid The process ID of the destination process
2380-
* \param[in] dst_slot The memory slot of the remote destination memory area
2381-
* registered via lpf_register_global().
2382-
* \param[in] dst_offset Destinaton offset (0 in most cases)
2383-
* \param[in] size The number of bytes to copy from the source memory area to
2384-
* the destination memory area (#lpf_memslot_t in most cases)
2385-
* \param[in] attr A #lpf_sync_attr_t value (use #LPF_MSG_DEFAULT)
2386-
* \returns #LPF_SUCCESS
2387-
* When this process successfully locks the slot
2388-
*/
2389-
extern _LPFLIB_API
2390-
lpf_err_t lpf_unlock_slot(
2391-
lpf_t ctx,
2392-
lpf_memslot_t src_slot,
2393-
size_t src_offset,
2394-
lpf_pid_t dst_pid,
2395-
lpf_memslot_t dst_slot,
2396-
size_t dst_offset,
2397-
size_t size,
2398-
lpf_msg_attr_t attr
2399-
);
2400-
24012339
/**
24022340
* This function returns in @rcvd_msgs the received message count on
24032341
* LPF slot #slot. It is only implemented for the zero backend (on Infiniband)

src/MPI/core.cpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -268,42 +268,6 @@ lpf_err_t lpf_sync( lpf_t ctx, lpf_sync_attr_t attr )
268268
}
269269

270270

271-
lpf_err_t lpf_lock_slot( lpf_t ctx,
272-
lpf_memslot_t src_slot,
273-
size_t src_offset,
274-
lpf_pid_t dst_pid,
275-
lpf_memslot_t dst_slot,
276-
size_t dst_offset,
277-
size_t size,
278-
lpf_msg_attr_t attr
279-
)
280-
{
281-
(void) attr; // ignore parameter 'msg' since this implementation only
282-
// implements core functionality
283-
lpf::Interface * i = realContext(ctx);
284-
if (!i->isAborted())
285-
i->lockSlot( src_slot, src_offset, dst_pid, dst_slot, dst_offset, size );
286-
return LPF_SUCCESS;
287-
}
288-
289-
lpf_err_t lpf_unlock_slot( lpf_t ctx,
290-
lpf_memslot_t src_slot,
291-
size_t src_offset,
292-
lpf_pid_t dst_pid,
293-
lpf_memslot_t dst_slot,
294-
size_t dst_offset,
295-
size_t size,
296-
lpf_msg_attr_t attr
297-
)
298-
{
299-
(void) attr; // ignore parameter 'msg' since this implementation only
300-
// implements core functionality
301-
lpf::Interface * i = realContext(ctx);
302-
if (!i->isAborted())
303-
i->unlockSlot( src_slot, src_offset, dst_pid, dst_slot, dst_offset, size );
304-
return LPF_SUCCESS;
305-
}
306-
307271
lpf_err_t lpf_counting_sync_per_slot( lpf_t ctx, lpf_sync_attr_t attr, lpf_memslot_t slot, size_t expected_sent, size_t expected_rcvd)
308272
{
309273
(void) attr; // ignore attr parameter since this implementation only

src/MPI/ibverbsZero.cpp

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -679,73 +679,6 @@ void IBVerbs :: dereg( SlotID id )
679679
}
680680

681681

682-
void IBVerbs :: blockingCompareAndSwap(SlotID srcSlot, size_t srcOffset, int dstPid, SlotID dstSlot, size_t dstOffset, size_t size, uint64_t compare_add, uint64_t swap)
683-
{
684-
const MemorySlot & src = m_memreg.lookup( srcSlot );
685-
const MemorySlot & dst = m_memreg.lookup( dstSlot);
686-
687-
char * localAddr
688-
= static_cast<char *>(src.glob[m_pid]._addr) + srcOffset;
689-
const char * remoteAddr
690-
= static_cast<const char *>(dst.glob[dstPid]._addr) + dstOffset;
691-
692-
struct ibv_sge sge;
693-
memset(&sge, 0, sizeof(sge));
694-
sge.addr = reinterpret_cast<uintptr_t>( localAddr );
695-
sge.length = std::min<size_t>(size, m_maxMsgSize );
696-
sge.lkey = src.mr->lkey;
697-
698-
struct ibv_send_wr wr;
699-
memset(&wr, 0, sizeof(wr));
700-
wr.wr_id = srcSlot;
701-
wr.sg_list = &sge;
702-
wr.next = NULL; // this needs to be set, otherwise EINVAL return error in ibv_post_send
703-
wr.num_sge = 1;
704-
wr.opcode = IBV_WR_ATOMIC_CMP_AND_SWP;
705-
wr.send_flags = IBV_SEND_SIGNALED;
706-
wr.wr.atomic.remote_addr = reinterpret_cast<uintptr_t>(remoteAddr);
707-
wr.wr.atomic.compare_add = compare_add;
708-
wr.wr.atomic.swap = swap;
709-
wr.wr.atomic.rkey = dst.glob[dstPid]._rkey;
710-
struct ibv_send_wr *bad_wr;
711-
int error;
712-
std::vector<ibv_wc_opcode> opcodes;
713-
714-
blockingCompareAndSwap:
715-
if (int err = ibv_post_send(m_connectedQps[dstPid].get(), &wr, &bad_wr ))
716-
{
717-
LOG(1, "Error while posting RDMA requests: " << std::strerror(err) );
718-
throw Exception("Error while posting RDMA requests");
719-
}
720-
721-
/**
722-
* Keep waiting on a completion of events until you
723-
* register a completed atomic compare-and-swap
724-
*/
725-
do {
726-
opcodes = wait_completion(error);
727-
if (error) {
728-
LOG(1, "Error in wait_completion");
729-
std::abort();
730-
}
731-
} while (std::find(opcodes.begin(), opcodes.end(), IBV_WC_COMP_SWAP) == opcodes.end());
732-
733-
uint64_t * remoteValueFound = reinterpret_cast<uint64_t *>(localAddr);
734-
/*
735-
* if we fetched the value we expected, then
736-
* we are holding the lock now (that is, we swapped successfully!)
737-
* else, re-post your request for the lock
738-
*/
739-
if (remoteValueFound[0] != compare_add) {
740-
LOG(4, "Process " << m_pid << " couldn't get the lock. remoteValue = " << remoteValueFound[0] << " compare_add = " << compare_add << " go on, iterate\n");
741-
goto blockingCompareAndSwap;
742-
}
743-
else {
744-
LOG(4, "Process " << m_pid << " reads value " << remoteValueFound[0] << " and expected = " << compare_add <<" gets the lock, done\n");
745-
}
746-
// else we hold the lock and swap value into the remote slot ...
747-
}
748-
749682
void IBVerbs :: put( SlotID srcSlot, size_t srcOffset,
750683
int dstPid, SlotID dstSlot, size_t dstOffset, size_t size)
751684
{

src/MPI/interface.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -100,27 +100,6 @@ void Interface :: put( memslot_t srcSlot, size_t srcOffset,
100100
size );
101101
}
102102

103-
// only for HiCR
104-
//#ifdef
105-
106-
void Interface :: lockSlot( memslot_t srcSlot, size_t srcOffset,
107-
pid_t dstPid, memslot_t dstSlot, size_t dstOffset,
108-
size_t size )
109-
{
110-
m_mesgQueue.lockSlot( srcSlot, srcOffset,
111-
dstPid, dstSlot, dstOffset,
112-
size );
113-
}
114-
115-
void Interface :: unlockSlot( memslot_t srcSlot, size_t srcOffset,
116-
pid_t dstPid, memslot_t dstSlot, size_t dstOffset,
117-
size_t size )
118-
{
119-
m_mesgQueue.unlockSlot( srcSlot, srcOffset,
120-
dstPid, dstSlot, dstOffset,
121-
size );
122-
}
123-
124103
void Interface :: getRcvdMsgCountPerSlot(size_t * msgs, SlotID slot) {
125104
m_mesgQueue.getRcvdMsgCountPerSlot(msgs, slot);
126105
}
@@ -172,9 +151,6 @@ err_t Interface :: syncPerSlot(memslot_t slot)
172151
}
173152
}
174153

175-
// only for HiCR
176-
//#endif
177-
178154
void Interface :: get( pid_t srcPid, memslot_t srcSlot, size_t srcOffset,
179155
memslot_t dstSlot, size_t dstOffset,
180156
size_t size )

src/MPI/interface.hpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ class _LPFLIB_LOCAL Interface
7070

7171
static err_t hook( const mpi::Comm & comm , spmd_t spmd, args_t args );
7272

73-
// only for HiCR
74-
// #if
7573
err_t countingSyncPerSlot(memslot_t slot, size_t expected_sent, size_t expected_rcvd);
7674

7775
err_t syncPerSlot(memslot_t slot);
@@ -90,16 +88,6 @@ class _LPFLIB_LOCAL Interface
9088

9189
void flushReceived();
9290

93-
void lockSlot( memslot_t srcSlot, size_t srcOffset,
94-
pid_t dstPid, memslot_t dstSlot, size_t dstOffset,
95-
size_t size );
96-
97-
void unlockSlot( memslot_t srcSlot, size_t srcOffset,
98-
pid_t dstPid, memslot_t dstSlot, size_t dstOffset,
99-
size_t size );
100-
101-
// only for HiCR
102-
//#endif
10391
err_t rehook( spmd_t spmd, args_t args);
10492

10593
void probe( machine_t & machine ) ;

src/MPI/mesgqueue.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -322,34 +322,6 @@ void MessageQueue :: get( pid_t srcPid, memslot_t srcSlot, size_t srcOffset,
322322
#endif
323323
}
324324

325-
void MessageQueue :: lockSlot( memslot_t srcSlot, size_t srcOffset,
326-
pid_t dstPid, memslot_t dstSlot, size_t dstOffset, size_t size )
327-
{
328-
ASSERT(srcSlot != LPF_INVALID_MEMSLOT);
329-
ASSERT(dstSlot != LPF_INVALID_MEMSLOT);
330-
(void) srcOffset;
331-
(void) dstOffset;
332-
(void) dstPid;
333-
(void) size;
334-
#ifdef LPF_CORE_MPI_USES_zero
335-
m_ibverbs.blockingCompareAndSwap(m_memreg.getVerbID(srcSlot), srcOffset, dstPid, m_memreg.getVerbID(dstSlot), dstOffset, size, 0ULL, 1ULL);
336-
#endif
337-
}
338-
339-
void MessageQueue :: unlockSlot( memslot_t srcSlot, size_t srcOffset,
340-
pid_t dstPid, memslot_t dstSlot, size_t dstOffset, size_t size )
341-
{
342-
ASSERT(srcSlot != LPF_INVALID_MEMSLOT);
343-
ASSERT(dstSlot != LPF_INVALID_MEMSLOT);
344-
(void) srcOffset;
345-
(void) dstOffset;
346-
(void) dstPid;
347-
(void) size;
348-
#ifdef LPF_CORE_MPI_USES_zero
349-
m_ibverbs.blockingCompareAndSwap(m_memreg.getVerbID(srcSlot), srcOffset, dstPid, m_memreg.getVerbID(dstSlot), dstOffset, size, 1ULL, 0ULL);
350-
#endif
351-
}
352-
353325
void MessageQueue :: put( memslot_t srcSlot, size_t srcOffset,
354326
pid_t dstPid, memslot_t dstSlot, size_t dstOffset, size_t size )
355327
{

src/MPI/mesgqueue.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ class _LPFLIB_LOCAL MessageQueue
6666
// returns how many processes have entered in an aborted state
6767
int sync( bool abort );
6868

69-
//only for HiCR
70-
void lockSlot( memslot_t srcSlot, size_t srcOffset,
71-
pid_t dstPid, memslot_t dstSlot, size_t dstOffset, size_t size );
72-
73-
void unlockSlot( memslot_t srcSlot, size_t srcOffset,
74-
pid_t dstPid, memslot_t dstSlot, size_t dstOffset, size_t size );
75-
7669
void getRcvdMsgCountPerSlot(size_t * msgs, memslot_t slot);
7770

7871
void getRcvdMsgCount(size_t * msgs);
@@ -88,7 +81,6 @@ class _LPFLIB_LOCAL MessageQueue
8881
int countingSyncPerSlot(memslot_t slot, size_t expected_sent, size_t expected_rcvd);
8982

9083
int syncPerSlot(memslot_t slot);
91-
// end only for HiCR
9284

9385
private:
9486
enum Msgs { BufPut ,

src/imp/core.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -146,32 +146,6 @@ lpf_err_t lpf_counting_sync_per_slot( lpf_t lpf, lpf_sync_attr_t attr, lpf_memsl
146146
return LPF_SUCCESS;
147147
}
148148

149-
lpf_err_t lpf_lock_slot(
150-
lpf_t ctx,
151-
lpf_memslot_t src_slot,
152-
size_t src_offset,
153-
lpf_pid_t dst_pid,
154-
lpf_memslot_t dst_slot,
155-
size_t dst_offset,
156-
size_t size,
157-
lpf_msg_attr_t attr
158-
) {
159-
return LPF_SUCCESS;
160-
}
161-
162-
lpf_err_t lpf_unlock_slot(
163-
lpf_t ctx,
164-
lpf_memslot_t src_slot,
165-
size_t src_offset,
166-
lpf_pid_t dst_pid,
167-
lpf_memslot_t dst_slot,
168-
size_t dst_offset,
169-
size_t size,
170-
lpf_msg_attr_t attr
171-
) {
172-
return LPF_SUCCESS;
173-
}
174-
175149
static double messageGap( lpf_pid_t p, size_t min_msg_size, lpf_sync_attr_t attr)
176150
{
177151
(void) p;

0 commit comments

Comments
 (0)