-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Benchmarked transpose and softmax functions.
- Loading branch information
1 parent
cca5d2e
commit 84301ba
Showing
4 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <iostream> | ||
|
||
#include "../include/m_algorithms.h" | ||
#include "../include/matrix.h" | ||
#include "../include/generator.h" | ||
#include "../include/matrix_benchmark.h" | ||
#include "../include/matrix_printer.h" | ||
|
||
int main(void) { | ||
|
||
std::cout << "[10000, 9000] Matrix Transpose Benchmark:" << std::endl << std::endl ; | ||
std::cout << "..." << std::endl; | ||
|
||
using matrix_t = Matrix::Representation; | ||
|
||
matrix_t ma = matrix_t(Matrix::Rows(10000), Matrix::Columns(9000)); | ||
Matrix::Generation::Normal<0, 1> normal_distribution_init; | ||
|
||
ma = normal_distribution_init(ma); | ||
|
||
Matrix::Operations::Timer timer( | ||
Matrix::Operations::Unary::Transpose{} | ||
); | ||
|
||
matrix_t mb = timer(ma); | ||
|
||
|
||
std::cout << std::endl << "Performed in " << timer.get_computation_duration_ms() << " ms." << std::endl; | ||
|
||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "../deps/doctest.h" | ||
|
||
#include "../include/matrix.h" | ||
#include "../include/generator.h" | ||
#include "../include/m_algorithms.h" | ||
|
||
|
||
TEST_CASE("Matrix Transpose") | ||
{ | ||
|
||
Matrix::Representation ma = Matrix::Representation( | ||
Matrix::Rows(200), Matrix::Columns(1000)); | ||
|
||
|
||
Matrix::Generation::Normal<0, 1> normal_distribution_init; | ||
|
||
ma = normal_distribution_init(ma); | ||
|
||
|
||
Matrix::Operations::Unary::Transpose operation; | ||
|
||
Matrix::Representation mb = operation(ma); | ||
Matrix::Representation mc = operation(mb); | ||
|
||
|
||
|
||
SUBCASE("Cache Oblivious Transpose") | ||
{ | ||
|
||
CHECK((Matrix::Representation{ma} == Matrix::Representation{mc}) == true); | ||
} | ||
|
||
|
||
} |