import sys from pyopus.parallel.mpi import MPI as VM from pyopus.parallel.base import MsgTaskExit, MsgTaskResult import funclib import os, time import numpy as np if __name__=='__main__': # Set work direcotry on worker to be the same as on the spawner. vm=VM(startupDir=os.getcwd(), debug=1) # Get hosts, find a non-local host myHostID=vm.hostID() # Find a remote host for hostID in vm.hosts(): if hostID!=myHostID: break # See if we have at least one remote host. if hostID==myHostID: print("\nWarning. Measuring local communication speed.") # Prepare data sizes dataSizes=[0, 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000] # Spawn bounceBack() taskIDs=vm.spawnFunction(funclib.bounceBack, kwargs={'vm': vm}, targetList=[hostID], count=1) # Check if it succeeded if len(taskIDs)<1:
import sys from pyopus.parallel.mpi import MPI as VM # By default stdout is forwarded to the mpirun terminal import funclib from pyopus.parallel.base import MsgTaskExit, MsgTaskResult import os, time if __name__=='__main__': # Startup dir must be the same as the one where funclib is located # so we can import it (funclib is not in PYTHONPATH). # MPI guarantees this by default, while PVM does not. vm=VM(startupDir=os.getcwd(), debug=2) # Get host list. hostIDs=vm.hosts() initialFreeSlots=vm.freeSlots() print("Hosts: ") for hostID in hostIDs: print(" "+str(hostID)) print("Free slots: "+str(initialFreeSlots)) # Spawn 2 tasks anywhere, send vm as argument with name 'vm'. # The spawned function must be defined in an importable module outside main .py file. print("\nSpawning 2 tasks, anywhere.") taskIDs=vm.spawnFunction(funclib.hello, kwargs={'vm': vm}, count=2) print("Spawned: ") for task in taskIDs: print " ", str(task) print("Free slots: "+str(vm.freeSlots())+"\n")
import sys from pyopus.parallel.mpi import MPI as VM from pyopus.parallel.base import MsgTaskExit, MsgTaskResult import funclib import os, time import numpy as np if __name__ == '__main__': # Set work direcotry on worker to be the same as on the spawner. vm = VM(startupDir=os.getcwd(), debug=1) # Get hosts, find a non-local host myHostID = vm.hostID() # Find a remote host for hostID in vm.hosts(): if hostID != myHostID: break # See if we have at least one remote host. if hostID == myHostID: print("\nWarning. Measuring local communication speed.") # Prepare data sizes dataSizes = [0, 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000] # Spawn bounceBack() taskIDs = vm.spawnFunction(funclib.bounceBack, kwargs={'vm': vm}, targetList=[hostID], count=1)
import sys from pyopus.parallel.mpi import MPI as VM # By default stdout is forwarded to the mpirun terminal import funclib from pyopus.parallel.base import MsgTaskExit, MsgTaskResult import os, time if __name__ == '__main__': # Startup dir must be the same as the one where funclib is located # so we can import it (funclib is not in PYTHONPATH). # MPI guarantees this by default, while PVM does not. vm = VM(startupDir=os.getcwd(), debug=2) # Get host list. hostIDs = vm.hosts() initialFreeSlots = vm.freeSlots() print("Hosts: ") for hostID in hostIDs: print(" " + str(hostID)) print("Free slots: " + str(initialFreeSlots)) # Spawn 2 tasks anywhere, send vm as argument with name 'vm'. # The spawned function must be defined in an importable module outside main .py file. print("\nSpawning 2 tasks, anywhere.") taskIDs = vm.spawnFunction(funclib.hello, kwargs={'vm': vm}, count=2) print("Spawned: ") for task in taskIDs: print " ", str(task) print("Free slots: " + str(vm.freeSlots()) + "\n")