Download Global Programming Interface (GPI) - GPI-2
Transcript
r e t u r n −1; } // g e t rank c o n s t i n t rank = getRankGPI ( ) ; // g e t number o f nodes c o n s t i n t numNodes = g et No de C ou nt GP I ( ) ; // g e t p o i n t e r t o g l o b a l memory c h a r ∗ memPtr = ( c h a r ∗ ) g et Dm aM e mP tr G PI ( ) ; // e v e r y t h i n g up and running , s y n c r o n i z e barrierGPI ( ) ; // shutdown shutdownGPI ( ) ; return 0; } 4.2 DMA operations There are one-sided and two-sided DMA operations. The one-sided operations are readDmaGPI and writeDmaGPI. They are both non-blocking and do not require any involvement of the node read from or written to. The status of such an operation can only be checked by querying the associated queue on the calling node. The two-sided operations are rcsvDmaGPI and sendDmaGPI. For every sendDmaGPI there has to be a matching recvDmaGPI and vice versa. While the sendDmaGPI is also a non-blocking operation, rcsvDmaGPI will return only when the all the data has been transferred. This operation is useful where relaxed synchronisation is required between the sender and the receiver. As noted previously a DMA transfer is only possible to and from GPI memory. The source and destination memory locations of a DMA operation are not specified by pointers but by relative byte offsets from the GPI memory start addresses of the involved nodes. This makes DMA operations easy because the exact memory addresses are not required which would be different for all nodes. i n t readDmaGPI ( c o n s t u n s i g n e d l o n g localOffset , c o n s t u n s i g n e d l o n g remOffset , c o n s t i n t size , c o n s t u n s i g n e d i n t rank , c o n s t u n s i g n e d i n t gpi_queue ) i n t writeDmaGPI ( c o n s t u n s i g n e d l o n g localOffset , c o n s t u n s i g n e d l o n g remOffset , c o n s t i n t size , c o n s t u n s i g n e d i n t rank , c o n s t u n s i g n e d i n t gpi_queue ) i n t sendDmaGPI ( c o n s t u n s i g n e d l o n g localOffset , c o n s t i n t size , c o n s t u n s i g n e d i n t rank , c o n s t u n s i g n e d i n t gpi_queue ) i n t recvDmaGPI ( c o n s t u n s i g n e d l o n g localOffset , c o n s t i n t size , c o n s t u n s i g n e d i n t rank , c o n s t u n s i g n e d i n t gpi_queue ) The arguments of all operations have identical arguments (where applicable): localOffset The local offset where the data is transferred to/from. remOffset The remote offset where the data is transferred to/from. size The transfer size in bytes. rank The node’s rank where the data is transferred to/from. gpiqueue The queue number to be used for the operation. return An int where 0 is success and -1 is operation failed. 7