How to run engine on the GPU? [closed]

1

I'm studying a simulator called simian ( link ), I'm mainly based on this article here: link

In this article, where one of the authors is the developer of the engine, it is said that in the main program loop it is possible to have it execute in the GPU from "event scheduler". I wanted a light to figure it out ...

Here is the main engine loop:

while globalMinLeft < self.endTime:
        epoch = globalMinLeft + self.minDelay

        self.minSent = self.infTime
        while len(self.eventQueue) > 0 and self.eventQueue[0][0] < epoch:
            (time, event) = heapq.heappop(self.eventQueue) #Next event
            self.now = time #Advance time

            #Simulate event
            entity = self.entities[event["rx"]][event["rxId"]]
            service = getattr(entity, event["name"])
            service(event["data"], event["tx"], event["txId"]) #Receive

            numEvents = numEvents + 1

        if self.size > 1:
            globalMinSent = self.MPI.allreduce(self.minSent, self.MPI.MIN) #Synchronize minSent
            while True: #Busy wait for incoming messages; synchronize
                while self.MPI.iprobe(): #Outer repeat loop needed since per standard, MPI_Iprobe can give false negatives!!
                    remoteEvent = self.MPI.recvAnySize()
                    heapq.heappush(self.eventQueue, (remoteEvent["time"], remoteEvent))
                minLeft = self.infTime
                if len(self.eventQueue) > 0: minLeft = self.eventQueue[0][0]
                globalMinLeft = self.MPI.allreduce(minLeft, self.MPI.MIN) #Synchronize minLeft
                if globalMinLeft <= globalMinSent: break #Global queue is not ahead in time to global minsent
        else:
            minLeft = self.infTime
            if len(self.eventQueue) > 0: minLeft = self.eventQueue[0][0]
            globalMinLeft = min(self.minSent, minLeft)

    if self.size > 1:
        self.MPI.barrier()
        totalEvents = self.MPI.allreduce(numEvents, self.MPI.SUM)
    else:
        totalEvents = numEvents

    if self.rank == 0:
        elapsedTime = timeLib.clock() - startTime
        print "SIMULATION COMPLETED IN: " + str(elapsedTime) + " SECONDS"
        print "SIMULATED EVENTS: " + str(totalEvents)
        print "EVENTS PER SECOND: " + str(totalEvents/elapsedTime)
        print "==========================================="
    
asked by anonymous 04.05.2018 / 21:14

0 answers