Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Uri Groisman committed Oct 21, 2024
1 parent 74dae12 commit 525b224
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# test_clusterUY
# test_clusterUY
40 changes: 40 additions & 0 deletions matmul.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Importar los paquetes necesarios

using LinearAlgebra
# using BenchmarkTools

# Función para multiplicar dos matrices cuadradas
function multiplicar_matrices(A::Matrix{T}, B::Matrix{T}) where T
N = size(A, 1) # Suponemos que ambas matrices son de tamaño NxN
C = zeros(T, N, N) # Creamos una matriz de ceros para almacenar el resultado
for i in 1:N
for j in 1:N
for k in 1:N
C[i, j] += A[i, k] * B[k, j]
end
end
end
return C
end

# Ejemplo de uso
N = 14000 # Dimensión de las matrices cuadradas
println("N = ", N)
A = rand(N, N) # Matriz A de tamaño NxN con números aleatorios
println("arme A")
B = rand(N, N) # Matriz B de tamaño NxN con números aleatorios
println("arme b")
C = zeros(N, N)
println("arme C")

# Medición del tiempo usando el operador nativo de Julia (*)
println("Tiempo usando LinearAlgebra (*):")
@time C = A * B;
println(C[20, 20])

# Medición del tiempo del enfoque manual (bucles anidados)
println("Tiempo para la multiplicación manual:")
@time C = multiplicar_matrices(A, B)
println(C[20, 20])


12 changes: 12 additions & 0 deletions matmul.sbatch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash -l
#SBATCH --job-name=matmul
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=10
#SBATCH --mem=32G
#SBATCH --time=05:00:00
#SBATCH --partition=normal
#SBATCH --qos=normal
#SBATCH --mail-type=ALL
#SBATCH [email protected]

julia matmul.jl
10 changes: 10 additions & 0 deletions salida_14000x14000.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
N = 14000
arme A
arme b
arme C
Tiempo usando LinearAlgebra (*):
9.409567 seconds (2.14 M allocations: 1.603 GiB, 1.08% gc time, 8.95% compilation time)
3489.1522887785495
Tiempo para la multiplicación manual:
10402.710355 seconds (9.49 k allocations: 1.461 GiB, 0.00% gc time, 0.00% compilation time)
3489.152288778564
10 changes: 10 additions & 0 deletions salida_4000x4000.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
N = 4000
arme A
arme b
arme C
Tiempo para la multiplicación manual:
216.589781 seconds (11.35 k allocations: 122.957 MiB, 0.03% gc time, 0.01% compilation time)
991.0913115368476
Tiempo usando LinearAlgebra (*):
1.339358 seconds (2.13 M allocations: 267.497 MiB, 1.61% gc time, 68.92% compilation time)
991.091311536845
10 changes: 10 additions & 0 deletions salida_400x400.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
N = 400
arme A
arme b
arme C
Tiempo para la multiplicación manual:
0.111715 seconds (11.35 k allocations: 2.107 MiB, 28.37% compilation time)
97.87527321564951
Tiempo usando LinearAlgebra (*):
0.992404 seconds (2.13 M allocations: 146.647 MiB, 10.61% gc time, 99.15% compilation time)
97.87527321564959
10 changes: 10 additions & 0 deletions salida_40x40.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
N = 40
arme A
arme b
arme C
Tiempo para la multiplicación manual:
0.031069 seconds (11.35 k allocations: 920.234 KiB, 99.73% compilation time)
9.15874926841646
Tiempo usando LinearAlgebra (*):
0.966798 seconds (2.13 M allocations: 145.439 MiB, 10.29% gc time, 99.97% compilation time)
9.15874926841646
10 changes: 10 additions & 0 deletions test.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function f(x)

for i in 1:x
println(i, "Hola ClusterUY")
end

end


f(20)

0 comments on commit 525b224

Please sign in to comment.