Here is my dataset in rank 0, and I want to send it to another rank by using Send after converting it to NumPy array.
data = [['zzz', '2', '-1'], ['xxx', '5', '-99'], ['zzz', '2', '-1']]
I tried many string datatype when converting to a NumPy array, but it doesn't work.
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()
if rank == 0:
data = [['zzz', '2', '-1'], ['xxx', '5', '-99'], ['zzz', '2', '-1']]
data_arr = np.array(data, dtype='S13')
comm.Send(data, dest=1, tag=10)
else:
data_arr = np.empty(shape=(3,3),dtype='S13')
comm.Recv(data_arr, source=0, tag=10)
I know send and recv (lower) can handle this, but I am still wondering it is possible to passing array or list of string by using Send and Recv.
Many thanks!