-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete PIMPL implementation for MatrixHandler.
- Loading branch information
Showing
12 changed files
with
117 additions
and
202 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
// this class encapsulates various matrix manipulation operations, commonly required by linear solvers: | ||
// this includes | ||
// (1) Matrix format conversion: coo2csr, csr2csc | ||
// (2) Matrix vector product (SpMV) | ||
// (3) Matrix 1-norm | ||
#pragma once | ||
#include <resolve/Common.hpp> | ||
#include <resolve/MemoryUtils.hpp> | ||
|
@@ -22,19 +17,33 @@ namespace ReSolve | |
class Csr; | ||
} | ||
class LinAlgWorkspace; | ||
class LinAlgWorkspaceCUDA; | ||
class MatrixHandlerImpl; | ||
} | ||
|
||
|
||
namespace ReSolve { | ||
|
||
/** | ||
* @brief this class encapsulates various matrix manipulation operations, | ||
* commonly required by linear solvers. | ||
* | ||
* This includes: | ||
* - Matrix format conversion: coo2csr, csr2csc | ||
* - Matrix vector product (SpMV) | ||
* - Matrix 1-norm | ||
* | ||
* @author Kasia Swirydowicz <[email protected]> | ||
* @author Slaven Peles <[email protected]> | ||
*/ | ||
class MatrixHandler | ||
{ | ||
using vector_type = vector::Vector; | ||
|
||
public: | ||
MatrixHandler(); | ||
MatrixHandler(LinAlgWorkspace* workspace); | ||
MatrixHandler(LinAlgWorkspaceCUDA* workspace); | ||
~MatrixHandler(); | ||
|
||
int csc2csr(matrix::Csc* A_csc, matrix::Csr* A_csr, std::string memspace); //memspace decides on what is returned (cpu or cuda pointer) | ||
|
@@ -52,12 +61,14 @@ namespace ReSolve { | |
void setValuesChanged(bool toWhat, std::string memspace); | ||
|
||
private: | ||
LinAlgWorkspace* workspace_{nullptr}; | ||
bool new_matrix_{true}; ///< if the structure changed, you need a new handler. | ||
|
||
MemoryHandler mem_; ///< Device memory manager object | ||
MatrixHandlerImpl* cpuImpl_{nullptr}; | ||
MatrixHandlerImpl* cudaImpl_{nullptr}; | ||
|
||
bool isCpuEnabled_{false}; | ||
bool isCudaEnabled_{false}; | ||
}; | ||
|
||
} // namespace ReSolve | ||
|
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
Oops, something went wrong.