Skip to content

Commit dbcabf9

Browse files
committed
Minor changes
1 parent 57fd341 commit dbcabf9

File tree

5 files changed

+36
-7
lines changed

5 files changed

+36
-7
lines changed

scripts/profiling_memory_and_time.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
profile = LineProfiler()
2525
profile.add_function(parallel_tridiag_eigen)
26-
26+
os.makedirs("Profiling_files", exist_ok=True) # to save the outputs of profiling
2727

2828
seed = 1000
2929
np.random.seed(seed)
@@ -91,6 +91,7 @@
9191
mem_after_lanczos = proc.memory_info().rss / 1024 / 1024 # MB
9292
delta_mem_lanczos = mem_after_lanczos - mem_before_lanczos
9393
delta_t_lanczos = end_lanczos - begin_lanczos
94+
print(f'delta_t_lanczos: {delta_t_lanczos:.4f} s')
9495

9596
print("Done. Now computing eigenvalues...")
9697
else:
@@ -214,6 +215,15 @@
214215
label="SciPy",
215216
)
216217

218+
lanczos_avg = df.groupby("matrix_size")["mem_lanczos_mb"].mean()
219+
plt.plot(
220+
lanczos_avg.index,
221+
lanczos_avg.values,
222+
marker="*",
223+
linestyle="-",
224+
label="Lanczos",
225+
)
226+
217227
for nproc in nproc_values:
218228
subset = df[df["n_processes"] == nproc].sort_values("matrix_size")
219229
label = f"Divide et impera ({nproc} proc{'s' if nproc > 1 else ''})"
@@ -265,6 +275,15 @@
265275
label="SciPy",
266276
)
267277

278+
lanczos_avg = df.groupby("matrix_size")["time_lanczos"].mean()
279+
plt.plot(
280+
lanczos_avg.index,
281+
lanczos_avg.values,
282+
marker="*",
283+
linestyle="-",
284+
label="Lanczos",
285+
)
286+
268287
for nproc in nproc_values:
269288
subset = df[df["n_processes"] == nproc].sort_values("matrix_size")
270289
label = f"Divide et impera ({nproc} proc{'s' if nproc > 1 else ''})"

shell/submit.sbatch

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ last_nproc="${n_processes[-1]}"
4040

4141
CONFIG_FILE="experiments/config.yaml"
4242

43-
#rm -rf logs
44-
echo "IMPORTANT: please remember to delete the logs folder before calling this script."
43+
mkdir -p logs
44+
rm logs/*
45+
mkdir -p Profiling_files
46+
rm Profiling_files/*
4547

4648
# Backup the original config
4749
cp $CONFIG_FILE ${CONFIG_FILE}.bak

shell/submit.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ last_nproc="${n_processes[-1]}"
99

1010
CONFIG_FILE="experiments/config.yaml"
1111

12-
#rm -rf logs
13-
echo "IMPORTANT: please remember to delete the logs folder before calling this script."
12+
mkdir -p logs
13+
rm logs/*
14+
mkdir -p Profiling_files
15+
rm Profiling_files/*
1416

1517
# Backup the original config
1618
cp $CONFIG_FILE ${CONFIG_FILE}.bak

shell/time_profile.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@
33
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
44
python_script="$SCRIPT_DIR/../scripts/profiling_memory_and_time.py"
55
profiling_files="$SCRIPT_DIR/../Profiling_files/"*
6+
CONFIG_FOLDER="$SCRIPT_DIR/../experiments"
7+
CONFIG_FILE="$CONFIG_FOLDER/config.yaml"
68

9+
echo "Please pass as input the following arguments: 1) number of processes 2) matrix size"
710
echo "Cleaning the Profiling_files folder"
811
rm -f $profiling_files
912

10-
echo "Running with $1 process(es)"
13+
cp "${CONFIG_FILE}" "${CONFIG_FOLDER}/config.bak"
14+
sed -i "s/^dim: .*/dim: $2/" $CONFIG_FILE
15+
mv "${CONFIG_FOLDER}/config.bak" "${CONFIG_FILE}"
16+
17+
echo "Running with $1 process(es) with a matrix of size $2"
1118
mpirun -np "$1" python "$python_script"

src/pyclassify/parallel_tridiag_eigen.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def find_interval_extreme(total_dimension, n_processor):
4949
return counts, displs
5050

5151

52-
# @profile
5352
def parallel_tridiag_eigen(
5453
diag,
5554
off,

0 commit comments

Comments
 (0)