handling of cuDSS-based linear solvers More...
#include "base/cs_defs.h"#include <stdarg.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <assert.h>#include <math.h>#include <cudss.h>#include "bft/bft_error.h"#include "bft/bft_printf.h"#include "base/cs_base.h"#include "base/cs_dispatch.h"#include "base/cs_log.h"#include "base/cs_fp_exception.h"#include "base/cs_halo.h"#include "base/cs_math.h"#include "base/cs_mem.h"#include "alge/cs_matrix.h"#include "alge/cs_matrix_default.h"#include "base/cs_timer.h"#include "alge/cs_sles.h"#include "alge/cs_sles_cudss.h"
Include dependency graph for cs_sles_cudss.cpp:Functions | |
| cs_sles_cudss_t * | cs_sles_cudss_define (int f_id, const char *name) |
| Define and associate an cuDSS linear system solver for a given field or equation name. More... | |
| cs_sles_cudss_t * | cs_sles_cudss_create (void) |
| Create cuDSS linear system solver info and context. More... | |
| void * | cs_sles_cudss_copy (const void *context) |
| Create cuDSS linear system solver info and context based on existing info and context. More... | |
| void | cs_sles_cudss_destroy (void **context) |
| Destroy cuDSS linear system solver info and context. More... | |
| void | cs_sles_cudss_setup (void *context, const char *name, const cs_matrix_t *a, int verbosity) |
| Setup cuDSS linear equation solver. More... | |
| cs_sles_convergence_state_t | cs_sles_cudss_solve (void *context, const char *name, const cs_matrix_t *a, int verbosity, double precision, double r_norm, int *n_iter, double *residual, const cs_real_t *rhs, cs_real_t *vx_ini, cs_real_t *vx, size_t aux_size, void *aux_vectors) |
| Call cuDSS linear equation solver. More... | |
| void | cs_sles_cudss_free (void *context) |
| Free cuDSS linear equation solver setup context. More... | |
| void | cs_sles_cudss_log (const void *context, cs_log_t log_type) |
| Log sparse linear equation solver info. More... | |
| void | cs_sles_cudss_library_info (cs_log_t log_type) |
| Print information on cuDSS library. More... | |
handling of cuDSS-based linear solvers
| void * cs_sles_cudss_copy | ( | const void * | context | ) |
Create cuDSS linear system solver info and context based on existing info and context.
Most configuration parameters will be copied from the existing context, though not all, since cuDSS does not provide a comprehensive way to do this.
| [in] | context | pointer to reference info and context (actual type: cs_sles_cudss_t *) |
| cs_sles_cudss_t * cs_sles_cudss_create | ( | void | ) |
Create cuDSS linear system solver info and context.
In case of rotational periodicity for a block (non-scalar) matrix, the matrix type will be forced to MATSHELL ("shell") regardless of the option used.
| cs_sles_cudss_t * cs_sles_cudss_define | ( | int | f_id, |
| const char * | name | ||
| ) |
Define and associate an cuDSS linear system solver for a given field or equation name.
If this system did not previously exist, it is added to the list of "known" systems. Otherwise, its definition is replaced by the one defined here.
This is a utility function: if finer control is needed, see cs_sles_define and cs_sles_cudss_create.
In case of rotational periodicity for a block (non-scalar) matrix, the matrix type will be forced to MATSHELL ("shell") regardless of the option used.
Note that this function returns a pointer directly to the solver management structure. This may be used to set further options. If needed, cs_sles_find may be used to obtain a pointer to the matching cs_sles_t container.
| [in] | f_id | associated field id, or < 0 |
| [in] | name | associated name if f_id < 0, or nullptr |
| void cs_sles_cudss_destroy | ( | void ** | context | ) |
Destroy cuDSS linear system solver info and context.
| [in,out] | context | pointer to cuDSS solver info and context (actual type: cs_sles_cudss_t **) |
| void cs_sles_cudss_free | ( | void * | context | ) |
Free cuDSS linear equation solver setup context.
This function frees resolution-related data, such as buffers and preconditioning but does not free the whole context, as info used for logging (especially performance data) is maintained.
| [in,out] | context | pointer to cuDSS solver info and context (actual type: cs_sles_cudss_t *) |
| void cs_sles_cudss_library_info | ( | cs_log_t | log_type | ) |
Print information on cuDSS library.
| [in] | log_type | log type |
| void cs_sles_cudss_log | ( | const void * | context, |
| cs_log_t | log_type | ||
| ) |
Log sparse linear equation solver info.
| [in] | context | pointer to cuDSS solver info and context (actual type: cs_sles_cudss_t *) |
| [in] | log_type | log type |
| void cs_sles_cudss_setup | ( | void * | context, |
| const char * | name, | ||
| const cs_matrix_t * | a, | ||
| int | verbosity | ||
| ) |
Setup cuDSS linear equation solver.
| [in,out] | context | pointer to cuDSS solver info and context (actual type: cs_sles_cudss_t *) |
| [in] | name | pointer to system name |
| [in] | a | associated matrix |
| [in] | verbosity | associated verbosity |
| cs_sles_convergence_state_t cs_sles_cudss_solve | ( | void * | context, |
| const char * | name, | ||
| const cs_matrix_t * | a, | ||
| int | verbosity, | ||
| double | precision, | ||
| double | r_norm, | ||
| int * | n_iter, | ||
| double * | residual, | ||
| const cs_real_t * | rhs, | ||
| cs_real_t * | vx_ini, | ||
| cs_real_t * | vx, | ||
| size_t | aux_size, | ||
| void * | aux_vectors | ||
| ) |
Call cuDSS linear equation solver.
| [in,out] | context | pointer to cuDSS solver info and context (actual type: cs_sles_cudss_t *) |
| [in] | name | pointer to system name |
| [in] | a | matrix |
| [in] | verbosity | associated verbosity |
| [in] | precision | solver precision |
| [in] | r_norm | residual normalization |
| [out] | n_iter | number of "equivalent" iterations |
| [out] | residual | residual |
| [in] | rhs | right hand side |
| [in] | vx_ini | initial system solution (vx if nonzero, nullptr if zero) |
| [in,out] | vx | system solution |
| [in] | aux_size | number of elements in aux_vectors (in bytes) |
| aux_vectors | optional working area (internal allocation if nullptr) |