Changeset 604 for trunk/ADOL-C/include


Ignore:
Timestamp:
Mar 24, 2015 8:34:25 PM (5 years ago)
Author:
kulshres
Message:

Revert "Also use boost pool_allocator in tapeless mode"

As noticed when using ADIC runtime (which is basically the same usage)
pool_allocator does not help but actually harms the performance in this
case. This is because the size of the derivative array is not a compile
time constant and the pool allocator requires object sizes that it
manages to be known at compile time.

This reverts commit e6c580614b7fcaf2b81d901bef63a6ae45c22d28.

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ADOL-C/include/adolc/adtl.h

    r603 r604  
    256256#include <limits>
    257257
    258 
    259258namespace adtl {
    260259
     
    277276#endif
    278277
    279 struct adtl_alloc {
    280     static double* allocate(size_t n);
    281     static void deallocate(double* p, size_t n);
    282 };
    283 
    284 
    285278inline bool adouble::_do_val() {
    286279    return ((forward_mode & ADTL_Z_MASK) == ADTL_Z_MASK);
     
    335328inline adouble::adouble() : val(0), adval(NULL) {
    336329    if (do_adval())
    337         adval = adtl_alloc::allocate(adouble::numDir);
     330        adval = new double[adouble::numDir];
    338331    if (do_indo()) {
    339332     if (!pattern.empty())
     
    344337inline adouble::adouble(const double v) : val(v), adval(NULL) {
    345338    if (do_adval()) {
    346         adval = adtl_alloc::allocate(adouble::numDir);
     339        adval = new double[adouble::numDir];
    347340        FOR_I_EQ_0_LT_NUMDIR
    348341            ADVAL_I = 0.0;
     
    356349inline adouble::adouble(const double v, const double* adv) : val(v), adval(NULL) {
    357350    if (do_adval()) {
    358         adval = adtl_alloc::allocate(adouble::numDir);
     351        adval = new double[adouble::numDir];
    359352        FOR_I_EQ_0_LT_NUMDIR
    360353            ADVAL_I=ADV_I;
     
    368361inline adouble::adouble(const adouble& a) : val(a.val), adval(NULL) {
    369362    if (do_adval()) {
    370         adval = adtl_alloc::allocate(adouble::numDir);
     363        adval = new double[adouble::numDir];
    371364        FOR_I_EQ_0_LT_NUMDIR
    372365            ADVAL_I=a.ADVAL_I;
     
    383376inline adouble::~adouble() {
    384377    if (adval != NULL)
    385         adtl_alloc::deallocate(adval,adouble::numDir);
     378        delete[] adval;
    386379#if 0
    387380    if ( !pattern.empty() )
Note: See TracChangeset for help on using the changeset viewer.