Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MPI troubles.
#1
I am going to get 5 computers from my school. Why five? HPC cluster. Why HPC cluster? So I feel smart and that I'm actually doing something with my life. Anyways, they're just a bunch of 2012-2014 boxes. I know about clustering to receiving the computers because of some late night essay research. Unfortunately, I only know Python (not that its bad or anything) and must use MPI4PY (isn't actually a problem either, its just a lack of options on my end). For the last few days I've been trying to organize data sent to the master into a dictionary, with the the name of the node associated with the GFLOPs of the node (I know this isn't the best way to determine how good a given computer is, but I'm lazy). My idea is to create a one entry dictionary for on each node and send that to the master node which updates() it to the master dictionary. But, I can't figure out how to recv the data.

from mpi4py import MPI
import time

comm = MPI.COMM_WORLD #i dont wanna type alot
rank = comm.rank #i dont wanna type alot
size = comm.size #you know me :)
slavenodes = {} #this is so i can gather and store node and their FLOPS
stat = {} #one entry dict sent gathered from each node and merged with the slavenodes dictionary for workload distribution.

print ("My rank is: ", rank)


	
if comm.rank == 0: #grab one entry dictionary, add to master dictionary
	while len(slavenodes) < size:
		g = comm.gather(stat, root=0)
		slavenodes.update(g)
	print(slavenodes)
else: #calculate GFLOPS, create one entry dictionary with rank and GFLOPS, and send it to Master.
	float_increment = 1.03 #random
	start = 57.24 #random
	floating_point = start #reusing variables
	start = time.time() #start time
	for i in range(10 ** 6):
		floating_point += float_increment 
	end = time.time() #end time
	seconds = end - start
	giga = 10 ** 6
	flops = giga / seconds
	print ("I can run at", str(flops),"FLOPS. Actually, because Python is pretty slow, it is probably much more.")
	node = rank
	stat[node] = flops
	#comm.send(stat, dest=0,)
	print(stat)


I need GFLOPS and node rank because I plan to distribute workloads based on GFLOPS.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020