Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
CTA-LAPP
PHOENIX_LIBS
PhoenixPerformance
Commits
93eecfff
Commit
93eecfff
authored
Jan 08, 2021
by
Pierre Aubert
Browse files
Add saxpy and hadamard product test perf
parent
d153d6e3
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
316 additions
and
4 deletions
+316
-4
CMakeLists.txt
CMakeLists.txt
+4
-1
README.md
README.md
+1
-0
cmake/phoenix_base_project.cmake
cmake/phoenix_base_project.cmake
+3
-2
src/CMakeLists.txt
src/CMakeLists.txt
+3
-0
src/cpp20/CMakeLists.txt
src/cpp20/CMakeLists.txt
+2
-1
src/cpp20/Parallel/CMakeLists.txt
src/cpp20/Parallel/CMakeLists.txt
+2
-0
src/cpp20/Parallel/hadamard/CMakeLists.txt
src/cpp20/Parallel/hadamard/CMakeLists.txt
+20
-0
src/cpp20/Parallel/hadamard/hadamard.cpp
src/cpp20/Parallel/hadamard/hadamard.cpp
+27
-0
src/cpp20/Parallel/hadamard/hadamard.h
src/cpp20/Parallel/hadamard/hadamard.h
+15
-0
src/cpp20/Parallel/hadamard/main.cpp
src/cpp20/Parallel/hadamard/main.cpp
+34
-0
src/cpp20/Parallel/saxpy/CMakeLists.txt
src/cpp20/Parallel/saxpy/CMakeLists.txt
+20
-0
src/cpp20/Parallel/saxpy/main.cpp
src/cpp20/Parallel/saxpy/main.cpp
+35
-0
src/cpp20/Parallel/saxpy/saxpy.cpp
src/cpp20/Parallel/saxpy/saxpy.cpp
+28
-0
src/cpp20/Parallel/saxpy/saxpy.h
src/cpp20/Parallel/saxpy/saxpy.h
+0
-0
src/cpp20/Sequential/CMakeLists.txt
src/cpp20/Sequential/CMakeLists.txt
+6
-0
src/cpp20/Sequential/hadamard/CMakeLists.txt
src/cpp20/Sequential/hadamard/CMakeLists.txt
+20
-0
src/cpp20/Sequential/hadamard/hadamard.cpp
src/cpp20/Sequential/hadamard/hadamard.cpp
+27
-0
src/cpp20/Sequential/hadamard/hadamard.h
src/cpp20/Sequential/hadamard/hadamard.h
+15
-0
src/cpp20/Sequential/hadamard/main.cpp
src/cpp20/Sequential/hadamard/main.cpp
+34
-0
src/cpp20/Sequential/saxpy/CMakeLists.txt
src/cpp20/Sequential/saxpy/CMakeLists.txt
+20
-0
No files found.
CMakeLists.txt
View file @
93eecfff
...
...
@@ -3,15 +3,18 @@ cmake_minimum_required(VERSION 2.8)
add_subdirectory
(
cmake
)
find_package
(
TBB COMPONENTS tbb REQUIRED
)
phoenix_base_project
(
"PhoenixPerformance"
"1.4.1"
"Set of performance test"
"https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/PhoenixPerformance"
)
pull_extra_module
(
"MicroBenchmark"
"https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/MicroBenchmark.git"
)
pull_extra_module
(
"TensorAlloc"
"https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS/TensorAlloc.git"
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
${
CMAKE_CURRENT_BINARY_DIR
}
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/src
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/src
${
TBB_TBB_INCLUDE_DIRS
}
)
add_subdirectory
(
src
)
...
...
README.md
View file @
93eecfff
...
...
@@ -16,6 +16,7 @@ https://cta-lapp.pages.in2p3.fr//PHOENIX_LIBS/PhoenixPerformance/
-
c++ compiler >=5.3.1
-
cmake > 3
-
make
-
libtbb, libtbb-dev
# Installation for Users
...
...
cmake/phoenix_base_project.cmake
View file @
93eecfff
...
...
@@ -32,9 +32,10 @@ function(phoenix_base_project programName programVersion programDescritpion prog
message
(
STATUS
"Build for tests COVERAGE"
)
set
(
CTEST_COVERAGE_COMMAND
"gcov"
)
set
(
SELF_TESTS_MODE yes
)
set
(
CMAKE_CXX_FLAGS
"--std=c++20 -Wall -Werror -g -O0 -fprofile-arcs -ftest-coverage"
PARENT_SCOPE
)
# --std=c++2a is to enable C++20
set
(
CMAKE_CXX_FLAGS
"--std=c++2a -Wall -Werror -g -O0 -fprofile-arcs -ftest-coverage"
PARENT_SCOPE
)
else
()
set
(
CMAKE_CXX_FLAGS
"--std=c++2
0
-Wall -Werror -g -O2"
PARENT_SCOPE
)
set
(
CMAKE_CXX_FLAGS
"--std=c++2
a
-Wall -Werror -g -O2"
PARENT_SCOPE
)
endif
()
add_definitions
(
-D__PROGRAM_VERSION__=
"
${
PROGRAM_VERSION
}
"
)
...
...
src/CMakeLists.txt
View file @
93eecfff
project
(
Phoenix
)
cmake_minimum_required
(
VERSION 2.8
)
remove_definitions
(
-O3
)
set
(
EXTRA_DEPENDENCIES tensor_alloc data_stream TBB::tbb
)
add_subdirectory
(
cpp20
)
src/cpp20/CMakeLists.txt
View file @
93eecfff
project
(
Phoenix
)
cmake_minimum_required
(
VERSION 2.8
)
add_subdirectory
(
saxpy
)
add_subdirectory
(
Sequential
)
add_subdirectory
(
Parallel
)
src/cpp20/
saxpy
/CMakeLists.txt
→
src/cpp20/
Parallel
/CMakeLists.txt
View file @
93eecfff
project
(
Phoenix
)
cmake_minimum_required
(
VERSION 2.8
)
add_subdirectory
(
hadamard
)
add_subdirectory
(
saxpy
)
src/cpp20/Parallel/hadamard/CMakeLists.txt
0 → 100644
View file @
93eecfff
project
(
Phoenix
)
cmake_minimum_required
(
VERSION 2.8
)
set
(
CONFIG_HADAMARD
"1000, 2000, 3000, 4000, 5000, 10000, 50000, 100000, 200000, 500000, 1000000, 5000000, 10000000"
)
set
(
progSrc hadamard.cpp main.cpp
)
phoenix_compileAndRunExample
(
perf_hadamard_par_O0
"-O0"
"
${
CONFIG_HADAMARD
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_hadamard_par_O1
"-O1"
"
${
CONFIG_HADAMARD
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_hadamard_par_O2
"-O2"
"
${
CONFIG_HADAMARD
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_hadamard_par_O3
"-O3"
"
${
CONFIG_HADAMARD
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_hadamard_par_Ofast
"-Ofast"
"
${
CONFIG_HADAMARD
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_hadamard_par_vectorize_O3
"-O3 -ftree-vectorize -march=native -mtune=native -mavx2"
"
${
CONFIG_HADAMARD
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_hadamard_par_vectorize_Ofast
"-Ofast -ftree-vectorize -march=native -mtune=native -mavx2"
"
${
CONFIG_HADAMARD
}
"
${
progSrc
}
)
phoenix_plotPerfLogX
(
"hadamard_parBase"
perf_hadamard_par_O0 perf_hadamard_par_O1 perf_hadamard_par_O2 perf_hadamard_par_O3 perf_hadamard_par_Ofast
)
phoenix_plotPerfLogX
(
"hadamard_parVectorize"
perf_hadamard_par_O3 perf_hadamard_par_vectorize_O3 perf_hadamard_par_vectorize_Ofast
)
src/cpp20/Parallel/hadamard/hadamard.cpp
0 → 100644
View file @
93eecfff
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
//some doc at : https://en.cppreference.com/w/cpp/header/algorithm
#include <algorithm>
//Some doc at : https://en.cppreference.com/w/cpp/header/execution
#include <execution>
#include "hadamard.h"
///Do a classical hadamard product
/** @param[out] tabRes : table of the result
* @param tabX : talbe of x values
* @param tabY : table of y values
* @param nbElement : number of elements in the tables
*/
void
hadamard_product
(
float
*
tabRes
,
const
float
*
tabX
,
const
float
*
tabY
,
size_t
nbElement
){
std
::
transform
(
std
::
execution
::
par_unseq
,
tabX
,
tabX
+
nbElement
,
tabY
,
tabRes
,
[
=
](
float
xi
,
float
yi
){
return
xi
*
yi
;
});
}
src/cpp20/Parallel/hadamard/hadamard.h
0 → 100644
View file @
93eecfff
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
#ifndef __HADAMARD_PRODUCT_H__
#define __HADAMARD_PRODUCT_H__
#include <iostream>
void
hadamard_product
(
float
*
tabRes
,
const
float
*
tabX
,
const
float
*
tabY
,
size_t
nbElement
);
#endif
src/cpp20/Parallel/hadamard/main.cpp
0 → 100644
View file @
93eecfff
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
#include <iostream>
#include "micro_benchmark.h"
#include "PTensor.h"
#include "hadamard.h"
///Get the number of nanoseconds per elements
/** @param nbElement : number of elements of the tables
*/
void
evaluateHadamardProduct
(
size_t
nbElement
){
PTensor
<
float
>
tabX
(
AllocMode
::
ALIGNED
,
nbElement
);
PTensor
<
float
>
tabY
(
AllocMode
::
ALIGNED
,
nbElement
);
PTensor
<
float
>
tabRes
(
AllocMode
::
ALIGNED
,
nbElement
);
for
(
size_t
i
(
0lu
);
i
<
nbElement
;
++
i
){
tabX
[
i
]
=
i
*
19lu
%
11
;
tabY
[
i
]
=
i
*
27lu
%
19
;
}
micro_benchmarkAutoNsPrint
(
"evaluate hadamard"
,
nbElement
,
hadamard_product
,
tabRes
.
getData
(),
tabX
.
getData
(),
tabY
.
getData
(),
nbElement
);
}
int
main
(
int
argc
,
char
**
argv
){
return
micro_benchmarkParseArg
(
argc
,
argv
,
evaluateHadamardProduct
);
}
src/cpp20/Parallel/saxpy/CMakeLists.txt
0 → 100644
View file @
93eecfff
project
(
Phoenix
)
cmake_minimum_required
(
VERSION 2.8
)
set
(
CONFIG_SAXPY
"1000, 2000, 3000, 4000, 5000, 10000, 50000, 100000, 200000, 500000, 1000000, 5000000, 10000000"
)
set
(
progSrc saxpy.cpp main.cpp
)
phoenix_compileAndRunExample
(
perf_saxpy_par_O0
"-O0"
"
${
CONFIG_SAXPY
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_saxpy_par_O1
"-O1"
"
${
CONFIG_SAXPY
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_saxpy_par_O2
"-O2"
"
${
CONFIG_SAXPY
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_saxpy_par_O3
"-O3"
"
${
CONFIG_SAXPY
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_saxpy_par_Ofast
"-Ofast"
"
${
CONFIG_SAXPY
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_saxpy_par_vectorize_O3
"-O3 -ftree-vectorize -march=native -mtune=native -mavx2"
"
${
CONFIG_SAXPY
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_saxpy_par_vectorize_Ofast
"-Ofast -ftree-vectorize -march=native -mtune=native -mavx2"
"
${
CONFIG_SAXPY
}
"
${
progSrc
}
)
phoenix_plotPerfLogX
(
"saxpy_parBase"
perf_saxpy_par_O0 perf_saxpy_par_O1 perf_saxpy_par_O2 perf_saxpy_par_O3 perf_saxpy_par_Ofast
)
phoenix_plotPerfLogX
(
"saxpy_parVectorize"
perf_saxpy_par_O3 perf_saxpy_par_vectorize_O3 perf_saxpy_par_vectorize_Ofast
)
src/cpp20/Parallel/saxpy/main.cpp
0 → 100644
View file @
93eecfff
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
#include <iostream>
#include "micro_benchmark.h"
#include "PTensor.h"
#include "saxpy.h"
///Get the number of nanoseconds per elements
/** @param nbElement : number of elements of the tables
*/
void
evaluateHadamardProduct
(
size_t
nbElement
){
PTensor
<
float
>
tabX
(
AllocMode
::
ALIGNED
,
nbElement
);
PTensor
<
float
>
tabY
(
AllocMode
::
ALIGNED
,
nbElement
);
PTensor
<
float
>
tabRes
(
AllocMode
::
ALIGNED
,
nbElement
);
for
(
size_t
i
(
0lu
);
i
<
nbElement
;
++
i
){
tabX
[
i
]
=
i
*
19lu
%
11
;
tabY
[
i
]
=
i
*
27lu
%
19
;
}
float
scal
(
3.0
f
);
micro_benchmarkAutoNsPrint
(
"evaluate saxpy"
,
nbElement
,
saxpy
,
tabRes
.
getData
(),
tabX
.
getData
(),
tabY
.
getData
(),
scal
,
nbElement
);
}
int
main
(
int
argc
,
char
**
argv
){
return
micro_benchmarkParseArg
(
argc
,
argv
,
evaluateHadamardProduct
);
}
src/cpp20/Parallel/saxpy/saxpy.cpp
0 → 100644
View file @
93eecfff
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
//some doc at : https://en.cppreference.com/w/cpp/header/algorithm
#include <algorithm>
//Some doc at : https://en.cppreference.com/w/cpp/header/execution
#include <execution>
#include "saxpy.h"
///Do a classical saxpy
/** @param[out] tabRes : table of the result
* @param tabX : talbe of x values
* @param tabY : table of y values
* @param scal : scalar which multiplies tabX
* @param nbElement : number of elements in the tables
*/
void
saxpy
(
float
*
tabRes
,
const
float
*
tabX
,
const
float
*
tabY
,
float
scal
,
size_t
nbElement
){
std
::
transform
(
std
::
execution
::
par_unseq
,
tabX
,
tabX
+
nbElement
,
tabY
,
tabRes
,
[
=
](
float
xi
,
float
yi
){
return
scal
*
xi
+
yi
;
});
}
src/cpp20/saxpy/saxpy.h
→
src/cpp20/
Parallel/
saxpy/saxpy.h
View file @
93eecfff
File moved
src/cpp20/Sequential/CMakeLists.txt
0 → 100644
View file @
93eecfff
project
(
Phoenix
)
cmake_minimum_required
(
VERSION 2.8
)
add_subdirectory
(
hadamard
)
add_subdirectory
(
saxpy
)
src/cpp20/Sequential/hadamard/CMakeLists.txt
0 → 100644
View file @
93eecfff
project
(
Phoenix
)
cmake_minimum_required
(
VERSION 2.8
)
set
(
CONFIG_HADAMARD
"1000, 2000, 3000, 4000, 5000, 10000"
)
set
(
progSrc hadamard.cpp main.cpp
)
phoenix_compileAndRunExample
(
perf_hadamard_seq_O0
"-O0"
"
${
CONFIG_HADAMARD
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_hadamard_seq_O1
"-O1"
"
${
CONFIG_HADAMARD
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_hadamard_seq_O2
"-O2"
"
${
CONFIG_HADAMARD
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_hadamard_seq_O3
"-O3"
"
${
CONFIG_HADAMARD
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_hadamard_seq_Ofast
"-Ofast"
"
${
CONFIG_HADAMARD
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_hadamard_seq_vectorize_O3
"-O3 -ftree-vectorize -march=native -mtune=native -mavx2"
"
${
CONFIG_HADAMARD
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_hadamard_seq_vectorize_Ofast
"-Ofast -ftree-vectorize -march=native -mtune=native -mavx2"
"
${
CONFIG_HADAMARD
}
"
${
progSrc
}
)
phoenix_plotPerf
(
"hadamard_seqBase"
perf_hadamard_seq_O0 perf_hadamard_seq_O1 perf_hadamard_seq_O2 perf_hadamard_seq_O3 perf_hadamard_seq_Ofast
)
phoenix_plotPerf
(
"hadamard_seqVectorize"
perf_hadamard_seq_O3 perf_hadamard_seq_vectorize_O3 perf_hadamard_seq_vectorize_Ofast
)
src/cpp20/Sequential/hadamard/hadamard.cpp
0 → 100644
View file @
93eecfff
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
//some doc at : https://en.cppreference.com/w/cpp/header/algorithm
#include <algorithm>
//Some doc at : https://en.cppreference.com/w/cpp/header/execution
#include <execution>
#include "hadamard.h"
///Do a classical hadamard product
/** @param[out] tabRes : table of the result
* @param tabX : talbe of x values
* @param tabY : table of y values
* @param nbElement : number of elements in the tables
*/
void
hadamard_product
(
float
*
tabRes
,
const
float
*
tabX
,
const
float
*
tabY
,
size_t
nbElement
){
std
::
transform
(
std
::
execution
::
seq
,
tabX
,
tabX
+
nbElement
,
tabY
,
tabRes
,
[
=
](
float
xi
,
float
yi
){
return
xi
*
yi
;
});
}
src/cpp20/Sequential/hadamard/hadamard.h
0 → 100644
View file @
93eecfff
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
#ifndef __HADAMARD_PRODUCT_H__
#define __HADAMARD_PRODUCT_H__
#include <iostream>
void
hadamard_product
(
float
*
tabRes
,
const
float
*
tabX
,
const
float
*
tabY
,
size_t
nbElement
);
#endif
src/cpp20/Sequential/hadamard/main.cpp
0 → 100644
View file @
93eecfff
/***************************************
Auteur : Pierre Aubert
Mail : aubertp7@gmail.com
Licence : CeCILL-C
****************************************/
#include <iostream>
#include "micro_benchmark.h"
#include "PTensor.h"
#include "hadamard.h"
///Get the number of nanoseconds per elements
/** @param nbElement : number of elements of the tables
*/
void
evaluateHadamardProduct
(
size_t
nbElement
){
PTensor
<
float
>
tabX
(
AllocMode
::
ALIGNED
,
nbElement
);
PTensor
<
float
>
tabY
(
AllocMode
::
ALIGNED
,
nbElement
);
PTensor
<
float
>
tabRes
(
AllocMode
::
ALIGNED
,
nbElement
);
for
(
size_t
i
(
0lu
);
i
<
nbElement
;
++
i
){
tabX
[
i
]
=
i
*
19lu
%
11
;
tabY
[
i
]
=
i
*
27lu
%
19
;
}
micro_benchmarkAutoNsPrint
(
"evaluate hadamard"
,
nbElement
,
hadamard_product
,
tabRes
.
getData
(),
tabX
.
getData
(),
tabY
.
getData
(),
nbElement
);
}
int
main
(
int
argc
,
char
**
argv
){
return
micro_benchmarkParseArg
(
argc
,
argv
,
evaluateHadamardProduct
);
}
src/cpp20/Sequential/saxpy/CMakeLists.txt
0 → 100644
View file @
93eecfff
project
(
Phoenix
)
cmake_minimum_required
(
VERSION 2.8
)
set
(
CONFIG_SAXPY
"1000, 2000, 3000, 4000, 5000, 10000"
)
set
(
progSrc saxpy.cpp main.cpp
)
phoenix_compileAndRunExample
(
perf_saxpy_seq_O0
"-O0"
"
${
CONFIG_SAXPY
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_saxpy_seq_O1
"-O1"
"
${
CONFIG_SAXPY
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_saxpy_seq_O2
"-O2"
"
${
CONFIG_SAXPY
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_saxpy_seq_O3
"-O3"
"
${
CONFIG_SAXPY
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_saxpy_seq_Ofast
"-Ofast"
"
${
CONFIG_SAXPY
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_saxpy_seq_vectorize_O3
"-O3 -ftree-vectorize -march=native -mtune=native -mavx2"
"
${
CONFIG_SAXPY
}
"
${
progSrc
}
)
phoenix_compileAndRunExample
(
perf_saxpy_seq_vectorize_Ofast
"-Ofast -ftree-vectorize -march=native -mtune=native -mavx2"
"
${
CONFIG_SAXPY
}
"
${
progSrc
}
)
phoenix_plotPerf
(
"saxpy_seqBase"
perf_saxpy_seq_O0 perf_saxpy_seq_O1 perf_saxpy_seq_O2 perf_saxpy_seq_O3 perf_saxpy_seq_Ofast
)
phoenix_plotPerf
(
"saxpy_seqVectorize"
perf_saxpy_seq_O3 perf_saxpy_seq_vectorize_O3 perf_saxpy_seq_vectorize_Ofast
)
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment