Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:15:35

0001 /*
0002     Copyright (C) 2020 Daniel Schultz
0003     Copyright (C) 2022 Fredrik Johansson
0004 
0005     This file is part of FLINT.
0006 
0007     FLINT is free software: you can redistribute it and/or modify it under
0008     the terms of the GNU Lesser General Public License (LGPL) as published
0009     by the Free Software Foundation; either version 3 of the License, or
0010     (at your option) any later version.  See <https://www.gnu.org/licenses/>.
0011 */
0012 
0013 #ifndef THREAD_SUPPORT_H
0014 #define THREAD_SUPPORT_H
0015 
0016 #include "flint.h"
0017 
0018 #ifdef __cplusplus
0019  extern "C" {
0020 #endif
0021 
0022 #define FLINT_DEFAULT_THREAD_LIMIT 99999
0023 
0024 slong flint_request_threads(thread_pool_handle ** handles, slong thread_limit);
0025 
0026 void flint_give_back_threads(thread_pool_handle * handles, slong num_handles);
0027 
0028 slong flint_get_num_available_threads(void);
0029 
0030 #define FLINT_PARALLEL_UNIFORM 1
0031 #define FLINT_PARALLEL_STRIDED 2
0032 #define FLINT_PARALLEL_DYNAMIC 4
0033 #define FLINT_PARALLEL_BSPLIT_LEFT_INPLACE 8
0034 #define FLINT_PARALLEL_VERBOSE 512
0035 
0036 typedef void (* do_func_t)(slong i, void * args);
0037 
0038 void flint_parallel_do(do_func_t f, void * args, slong n, int thread_limit, int flags);
0039 
0040 typedef void (* bsplit_merge_func_t)(void *, void *, void *, void *);
0041 typedef void (* bsplit_basecase_func_t)(void *, slong, slong, void *);
0042 typedef void (* bsplit_init_func_t)(void *, void *);
0043 typedef void (* bsplit_clear_func_t)(void *, void *);
0044 
0045 void flint_parallel_binary_splitting(void * res, bsplit_basecase_func_t basecase, bsplit_merge_func_t merge,
0046     size_t sizeof_res, bsplit_init_func_t init, bsplit_clear_func_t clear, void * args, slong a, slong b, slong basecase_cutoff, int thread_limit, int flags);
0047 
0048 #ifdef __cplusplus
0049 }
0050 #endif
0051 
0052 #endif