mpi4py-examples icon indicating copy to clipboard operation
mpi4py-examples copied to clipboard

Executed the code but the error pops up.

Open LokeshPullagura opened this issue 5 years ago • 2 comments
trafficstars

When i executed the code, I got the error as stated below:

Traceback (most recent call last): File "MPI_Multiplication.py", line 75, in row = a[offset, :] IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

Can anyone help me in solving this issue?

Thanks in advance.

LokeshPullagura avatar Nov 27 '19 12:11 LokeshPullagura

in line 53 should cast result of divided to integer, as below

else:
    slice = int(numberRows / (worldSize-1))

mymindd avatar Feb 04 '20 08:02 mymindd

@mymindd As suggested, I have changed in the code, however another error pops up as below:

Traceback (most recent call last): File "/home/lokesh/PycharmProjects/mpi/MPI_Multiplication.py", line 118, in comm.Recv([res1, MPI.FLOAT], source=1, tag=1) File "mpi4py/MPI/Comm.pyx", line 285, in mpi4py.MPI.Comm.Recv mpi4py.MPI.Exception: Invalid rank, error stack: PMPI_Recv(171): MPI_Recv(buf=0x1a5a800, count=20000, MPI_FLOAT, src=1, tag=1, MPI_COMM_WORLD, status=0x1) failed PMPI_Recv(108): Invalid rank has value 1 but must be nonnegative and less than 1

Can you help me in this?

LokeshPullagura avatar Feb 04 '20 10:02 LokeshPullagura