-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6106e98
commit 30ece5b
Showing
10 changed files
with
221 additions
and
2 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
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
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
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,36 @@ | ||
#include "bml.h" | ||
#include "bml_test.h" | ||
|
||
#include <stdio.h> | ||
|
||
int | ||
test_introspection( | ||
const int N, | ||
const bml_matrix_type_t matrix_type, | ||
const bml_matrix_precision_t matrix_precision, | ||
const int M) | ||
{ | ||
switch (matrix_precision) | ||
{ | ||
case single_real: | ||
return test_introspection_single_real(N, matrix_type, | ||
matrix_precision, M); | ||
break; | ||
case double_real: | ||
return test_introspection_double_real(N, matrix_type, | ||
matrix_precision, M); | ||
break; | ||
case single_complex: | ||
return test_introspection_single_complex(N, matrix_type, | ||
matrix_precision, M); | ||
break; | ||
case double_complex: | ||
return test_introspection_double_complex(N, matrix_type, | ||
matrix_precision, M); | ||
break; | ||
default: | ||
fprintf(stderr, "unknown matrix precision\n"); | ||
return -1; | ||
break; | ||
} | ||
} |
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,36 @@ | ||
#ifndef __INTROSPECTION_H | ||
#define __INTROSPECTION_H | ||
|
||
#include <bml.h> | ||
|
||
int test_introspection( | ||
const int N, | ||
const bml_matrix_type_t matrix_type, | ||
const bml_matrix_precision_t matrix_precision, | ||
const int M); | ||
|
||
int test_introspection_single_real( | ||
const int N, | ||
const bml_matrix_type_t matrix_type, | ||
const bml_matrix_precision_t matrix_precision, | ||
const int M); | ||
|
||
int test_introspection_double_real( | ||
const int N, | ||
const bml_matrix_type_t matrix_type, | ||
const bml_matrix_precision_t matrix_precision, | ||
const int M); | ||
|
||
int test_introspection_single_complex( | ||
const int N, | ||
const bml_matrix_type_t matrix_type, | ||
const bml_matrix_precision_t matrix_precision, | ||
const int M); | ||
|
||
int test_introspection_double_complex( | ||
const int N, | ||
const bml_matrix_type_t matrix_type, | ||
const bml_matrix_precision_t matrix_precision, | ||
const int M); | ||
|
||
#endif |
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,73 @@ | ||
#include "bml.h" | ||
#include "../typed.h" | ||
#include "bml_introspection.h" | ||
|
||
#include <stdlib.h> | ||
#include <stdio.h> | ||
|
||
int TYPED_FUNC( | ||
test_introspection) ( | ||
const int N, | ||
const bml_matrix_type_t matrix_type, | ||
const bml_matrix_precision_t matrix_precision, | ||
const int M) | ||
{ | ||
bml_matrix_t *A = NULL; | ||
|
||
bml_distribution_mode_t distrib_mode = sequential; | ||
#ifdef DO_MPI | ||
if (bml_getNRanks() > 1) | ||
{ | ||
LOG_INFO("Use distributed matrix\n"); | ||
distrib_mode = distributed; | ||
} | ||
#endif | ||
|
||
A = bml_random_matrix(matrix_type, matrix_precision, N, M, distrib_mode); | ||
|
||
bml_matrix_type_t deep_type = bml_get_deep_type(A); | ||
|
||
bml_matrix_type_t type = bml_get_type(A); | ||
|
||
#ifdef DO_MPI | ||
switch (deep_type) | ||
{ | ||
case dense: | ||
LOG_INFO("deep type is dense\n"); | ||
break; | ||
case ellpack: | ||
LOG_INFO("deep type is ellpack\n"); | ||
break; | ||
case ellsort: | ||
LOG_INFO("deep type is ellsort\n"); | ||
break; | ||
case ellblock: | ||
LOG_INFO("deep type is ellblock\n"); | ||
break; | ||
case csr: | ||
LOG_INFO("deep type is csr\n"); | ||
break; | ||
case distributed2d: | ||
LOG_ERROR("deep type should not be distributed2d\n"); | ||
return -1; | ||
break; | ||
default: | ||
LOG_ERROR("unknown deep type\n"); | ||
return -1; | ||
break; | ||
} | ||
|
||
#else | ||
if (deep_type != type) | ||
{ | ||
LOG_ERROR("type and deep_type not equal!\n"); | ||
return -1; | ||
} | ||
#endif | ||
|
||
LOG_INFO("bml_introspection passed for task %d\n", bml_getMyRank()); | ||
|
||
bml_deallocate(&A); | ||
|
||
return 0; | ||
} |