I have an input tab separated text file:
0 .4
1 .9
2 .2
3 .12
4 .55
5 .98
I analyze it in plain Python as:
lines = open("songs.tsv").readlines()
def extract_hotness(line):
return float(line.split()[1])
songs_hotness =map(extract_hotness, lines)
max_hotness = max(songs_hotness)
How do I perform the same operation in parallel using mpi4py
?
I started implementing this with scatter
, but that won't work straight away because scatter
needs list elements to be the same length as the number of nodes.