Updated response
This commit is contained in:
parent
0a954e09da
commit
af5a611951
5 changed files with 44 additions and 3 deletions
BIN
Sheet5/Ex2_Second_Attempt.pdf
Normal file
BIN
Sheet5/Ex2_Second_Attempt.pdf
Normal file
Binary file not shown.
30
Sheet5/Ex2_Second_Attempt/Makefile
Normal file
30
Sheet5/Ex2_Second_Attempt/Makefile
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
#
|
||||||
|
# use GNU-Compiler tools
|
||||||
|
COMPILER=GCC_
|
||||||
|
# alternatively from the shell
|
||||||
|
# export COMPILER=GCC_
|
||||||
|
# or, alternatively from the shell
|
||||||
|
# make COMPILER=GCC_
|
||||||
|
|
||||||
|
# use Intel compilers
|
||||||
|
#COMPILER=ICC_
|
||||||
|
|
||||||
|
# use PGI compilers
|
||||||
|
# COMPILER=PGI_
|
||||||
|
EX=Ex2
|
||||||
|
|
||||||
|
SOURCES = main${EX}.cpp
|
||||||
|
OBJECTS = $(SOURCES:.cpp=.o)
|
||||||
|
|
||||||
|
PROGRAM = main.${COMPILER}
|
||||||
|
|
||||||
|
# uncomment the next to lines for debugging and detailed performance analysis
|
||||||
|
CXXFLAGS += -g -fopenmp
|
||||||
|
LINKFLAGS += -g -fopenmp -ltbb
|
||||||
|
# do not use -pg with PGI compilers
|
||||||
|
|
||||||
|
ifndef COMPILER
|
||||||
|
COMPILER=GCC_
|
||||||
|
endif
|
||||||
|
|
||||||
|
include ${COMPILER}default.mk
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
// #include <execution> // only include if the compiler supports it
|
#include <execution> // only include if the compiler supports it
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
@ -94,7 +94,7 @@ int main() {
|
||||||
"but my Mac's Clang compiler does not support parallel execution policies.\n";
|
"but my Mac's Clang compiler does not support parallel execution policies.\n";
|
||||||
|
|
||||||
// C++17 execution policy version
|
// C++17 execution policy version
|
||||||
/*
|
|
||||||
double t_ep_start = omp_get_wtime();
|
double t_ep_start = omp_get_wtime();
|
||||||
|
|
||||||
auto p = minmax_element(execution::par, v.begin(), v.end());
|
auto p = minmax_element(execution::par, v.begin(), v.end());
|
||||||
|
|
@ -140,6 +140,6 @@ int main() {
|
||||||
<< ", Harmonic mean: " << harm_ep << "\n";
|
<< ", Harmonic mean: " << harm_ep << "\n";
|
||||||
cout << "Standard deviation: " << std_ep << "\n";
|
cout << "Standard deviation: " << std_ep << "\n";
|
||||||
cout << "Elapsed time (s): " << t_ep_end - t_ep_start << "\n";
|
cout << "Elapsed time (s): " << t_ep_end - t_ep_start << "\n";
|
||||||
*/
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
Sheet5/Ex5_Second_Attempt.pdf
Normal file
BIN
Sheet5/Ex5_Second_Attempt.pdf
Normal file
Binary file not shown.
|
|
@ -1,4 +1,15 @@
|
||||||
|
UPDATE 2025-12-18
|
||||||
|
Ex2_Second_Attempt:
|
||||||
|
* Makefile missing [GH: added]
|
||||||
|
* execution::par : correct results and seems 6x faster on 8 cores.
|
||||||
|
|
||||||
|
Ex5_Second_Attempt:
|
||||||
|
* FEM assembling parallel OK
|
||||||
|
* no parallelization of GetDiag
|
||||||
|
* extra _omp version of JacobiSolve and two others
|
||||||
|
This is not necessary. Parallelize directly in the functions, also in vdop.cpp
|
||||||
|
See pdf Ex5_Second_Attempt.pdf
|
||||||
|
----------------------------
|
||||||
Summery of your results?!
|
Summery of your results?!
|
||||||
|
|
||||||
g++ -O3 -fopenmp mainEx1.cpp mylib.cpp -o dotprod
|
g++ -O3 -fopenmp mainEx1.cpp mylib.cpp -o dotprod
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue