72 const char* name =
"exp4-int-gpu";
85 __device__
int num_integrator_steps;
93 int num_integrator_steps_host;
109 cudaErrorCheck( cudaMemcpyFromSymbol(&num_integrator_steps_host, num_integrator_steps,
sizeof(
int)) );
110 if (num_integrator_steps_host == -1)
113 cudaErrorCheck( cudaMemcpyFromSymbol(err_log_host, err_log, num_integrator_steps_host *
sizeof(
double)) );
114 cudaErrorCheck( cudaMemcpyFromSymbol(m_log_host, m_log, num_integrator_steps_host *
sizeof(
int)) );
115 cudaErrorCheck( cudaMemcpyFromSymbol(m1_log_host, m1_log, num_integrator_steps_host *
sizeof(
int)) );
116 cudaErrorCheck( cudaMemcpyFromSymbol(m2_log_host, m2_log, num_integrator_steps_host *
sizeof(
int)) );
117 cudaErrorCheck( cudaMemcpyFromSymbol(t_log_host, t_log, num_integrator_steps_host *
sizeof(
double)) );
118 cudaErrorCheck( cudaMemcpyFromSymbol(h_log_host, h_log, num_integrator_steps_host *
sizeof(
double)) );
119 cudaErrorCheck( cudaMemcpyFromSymbol(reject_log_host, reject_log, num_integrator_steps_host *
sizeof(
bool)) );
121 for (
int i = 0; i < num_integrator_steps_host; ++i)
123 if (reject_log_host[i])
125 fprintf(rFile,
"%.15le\t%.15le\t%.15le\t%d\t%d\t%d\n", t_log_host[i], h_log_host[i], err_log_host[i], m_log_host[i], m1_log_host[i], m2_log_host[i]);
129 fprintf(logFile,
"%.15le\t%.15le\t%.15le\t%d\t%d\t%d\n", t_log_host[i], h_log_host[i], err_log_host[i], m_log_host[i], m1_log_host[i], m2_log_host[i]);
147 int len = strlen(f_name);
148 char out_name[len + 17];
149 sprintf(out_name,
"log/%s-kry-log.txt", f_name);
150 logFile = fopen(out_name,
"w");
152 char out_reject_name[len + 23];
153 sprintf(out_reject_name,
"log/%s-kry-reject.txt", f_name);
156 rFile = fopen(out_reject_name,
"w");
169 size_t num_bytes = 0;
177 num_bytes += 7 *
NSP;
179 num_bytes *=
sizeof(double);
181 num_bytes +=
STRIDE *
sizeof(int);
185 num_bytes +=
STRIDE *
sizeof(cuDoubleComplex);
187 num_bytes += 1 *
sizeof(int);
void cleanup_solver(solver_memory **h_mem, solver_memory **d_mem)
Cleans up solver memory.
void initialize_solver(int padded, solver_memory **h_mem, solver_memory **d_mem)
Initializes the GPU solver.
Defines some simple macros to simplify GPU indexing.
size_t required_solver_size()
Returns the total size (in bytes) required for memory storage for a single GPU thread Used in calcula...
int padded
Padded # of ODEs to solve.
#define STRIDE
the matrix dimensions
#define MAX_STEPS
Maximum allowed internal timesteps per integration step.
const char * solver_name()
Returns a descriptive solver name.
Structure containing memory needed for EXP4 algorithm.
void createAndZero(void **ptr, size_t size)
Convienvience method to Cuda Malloc and memset a pointer to zero.
The generic initialization file for poles/hosts for RA based evaulation of the matrix exponential...
simple convenience file to include the correct solver properties file
void find_poles_and_residuals()
get poles and residues for rational approximant to matrix exponential
void solver_log()
Executes solver specific logging tasks.
void init_solver_log()
Initializes solver specific items for logging.
#define cudaErrorCheck(ans)
A file generated by Scons that specifies various options to the solvers.