-
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.
This prototype includes the dense and CSR matrix types and the identity matrix allocation API. Language bindings are not included. Issue: #570 Signed-off-by: Nicolas Bock <[email protected]>
- Loading branch information
1 parent
3529cda
commit d6c7853
Showing
8 changed files
with
145 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
|
||
message(STATUS "CMake version ${CMAKE_VERSION}") | ||
|
||
set(LANGUAGES C CXX) | ||
set(BML_BUILD_FORTRAN_INTERFACE TRUE CACHE BOOL | ||
"Build the Fortran API (requires a Fortran compiler)") | ||
if(BML_BUILD_FORTRAN_INTERFACE) | ||
list(APPEND LANGUAGES Fortran) | ||
endif() | ||
|
||
set(BML_BUILD_PYTHON_INTERFACE TRUE CACHE BOOL | ||
"Build the Python API (requires Python dev package)") | ||
|
||
project(bml ${LANGUAGES}) # don't move this line as it changes PROJECT_SOURCE_DIR | ||
|
||
add_subdirectory(src) | ||
add_subdirectory(tests) |
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,2 @@ | ||
add_library(bml | ||
bml_allocate.cc) |
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,4 @@ | ||
#ifndef __BML_H | ||
#define __BML_H | ||
|
||
#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,28 @@ | ||
#include "bml_types.h" | ||
|
||
#include <stdlib.h> | ||
|
||
/** Allocate the identity matrix. | ||
* | ||
* Note that the matrix \f$ A \f$ will be newly allocated. The | ||
* function does not check whether the matrix is already allocated. | ||
* | ||
* \ingroup allocate_group_C | ||
* | ||
* \param matrix_type The matrix type. | ||
* \param matrix_precision The precision of the matrix. | ||
* \param N The matrix size. | ||
* \param M The number of non-zeroes per row. | ||
* \param distrib_mode The distribution mode. | ||
* \return The matrix. | ||
*/ | ||
BMLMatrix * | ||
bml_identity_matrix( | ||
bml_matrix_type_t matrix_type, | ||
bml_matrix_precision_t matrix_precision, | ||
int N, | ||
int M, | ||
bml_distribution_mode_t distrib_mode) | ||
{ | ||
return NULL; | ||
} |
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 @@ | ||
#include "bml_types.h" |
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,79 @@ | ||
#ifndef __BML_TYPES_H | ||
#define __BML_TYPES_H | ||
|
||
/** The BML matrix type. */ | ||
class BMLMatrix | ||
{ | ||
/** The number of rows/columns. */ | ||
int N; | ||
}; | ||
|
||
/** The supported real precisions. */ | ||
typedef enum | ||
{ | ||
/** The matrix is not initialized. */ | ||
precision_uninitialized, | ||
/** Matrix data is stored in single precision (float). */ | ||
single_real, | ||
/** Matrix data is stored in double precision (double). */ | ||
double_real, | ||
/** Matrix data is stored in single-complex precision (float). */ | ||
single_complex, | ||
/** Matrix data is stored in double-complex precision (double). */ | ||
double_complex | ||
} bml_matrix_precision_t; | ||
|
||
/** The supported dense matrix elements orderings. */ | ||
typedef enum | ||
{ | ||
/** row-major order. */ | ||
dense_row_major, | ||
/** column-major order. */ | ||
dense_column_major | ||
} bml_dense_order_t; | ||
|
||
/** The supported distribution modes. */ | ||
typedef enum | ||
{ | ||
/** Each rank works on the full matrix. */ | ||
sequential, | ||
/** Each rank works on its part of the matrix. */ | ||
distributed, | ||
/** Each rank works on its set of graph partitions. */ | ||
graph_distributed | ||
} bml_distribution_mode_t; | ||
|
||
/** Decomposition for working in parallel. */ | ||
struct bml_domain_t | ||
{ | ||
/** number of processors */ | ||
int totalProcs; | ||
/** total number of rows */ | ||
int totalRows; | ||
/** total number of columns */ | ||
int totalCols; | ||
|
||
/** global minimum row number */ | ||
int globalRowMin; | ||
/** global maximum row number */ | ||
int globalRowMax; | ||
/** global total rows */ | ||
int globalRowExtent; | ||
|
||
/** maximum extent for most processors */ | ||
int maxLocalExtent; | ||
/** minimum extent for last processors */ | ||
int minLocalExtent; | ||
/** minimum row per rank */ | ||
int *localRowMin; | ||
/** maximum row per rank */ | ||
int *localRowMax; | ||
/** extent of rows per rank, localRowMax - localRowMin */ | ||
int *localRowExtent; | ||
/** local number of elements per rank */ | ||
int *localElements; | ||
/** local displacements per rank for 2D */ | ||
int *localDispl; | ||
}; | ||
|
||
#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,5 @@ | ||
include_directories(${CMAKE_SOURCE_DIR}/src) | ||
add_executable(bml-test | ||
bml-test.cc) | ||
|
||
add_test(NAME allocate COMMAND bml-test) |
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,8 @@ | ||
#include <bml.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
|
||
int main() { | ||
printf("starting tests\n"); | ||
return 1; | ||
} |