Multiplication matrix matrix MPI

hello guys, maybe a bit strange request, but could you help me write a matrix multiplication algorithm.
I’m quite new to parallel computing, but I have a task ahead of me with a very tight deadline.
So for now, all I can do is ask for help.
So far, all that I have been able to implement is the distribution of matrices across processes, but the multiplication logic itself cannot be done

using MPI

function split_count(N::Integer, n::Integer)
    q,r = divrem(N, n)
    return [i <= r ? q+1 : q for i = 1:n]

rank = MPI.Comm_rank(comm)
comm_size = MPI.Comm_size(comm)

root = 0

if rank == root
    N = 4

    A = rand(Float64, N, N)
    B = rand(Float64, N, N)
    println("series = ", A*B)
    result = similar(A)
    M_counts = [N for i = 1:comm_size]
    N_counts = split_count(N, comm_size)

    sizes = vcat(M_counts', N_counts')
    size_ubuf = UBuffer(sizes, 2)
    counts = vec(prod(sizes, dims=1))

    A_vbuf = VBuffer(A, counts)
    B_vbuf = VBuffer(B, counts)
    result_vbuf = VBuffer(result, counts)
    size_ubuf = UBuffer(nothing)
    result_vbuf = A_vbuf = VBuffer(nothing)
    B_vbuf = VBuffer(nothing)

local_size = MPI.Scatter(size_ubuf, NTuple{2,Int}, root, comm)
local_A = MPI.Scatterv!(A_vbuf, zeros(Float64, local_size), root, comm)
local_B = MPI.Scatterv!(B_vbuf, zeros(Float64, local_size), root, comm)


println("parallel = ", comp)

MPI.Gatherv!(comp, result_vbuf, root, comm)

if rank == root
    println("Final matrix")
    @show result

Have you considered just using a library like GitHub - JuliaParallel/Elemental.jl: Julia interface to the Elemental linear algebra library.?

unfortunately I don’t consider such options, the task is to write a program specifically on MPI

Is this some sort of homework problem (a task with a tight deadline for which you aren’t allowed to use existing tools out there)?


you can say so