Skip to content

Commit 9485b74

Browse files
committed
Stop passing jl_opts around
1 parent 98f49a8 commit 9485b74

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

src/elliptic/box/crs_box.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static void asm2_solve(const struct box *box) {
161161
}
162162

163163
template <typename T>
164-
static void asm1_setup(struct box *box, const jl_opts *opts, double tol, const struct comm *comm) {
164+
static void asm1_setup(struct box *box, double tol, const struct comm *comm) {
165165
buffer *bfr = &(box->bfr);
166166
struct comm *local = &(box->local);
167167

@@ -214,15 +214,16 @@ static void asm1_setup(struct box *box, const jl_opts *opts, double tol, const s
214214

215215
// Setup ASM1 solver.
216216
box->asm1 = NULL;
217-
switch(opts->asm1) {
217+
switch(box->opts.asm1) {
218218
case BOX_XXT:
219-
box->asm1 = (void *)crs_xxt_setup(box->sn, tmp_vtx, nnz, ia, ja, va, opts->dom, opts->null_space, local);
219+
box->asm1 = (void *)crs_xxt_setup(box->sn, tmp_vtx, nnz, ia, ja, va,
220+
box->opts.dom, box->opts.null_space, local);
220221
break;
221222
case BOX_CHOLMOD:
222-
asm1_cholmod_setup(A, null_space, box, opts);
223+
asm1_cholmod_setup(A, null_space, box);
223224
break;
224225
case BOX_GPU:
225-
asm1_gpu_setup(A, null_space, box, opts);
226+
asm1_gpu_setup(A, null_space, box);
226227
break;
227228
}
228229

@@ -240,7 +241,7 @@ static void asm1_setup(struct box *box, const jl_opts *opts, double tol, const s
240241
}
241242

242243
template <typename T>
243-
static void cpu_setup(struct box *box, const jl_opts *opts) {
244+
static void cpu_setup(struct box *box) {
244245
uint work_array_size = MAX(box->sn, *(nekData.box_n));
245246
box->sx = malloc(sizeof(T) * 2 * work_array_size);
246247
box->srhs = (void *)((T *)box->sx + work_array_size);
@@ -293,7 +294,7 @@ static void gpu_setup(struct box *box) {
293294
T *inv_mul = tcalloc(T, box->sn);
294295
for (uint i = 0; i < box->un; i++)
295296
inv_mul[i] = 1.0;
296-
gs(inv_mul, opts->dom, gs_add, 0, box->gsh, &(box->bfr));
297+
gs(inv_mul, box->opts.dom, gs_add, 0, box->gsh, &(box->bfr));
297298
for (uint i = 0; i < box->sn; i++)
298299
inv_mul[i] = 1.0 / inv_mul[i];
299300
o_invmul.copyFrom(inv_mul);
@@ -326,14 +327,14 @@ struct box *crs_box_setup(uint n, const ulong *id, uint nnz, const uint *Ai, con
326327
const double tol = 1e-12;
327328
switch(opts->dom) {
328329
case gs_double:
329-
asm1_setup<double>(box, opts, tol, comm);
330-
cpu_setup<double>(box, opts);
331-
gpu_setup<double>(box, opts);
330+
asm1_setup<double>(box, tol, comm);
331+
cpu_setup<double>(box);
332+
gpu_setup<double>(box);
332333
break;
333334
case gs_float:
334-
asm1_setup<float>(box, opts, tol, comm);
335-
cpu_setup<float>(box, opts);
336-
gpu_setup<float>(box, opts);
335+
asm1_setup<float>(box, tol, comm);
336+
cpu_setup<float>(box);
337+
gpu_setup<float>(box);
337338
break;
338339
default:
339340
break;

src/elliptic/box/crs_box_cholmod.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@ static void csr_finalize(struct cholmod_csr *B) {
5050
free(B);
5151
}
5252

53-
void asm1_cholmod_setup(struct csr *A, unsigned null_space, struct box *box, const jl_opts *opts) {
53+
void asm1_cholmod_setup(struct csr *A, unsigned null_space, struct box *box) {
5454
if (initialied)
5555
return;
5656

57-
dom = opts->dom;
57+
dom = box->opts.dom;
5858
switch (dom) {
5959
case gs_double:
60-
box->asm1 = (void *)csr_setup_double(A, null_space, &box->global);
60+
box->asm1 = (void *)csr_setup_double(A, null_space, &(box->global));
6161
break;
6262
case gs_float:
63-
box->asm1 = (void *)csr_setup_float(A, null_space, &box->global);
63+
box->asm1 = (void *)csr_setup_float(A, null_space, &(box->global));
6464
break;
6565
default:
6666
break;

src/elliptic/box/crs_box_gpu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ void asm1_gpu_free(struct box *box) {
185185
#elif defined(ENABLE_ONEMKL)
186186
#include "crs_box_gpu_onemkl.hpp"
187187

188-
void asm1_gpu_setup(struct csr *A, unsigned null_space, struct box *box, const jl_opts *opts) {
188+
void asm1_gpu_setup(struct csr *A, unsigned null_space, struct box *box) {
189189
assert(null_space == 0);
190190

191191
if (initialized) return;
@@ -208,7 +208,7 @@ void asm1_gpu_setup(struct csr *A, unsigned null_space, struct box *box, const j
208208
d_x = box_onemkl_device_malloc<double>(nr);
209209

210210
initialized = 1;
211-
dom = opts->dom;
211+
dom = box->opts.dom;
212212
}
213213

214214
template <typename T>

src/elliptic/box/crs_box_impl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ void sparse_cholmod_solve(void *x, struct cholmod_csr *factor, const void *r);
5050
void sparse_cholmod_free(struct cholmod_csr *factor);
5151

5252
// ASM1: CHOLMOD API interface.
53-
void asm1_cholmod_setup(struct csr *A, unsigned null_space, struct box *box, const jl_opts *opts);
53+
void asm1_cholmod_setup(struct csr *A, unsigned null_space, struct box *box);
5454
void asm1_cholmod_solve(void *x, struct box *box, const void *r);
5555
void asm1_cholmod_free(struct box *box);
5656

5757
// ASM1: GPU BLAS interface.
58-
void asm1_gpu_setup(struct csr *A, unsigned null_space, struct box *box, const jl_opts *opts);
58+
void asm1_gpu_setup(struct csr *A, unsigned null_space, struct box *box);
5959
void asm1_gpu_solve(void *x, struct box *box, const void *r);
6060
void asm1_gpu_solve(occa::memory &o_x, struct box *box, occa::memory &o_r);
6161
void asm1_gpu_free(struct box *box);

0 commit comments

Comments
 (0)