CN109669788A - The MPI implementation method of multi core chip towards direct memory access interconnection communication - Google Patents

The MPI implementation method of multi core chip towards direct memory access interconnection communication Download PDF

Info

Publication number
CN109669788A
CN109669788A CN201811504329.6A CN201811504329A CN109669788A CN 109669788 A CN109669788 A CN 109669788A CN 201811504329 A CN201811504329 A CN 201811504329A CN 109669788 A CN109669788 A CN 109669788A
Authority
CN
China
Prior art keywords
message
mpi
context
transmission
memory access
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811504329.6A
Other languages
Chinese (zh)
Inventor
周泉
杨靓
何卫强
巨新刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xian Microelectronics Technology Institute
Original Assignee
Xian Microelectronics Technology Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xian Microelectronics Technology Institute filed Critical Xian Microelectronics Technology Institute
Priority to CN201811504329.6A priority Critical patent/CN109669788A/en
Publication of CN109669788A publication Critical patent/CN109669788A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/545Interprogram communication where tasks reside in different layers, e.g. user- and kernel-space

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Communication Control (AREA)

Abstract

The invention discloses a kind of implementation methods for simplifying MPI of multi core chip towards direct memory access interconnection communication, by establishing a distributed context data structure and a reception context data structure simultaneously as the control structure and data structure for supporting entire parallel environment in recipient and sender, message sender is actually not carried out data and sends operation, it need to be only described to message is sent, set transmission context, when recipient, which runs, receives calling, if context matches, then the message in memory address that sender specifies is read back local memory space, the transmitting of message is realized between the design and process that can realize concurrent program in application layer with minimum memory footprint, for supporting the parallel Programming of the multi core chip using direct memory access interconnection communication, realize Process Synchronization function , can be used for the complicated parallel Programming of the multi core chip of direct memory access interconnection communication.

Description

The MPI implementation method of multi core chip towards direct memory access interconnection communication
Technical field
The invention belongs to multiple programming field, the MPI for being related to interconnecting the multi core chip of communication towards direct memory access is real Existing method.
Background technique
Multiple programming based on message passing interface (MPI) is current one of the most common type multiple programming method, it is main The parallel Programming of Based on Distributed memory architecture is applied widely in high-performance computing sector.MPI is multiple programming A kind of standard is provided, is realized without representing a certain specific MPI.MPI standard is managed collectively by MPI forum, at present MPI-3.1 Standard Edition is had evolved to, wherein including hundreds of calling interfaces for supporting parallel Programming.
MPI is initially applied to the multiple programming of distributed multi-microcomputer, but with the hair of integrated circuit technique and technique Exhibition, multi core chip becomes the mainstream of current processor design, so that MPI is gradually obtained in chip multi-core parallel Programming Extensive research and application.In a large amount of multiple nucleus system chip, realized using the internuclear interconnection structure of direct memory access more Core communication is a kind of common technological means.In this internuclear interconnection structure, MPI is also played simultaneously guarantees that internuclear data are consistent Property effect because the internuclear interconnection communication mechanism of direct memory access generally only provide " routing+direct memory access " net Network layers service, i.e. hardware are only responsible for for the data in source node memory being transported in the memory of destination node by network routing, And the transport layer between application layer and network layer is transferred to complete the method for guaranteeing data consistency.MPI is in such system In act as the role of transport layer, provide service with process communication for multiple programming.
The benefit that hardware only provides the network layer of internuclear direct memory access is that the transport layer on upper layer is transferred to software program It realizes, provides biggish exploration space for the design realization of transport layer.Realization for the MPI of multi core chip generally uses The a subset of standard MPI is transmitted to complete on piece inter-core message, in the extremely valuable and limited single-chip multi-core environment of resource The middle intercore communication for realizing lightweight, while supporting the realization of concurrent program frame.In current existing technology, without abundant The MPI simplified enough is realized using the characteristic of internuclear direct memory access, and with memory foot as small as possible in application layer Mark realizes the support to parallel Programming and multi-core communication, and this method is exactly in multi core chip interior joint memory source It is realized required for parallel computation between nervous lightweight processor core.
Summary of the invention
The purpose of the present invention is to provide towards direct memory access interconnection communication multi core chip MPI implementation method, With overcome the deficiencies in the prior art.
In order to achieve the above objectives, the present invention adopts the following technical scheme:
A kind of implementation method for simplifying MPI of the multi core chip towards direct memory access interconnection communication, including following step It is rapid: a distributed context data structure and a reception context data structure are established simultaneously in recipient and sender, Recipient first have to access sender distributed context data structure, judged by distributed context data structure be It is no to there is message to need to receive, and determine whether to want received message phase with itself by distributed context data structure information Matching;If there is message will receive and match messages, recipient individually initiate the read operation to message again, message read back itself Memory headroom.
Further, distributed context uses static storage in each process, in the operation of entire parallel environment Fixed memory space is occupied in the process.
Further, distributed context data structure includes sending context, process sum and current process number.
Further, sending context includes a control semaphore and five message semantic definitions for describing transmission message Member, the message semantic definition member with send call in message semantic definition parameter it is corresponding, and operation send call when can will Message semantic definition parameter in calling is assigned to corresponding message semantic definition member, the side for passing through direct memory access for recipient respectively Formula obtains;The control semaphore is the control structure for sending context, for the synchronous coordination of receiving-transmitting sides, controls semaphore Be initially 0.
Further, recipient accesses the transmission context of sender first, by the transmission context of sender Control semaphore to determine whether there is message to need to receive, and pass through sender send the message semantic definition member in context come Determine whether that received message is wanted to match with itself;If there is message will receive and match messages, recipient individually initiate again Read operation to message reads back message the memory headroom of itself.
Further, the process sum is the number of processes executed parallel in whole system, initial by parallel system Change Shi Zhiding.
Further, process number is number of the current process in all concurrent processes;Parallel system is initial When change, a mutually different process number value can be distributed to each process, which is just stored in this process volume In number component.
Further, it receives context and uses dynamic memory.
Further, non-occluding object structural body type: non-obstruction is defined when realizing the transmitting of point-to-point non-Blocking message The distributed context variable that the realization of message transmission is defined dependent on MPI_Context, non-occluding object are defined as one The referred to as structural body of MPI_Request includes message semantic definition, call type, the complement mark of Non-blocking call in the structural body And execute state;The message semantic definition is used to back up by the message semantic definition parameter of current non-barrage reception/transmission tune, wherein The member of message semantic definition includes message buffer pointer, message-length, message data type, source/destination process number, message mark Will;Non- occluding object structural body only serves the relevant calling of non-obstruction.
Further, non-occluding object structural body uses static storage, and in multiple programming, each process need to only safeguard one Distributed context receives context and non-occluding object structural body, and non-occluding object structural body is used for the non-resistance being performed simultaneously Plug sends and receivees.
Further, non-obstruction etc. the execution state to be called for inquiring Non-blocking call first, if the state of execution is aobvious It is shown as transmitting inactive, then according to the message semantic definition and call type in Non-blocking call, re-initiates a block type transmission, It is 1 that corresponding complement mark is arranged after being transmitted, and execution state is set as having completed, and is finally returned to;If executed Status display is to transmit, then detects the transmission state of hardware, and it is 1 that corresponding complement mark is arranged after being transmitted, And be set as having completed by execution state, it finally returns to;If executing status display transmission to be completed, directly return;
The query calls of non-obstruction inquire the execution state of Non-blocking call first, if executing status display is to transmit not Starting will then be completed to indicate to be set as 0, then be returned;If executing status display is to transmit, pass through detection hardware Whether transmission state is the free time to determine whether transmission is completed, corresponding complement mark is then arranged and executes state, most After return;If executing status display transmission to be completed, directly return.
Compared with prior art, the invention has the following beneficial technical effects:
A kind of implementation method for simplifying MPI of the multi core chip towards direct memory access interconnection communication of the present invention, passes through A distributed context data structure and a reception context data structure conduct are established simultaneously in recipient and sender The control structure and data structure for supporting entire parallel environment utilize distributed context data structure and a reception context As message transport vehicle, message sender is actually not carried out data and sends operation data structure, need to only disappear to transmission Breath is described, and sets and sends context,, will hair if context matches when recipient, which runs, receives calling Message in the specified memory address in the side of sending is read back local memory space, can be realized simultaneously with minimum memory footprint in application layer The transmitting that message is realized between the design and process of line program, for supporting the multicore using direct memory access interconnection communication The parallel Programming of chip, and the complicated parallel Programming of the multi core chip for direct memory access interconnection communication.
Further, non-occluding object structural body type is defined when realizing the transmitting of point-to-point non-Blocking message, if needed The transmitting of non-Blocking message is used, then need to re-define most two non-occluding object structural bodies, is respectively used to be performed simultaneously Non- barrage reception and transmission are just able to achieve building for entire parallel system, each member point for storage above, in structural body Amount can be stored using individual character, therefore minimum memory headroom expense is only needed just to be able to achieve building for entire parallel frame.
Further, the present invention is by defining non-occluding object structural body, provides obstruction between concurrent process and non- Blocking message transfer function and Process Synchronization function, can be used for answering for the multi core chip of direct memory access interconnected communication Miscellaneous parallel Programming.
Detailed description of the invention
Fig. 1 is the statement of distributed context type MPI_Context;
Fig. 2 is the statement for receiving context type MPI_Rcontext;
Fig. 3 is statement of the non-obstruction to MPI_Request;
Fig. 4 is the traffic model of storage and the direct memory access interconnection of distributed context;
The execution process of Fig. 5 messaging protocol;
Fig. 6 is the execution process that message is sent;Fig. 6 (a) is the execution flow chart of MPI_Send;Fig. 6 (b) is MPI_ The execution flow chart of Isend;
Fig. 7 is the execution process of message sink;Fig. 7 (a) is the execution flow chart of MPI_Recv;Fig. 7 (b) is MPI_ The execution flow chart of Irecv;
Fig. 8 is the execution process for waiting non-blocks transmission to complete;
Fig. 9 is that the state-detection of non-blocks transmission executes process.
Specific embodiment
The invention will be described in further detail with reference to the accompanying drawing:
A kind of implementation method for simplifying MPI of the multi core chip towards direct memory access interconnection communication, including following step It is rapid: a distributed context data structure and a reception context data structure are established respectively in recipient and sender, Distributed context data structure includes sending context, process sum and current process number;Recipient accesses transmission first The transmission context of side, judges whether there is message by the control semaphore of the transmission context of sender and needs to receive, and lead to The message semantic definition member of the transmission context of sender is crossed to determine whether to want received message to match with itself;If there is disappearing Breath will receive and match messages, recipient individually initiate the read operation to message again, and message is read back the memory headroom of itself;Fortune When row receives calling, sender can be obtained in such a way that sender's process specified when calling is numbered through direct memory access Transmission context, and be saved in receive call reception context in, so as to receive call by reception context learn hair The semaphore status for the side of sending, and whether the message that confirmation message sender is issued matches with message to be received, if With the message for then receiving other side's sending, do not received if mismatching.
It receives context to define in receiving calling, belongs to and receive the dynamic local variable in calling, using dynamic memory; Receive context and be defined as the structural body variable of MPI_Rcontext type, the statement of MPI_Rcontext as shown in Figure 2, In member type with send context in member type it is identical.
The definition of distributed context:
Using a single distributed context mechanism body type as point-to-point message transmission in this invention The data structure and control structure of agreement;Distributed context uses static storage, the distribution in each process The variable of the entitled MPI_Context of context mechanism body type, statement method MPI_Context type as shown in Figure 1: are referred to as The distributed context of MPI, in the realization of messaging protocol, each core run parallel safeguards a MPI_ The structural body variable of Context, and the structural body variable uses static storage in entire parallel task implementation procedure, entire Parallel environment occupies fixed memory space during running, so that other processor cores can interact content therein Formula access;
The transmission context include a synchronization signal amount and for describe send message five message semantic definitions at Member, the message semantic definition member are the data structure for sending context, corresponding with the message semantic definition parameter in calling is sent, And the message semantic definition parameter in calling can be assigned to corresponding message semantic definition member respectively when operation sends and calls, for receiving Side is obtained by way of direct memory access;The control semaphore is the control structure for sending context, for receiving and dispatching The synchronous coordination of both sides, control semaphore is initially 0;Five message semantic definition members specifically include transmission message buffer and refer to Needle, the data type for sending message-length, sending message, the purpose process number and transmission message flag for sending message.
The process sum is the number of processes executed parallel in whole system, is specified when being initialized by parallel system, One-to-one abstract, i.e. core one process of operation, therefore process will be carried out in this invention between process and processor core Sum does not exceed the quantity of core;
The process number is number of the current process in all concurrent processes;When parallel system initializes, it can give Each process distributes a mutually different process number value, which is just stored in this process number component.
In order to realize the waiting and inquiry of Non-blocking call, non-obstruction is defined when realizing the transmitting of point-to-point non-Blocking message Object structure body type: the realization of non-Blocking message transmitting also depends on the distributed context that MPI_Context is defined and becomes Amount, non-occluding object are defined as the structural body for being known as MPI_Request, contain Non-blocking call in the structural body Message semantic definition, call type, complement mark and execution four parts of state, totally 8 member's components, as shown in Figure 3: described Message semantic definition be used for back up by currently non-barrage reception/transmission tune message semantic definition parameter, wherein the member of message semantic definition include Message buffer pointer, message-length, message data type, source/destination process number, message flag;Non- occluding object structure Body only serves the relevant calling of non-obstruction, and applying for it is introduced in 4 non-specific implementations for blocking relevant calling:
Non-blocking call type: I_CallType;The call type currently executed is returned for non-blocking communication handle, The member can be labeled as two kinds of call types: MPI_NonblockingSend (non-obstruction is sent) and MPI_ NonblockingReceive (non-barrage reception);
Non-blocking call complement mark: I_Flag;Call whether the mark of successful execution, successful execution return 1, failure then Return to 0;
Non-blocking call executes state: I_Status;Whether display message transmission has been started up, or is transmitting, or Through being transmitted, specific value are as follows:
MPI_UnStart (transmission is inactive), MPI_InTransmitting (transmission), MPI_ TransCompleted (transmission is completed).
In conclusion including 8 member's components in distributed context mechanism body, contained in non-occluding object structural body 8 member's components, receiving includes 6 member's components in context, wherein distributed context and non-occluding object structural body are adopted With static storage, receives context and use dynamic memory;In multiple programming, each process need to only safeguard distribution or more Text only includes the storage overhead of 6+8=14 structural body member's component, is just able to achieve basic in total in addition receiving context Point-to-point block type message transmission.Non- Blocking message transmitting is used if necessary, then needing to re-define most two non-obstructions pair Image structures body is respectively used to the non-barrage reception being performed simultaneously and transmission, is just able to achieve building for entire parallel system;From storage For upper, each member's component in structural body can be stored using individual character, therefore only need minimum memory headroom expense just It is able to achieve building for entire parallel frame.The present invention is to provide a kind of implementation methods of message transmission multiple programming simplified.
In the realization of messaging protocol, each core run parallel safeguards the structural body of a MPI_Context Variable, the distributed context which represents use static storage during entire task execution, occupy and fix Memory headroom realize the same of process so that other cores obtain transmission context therein by way of direct memory access Message transmission is walked, as shown in Figure 4.Two nodes shown in Fig. 4 realize the communication of direct memory access by interference networks, because Processor core need to only specify source/destination node serial number to network interface, source/destination memory address, pass when this internuclear data is transmitted The basic parameter such as defeated length, then directly initiates transmission request, and data can memory control unit, network by both sides Interface and interference networks transmit between the memory under two nodes.
The execution process of messaging protocol is as shown in Figure 5.Node is illustrated in Fig. 50Node is to Node1Node transmission disappears The implementation procedure of breath.Node0On process call MPI_Send to realize that the block type of message is sent, and Node1On process call MPI_Recv realizes that the block type of message receives:
Node0It calls and executes sequence when MPI_Send are as follows:
(1) whether the value of confirmation signal amount is 0, if it is 0, shows that sendaisle is available, process enters (2) step; If not being 0, until waiting until that semaphore is 0;
(2) the correspondence member that interface parameters when MPI_Send will be called to be assigned to transmission context, completion disappear to transmission The description of breath, process enter (3) step;
(3) semaphore is changed to 1, process enters (4) step;
(4) wait until semaphore value be 0, show that message has succeeded and received by other side, process enter (5) step;
(5) it calls and returns.
Node1Call MPI_Recv's to execute sequence are as follows:
(1) transmission context (a total of six member point of source is obtained according to the originating process number for calling MPI_Recv to provide Amount), and the corresponding member for the reception context being assigned in local memory;
(2) it checks the semaphore obtained from source, if the signal quantity obtained is 0, returns to (1) step, obtain again Take the transmission context of source;If semaphore is 1, why enter (3) step;
(3) the message semantic definition parameter provided with the reception context in local memory and in calling carries out match messages inspection It looks into, if it does not match, the message is not intended for this node, process returns to (1) step;If it does, then the message is The message of local node is issued, process enters (4) step;
(4) according to receiving the message semantic definition parameter in calling and receiving contextual information, source node memory is directly read In message to local memory space, process enters (5) step after completing message transmission;
(5) signal quantity sent in context that sender is arranged is 0, and process enters (6) step;
(6) it calls and returns, complete message sink.
It, only need to be to transmission from above procedure as can be seen that message sender, which is actually not carried out data, sends operation Message is described, and sets and sends context,, will if context matches when recipient, which runs, receives calling The message in memory address that sender specifies is read back local memory space, and the semaphore that other side is then arranged is 0, is completed primary Message transmission.
Non- Blocking message transmitting implementation procedure is similar, only needs in the process of implementation to the letter in non-occluding object Breath is configured and backs up, and can be returned to before message transmission does not complete.
The waiting of non-Blocking message transmitting is specific related to non-occluding object to inquiry, according to the execution in non-occluding object The value of state members executes different operations.
Non- obstruction etc. it is to be called first inquire Non-blocking call execution state, if execute status display be transmission not Starting re-initiates a block type transmission, after being transmitted then according to the message semantic definition and call type in Non-blocking call It is 1 that corresponding complement mark, which is arranged, and execution state is set as having completed, and is finally returned to;It is if executing status display It is transmitting, is then detecting the transmission state of hardware, it is 1 that corresponding complement mark is arranged after being transmitted, and will execute shape State is set as having completed, and finally returns to;If executing status display transmission to be completed, directly return.
The query calls of non-obstruction inquire the execution state of Non-blocking call first, if executing status display is to transmit not Starting will then be completed to indicate to be set as 0, then be returned;If executing status display is to transmit, pass through detection hardware Whether transmission state is the free time to determine whether transmission is completed, and corresponding complement mark is then arranged and executes state, finally It returns;If executing status display transmission to be completed, directly return.
It is described further with reference to the accompanying drawing to structural principle of the invention and using step:
It include 11 calling based on the multiple programming library that method disclosed by the invention is realized, this 11 are called as shown in table 2, Including 6 basic calling, the Process Synchronization calling of 4 non-relevant calling of obstruction and 1 extension.
11 multiple programming calling interfaces that table 2 is realized based on this invention
Embodiments of the present invention are further described below with reference to this 11 calling interfaces.
1. parallel environment initializes
Entitled MPI_Init is called in parallel environment initialization, it is this invention for multi core chip parallel Programming First calling, call prototype are as follows: MPI_Init (int proc_num, MPI_Context*context);MPI_Init's Function is to establish multiple parallel tasks, makees initialization appropriate to parallel environment, subsequently into multitask running;MPI_Init tune With including two parameters:
Proc_num is the concurrent process quantity of starting, and type is integer;It will be carried out between process and processor core a pair of One abstract, i.e. core one process of operation, therefore process sum is no more than the quantity of core;
Context is the pointer for being directed toward distributed context data structure, passes through the pointer dividing to the incoming process of calling Cloth context realizes the initialization to distributed context;
No. 0 process is started operation by default first in this invention, i.e., in Node0Upper execution MPI_Init, and realize The initialization of parallel environment, implementation steps are as follows:
(1) successively the instruction of each process is sent by on-chip interconnection network according to specified process sum proc_num To Node1…Noder-1Program storage area in, r=proc_num here, in addition Node0The process at place, in total proc_num A process;
(2) it is initialized under each node by the context that context is specified, it is main that process sum and process are set Number, and semaphore is initialized as 0, wherein the number for distributing to each process is followed successively by 0,1,2 ... proc_num-1;
(3) start node corresponding to newly created process to bring into operation, call and return.
2. obtaining concurrent process sum
The calling that the process sum in parallel system is obtained in this invention is MPI_Comm_size, calls prototype are as follows: MPI_Comm_size(MPI_Context*context,int*size);Wherein point of the context to the incoming current process of calling Cloth context, size transmit the pointer of a process sum to calling.
The realization of MPI_Comm_size is simpler, need to only be found by context process sum in contextual information at Member, and the position that its assignment to size is directed toward.
3. obtaining current process number
The calling that current process number is obtained in this invention is MPI_Comm_rank, calls prototype are as follows: MPI_Comm_ rank(MPI_Context*context,int*rank);Wherein context is passed to the distribution of current process up and down to calling Text, rank transmit the pointer of a return process number to calling;It directly will be above and below distribution in the realization of MPI_Comm_rank The position that process number member assignment in text is directed toward to rank.
4. message is sent
Message transmission is divided into block type and sends and two kinds of non-block type transmission in this invention;Block type transmission, which refers to, is adjusting With the calling for being all sent completely just return after initiation up to message;The transmission of non-block type refers to after calling is initiated can be with The calling returned immediately, but call to return and be not meant to that message transmission is successfully completed.
It is MPI_Send (void*buf, int count, MPI_Datatype that block type, which sends and calls prototype, Datatype, int dest, int tag, MPI_Context*context), parameter therein:
Buf is the pointer of message to be sent, i.e., the initial address of message to be sent in memory;
Count is the length of message to be sent, and the unit of the length is determined by data type;
Datatype is the data type of message to be sent, can support the byte data of such as character type, short Half digital data, integer and the digital data of single-precision floating point type etc. are designed with specific reference to system needs;
Dest is purpose process number;
Tag is the mark for sending message, is provided in the form of integer data, which must receive this message with recipient When the mark that provides it is identical;
Context transmits the pointer of distributed context mechanism body to calling, will pass through the pointer when message is sent It addresses and transmission contextual information is set;
Shown in execution process such as Fig. 6 (a) of MPI_Send, this process is accessed according to parameter context in realization and is safeguarded Distributed context, perform the following steps in sequence:
(1) whether the value of confirmation signal amount is 0, if it is 0, shows that sendaisle is available, process enters (2) step; If not being 0, until waiting until that semaphore is 0.
(2) message semantic definition parameter when MPI_Send will be called to be written in memory in the correspondence member for sending context, it is complete The description of message is sent in pairs, and process enters (3) step.
(3) semaphore is changed to 1, process enters (4) step.
(4) wait until semaphore value be 0, show that message has succeeded and received by other side, process enter (5) step.
(5) it calls and returns.
In order to realize the Overlapped Execution of process and message transmission in core, with the process performance of further lifting system, this item Invention also provides a kind of implementation method that non-Blocking message is sent, and calling prototype is MPI_Isend (void*buf, int count,MPI_Datatype datatype,int dest,int tag,MPI_Context*context,MPI_Request* request).The calling, in nominally more letters " I ", is shown to be Non-blocking call compared with MPI_Send.Call ginseng A more request pointer in number, the information of Non-blocking call object is returned to by the pointer, so as to subsequent to non-obstruction It calls to execute and waits and inquire.
Shown in execution process such as Fig. 6 (b) of MPI_Isend, it is followed successively by following steps:
(1) message being assigned to the message semantic definition provided in call parameters in non-occluding object pointed by request The corresponding member of description, completes the data backup that current non-obstruction sends message, and process enters (2) step.
(2) inquiry sends the semaphore in context, if signal quantity is not 0, enters (3) step, otherwise enters (5) step.
(3) judge whether generate send time-out, if send time-out, process enter (4) step, if do not have overtime process into Enter (2) step.According to time-out is sent to the number of semaphore inquiry to decide whether to generate in this step, herein continuously The number of inquiry can according to need in the implementation carrys out appropriate adjustment.
(4) it sets the call type member in status information to MPI_NonblockingSend (non-obstruction is sent), it is complete It is 0 (returning to 0 value, indicate not completing communication) at traffic sign placement, execution state is set as MPI_UnStart (inactive), process Into (8) step.
(5) message semantic definition provided when calling MPI_Isend is all assigned to the corresponding member for sending context, is completed Message semantic definition is sent, process enters (6) step.
(6) setting signal magnitude is 1, and message formally issues, and process enters (6) step.
(7) it sets the call type member in status information to MPI_NonblockingSend (non-obstruction is sent), it is complete It is 0 (returning to 0 value, indicate not completing communication) at traffic sign placement, execution state is set as MPI_InTransmiting and (is passing It is defeated), process enters (8) step.
(8) it calls and returns.
From above non-obstruction transmission flow can be seen that it is non-obstruction send call return cannot be guaranteed message at Function is sent, and the return or generation of calling in (4) step or occur in (7) step.Occur (4) step return be because It is occupied always for sendaisle, transmission time-out is produced, and this invention is not accounted for the multiple support for sending task, it is latter A transmission task must could execute after previous transmission task is completed, and return, disappear from (4) step if sending and calling Breath sends request and is not executed actually, is only marked to current transmission calling and its state, program is set Meter personnel can complete the calling by calling LMPI_Wait, or the state of the calling is inquired with MPI_Test.MPI_ The specific embodiment that Wait and MPI_Test is called will be described in detail later.Non- obstruction, which is sent, calls the state after executing still Before not yet explicitly, read operation cannot be carried out to the data for sending buffer area, in order to avoid cause loss of data or mistake.
5. message sink
Message sink is divided into block type and receives and two kinds of non-block type reception;Block type reception refers to after calling initiation Until message all finishes receiving the calling just returned;Non- block type receive refer to call initiate after can return immediately It calls, but calls to return and be not meant to that message all receives local;
It is MPI_Recv (void*buf, int count, MPI_Datatype that block type, which receives and calls prototype, Datatype, int source, int tag, MPI_Context*context), parameter therein:
Buf is the buffer pointer for receiving message, i.e. the initial address of reception message deposit in memory;
Count is the length of message to be received, and the unit of the length is determined by data type, and has to be larger than to be equal to and send The transmission length of side, message can be just correctly received;
Datatype is the data type of message to be received, can support the byte data of such as character type, short Half digital data, integer and the digital data of single-precision floating point type etc. are designed with specific reference to system needs;
Source is the process number for receiving the source of message;
Tag is the mark for receiving message, is provided in the form of integer data, which must send this message with sender When the mark that provides it is identical;
Context transmits the pointer of distributed context mechanism body to calling, will pass through the pointer when message sink Address distributed contextual information;
Shown in execution process such as Fig. 7 (a) of MPI_Recv, this process and hair are accessed according to parameter context in realization It is sent into the distributed context of journey, is perform the following steps in sequence:
(1) transmission context (a total of six member point of source is obtained according to the originating process number for calling MPI_Recv to provide Amount), and the corresponding member for the reception context being assigned in local memory.
(2) it checks the semaphore obtained from source, if the signal quantity obtained is 0, returns to (1) step, again Obtain the transmission context of source;If semaphore is 1, enter (3) step.
(3) parameter provided with the reception context in local memory and in calling carries out match messages inspection, if not Matching, then the message is not intended for this node, and process returns to (1) step;If it does, then the message is intended for local section The message of point, process enter (4) step.
(4) according to receiving the parameter in calling and receiving contextual information, the message in source node memory is directly read To local memory space, process enters (5) step after completing message transmission.
(5) signal quantity sent in context that sender is arranged is 0, and process enters (6) step.
(6) it calls and returns.
In order to realize the Overlapped Execution of process and message transmission in core, with the process performance of further lifting system, this item Invention also provides a kind of received implementation method of non-Blocking message, and calling prototype is MPI_Irecv (void*buf, int count,MPI_Datatype datatype,int source,int tag,MPI_Context*context,MPI_ Request*request).The calling, in nominally more letters " I ", is shown to be non-obstruction tune compared with MPI_Recv With.A more request pointer in call parameters, returns to the information of Non-blocking call object, by the pointer with after an action of the bowels Continuous execute to Non-blocking call waits and inquires.
Shown in execution process such as Fig. 7 (b) of MPI_Irecv, it is divided into following steps:
(1) message being assigned to the message semantic definition provided in call parameters in non-occluding object pointed by request The corresponding member of description, completes the data backup of current non-barrage reception message, and process enters (2) step.
(2) the transmission context for obtaining originating process is numbered according to originating process, and the transmission context received is assigned to this Ground process receives the correspondence member of context, and process enters (3) step.
(3) if the other side's signal quantity received is not 1, enter (4) step, otherwise enter (5) step.
(4) judge whether generate receive time-out, if receive time-out, process enter (6) step, if do not have overtime process into Enter (2) step.It is decided whether to generate hair according to the transmission context number of the acquisition originating process executed in this step Time-out is sent, the number continuously acquired herein can according to need in the implementation carrys out appropriate adjustment.
(5) information in local reception context is checked with message semantic definition when receiving calling.If there is Item is mismatched, shows that the message that other side sends is not intended for this process, process enters (6) step, if received in context The information of acquisition and the description received when calling exactly match, and show that the message is that this process needs received message, process into Enter (7) step.
(6) it sets the call type member in status information to MPI_NonblockingRecv (non-barrage reception), it is complete It is 0 (returning to 0 value, indicate not completing communication) at traffic sign placement, execution state is set as MPI_UnStart (inactive), process Into (9) step.
(7) it according to receiving the parameter in calling and receiving contextual information, initiates to the message in source node memory Read operation, process immediately enter (8) step.
(8) it sets the call type member in status information to MPI_NonblockingRecv (non-barrage reception), it is complete It is 0 (returning to 0 value, indicate not completing communication) at traffic sign placement, execution state is set as MPI_InTransmiting and (is passing It is defeated), process enters (9) step.
(9) it calls and returns.
Can be seen that the return that non-barrage reception calls from above process cannot be guaranteed that message has been successfully transmitted, and adjust Return or generation in (6) step or occur in (8) step.Occur in the return of (6) step to be because of sender one This process is not issued directly to want received data and produce reception time-out, or because the message that sender issues be not this into Journey wants received message.The return in (6) step occurs, message sink request is not executed actually, only to working as Preceding reception calling and its state are marked, and programmer can have been waited for the arrival of news by calling MPI_Wait At, or MPI_Test is called to inquire the state of the calling.Clear the 0 of sender's semaphore is in recipient when non-barrage reception MPI_Wait or MPI_Test is called to realize, when recipient calls MPI_Wait or MPI_Test, if detecting biography It is defeated to have completed, 0 can be set by the semaphore of sender automatically, show that receiving process completes message sink to transmission process.
6. waiting for
Waiting for calling is MPI_Wait, and function is to wait the completion of a Non-blocking call, its calling prototype is MPI_Wait (MPI_Request*request, MPI_Status*status), parameter request therein are Non-blocking call Pointer passes through the status information of the available Non-blocking call of the pointer;Status transmits a return state to MPI_Wait Pointer.
The execution process of MPI_Wait is as shown in figure 8, be divided into following steps:
(1) according to handle value request query execution state, if current execution state is MPI_InTransmiting (transmission), process enter (2) step;If current execution state is MPI_UnStart (inactive), process enters the (3) step;If current execution state is MPI_TransCompleted (transmission is completed), process enters (9) step.
(2) transmission state for detecting hardware, until being transmitted, process enters (4) step.
(3) query calls type flows if call type is MPI_NonblockingReceive (non-barrage reception) Journey enters (5) step, if call type is MPI_NonblockingSend (non-obstruction is sent), process is directly entered (6) Step.
(4) query calls type, if call type is MPI_NonblockingReceive (non-barrage reception), process Into (7) step, otherwise enter (8) step.
(5) it according to the message semantic definition backup information of the request Non-blocking call object being directed toward, executes a secondary stricture and connects It receives, process enters (7) step.
(6) according to the message semantic definition backup information of the request Non-blocking call object being directed toward, secondary stricture hair is executed It send, process enters (8) step.
(7) setting sender's semaphore is 0, and process enters (8) step.
(8) complement mark being arranged in status information is 1 (returning to 1 indicates to be transmitted), the state value that status is directed toward It is set as MPI_TransCompleted (transmission is completed), process enters (9) step.
(9) it calls and returns.
7. state-detection
It is MPI_Test that state-detection, which is called, its function is to detect the execution state of Non-blocking call, and calling prototype is MPI_Test (MPI_Request*request, int*flag, MPI_Status*status), wherein parameter request is non- Obstruction calls pointer to object;Flag transmits the pointer for calling the mark whether successfully completed;Status is return state Pointer.
The execution process of MPI_Test is as shown in figure 9, be divided into following steps:
(1) according to handle value request query execution state, if current execution state is MPI_InTransmiting (transmission), process enter (2) step;If current execution state is MPI_UnStart (inactive), process enters the (3) step;If current execution state is MPI_TransCompleted (transmission is completed), process enters (6) step.
(2) transmission state of hardware is detected, if transmission has been completed, process enters (4) step, if be transmitted without At process enters (5) step.
(3) 0 is set by the flag value of statistical indicant being directed toward, process enters (6) step.
(4) value of statistical indicant that setting flag is directed toward is that the state value that 1, status is directed toward is set as MPI_TransCompleted (transmission is completed), process enter (6) step.
(5) MPI_ is set by the state value that the flag value of statistical indicant being directed toward is set as 0, status direction InTransmiting (is being transmitted), and process enters (6) step.
(6) it calls and returns.
8. Process Synchronization
It is MPI_Barrier (MPI_Context*context), its function that Process Synchronization, which calls prototype, in this invention It is to synchronize all processes, only when all processes have all run the calling of MPI_Barrier, each process could continue past After execute, first reach MPI_Barrier calling at process have to wait for.MPI_Barrier needs to call front institute when realizing The obstruction stated is sent and barrage reception function.One is first carried out inside MPI_Barrier from Node0Null message (the nothing of beginning Message content only transmits message describing information) ring-type transmitting, i.e. Node0To Node1Process sends the message that a length is 0, Node1It receives the message and is sent to Node later2, each process successively transmits, and to the last a process passes null message back To Node0, at this moment may determine that each process has all been gone at MPI_Barrier calling.Node0Process receives to the end Return is called to one null message of each process broadcast transmission and from MPI_Barrier again after the null message of return, is continued Execute follow-up work.Each process receives Node0It also calls and returns from MPI_Barrier after the null message of broadcast, continue Execute follow-up work.
9. parallel environment terminates
It is MPI_Finalize that the end of parallel environment, which is called, in this invention, its function is to terminate MPI and advance Journey, calling prototype is MPI_Finalize ().It is all removed after executing MPI_Finalize by all processes of MPI_Init creation Pin only retains Node0Process continues to run.Non- Node0Process when calling MPI_Finalize to Node0A message is sent, Show that the task of oneself is completed comprehensively, then waits Node always0It receives the message and ties oneself from parallel environment Beam falls.Node0When process calls MPI_Finalize, other processes are inquired one by one, if receiving the end letter of other processes Breath, then make necessary end processing to corresponding process.

Claims (10)

1. a kind of implementation method for simplifying MPI of the multi core chip towards direct memory access interconnection communication, which is characterized in that packet It includes following steps: in recipient and sender while establishing a distributed context data structure and a reception context number According to structure, recipient first has to the distributed context data structure of access sender, passes through distributed context data structure To determine whether there is message to need to receive, and determine whether to receive with itself by distributed context data structure information Message match;If there is message will receive and match messages, recipient individually initiates the read operation to message again, by message Read back itself memory headroom.
2. a kind of reality for simplifying MPI of multi core chip towards direct memory access interconnection communication according to claim 1 Existing method, which is characterized in that distributed context uses static storage in each process, in the operation of entire parallel environment Fixed memory space is occupied in the process, is received context and is used dynamic memory.
3. a kind of reality for simplifying MPI of multi core chip towards direct memory access interconnection communication according to claim 1 Existing method, which is characterized in that distributed context data structure includes sending context, process sum and current process number.
4. a kind of reality for simplifying MPI of multi core chip towards direct memory access interconnection communication according to claim 3 Existing method, which is characterized in that sending context includes that a control semaphore and five message for describing to send message are retouched Member is stated, the message semantic definition member is corresponding with the message semantic definition parameter in calling is sent, and the meeting when operation sends and calls Message semantic definition parameter in calling is assigned to corresponding message semantic definition member respectively, passes through direct memory access for recipient Mode obtains;The control semaphore is the control structure for sending context, for the synchronous coordination of receiving-transmitting sides, controls signal Amount is initially 0.
5. a kind of reality for simplifying MPI of multi core chip towards direct memory access interconnection communication according to claim 4 Existing method, which is characterized in that recipient accesses the transmission context of sender first, by the transmission context of sender Control semaphore to determine whether there is message to need to receive, and pass through sender send the message semantic definition member in context come Determine whether that received message is wanted to match with itself;If there is message will receive and match messages, recipient individually initiate again Read operation to message reads back message the memory headroom of itself.
6. a kind of reality for simplifying MPI of multi core chip towards direct memory access interconnection communication according to claim 3 Existing method, which is characterized in that the process sum is the number of processes executed parallel in whole system, initial by parallel system Change Shi Zhiding.
7. a kind of reality for simplifying MPI of multi core chip towards direct memory access interconnection communication according to claim 3 Existing method, which is characterized in that the process number is number of the current process in all concurrent processes;Parallel system is initial When change, a mutually different process number value can be distributed to each process, which is just stored in this process volume In number component.
8. a kind of reality for simplifying MPI of multi core chip towards direct memory access interconnection communication according to claim 1 Existing method, which is characterized in that define non-occluding object structural body type: non-obstruction when realizing the transmitting of point-to-point non-Blocking message The distributed context variable that the realization of message transmission is defined dependent on MPI_Context, non-occluding object are defined as one The referred to as structural body of MPI_Request includes message semantic definition, call type, the complement mark of Non-blocking call in the structural body And execute state;The message semantic definition is used to back up by the message semantic definition parameter of current non-barrage reception/transmission tune, wherein The member of message semantic definition includes message buffer pointer, message-length, message data type, source/destination process number, message mark Will;Non- occluding object structural body only serves the relevant calling of non-obstruction.
9. a kind of reality for simplifying MPI of multi core chip towards direct memory access interconnection communication according to claim 1 Existing method, which is characterized in that non-occluding object structural body uses static storage, and in multiple programming, each process need to only safeguard one A distribution context receives context and non-occluding object structural body, and non-occluding object structural body is non-for being performed simultaneously Barrage reception and transmission.
10. a kind of reality for simplifying MPI of multi core chip towards direct memory access interconnection communication according to claim 8 Existing method, which is characterized in that non-obstruction etc. the execution state to be called for inquiring Non-blocking call first, if the state of execution is aobvious It is shown as transmitting inactive, then according to the message semantic definition and call type in Non-blocking call, re-initiates a block type transmission, It is 1 that corresponding complement mark is arranged after being transmitted, and execution state is set as having completed, and is finally returned to;If executed Status display is to transmit, then detects the transmission state of hardware, and it is 1 that corresponding complement mark is arranged after being transmitted, And be set as having completed by execution state, it finally returns to;If executing status display transmission to be completed, directly return;
The query calls of non-obstruction inquire the execution state of Non-blocking call first, if executing status display is that transmission is not opened It is dynamic, then it will complete to indicate to be set as 0, then return;If executing status display is to transmit, pass through the biography of detection hardware Whether defeated state is the free time to determine whether transmission is completed, corresponding complement mark is then arranged and executes state, finally It returns;If executing status display transmission to be completed, directly return.
CN201811504329.6A 2018-12-10 2018-12-10 The MPI implementation method of multi core chip towards direct memory access interconnection communication Pending CN109669788A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811504329.6A CN109669788A (en) 2018-12-10 2018-12-10 The MPI implementation method of multi core chip towards direct memory access interconnection communication

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811504329.6A CN109669788A (en) 2018-12-10 2018-12-10 The MPI implementation method of multi core chip towards direct memory access interconnection communication

Publications (1)

Publication Number Publication Date
CN109669788A true CN109669788A (en) 2019-04-23

Family

ID=66144259

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811504329.6A Pending CN109669788A (en) 2018-12-10 2018-12-10 The MPI implementation method of multi core chip towards direct memory access interconnection communication

Country Status (1)

Country Link
CN (1) CN109669788A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112929461A (en) * 2021-01-21 2021-06-08 中国人民解放军国防科技大学 MPI process management interface implementation method based on high-speed interconnection network
CN113452602A (en) * 2021-06-21 2021-09-28 网易(杭州)网络有限公司 Message transmission method and device, electronic equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103096168A (en) * 2012-12-25 2013-05-08 四川九洲电器集团有限责任公司 Data communication parallel processing method based on internet protocol television (IPTV) set top box
CN103248467A (en) * 2013-05-14 2013-08-14 中国人民解放军国防科学技术大学 In-chip connection management-based RDMA communication method
CN104346229A (en) * 2014-11-14 2015-02-11 国家电网公司 Processing method for optimization of inter-process communication of embedded operating system
CN105446936A (en) * 2015-11-16 2016-03-30 上海交通大学 Distributed hash table method based on HTM and one-way RDMA operation
CN105793835A (en) * 2013-12-04 2016-07-20 甲骨文国际公司 System and method for managing and supporting virtual host bus adaptor (vhba) over infiniband (ib) and for supporting efficient buffer usage with a single external memory interface
CN106598752A (en) * 2016-11-15 2017-04-26 北京大学深圳研究生院 Remote zero-copy method
CN107147590A (en) * 2017-07-12 2017-09-08 郑州云海信息技术有限公司 A kind of method and system based on rdma protocol message communicating

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103096168A (en) * 2012-12-25 2013-05-08 四川九洲电器集团有限责任公司 Data communication parallel processing method based on internet protocol television (IPTV) set top box
CN103248467A (en) * 2013-05-14 2013-08-14 中国人民解放军国防科学技术大学 In-chip connection management-based RDMA communication method
CN105793835A (en) * 2013-12-04 2016-07-20 甲骨文国际公司 System and method for managing and supporting virtual host bus adaptor (vhba) over infiniband (ib) and for supporting efficient buffer usage with a single external memory interface
CN104346229A (en) * 2014-11-14 2015-02-11 国家电网公司 Processing method for optimization of inter-process communication of embedded operating system
CN105446936A (en) * 2015-11-16 2016-03-30 上海交通大学 Distributed hash table method based on HTM and one-way RDMA operation
CN106598752A (en) * 2016-11-15 2017-04-26 北京大学深圳研究生院 Remote zero-copy method
CN107147590A (en) * 2017-07-12 2017-09-08 郑州云海信息技术有限公司 A kind of method and system based on rdma protocol message communicating

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112929461A (en) * 2021-01-21 2021-06-08 中国人民解放军国防科技大学 MPI process management interface implementation method based on high-speed interconnection network
CN112929461B (en) * 2021-01-21 2022-09-16 中国人民解放军国防科技大学 MPI process management interface implementation method based on high-speed interconnection network
CN113452602A (en) * 2021-06-21 2021-09-28 网易(杭州)网络有限公司 Message transmission method and device, electronic equipment and storage medium
CN113452602B (en) * 2021-06-21 2023-03-24 网易(杭州)网络有限公司 Message transmission method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US7984448B2 (en) Mechanism to support generic collective communication across a variety of programming models
CN103401909B (en) Data interactive method based on BS and system, client and server
CN103116520B (en) Method based on the remote procedure call of TCP/ UDP
CN107370796B (en) Intelligent learning system based on Hyper TF
CN110134534B (en) System and method for optimizing message processing for big data distributed system based on NIO
US10609125B2 (en) Method and system for transmitting communication data
CN104615489B (en) A kind of implementation method of multinode data interaction
CN105959347B (en) A kind of digital collaborative simulation system communication means based on P2P network
US20230080588A1 (en) Mqtt protocol simulation method and simulation device
US20220232101A1 (en) Virtual workspace experience visualization and optimization
CN105959349A (en) Distributed service end operation system and method
CN109669788A (en) The MPI implementation method of multi core chip towards direct memory access interconnection communication
CN110308986A (en) The method of distributed training data communication on container cloud based on Optimized Operation
CN106209996A (en) Communication processing method and device
CN103684913B (en) Method of testing, physical equipment, terminal and the system of protocol stack
US6813629B1 (en) Method and apparatus for facilitating object communication across a network
US20030202522A1 (en) System for concurrent distributed processing in multiple finite state machines
CN110380930B (en) Test method, test device, server and computer storage medium
JP4976128B2 (en) Transparent session transport between servers
CN114697334B (en) Method and device for executing scheduling task
CN115361382A (en) Data processing method, device, equipment and storage medium based on data group
CN112351106B (en) Service grid platform containing event grid and communication method thereof
CN109597679A (en) A kind of distributed computing processing method
CN102438007B (en) Virtual bus module organization method of radar terminal
CN104539698B (en) A kind of multithreading socket synchronous communication cut-in method based on delay amendment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20190423

RJ01 Rejection of invention patent application after publication