AmgxInterface.hpp
Go to the documentation of this file.
64 AMGX_RC err, const std::string& expression, const std::string& file, const std::string& function, int line)
70 "AMGX error in expression: {}\nError code: {}\nError message: {}\nLocation: {}:{} in function {}",
92amgxSafeCall(AMGX_RC rc, const std::string& expression, const std::string& file, const std::string& function, int line)
107#define OPM_AMGX_SAFE_CALL(expr) ::Opm::gpuistl::amgxSafeCall((expr), #expr, __FILE__, __func__, __LINE__)
183 static AMGX_solver_handle createSolver(AMGX_resources_handle resources, AMGX_Mode mode, AMGX_config_handle config)
432 AMGX_matrix_upload_all(amgxMatrix, n, nnz, block_size, block_size, row_ptrs, col_indices, values, nullptr));
446 static void updateAmgxMatrixCoefficientsFromGpuSparseMatrix(const GpuSparseMatrix<T>& gpuSparseMatrix,
474 static void updateGpuSparseMatrixFromAmgxMatrix(AMGX_matrix_handle amgxMatrix, GpuSparseMatrix<T>& gpuSparseMatrix)
549 OPM_AMGX_SAFE_CALL(AMGX_pin_memory(const_cast<T*>(values), sizeof(T) * nnz * block_size * block_size));
615 if constexpr (std::is_same_v<MatrixFieldType, double> && std::is_same_v<VectorFieldType, double>) {
617 } else if constexpr (std::is_same_v<MatrixFieldType, float> && std::is_same_v<VectorFieldType, double>) {
619 } else if constexpr (std::is_same_v<MatrixFieldType, float> && std::is_same_v<VectorFieldType, float>) {
#define OPM_AMGX_SAFE_CALL(expr) Macro to wrap AMGX function calls with error checking. Definition: AmgxInterface.hpp:107 Unified interface for AMGX operations with both CPU and GPU data structures. Definition: AmgxInterface.hpp:122 static void updateAmgxMatrixFromGpuSparseMatrix(const GpuSparseMatrix< T > &gpuSparseMatrix, AMGX_matrix_handle amgxMatrix) Update an AMGX matrix from a GpuSparseMatrix (device-to-device transfer) Definition: AmgxInterface.hpp:417 static AMGX_Mode determineAmgxMode() Determine the appropriate AMGX mode based on matrix and vector field types. Definition: AmgxInterface.hpp:613 static void updateGpuVectorFromAmgx(AMGX_vector_handle amgx_vec, GpuVector< T > &gpu_vec) Update a GpuVector from an AMGX vector (device-to-device transfer) Definition: AmgxInterface.hpp:340 static void destroyResources(AMGX_resources_handle resources) Destroy an AMGX resources handle. Definition: AmgxInterface.hpp:244 static AMGX_resources_handle createResources(AMGX_config_handle config) Create AMGX resources from a config. Definition: AmgxInterface.hpp:167 static void initialize() Initialize the AMGX library. Definition: AmgxInterface.hpp:130 static void updateGpuSparseMatrixFromAmgxMatrix(AMGX_matrix_handle amgxMatrix, GpuSparseMatrix< T > &gpuSparseMatrix) Update a GpuSparseMatrix from an AMGX matrix (device-to-device transfer) Definition: AmgxInterface.hpp:474 static void destroyVector(AMGX_vector_handle vector) Destroy an AMGX vector handle. Definition: AmgxInterface.hpp:292 static AMGX_solver_handle createSolver(AMGX_resources_handle resources, AMGX_Mode mode, AMGX_config_handle config) Create an AMGX solver. Definition: AmgxInterface.hpp:183 static void updateAmgxMatrixCoefficientsFromGpuSparseMatrix(const GpuSparseMatrix< T > &gpuSparseMatrix, AMGX_matrix_handle amgxMatrix) Update only the coefficient values of an AMGX matrix from a GpuSparseMatrix. Definition: AmgxInterface.hpp:446 static void updateMatrixValues(const MatrixType &matrix, AMGX_matrix_handle amgx_matrix) Update matrix values in AMGX. Definition: AmgxInterface.hpp:590 static void updateAmgxFromGpuVector(const GpuVector< T > &gpu_vec, AMGX_vector_handle amgx_vec) Update an AMGX vector from a GpuVector (device-to-device transfer) Definition: AmgxInterface.hpp:310 static void initializeVector(int N, int block_size, AMGX_vector_handle amgx_vector) Initialize an AMGX vector with zeros. Definition: AmgxInterface.hpp:574 static void destroyConfig(AMGX_config_handle config) Destroy an AMGX config handle. Definition: AmgxInterface.hpp:226 static AMGX_config_handle createConfig(const std::string &config_string) Create an AMGX config handle from a configuration string. Definition: AmgxInterface.hpp:153 static void destroySolver(AMGX_solver_handle solver) Destroy an AMGX solver handle. Definition: AmgxInterface.hpp:257 static AMGX_matrix_handle createMatrix(AMGX_resources_handle resources, AMGX_Mode mode) Create an AMGX matrix. Definition: AmgxInterface.hpp:198 static void initializeMatrix(const MatrixType &matrix, AMGX_matrix_handle amgx_matrix) Initialize an AMGX matrix from any matrix type (CPU or GPU) Definition: AmgxInterface.hpp:515 static AMGX_vector_handle createVector(AMGX_resources_handle resources, AMGX_Mode mode) Create an AMGX vector. Definition: AmgxInterface.hpp:213 static void finalize() Finalize the AMGX library. Definition: AmgxInterface.hpp:141 static void destroyMatrix(AMGX_matrix_handle amgx_matrix, const MatrixType &matrix) Destroy an AMGX matrix handle. Definition: AmgxInterface.hpp:272 static void transferVectorToAmgx(const VectorType &vec, AMGX_vector_handle amgx_vec) Transfer vector to AMGX from any vector type (CPU or GPU) Definition: AmgxInterface.hpp:370 static void transferVectorFromAmgx(AMGX_vector_handle amgx_vec, VectorType &vec) Transfer vector from AMGX to any vector type (CPU or GPU) Definition: AmgxInterface.hpp:396 The GpuSparseMatrix class simple wrapper class for a CuSparse matrix. Definition: GpuSparseMatrix.hpp:60 GpuVector< int > & getRowIndices() getRowIndices returns the row indices used to represent the BSR structure. Definition: GpuSparseMatrix.hpp:207 size_t nonzeroes() const nonzeroes behaves as the Dune::BCRSMatrix::nonzeros() function and returns the number of non zero blo... Definition: GpuSparseMatrix.hpp:166 size_t blockSize() const blockSize size of the blocks Definition: GpuSparseMatrix.hpp:273 size_t N() const N returns the number of rows (which is equal to the number of columns) Definition: GpuSparseMatrix.hpp:152 GpuVector< int > & getColumnIndices() getColumnIndices returns the column indices used to represent the BSR structure. Definition: GpuSparseMatrix.hpp:233 GpuVector< T > & getNonZeroValues() getNonZeroValues returns the GPU vector containing the non-zero values (ordered by block) Definition: GpuSparseMatrix.hpp:181 Definition: gpu_type_detection.hpp:30 #define OPM_GPU_SAFE_CALL(expression) OPM_GPU_SAFE_CALL checks the return type of the GPU expression (function call) and throws an exceptio... Definition: gpu_safe_call.hpp:150 int to_int(std::size_t s) to_int converts a (on most relevant platforms) 64 bits unsigned size_t to a signed 32 bits signed int Definition: safe_conversion.hpp:52 Definition: AmgxInterface.hpp:38 std::string getAmgxErrorMessage(AMGX_RC err, const std::string &expression, const std::string &file, const std::string &function, int line) Get a descriptive error message for an AMGX error code. Definition: AmgxInterface.hpp:63 void amgxSafeCall(AMGX_RC rc, const std::string &expression, const std::string &file, const std::string &function, int line) Safe call wrapper for AMGX functions. Definition: AmgxInterface.hpp:92 Type trait to detect if a type is a GPU type. Definition: gpu_type_detection.hpp:40 |