aboutsummaryrefslogtreecommitdiff
path: root/pssolve.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2020-07-26 18:39:53 +0200
committerAnton Khirnov <anton@khirnov.net>2020-07-26 18:39:53 +0200
commit29f5b628317bcf83ddc5bfeaec92108b6bb1e89d (patch)
tree60b476d9a073045e3bc1cf5729b47174d04f7701 /pssolve.c
parente6180b82d89d69846cfdd7881dd067ff38ea6a79 (diff)
Switch to external threadpool library.
Diffstat (limited to 'pssolve.c')
-rw-r--r--pssolve.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/pssolve.c b/pssolve.c
index 28333e2..36e09cf 100644
--- a/pssolve.c
+++ b/pssolve.c
@@ -28,12 +28,12 @@
#include <cblas.h>
#include <lapacke.h>
+#include <threadpool.h>
#include "bicgstab.h"
#include "common.h"
#include "log.h"
#include "pssolve.h"
-#include "threadpool.h"
#define NB_COEFFS(eq_ctx) ((eq_ctx)->nb_coeffs[0] * (eq_ctx)->nb_coeffs[1])
#define NB_COLLOC_POINTS(eq_ctx) ((eq_ctx)->nb_colloc_points[0] * (eq_ctx)->nb_colloc_points[1])
@@ -58,8 +58,8 @@ struct PSSolvePriv {
int *ipiv;
double *mat;
- ThreadPoolContext *tp;
- ThreadPoolContext *tp_internal;
+ TPContext *tp;
+ TPContext *tp_internal;
};
typedef struct ConstructMatrixThread {
@@ -70,9 +70,7 @@ typedef struct ConstructMatrixThread {
unsigned int var_idx;
} ConstructMatrixThread;
-static void construct_matrix(void *arg,
- unsigned int job_idx, unsigned int nb_jobs,
- unsigned int thread_idx, unsigned int nb_threads)
+static void construct_matrix(void *arg, unsigned int job_idx, unsigned int thread_idx)
{
ConstructMatrixThread *cmt = arg;
const PSEquationContext *eq_ctx = cmt->eq_ctx;
@@ -192,8 +190,7 @@ int tdi_pssolve_solve(PSSolveContext *ctx,
.mat_stride = s->nb_coeffs,
.var_idx = j,
};
- tdi_threadpool_execute(s->tp, NB_COEFFS(&s->eqs[j]), construct_matrix,
- &thread);
+ tp_execute(s->tp, NB_COEFFS(&s->eqs[j]), construct_matrix, &thread);
mat += NB_COEFFS(&s->eqs[j]) * s->nb_coeffs;
}
}
@@ -347,7 +344,7 @@ int tdi_pssolve_context_init(PSSolveContext *ctx)
if (ctx->tp) {
s->tp = ctx->tp;
} else {
- ret = tdi_threadpool_init(&s->tp_internal, 1);
+ ret = tp_init(&s->tp_internal, 1);
if (ret < 0)
return ret;
s->tp = s->tp_internal;
@@ -487,7 +484,7 @@ void tdi_pssolve_context_free(PSSolveContext **pctx)
free(ctx->priv->mat);
tdi_bicgstab_context_free(&ctx->priv->bicgstab);
- tdi_threadpool_free(&ctx->priv->tp_internal);
+ tp_free(&ctx->priv->tp_internal);
}
free(ctx->priv);