From 525b224ff7fd0b18340c1d04c30d293a6ec292e6 Mon Sep 17 00:00:00 2001
From: Uri Groisman <uri@login.datos.cluster.uy>
Date: Mon, 21 Oct 2024 12:54:30 -0300
Subject: [PATCH] first commit

---
 README.md              |  1 +
 matmul.jl              | 40 ++++++++++++++++++++++++++++++++++++++++
 matmul.sbatch          | 12 ++++++++++++
 salida_14000x14000.out | 10 ++++++++++
 salida_4000x4000.out   | 10 ++++++++++
 salida_400x400.out     | 10 ++++++++++
 salida_40x40.out       | 10 ++++++++++
 test.jl                | 10 ++++++++++
 8 files changed, 103 insertions(+)
 create mode 100644 matmul.jl
 create mode 100644 matmul.sbatch
 create mode 100644 salida_14000x14000.out
 create mode 100644 salida_4000x4000.out
 create mode 100644 salida_400x400.out
 create mode 100644 salida_40x40.out
 create mode 100644 test.jl

diff --git a/README.md b/README.md
index f2ea0f6..5d3b4cd 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,2 @@
 # test_clusterUY
+# test_clusterUY
diff --git a/matmul.jl b/matmul.jl
new file mode 100644
index 0000000..eb1e129
--- /dev/null
+++ b/matmul.jl
@@ -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])
+
+
diff --git a/matmul.sbatch b/matmul.sbatch
new file mode 100644
index 0000000..b8ed710
--- /dev/null
+++ b/matmul.sbatch
@@ -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 --mail-user=urigro@gmail.com
+
+julia matmul.jl
diff --git a/salida_14000x14000.out b/salida_14000x14000.out
new file mode 100644
index 0000000..f827125
--- /dev/null
+++ b/salida_14000x14000.out
@@ -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
diff --git a/salida_4000x4000.out b/salida_4000x4000.out
new file mode 100644
index 0000000..d7cbbda
--- /dev/null
+++ b/salida_4000x4000.out
@@ -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
diff --git a/salida_400x400.out b/salida_400x400.out
new file mode 100644
index 0000000..bd71546
--- /dev/null
+++ b/salida_400x400.out
@@ -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
diff --git a/salida_40x40.out b/salida_40x40.out
new file mode 100644
index 0000000..5b690c0
--- /dev/null
+++ b/salida_40x40.out
@@ -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
diff --git a/test.jl b/test.jl
new file mode 100644
index 0000000..863789f
--- /dev/null
+++ b/test.jl
@@ -0,0 +1,10 @@
+function f(x)
+
+  for i in 1:x
+    println(i, "Hola ClusterUY")
+  end
+
+end
+
+
+f(20)