Changeset 3f94cb in git for libpolys/polys/flint_mpoly.cc


Ignore:
Timestamp:
Jul 24, 2019, 5:11:36 PM (5 years ago)
Author:
tthsqe12 <tthsqe12@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
3d5b277e2651a792f826b544d03d7179c438dba0
Parents:
690c98d2dc9aa6f233ef1da705b30c910d6e9898
Message:
limit worker threads based on poly length
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/flint_mpoly.cc

    r690c98 r3f94cb  
    241241    fmpq_t content;
    242242
    243     convert_sing_to_fmpq_mpoly_base(slong num_threads_, fmpq_mpoly_struct * res_,
    244                              const fmpq_mpoly_ctx_struct * ctx_, const ring r_, poly p)
    245       : num_threads(num_threads_),
     243    convert_sing_to_fmpq_mpoly_base(fmpq_mpoly_struct * res_,
     244                     const fmpq_mpoly_ctx_struct * ctx_, const ring r_, poly p)
     245      : num_threads(0),
    246246        res(res_),
    247247        ctx(ctx_),
     
    428428    thread_pool_handle * handles;
    429429    slong num_handles;
    430     slong thread_limit = 1000;
    431 
    432     /* get workers */
     430    slong thread_limit = 1000; // TODO: should be paramter to this function
     431
     432    /* the constructor works out the length of p and sets some markers */
     433    convert_sing_to_fmpq_mpoly_base base(res, ctx, r, p);
     434
     435    /* sensibly limit thread count and get workers */
     436    thread_limit = FLINT_MIN(thread_limit, base.length/1024);
    433437    handles = NULL;
    434438    num_handles = 0;
     
    444448    }
    445449
    446     /* the constructor works out the length of p and sets some markers */
    447     convert_sing_to_fmpq_mpoly_base base(num_handles + 1, res, ctx, r, p);
    448 
    449450    /* fill in thread division points */
     451    base.num_threads = 1 + num_handles;
    450452    convert_sing_to_fmpq_mpoly_arg * args = new convert_sing_to_fmpq_mpoly_arg[base.num_threads];
    451453    slong cur_idx = 0;
     
    606608    thread_pool_handle * handles;
    607609    slong num_handles;
    608     slong thread_limit = 1000;
    609 
    610     /* get workers */
     610    slong thread_limit = 1000;// TODO: should be paramter to this function
     611
     612    /* sensibly limit threads and get workers */
     613    thread_limit = FLINT_MIN(thread_limit, f->zpoly->length/1024);
    611614    handles = NULL;
    612615    num_handles = 0;
     
    623626
    624627    convert_fmpq_mpoly_to_sing_base base(num_handles + 1, f, ctx, r);
    625 
    626628    convert_fmpq_mpoly_to_sing_arg * args = new convert_fmpq_mpoly_to_sing_arg[base.num_threads];
    627629    slong cur_idx = 0;
     
    681683    ring r;
    682684
    683     convert_sing_to_nmod_mpoly_base(slong num_threads_, nmod_mpoly_struct * res_,
    684                             const nmod_mpoly_ctx_struct * ctx_, const ring r_, poly p)
    685       : num_threads(num_threads_),
     685    convert_sing_to_nmod_mpoly_base(nmod_mpoly_struct * res_,
     686                     const nmod_mpoly_ctx_struct * ctx_, const ring r_, poly p)
     687      : num_threads(0),
    686688        res(res_),
    687689        ctx(ctx_),
     
    792794    thread_pool_handle * handles;
    793795    slong num_handles;
    794     slong thread_limit = 1000;
    795 
    796     /* get workers */
     796    slong thread_limit = 1000; // TODO: should be paramter to this function
     797
     798    /* the constructor works out the length of p and sets some markers */
     799    convert_sing_to_nmod_mpoly_base base(res, ctx, r, p);
     800
     801    /* sensibly limit thread count and get workers */
     802    thread_limit = FLINT_MIN(thread_limit, base.length/1024);
    797803    handles = NULL;
    798804    num_handles = 0;
     
    808814    }
    809815
    810     convert_sing_to_nmod_mpoly_base base(num_handles + 1, res, ctx, r, p);
    811 
    812816    /* fill in thread division points */
     817    base.num_threads = 1 + num_handles;
    813818    convert_sing_to_nmod_mpoly_arg * args = new convert_sing_to_nmod_mpoly_arg[base.num_threads];
    814819    slong cur_idx = 0;
     
    921926    thread_pool_handle * handles;
    922927    slong num_handles;
    923     slong thread_limit = 1000;
    924 
    925     /* get workers */
     928    slong thread_limit = 1000; // TODO: should be paramter to this function
     929
     930    /* sensibly limit threads and get workers */
     931    thread_limit = FLINT_MIN(thread_limit, f->length/1024);
    926932    handles = NULL;
    927933    num_handles = 0;
     
    938944
    939945    convert_nmod_mpoly_to_sing_base base(num_handles + 1, f, ctx, r);
    940 
    941946    convert_nmod_mpoly_to_sing_arg * args = new convert_nmod_mpoly_to_sing_arg[base.num_threads];
    942947    slong cur_idx = 0;
Note: See TracChangeset for help on using the changeset viewer.