Memory Required for Large Matrices

This table shows how much memory is required for four matrices of the given size and type. (We need four matrices: A, B, C1, and C2.)

Matrix SizeFloat64 MemoryFloat32 MemoryInt64 MemoryInt32 Memory
1k by 1k0.03 GiB0.01 GiB0.03 GiB0.01 GiB
2k by 2k0.12 GiB0.06 GiB0.12 GiB0.06 GiB
3k by 3k0.27 GiB0.13 GiB0.27 GiB0.13 GiB
4k by 4k0.48 GiB0.24 GiB0.48 GiB0.24 GiB
5k by 5k0.75 GiB0.37 GiB0.75 GiB0.37 GiB
6k by 6k1.07 GiB0.54 GiB1.07 GiB0.54 GiB
7k by 7k1.46 GiB0.73 GiB1.46 GiB0.73 GiB
8k by 8k1.91 GiB0.95 GiB1.91 GiB0.95 GiB
9k by 9k2.41 GiB1.21 GiB2.41 GiB1.21 GiB
10k by 10k2.98 GiB1.49 GiB2.98 GiB1.49 GiB
11k by 11k3.61 GiB1.8 GiB3.61 GiB1.8 GiB
12k by 12k4.29 GiB2.15 GiB4.29 GiB2.15 GiB
13k by 13k5.04 GiB2.52 GiB5.04 GiB2.52 GiB
14k by 14k5.84 GiB2.92 GiB5.84 GiB2.92 GiB
15k by 15k6.71 GiB3.35 GiB6.71 GiB3.35 GiB
16k by 16k7.63 GiB3.81 GiB7.63 GiB3.81 GiB
17k by 17k8.61 GiB4.31 GiB8.61 GiB4.31 GiB
18k by 18k9.66 GiB4.83 GiB9.66 GiB4.83 GiB
19k by 19k10.76 GiB5.38 GiB10.76 GiB5.38 GiB
20k by 20k11.92 GiB5.96 GiB11.92 GiB5.96 GiB
30k by 30k26.82 GiB13.41 GiB26.82 GiB13.41 GiB
40k by 40k47.68 GiB23.84 GiB47.68 GiB23.84 GiB
50k by 50k74.51 GiB37.25 GiB74.51 GiB37.25 GiB
60k by 60k107.29 GiB53.64 GiB107.29 GiB53.64 GiB
70k by 70k146.03 GiB73.02 GiB146.03 GiB73.02 GiB
80k by 80k190.73 GiB95.37 GiB190.73 GiB95.37 GiB
90k by 90k241.4 GiB120.7 GiB241.4 GiB120.7 GiB
100k by 100k298.02 GiB149.01 GiB298.02 GiB149.01 GiB

Generating These Tables

mem_req(s, ::Type{T}) where {T} = 4s^2*sizeof(T) / (1 << 30)

function print_table(types::Vector{DataType}, Ns = nothing)
    println("| Matrix Size | $(join(types, " Memory | ")) Memory |")
    println("| ----------- | $(repeat(" ------ |", length(types)))")
    if Ns isa Nothing
        _Ns = sort(unique(vcat(collect(1:1:20), collect(20:10:100))))
    else
        _Ns = Ns
    end
    for N in _Ns
        mem = mem_req.(N * 1_000, types)
        m = round.(mem; digits = 2)
        println("| $(N)k by $(N)k | $(join(m, " GiB | ")) GiB |")
    end
    return nothing
end
julia> print_table([Float64, Float32, Int64, Int32])