Commit c7ea0e8e authored by David Bommes's avatar David Bommes

-added text file for building in windows

-some minor compilation fixes for windows
-added fixed seed for random number generator


git-svn-id: http://www.openflipper.org/svnrepo/CoMISo/trunk@225 1355f012-dd97-4b2f-ae87-10fa9f823a57
parent 31c37650
This document describes how to build CoMISo on Windows:
1) checkout CoMISo from svn (e.g. with freeware TortoiseSVN):
--------------------------------------------------------------------
http://www.openflipper.org/svnrepo/CoMISo/trunk/CoMISo
2) Install cmake:
------------------------------------------------------------------
http://www.cmake.org/cmake/resources/software.html
(I used Version 2.8.11.1)
-start cmake-gui
-specify build system, e.g. Microsoft Visual Studio 12
-specify source location, e.g. C:/projects/CoMISo
-specify a build location (outside the source directories!),
e.g. C:/projects/CoMISo_build
-press configure button
3) Install GMM++:
------------------------------------------------------------------
just download and extract...
http://download.gna.org/getfem/stable/gmm-4.2.tar.gz
and adjust paths in cmake-gui
4) Install Eigen3:
------------------------------------------------------------------
just download and extract...
http://bitbucket.org/eigen/eigen/get/3.1.3.zip
and adjust paths in cmake-gui
5) Install Blas:
------------------------------------------------------------------
you can use any blas implementation available
here I describe the preparation of OpenBlas
download OpenBlas:
http://github.com/xianyi/OpenBLAS/zipball/v0.2.6
follow the install instructions of OpenBlas(see below):
Quick guide to build library for Windows 64bit.
1. What you need
a. Windows Server 2003 or later
b. Cygwin environment(make, gcc, g77, perl, sed, wget)
c. MinGW64 compiler
d. Microsoft Visual Studio (lib.exe and mspdb80.dll are required to create dll)
2. Do ./quickbuild.win64
3. make PREFIX=/path/to/your/installation install
4. adjust BLAS_LIBRARIES path in cmake-gui to previously generated lib
6) In cmake-gui press configure and generate
------------------------------------------------------------------
this creates the file "CoMISo.sln" inside the build folder,
which can be opened with Microsoft Visual Studio
- many dependencies are optional and only required if some of the
advanced classes are used. Which packages were found in your
configuration and are available during runtime is stated in
CoMISo\Config\config.hh
7) Test compiled example programs
-----------------------------------
run e.g. .\Build\factored_solver.exe (from console to see output)
include (CoMISoExample)
if (WIN32)
acg_add_executable (factored_solver WIN32 ${sources} ${headers} )
else ()
acg_add_executable (factored_solver ${sources} ${headers} )
endif ()
acg_add_executable (factored_solver ${sources} ${headers} )
# enable rpath linking
set_target_properties(factored_solver PROPERTIES INSTALL_RPATH_USE_LINK_PATH 1)
......
......@@ -87,6 +87,9 @@ void print_equations( const MatrixT& _B)
// Example main
int main(void)
{
// initialize random number generator
srand(12345);
std::cout << "---------- 1) setup an (m x n) sparse row matrix B (i.e. the B in the system ((Bx)^T)Bx)" << std::endl;
int m = 9;
int n = 5+1;
......
include (CoMISoExample)
if (WIN32)
acg_add_executable (quadratic_solver WIN32 ${sources} ${headers} )
else ()
acg_add_executable (quadratic_solver ${sources} ${headers} )
endif ()
acg_add_executable (quadratic_solver ${sources} ${headers} )
# enable rpath linking
set_target_properties(quadratic_solver PROPERTIES INSTALL_RPATH_USE_LINK_PATH 1)
......
include (CoMISoExample)
if (WIN32)
acg_add_executable (small_cplex_soc WIN32 ${sources} ${headers} )
else ()
acg_add_executable (small_cplex_soc ${sources} ${headers} )
endif ()
acg_add_executable (small_cplex_soc ${sources} ${headers} )
# enable rpath linking
set_target_properties(small_cplex_soc PROPERTIES INSTALL_RPATH_USE_LINK_PATH 1)
......
include (CoMISoExample)
if (WIN32)
acg_add_executable (small_eigenproblem WIN32 ${sources} ${headers} )
else ()
acg_add_executable (small_eigenproblem ${sources} ${headers} )
endif ()
acg_add_executable (small_eigenproblem ${sources} ${headers} )
# enable rpath linking
set_target_properties(small_eigenproblem PROPERTIES INSTALL_RPATH_USE_LINK_PATH 1)
......
include (CoMISoExample)
if (WIN32)
acg_add_executable (small_factored_solver WIN32 ${sources} ${headers} )
else ()
acg_add_executable (small_factored_solver ${sources} ${headers} )
endif ()
acg_add_executable (small_factored_solver ${sources} ${headers} )
# enable rpath linking
set_target_properties(small_factored_solver PROPERTIES INSTALL_RPATH_USE_LINK_PATH 1)
......
include (CoMISoExample)
if (WIN32)
acg_add_executable (small_miqp WIN32 ${sources} ${headers} )
else ()
acg_add_executable (small_miqp ${sources} ${headers} )
endif ()
acg_add_executable (small_miqp ${sources} ${headers} )
# enable rpath linking
set_target_properties(small_miqp PROPERTIES INSTALL_RPATH_USE_LINK_PATH 1)
......
include (CoMISoExample)
if (WIN32)
acg_add_executable (small_nleast_squares WIN32 ${sources} ${headers} )
else ()
acg_add_executable (small_nleast_squares ${sources} ${headers} )
endif ()
acg_add_executable (small_nleast_squares ${sources} ${headers} )
# enable rpath linking
set_target_properties(small_nleast_squares PROPERTIES INSTALL_RPATH_USE_LINK_PATH 1)
......
include (CoMISoExample)
if (WIN32)
acg_add_executable (small_nsolver WIN32 ${sources} ${headers} )
else ()
acg_add_executable (small_nsolver ${sources} ${headers} )
endif ()
acg_add_executable (small_nsolver ${sources} ${headers} )
# enable rpath linking
set_target_properties(small_nsolver PROPERTIES INSTALL_RPATH_USE_LINK_PATH 1)
......
include (CoMISoExample)
if (WIN32)
acg_add_executable (small_quadratic_solver WIN32 ${sources} ${headers} )
else ()
acg_add_executable (small_quadratic_solver ${sources} ${headers} )
endif ()
acg_add_executable (small_quadratic_solver ${sources} ${headers} )
# enable rpath linking
set_target_properties(small_quadratic_solver PROPERTIES INSTALL_RPATH_USE_LINK_PATH 1)
......
include (CoMISoExample)
if (WIN32)
acg_add_executable (small_quadratic_resolve WIN32 ${sources} ${headers} )
else ()
acg_add_executable (small_quadratic_resolve ${sources} ${headers} )
endif ()
acg_add_executable (small_quadratic_resolve ${sources} ${headers} )
# enable rpath linking
set_target_properties(small_quadratic_resolve PROPERTIES INSTALL_RPATH_USE_LINK_PATH 1)
......
include (CoMISoExample)
if (WIN32)
acg_add_executable (small_sparseqr WIN32 ${sources} ${headers} )
else ()
acg_add_executable (small_sparseqr ${sources} ${headers} )
endif ()
acg_add_executable (small_sparseqr ${sources} ${headers} )
# enable rpath linking
set_target_properties(small_sparseqr PROPERTIES INSTALL_RPATH_USE_LINK_PATH 1)
......
#include "NPDerivativeChecker.hh"
namespace COMISO {
NPDerivativeChecker::NPDerivativeChecker()
{}
NPDerivativeChecker::~NPDerivativeChecker()
{}
}
......@@ -14,11 +14,15 @@
#include "NProblemGmmInterface.hh"
#include "NProblemInterface.hh"
#include <iostream>
#include <iomanip>
#include <limits>
#include <cfloat>
#include <cmath>
#include <climits>
#include <CoMISo/Utils/VSToolsT.hh>
#include <CoMISo/Utils/StopWatch.hh>
#include <gmm/gmm.h>
......@@ -44,7 +48,7 @@ class COMISODLLEXPORT NPDerivativeChecker
{
public:
struct Config
struct COMISODLLEXPORT Config
{
Config() : x_min(-1.0), x_max(1.0), n_iters(1), dx(1e-5), eps(1e-3), relativeEps(std::numeric_limits<double>::quiet_NaN())
{}
......@@ -58,10 +62,10 @@ public:
};
/// Default constructor
NPDerivativeChecker() {}
NPDerivativeChecker();
/// Destructor
~NPDerivativeChecker() {}
~NPDerivativeChecker();
template<class ProblemInterface>
bool check_all(ProblemInterface* _np, double _dx, double _eps)
......@@ -107,11 +111,11 @@ public:
x[j] += conf_.dx;
double fd = (f1-f0)/(2.0*conf_.dx);
if ((!std::isnan(conf_.relativeEps) && fabs(fd-g[j]) > fmax(fabs(g[j]), 1.0) * conf_.relativeEps) || fabs(fd-g[j]) > conf_.eps)
if ((!std::isnan(conf_.relativeEps) && std::abs(fd-g[j]) > std::max(std::abs(g[j]), 1.0) * conf_.relativeEps) || std::abs(fd-g[j]) > conf_.eps)
{
++ n_errors;
std::cerr << "Gradient error in component " << j << ": " << g[j]
<< " should be " << fd << " (" << fabs(fd-g[j]) << ")" << std::endl;
<< " should be " << fd << " (" << std::abs(fd-g[j]) << ")" << std::endl;
}
else ++ n_ok;
}
......@@ -161,13 +165,13 @@ public:
double fd = (f0-f1-f2+f3)/(4.0*conf_.dx*conf_.dx);
if ((!std::isnan(conf_.relativeEps) && fabs(fd-H.coeff(j,k)) > fmax(fabs(getCoeff(H, j,k)), 1.0) * conf_.relativeEps) || fabs(fd-getCoeff(H, j,k)) > conf_.eps)
if ((!std::isnan(conf_.relativeEps) && std::abs(fd-H.coeff(j,k)) > std::max(std::abs(getCoeff(H, j,k)), 1.0) * conf_.relativeEps) || std::abs(fd-getCoeff(H, j,k)) > conf_.eps)
{
++ n_errors;
std::cerr << "Hessian error in component " << j << "," << k << ": " << getCoeff(H, j,k)
<< " should be (following FiniteDifferences) " << fd
<< " (absolute delta: " << fabs(fd-getCoeff(H, j,k))
<< ", relative delta:" << (fabs(fd-getCoeff(H, j,k))/fmax(fabs(getCoeff(H, j,k)), 1.0)) << ")" << std::endl;
<< " (absolute delta: " << std::abs(fd-getCoeff(H, j,k))
<< ", relative delta:" << (std::abs(fd-getCoeff(H, j,k))/std::max(std::abs(getCoeff(H, j,k)), 1.0)) << ")" << std::endl;
}
else ++ n_ok;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment