Skip to content

Commit

Permalink
modified plots generated in numerical_analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya Dendukuri committed Jun 18, 2024
1 parent c74f3f2 commit bdcb3a0
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 35 deletions.
5 changes: 2 additions & 3 deletions test/unit/linear_algebra/test_lapacke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const std::size_t number_of_runs = 100;
/// sizes to check consistency
TEST(LapackeTest, SinglePrecision)
{
std::size_t sizes[5] = { 500, 1000, 10000, 100000, 1000000 };
std::size_t sizes[5] = { 1000, 10000, 100000, 1000000, 10000000 };
vecf errors(5, 0);
vecd times(5, 0);

Expand Down Expand Up @@ -91,8 +91,7 @@ TEST(LapackeTest, SinglePrecision)
/// sizes to check consistency
TEST(LapackeTest, DoublePrecision)
{
std::size_t sizes[5] = { 500, 1000, 10000, 100000, 1000000 };

std::size_t sizes[5] = { 1000, 10000, 100000, 1000000, 10000000 };
vecd errors(5, 0);
vecd times(5, 0);
for (std::size_t i = 0; i < 5; i++)
Expand Down
4 changes: 2 additions & 2 deletions test/unit/linear_algebra/test_tridiagonal_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const std::size_t number_of_runs = 100;
/// sizes to check consistency
TEST(TridiagSolveTest, SinglePrecision)
{
std::size_t sizes[5] = { 500, 1000, 10000, 100000, 1000000 };
std::size_t sizes[5] = { 1000, 10000, 100000, 1000000, 10000000 };
float error = 0;
vecd errors(5, 0);
vecd times(5, 0);
Expand Down Expand Up @@ -81,7 +81,7 @@ TEST(TridiagSolveTest, SinglePrecision)
/// sizes to check consistency
TEST(TridiagSolveTest, DoublePrecision)
{
std::size_t sizes[5] = { 500, 1000, 10000, 100000, 1000000 };
std::size_t sizes[5] = { 1000, 10000, 100000, 1000000, 10000000 };
vecd errors(5, 0);
vecd times(5, 0);
for (std::size_t i = 0; i < 5; i++)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
3.30626e-17 0.417286
3.28675e-17 0.0167708
3.29103e-17 0.168244
3.2997e-17 1.69772
3.29721e-17 17.5553
3.29913e-17 0.0176367
3.30137e-17 0.175568
3.29986e-17 1.73411
3.29744e-17 17.864
3.29784e-17 188.188
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
1.61305e-08 0.0735512
1.63403e-08 0.031625
1.62899e-08 0.315323
1.62863e-08 3.16128
1.62782e-08 19.8034
1.63141e-08 0.0319062
1.62981e-08 0.315242
1.63017e-08 3.15343
1.62755e-08 18.4041
1.63076e-08 166.735
20 changes: 10 additions & 10 deletions tool/numerical_analysis/tridiagonal_solver/plot_analysis.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using DataFrames, CSV, StatsPlots


sizes = [500, 1000, 10000, 100000, 1000000]
sizes = [1000, 10000, 100000, 1000000, 10000000]

f1=DataFrame(CSV.File("lapacke_single_precision.dat", delim=" ", header=false))
f2=DataFrame(CSV.File("lapacke_double_precision.dat", delim=" ", header=false))
Expand All @@ -22,11 +22,11 @@ tuvx_errors_double_precision = f4[:, 1]
tuvx_times_double_precision = f4[:, 2]

#scatter plots
#scatter(lapack_times_single_precision, lapack_errors_single_precision, label="LAPACKE SINGLE PRECISION")
scatter(lapack_times_double_precision, lapack_errors_double_precision, label="LAPACKE DOUBLE PRECISION")
scatter!(tuvx_times_double_precision, tuvx_errors_double_precision, label="TUV-X SINGLE PRECISION")
#scatter!(tuvx_times_single_precision, tuvx_errors_single_precision, label="TUV-X DOUBLE PRECISION")
savefig("scatter.png")
bar(string.(sizes), lapack_errors_single_precision.-tuvx_errors_single_precision)
savefig("single_errors.png")

bar(string.(sizes), lapack_errors_double_precision.-tuvx_errors_double_precision)
savefig("double_errors.png")


# bar plots
Expand All @@ -40,14 +40,14 @@ data = [lapack_errors_single_precision; tuvx_errors_single_precision]
groups = repeat(["LAPACKE", "TUV-X"], inner = 5)
plot(groupedbar(nam, data, groups=groups))
title!("Comparing Accuracy (Single Precision)")
xlabel!("System Size")
ylabel!("Relative Error")
xlabel!("System Size")
savefig("single_precision_errors.png")

data = [lapack_times_single_precision; tuvx_times_single_precision]
data = [lapack_times_single_precision ./ sizes; tuvx_times_single_precision ./ sizes]
groups = repeat(["LAPACKE", "TUV-X"], inner = 5)
plot(groupedbar(nam, data, groups=groups), yaxis=:log)
title!("Comparing Speed (Double Precision)")
title!("Comparing Speed (Single Precision)")
xlabel!("System Size")
ylabel!("Run Time (ms)")
savefig("single_precision_times.png")
Expand All @@ -60,7 +60,7 @@ xlabel!("System Size")
ylabel!("Relative Error")
savefig("double_precision_errors.png")

data = [lapack_times_double_precision; tuvx_times_double_precision]
data = [lapack_times_double_precision ./ sizes; tuvx_times_double_precision ./ sizes]
groups = repeat(["LAPACKE", "TUV-X"], inner = 5)
plot(groupedbar(nam, data, groups=groups), yaxis=:log)
title!("Comparing Speed (Double Precision)")
Expand Down
Binary file modified tool/numerical_analysis/tridiagonal_solver/scatter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
3.25666e-17 0.00575997
3.27243e-17 0.0106145
3.30318e-17 0.108197
3.29515e-17 1.66856
3.29829e-17 15.1904
3.30033e-17 0.0106112
3.29421e-17 0.108319
3.29942e-17 1.68017
3.29831e-17 15.0755
3.29797e-17 146.831
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
1.61895e-08 0.00851904
1.61348e-08 0.0169347
1.63005e-08 0.221691
1.62871e-08 2.28039
1.62731e-08 14.3214
1.61746e-08 0.016908
1.62785e-08 0.227215
1.62936e-08 2.232
1.62759e-08 16.4258
1.63053e-08 107.242

0 comments on commit bdcb3a0

Please sign in to comment.