Comments (6)
I now have visual studio 2013 up and running without without warnings, expect for the fact that asctime and gmtime are not thread safe (which I have decided to leave for the time being).
Would you please provide a simple example that results in the warnings you intend to fix here and (so I can add it to the CppAD tests to make sure that the fix works).
from cppad.
The warning appear at every call to ‘Forward(0, x)’;
Example:
std::vector<CppAD::AD<CppAD::zdouble>> vdX(1);
std::vector<CppAD::AD<CppAD::zdouble>> vdY(1);
CppAD::ADFun<CppAD::zdouble> Function;
std::vector<CppAD::zdouble> vdX2(1);
std::vector<CppAD::zdouble> vdY2(1);
vdX[0] = 10.0;
Independent(vdX);
vdY[0] = vdX[0]*2.0;
Function.Dependent(vdX, vdY);
vdX2[0] = 20.0;
vdY2 = Function.Forward(0, vdX2); // Generates warnings during compilation
If I add this template constructor
template
/// Constructor from double
zdouble(const Base& value)
: dbl_((double)value)
{ }
And remove the double constructor
/// Constructor from double
/*zdouble(const double& dbl)
: dbl_(dbl)
{ }*/
Then the warnings are silenced.
Kind regards
Loutjie
From: Brad Bell [mailto:[email protected]]
Sent: 2015 September 22 07:36 PM
To: coin-or/CppAD
Cc: Loutjie
Subject: Re: [CppAD] Silence warning in Visual Studio 2010 when using zdouble (#10)
I now have visual studio 2013 up and running without without warnings, expect for the fact that asctime and gmtime are not thread safe (which I have decided to leave for the time being).
Would you please provide a simple example that results in the warnings you intend to fix here and (so I can add it to the CppAD tests to make sure that the fix works).
—
Reply to this email directly or view it on GitHub #10 (comment) . https://github.com/notifications/beacon/AM7EHxXoOUkgr7kYkJdDJIl1MHaHPDNSks5o0YjogaJpZM4FmpYj.gif
from cppad.
We compile at Warning Level 4.
From: Brad Bell [mailto:[email protected]]
Sent: 2015 September 22 07:36 PM
To: coin-or/CppAD
Cc: Loutjie
Subject: Re: [CppAD] Silence warning in Visual Studio 2010 when using zdouble (#10)
I now have visual studio 2013 up and running without without warnings, expect for the fact that asctime and gmtime are not thread safe (which I have decided to leave for the time being).
Would you please provide a simple example that results in the warnings you intend to fix here and (so I can add it to the CppAD tests to make sure that the fix works).
—
Reply to this email directly or view it on GitHub #10 (comment) . https://github.com/notifications/beacon/AM7EHxXoOUkgr7kYkJdDJIl1MHaHPDNSks5o0YjogaJpZM4FmpYj.gif
from cppad.
Warning level 4
https://msdn.microsoft.com/en-us/library/thxezb7y.aspx
is the key. It is generating lots more warnings in my tests. I will look
at them.
Brad.
On 9/22/2015 10:15 PM, Loutjie wrote:
We compile at Warning Level 4.
From: Brad Bell [mailto:[email protected]]
Sent: 2015 September 22 07:36 PM
To: coin-or/CppAD
Cc: Loutjie
Subject: Re: [CppAD] Silence warning in Visual Studio 2010 when using
zdouble (#10)I now have visual studio 2013 up and running without without warnings,
expect for the fact that asctime and gmtime are not thread safe (which
I have decided to leave for the time being).Would you please provide a simple example that results in the warnings
you intend to fix here and (so I can add it to the CppAD tests to make
sure that the fix works).—
Reply to this email directly or view it on GitHub
#10 (comment) .
https://github.com/notifications/beacon/AM7EHxXoOUkgr7kYkJdDJIl1MHaHPDNSks5o0YjogaJpZM4FmpYj.gif—
Reply to this email directly or view it on GitHub
#10 (comment).
from cppad.
On 9/22/2015 10:14 PM, Loutjie wrote:
The warning appear at every call to ‘Forward(0, x)’;
... snip ...
I have made some recent changes and now get no warning (with Visual
Studio 2013) with the following steps in a Windows CMD window
mkdir build
cd build
cmake -G "NMake Makefiles" -D cppad_cxx_flags="/W4" ..
nmake check_example
see
5787b4a
Note that this includes no warnings when compiling the file
https://github.com/coin-or/CppAD/blob/master/example/zdouble.cpp
and that files has order zero forward mode computations (using zdouble)
in it; see the code
z = g.Forward(0, x);
and consider the case where Base = zdouble.
In addition, I have tried replacing zdouble.cpp by the following (at
your suggestion) and still get no warning when executing 'nmake
check_example'.
include <cppad/cppad.hpp>
bool zdouble(void)
{ bool ok = true;
using std::cout;
//
std::vectorCppAD::ADCppAD::zdouble vdX(1);
std::vectorCppAD::ADCppAD::zdouble vdY(1);
CppAD::ADFunCppAD::zdouble Function;
std::vectorCppAD::zdouble vdX2(1);
std::vectorCppAD::zdouble vdY2(1);
vdX[0] = 10.0;
Independent(vdX);
vdY[0] = vdX[0]*2.0;
Function.Dependent(vdX, vdY);
vdX2[0] = 20.0;
vdY2 = Function.Forward(0, vdX2); // Generates warnings during
compilation
//
return ok;
}
~
from cppad.
If one uses the Visual Studio 2013 and the windows download, extraction, and testing instructions on
http://www.coin-or.org/CppAD/Doc/download.htm#Compressed%20Archives.Windows%20File%20Extraction%20and%20Testing
the only warnings are
- C4996: gmtime and asctime my be unsafe.
- LNK4044: unrecognized option '/openmp'; ignored
The functions asctime and gmtime are called when onlly one thread is active and there does not seem to be a standard way to get a thread safe version of these functions. The option /openmp is generated by cmake and is not valid for Visual Studio 2013 (but I think it works for 2015)
Note that the CppAD source code now suppresses the warnings
- C4100 unreferenced formal parameter
- C4127 conditional expression is constant
This is mentioned under the heading 09-24 on
http://www.coin-or.org/CppAD/Doc/whats_new_15.htm#09-24
CppAD uses the same signature for similar routines that in some cases do not use formal parameters. In addition, it has asserts for expressions that are constant.
from cppad.
Related Issues (20)
- solution vector is empty HOT 10
- Undefined reference to temp_file HOT 2
- ipopt and cppad tests HOT 11
- Problem to Link with CppAD and Ipopt HOT 16
- CppAD::cg::CGException: what(): GreaterThanZero cannot be called for non-parameters HOT 5
- Compiler warnings from use of bitwise '|' and '&' for bool arguments HOT 5
- Potential build mistake in third party tool in use of NDEBUG flag - CppAD compiled in Release HOT 13
- Static library for non-windows builds HOT 2
- User's Guide URL on README.md 404s HOT 8
- bin/get_colpack.sh Script Error HOT 6
- Exception thrown in val_graph optimizer HOT 3
- Name of function is cleared after val_graph optimization
- License question about the meaning of EPL-2.0 OR GPL-2.0-or-later HOT 3
- CppAD exception while running parallel loop HOT 13
- About Eigen. I can't store the scalar result of a matrix operation at the index location of another std::vector or Eigen::Vector. HOT 5
- Could NOT find GOOGLEHASH (missing: GOOGLEHASH_COMPILE) HOT 4
- make check_cppad_ipopt Failure HOT 14
- No installed conda 'base' environment found on macos-latest.
- ADFun::optimize gives compile error with std::complex HOT 4
- Errors when build with latest version of cppad and cppadcg on 3 years old code. HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cppad.