Changeset 3725


Ignore:
Timestamp:
Sep 21, 2015 8:20:43 AM (4 years ago)
Author:
bradbell
Message:

merge to branch: trunk
from repository: https://github.com/coin-or/CppAD
start hash code: eccf28fdd721e38ba23745ca0c75983db6422b12
end hash code: 958f206f6df804402f4ee8f607db53ba6d0f094b

commit 958f206f6df804402f4ee8f607db53ba6d0f094b
Author: Brad Bell <bradbell@…>
Date: Mon Sep 21 05:17:32 2015 -0700

CMakeLists.txt: fix mistake in HEAD~2 commit; i.e.,

b93491145791ae63bffaffc407d59762475091f2

commit f70c22c2d3de8a6b309db14dfa5b8a7fce3a35b0
Author: Brad Bell <bradbell@…>
Date: Sun Sep 20 22:02:44 2015 -0700

Remove invisible white space.

commit b93491145791ae63bffaffc407d59762475091f2
Author: Brad Bell <bradbell@…>
Date: Sun Sep 20 22:02:16 2015 -0700

  1. Add cppad_profile_flag to list of cmake commands.
  2. Fix more Microsoft C++ warnings.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/CMakeLists.txt

    r3705 r3725  
    106106# cppad_cxx_flags
    107107command_line_arg(cppad_cxx_flags NOTFOUND STRING
    108         "extra flags used with cppad source (besides debug and release flags)"
     108        "compile flags used with cppad (besides debug, release, and profile flags)"
     109)
     110# -----------------------------------------------------------------------------
     111# cppad_profile_flag
     112command_line_arg(cppad_profile_flag NOTFOUND STRING
     113        "compile flag used to compoile and link a profile version of a program"
    109114)
    110115# -----------------------------------------------------------------------------
  • trunk/bin/run_cmake.sh

    r3615 r3725  
    22# $Id$
    33# -----------------------------------------------------------------------------
    4 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
     4# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
    55#
    66# CppAD is distributed under multiple licenses. This distribution is under
     
    103103then
    104104        sed -e 's|^SET(CMAKE_BUILD_TYPE .*|SET(CMAKE_BUILD_TYPE DEBUG)|' \
    105                 -i  speed/CMakeLists.txt
    106 elif [ "$profile_speed" == 'yes' ]
    107 then
    108         sed -e 's|^SET(CMAKE_BUILD_TYPE .*|SET(CMAKE_BUILD_TYPE MinSizeRel)|' \
     105            -e 's|^# SET(CMAKE_CXX_FLAGS_DEBUG|SET(CMAKE_CXX_FLAGS_DEBUG|' \
    109106                -i  speed/CMakeLists.txt
    110107else
    111108        sed -e 's|^SET(CMAKE_BUILD_TYPE .*|SET(CMAKE_BUILD_TYPE RELEASE)|' \
     109            -e 's|^SET(CMAKE_CXX_FLAGS_DEBUG|# SET(CMAKE_CXX_FLAGS_DEBUG|' \
    112110                -i speed/CMakeLists.txt
    113111fi
     
    189187if [ "$testvector" != 'eigen' ]
    190188then
    191         cppad_cxx_flags="$cppad_cxx_flags -Wshadow"
     189        cppad_cxx_flags="$cppad_cxx_flags -Wshadow"
    192190fi
    193191cmake_args="$cmake_args -D cppad_cxx_flags='$cppad_cxx_flags'"
     
    198196        cmake_args="$cmake_args -D CMAKE_C_COMPILER=clang"
    199197        cmake_args="$cmake_args -D CMAKE_CXX_COMPILER=clang++"
     198fi
     199#
     200# profile
     201if [ "$profile_speed" == 'yes' ]
     202then
     203        cmake_args="$cmake_args -D cppad_profile_flag=-pg"
    200204fi
    201205#
  • trunk/multi_thread/openmp/a11c_openmp.cpp

    r3724 r3725  
    4848                for(i = 1; i < n; i++) /* i is private by default */
    4949                {       assert( omp_get_num_threads() == NUMBER_THREADS );
    50                         b[i] = (a[i] + a[i-1]) / 2.0;
     50                        b[i] = (a[i] + a[i-1]) / float(2);
    5151                }
    5252        }
  • trunk/multi_thread/openmp/simple_ad_openmp.cpp

    r2506 r3725  
    11// $Id$
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
    6 the terms of the 
     6the terms of the
    77                    Eclipse Public License Version 1.0.
    88
     
    2525
    2626$head Purpose$$
    27 This example demonstrates how CppAD can be used in a 
     27This example demonstrates how CppAD can be used in a
    2828OpenMP multi-threading environment.
    2929
     
    5656        // used to inform CppAD when we are in parallel execution mode
    5757        bool in_parallel(void)
    58         {       return static_cast<bool>( omp_in_parallel() ); }
     58        {       return omp_in_parallel() != 0; }
    5959        // ------------------------------------------------------------------
    6060        // used to inform CppAD of the current thread number
     
    7575        {       bool ok = true;
    7676
    77                 // initialize thread_all_ 
     77                // initialize thread_all_
    7878                int thread_num, int_num_threads = int(num_threads);
    7979                for(thread_num = 0; thread_num < int_num_threads; thread_num++)
     
    129129                Independent(ax);
    130130                ay[0] = sqrt( ax[0] * ax[0] );
    131                 CppAD::ADFun<double> f(ax, ay); 
     131                CppAD::ADFun<double> f(ax, ay);
    132132
    133                 // Check function value corresponds to the identity 
     133                // Check function value corresponds to the identity
    134134                double eps = 10. * CppAD::numeric_limits<double>::epsilon();
    135135                ok        &= NearEqual(ay[0], ax[0], eps, eps);
     
    152152        size_t thread_num;
    153153        for(thread_num = 0; thread_num < num_threads; thread_num++)
    154         {       ok &= thread_alloc::inuse(thread_num) == 0; 
    155                 ok &= thread_alloc::available(thread_num) == 0; 
     154        {       ok &= thread_alloc::inuse(thread_num) == 0;
     155                ok &= thread_alloc::available(thread_num) == 0;
    156156        }
    157157
     
    176176                thread_alloc::return_memory( v_ptr );
    177177                // check that there is no longer any memory inuse by this thread
    178                 ok &= thread_alloc::inuse(thread_num) == 0; 
     178                ok &= thread_alloc::inuse(thread_num) == 0;
    179179                // return all memory being held for future use by this thread
    180                 thread_alloc::free_available(thread_num); 
     180                thread_alloc::free_available(thread_num);
    181181        }
    182182
  • trunk/multi_thread/openmp/team_openmp.cpp

    r2506 r3725  
    11// $Id$
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
    6 the terms of the 
     6the terms of the
    77                    Eclipse Public License Version 1.0.
    88
     
    1010Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
    1111-------------------------------------------------------------------------- */
    12 /* 
     12/*
    1313$begin team_openmp.cpp$$
    1414$spell
     
    4242        // used to inform CppAD when we are in parallel execution mode
    4343        bool in_parallel(void)
    44         {       return static_cast<bool> ( omp_in_parallel() ); }
     44        {       return omp_in_parallel() != 0; }
    4545
    4646        // used to inform CppAD of the current thread number
    4747        size_t thread_num(void)
    48         {       return static_cast<size_t>( omp_get_thread_num() ); } 
     48        {       return static_cast<size_t>( omp_get_thread_num() ); }
    4949}
    5050
     
    6161        omp_set_num_threads( int(num_threads) );
    6262
    63         // setup for using CppAD::AD<double> in parallel 
     63        // setup for using CppAD::AD<double> in parallel
    6464        thread_alloc::parallel_setup(num_threads, in_parallel, thread_num);
    6565        thread_alloc::hold_memory(true);
     
    8282        for(thread_num = 0; thread_num < number_threads; thread_num++)
    8383                worker();
    84 // end omp parallel for 
     84// end omp parallel for
    8585
    8686        return ok;
  • trunk/omh/install/cmake.omh

    r3664 r3725  
    112112    \
    113113    -D cppad_cxx_flags=%cppad_cxx_flags%                                     \
     114    -D cppad_profile_flag=%cppad_profile_flag%                               \
    114115    \
    115116    -D cppad_testvector=%cppad_testvector%                                   \
     
    272273In order for the compiler to take advantage of features that are new in C++11,
    273274the $icode cppad_cxx_flags$$ must enable these features.
    274 The compiler may still be used with a flag that disables the new features.
     275The compiler may still be used with a flag that disables the new features
     276(unless it is a Microsoft compiler; i.e., $code _MSC_VER$$ is defined).
     277
     278$head cppad_profile_flag$$
     279$index profile$$
     280This specifies an addition compiler and link flag that is used
     281for $cref/profiling/speed_main/package/profile/$$ the speed tests.
     282A profile version of the speed test is only build when this argument
     283is present.
    275284
    276285$subhead Eigen and Fadbad$$
  • trunk/omh/whats_new/whats_new_15.omh

    r3724 r3725  
    5555        alloc
    5656        adouble
     57        gmtime
     58        asctime
    5759$$
    5860
     
    6466The purpose of this section is to
    6567assist you in learning about changes between various versions of CppAD.
     68
     69$head 09-20$$
     70$list number$$
     71Add the $cref/cppad_profile_flag/cmake/cppad_profile_flag/$$
     72to the list of possible $code cmake$$ command arguments.
     73$lnext
     74More of the warnings generated by Visual Studio 2013 have been fixed.
     75One remaining warning is about $code asctime$$ and $code gmtime$$ not being
     76thread safe.
     77$lend
    6678
    6779$head 09-19$$
  • trunk/speed/CMakeLists.txt

    r3565 r3725  
    44#
    55# CppAD is distributed under multiple licenses. This distribution is under
    6 # the terms of the 
     6# the terms of the
    77#                     Eclipse Public License Version 1.0.
    88#
     
    1010# Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
    1111# -----------------------------------------------------------------------------
    12 # Build the speed/* directory tests 
     12# Build the speed/* directory tests
    1313# Inherit environment from ../CMakeList.txt
    1414
    15 # CppAD developers use MinSizeRel for profiling the speed tests
    16 SET(CMAKE_CXX_FLAGS_MINSIZEREL "-O0 -DNDEBUG")
    17 SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
     15# CppAD developers use DEBUG for debugging speed tests.
     16# SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -DNDEBUG")
    1817
    19 # Specify build type for this directory and all its subdirectories. 
     18# Specify build type for this directory and all its subdirectories.
    2019# Possible values are DEBUG, RELEASE, RelWithDebInfo and MinSizeRel
    2120SET(CMAKE_BUILD_TYPE RELEASE)
     
    2827SET(check_depends "")
    2928
    30 # The CMakeLists.txt file in the specified source directory is processed 
     29# The CMakeLists.txt file in the specified source directory is processed
    3130# before the current input file continues beyond this command.
    3231# add_subdirectory(source_dir [binary_dir] [EXCLUDE_FROM_ALL])
     
    4241add_to_list(check_depends check_speed_example)
    4342#
    44 ADD_SUBDIRECTORY(profile)
    45 add_to_list(check_depends check_speed_profile)
     43IF ( cppad_profile_flag )
     44        ADD_SUBDIRECTORY(profile)
     45        add_to_list(check_depends check_speed_profile)
     46ENDIF ( cppad_profile_flag )
    4647#
    4748IF ( adolc_prefix )
  • trunk/speed/profile/CMakeLists.txt

    r3139 r3725  
    11# $Id$
    22# -----------------------------------------------------------------------------
    3 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
     3# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-15 Bradley M. Bell
    44#
    55# CppAD is distributed under multiple licenses. This distribution is under
    6 # the terms of the 
     6# the terms of the
    77#                     Eclipse Public License Version 1.0.
    88#
     
    1010# Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
    1111# -----------------------------------------------------------------------------
    12 # Build the speed/profile directory tests 
     12# Build the speed/profile directory tests
    1313# Inherit environment from ../CMakeList.txt
    1414# CMAKE_BUILD_TYPE determined by parent directory
    1515
    16 # Adds flags to the compiler command line for sources in the current directory 
    17 # and below. This command can be used to add any flags, but it was originally 
    18 # intended to add preprocessor definitions. 
    19 ADD_DEFINITIONS("-DCPPAD_PROFILE_SPEED -pg")
     16# Adds flags to the compiler command line for sources in the current directory
     17# and below. This command can be used to add any flags, but it was originally
     18# intended to add preprocessor definitions.
     19ADD_DEFINITIONS("-DCPPAD_PROFILE_SPEED ${cppad_profile_flag}")
    2020
    21 # Extra flags used by the linker when creating an executable. 
    22 SET(CMAKE_EXE_LINKER_FLAGS "-pg")
     21# Extra flags used by the linker when creating an executable.
     22SET(CMAKE_EXE_LINKER_FLAGS ${cppad_profile_flag})
    2323
    2424# Local include directories to search (not in package_prefix/includdir)
     
    2828#                 source1 source2 ... sourceN
    2929# )
    30 ADD_EXECUTABLE(speed_profile EXCLUDE_FROM_ALL ../main.cpp 
     30ADD_EXECUTABLE(speed_profile EXCLUDE_FROM_ALL ../main.cpp
    3131        ../cppad/ode.cpp
    32         ../cppad/det_lu.cpp 
    33         ../cppad/det_minor.cpp 
    34         ../cppad/mat_mul.cpp 
     32        ../cppad/det_lu.cpp
     33        ../cppad/det_minor.cpp
     34        ../cppad/mat_mul.cpp
    3535        ../cppad/poly.cpp
    3636        ../cppad/sparse_hessian.cpp
     
    5555
    5656# Add the check_speed_profile target
    57 ADD_CUSTOM_TARGET(check_speed_profile 
     57ADD_CUSTOM_TARGET(check_speed_profile
    5858        speed_profile correct 54321
    5959        DEPENDS speed_profile
Note: See TracChangeset for help on using the changeset viewer.