Skip to content

Commit

Permalink
Merge pull request #61 from darioizzo/update2022
Browse files Browse the repository at this point in the history
update for tbb and obake. CI update
  • Loading branch information
darioizzo authored Jun 15, 2022
2 parents 4c40ff2 + b2aae82 commit e97a3de
Show file tree
Hide file tree
Showing 17 changed files with 163 additions and 297 deletions.
17 changes: 0 additions & 17 deletions .circleci/config.yml

This file was deleted.

25 changes: 23 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,30 @@ on:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
conda_release:
ubuntu-debug:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: bash tools/gha_conda_release.sh
run: bash tools/gha-ubuntu-debug.sh
osx-debug:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- name: Build
run: bash tools/gha-osx-debug.sh
windows-release:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.8
channels: conda-forge
channel-priority: strict
- name: Build
run: .\tools\gha-windows-release.ps1
shell: powershell
11 changes: 0 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,9 @@ matrix:
sudo: required
services:
- docker
- env: AUDI_BUILD="manylinux64Py36" DOCKER_IMAGE="pagmo2/manylinux2010_x86_64_with_deps"
sudo: required
services:
- docker
- env: AUDI_BUILD="OSXDebug" AUDI_BUILD_TYPE="Debug"
os: osx
osx_image: xcode9.4
- env: AUDI_BUILD="OSXRelease" AUDI_BUILD_TYPE="Release"
os: osx
osx_image: xcode9.4


script:
- if [[ "${AUDI_BUILD}" == OSX* ]]; then bash tools/travis_osx.sh; fi
- if [[ "${AUDI_BUILD}" == manylinux* ]]; then bash tools/install_travis.sh; fi

notifications:
Expand Down
109 changes: 0 additions & 109 deletions azure-pipelines.yml

This file was deleted.

2 changes: 1 addition & 1 deletion include/audi/gdual.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace audi
* @note The class can be instantiated with any type that is suitable to be a coefficient in a obake polynomial.
*
*/
template <typename Cf, typename Monomial = obake::d_packed_monomial<unsigned long long, 8>>
template <typename Cf, typename Monomial = obake::d_packed_monomial<std::uint64_t, 8>>
class gdual
{
// Static checks.
Expand Down
6 changes: 0 additions & 6 deletions tests/division_perf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

#include <boost/optional.hpp>

#include <tbb/task_scheduler_init.h>

#include <audi/gdual.hpp>

using namespace audi;
Expand All @@ -33,10 +31,6 @@ void scalable_div(int m, int n)

BOOST_AUTO_TEST_CASE(division_performance)
{
boost::optional<tbb::task_scheduler_init> tinit;
if (boost::unit_test::framework::master_test_suite().argc > 1) {
tinit.emplace(boost::lexical_cast<unsigned>(boost::unit_test::framework::master_test_suite().argv[1u]));
}
std::cout << "Testing division of (x1^2 + ... + xn^2) / (x1 * (x1 + x2 + .. + xn) ): " << std::endl;
for (auto m = 5; m < 10; ++m) {
for (auto n = 5; n < 12; ++n) {
Expand Down
6 changes: 0 additions & 6 deletions tests/functions_from_d_perf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

#include <boost/optional.hpp>

#include <tbb/task_scheduler_init.h>

using namespace audi;

void scalable_test(int m, int n, gdual<double> (*func)(const gdual<double> &d), double param)
Expand All @@ -33,10 +31,6 @@ void scalable_test(int m, int n, gdual<double> (*func)(const gdual<double> &d),

BOOST_AUTO_TEST_CASE(functions_from_derivative_vs_nilpotency)
{
boost::optional<tbb::task_scheduler_init> tinit;
if (boost::unit_test::framework::master_test_suite().argc > 1) {
tinit.emplace(boost::lexical_cast<unsigned>(boost::unit_test::framework::master_test_suite().argv[1u]));
}

unsigned int low = 9, high = 10;

Expand Down
2 changes: 1 addition & 1 deletion tests/gdual_d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ BOOST_AUTO_TEST_CASE(subs)
// Testing the substitution symbol->value. The Taylor expansion of sin(0+dx) evaluated in dx=1 is
// compared against the value of sin(1)
{
gdual<double, obake::packed_monomial<unsigned long long>> x(0, "x", 100);
gdual<double, obake::packed_monomial<std::uint64_t>> x(0, "x", 100);
auto sx = sin(x);
auto sx1 = sx.subs("dx", 1.);
std::cout << sx << std::endl;
Expand Down
42 changes: 21 additions & 21 deletions tests/invert_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ BOOST_AUTO_TEST_CASE(computations)
{
// We invert (around 0) asin(x), hence checking to get the MacLaurin series
// for sin(x) = dx - dx^3/3! + dx^5/5! + H.O.T.
gdual<double, obake::packed_monomial<unsigned long long>> x(0, "x", 5);
std::vector<gdual<double, obake::packed_monomial<unsigned long long>>> map, map_inv;
gdual<double, obake::packed_monomial<std::uint64_t>> x(0, "x", 5);
std::vector<gdual<double, obake::packed_monomial<std::uint64_t>>> map, map_inv;
map.push_back(asin(x));
map_inv = invert_map(map);
BOOST_CHECK_CLOSE(map_inv[0].constant_cf(), 0, 1e-12); // constant
Expand All @@ -36,8 +36,8 @@ BOOST_AUTO_TEST_CASE(computations)
{
// We invert (around 0.1) some complex mathematical formula and check that its inversion
// computes correctly
gdual<double, obake::packed_monomial<unsigned long long>> x(0.1, "x", 10);
std::vector<gdual<double, obake::packed_monomial<unsigned long long>>> map, map_inv;
gdual<double, obake::packed_monomial<std::uint64_t>> x(0.1, "x", 10);
std::vector<gdual<double, obake::packed_monomial<std::uint64_t>>> map, map_inv;
auto p0 = x * 3. * sin(x / 2.) + x + 1. * pow(1 + x, cos(x * 3));
map.push_back(p0);
map_inv = invert_map(map);
Expand All @@ -50,44 +50,44 @@ BOOST_AUTO_TEST_CASE(computations)
{
// We invert a 2-D map in x,y (polynomial) and check that the map composition
// is the identity f(g(x)) = x (since no constant_cf is present)
gdual<double, obake::packed_monomial<unsigned long long>> x(1., "x", 4);
gdual<double, obake::packed_monomial<unsigned long long>> y(1., "y", 4);
std::vector<gdual<double, obake::packed_monomial<unsigned long long>>> map, map_inv;
gdual<double, obake::packed_monomial<std::uint64_t>> x(1., "x", 4);
gdual<double, obake::packed_monomial<std::uint64_t>> y(1., "y", 4);
std::vector<gdual<double, obake::packed_monomial<std::uint64_t>>> map, map_inv;
map.push_back(x + y + x * x * y - 3.);
map.push_back(x - y + y * y * x - 1.);
map_inv = invert_map(map);
auto I = map_inv & map;
BOOST_CHECK(EPSILON_COMPARE(I[0], gdual<double, obake::packed_monomial<unsigned long long>>(0, "x", 4), 1e-10));
BOOST_CHECK(EPSILON_COMPARE(I[1], gdual<double, obake::packed_monomial<unsigned long long>>(0, "y", 4), 1e-10));
BOOST_CHECK(EPSILON_COMPARE(I[0], gdual<double, obake::packed_monomial<std::uint64_t>>(0, "x", 4), 1e-10));
BOOST_CHECK(EPSILON_COMPARE(I[1], gdual<double, obake::packed_monomial<std::uint64_t>>(0, "y", 4), 1e-10));
}
{
// We invert a 2-D map in x,y and check that the map composition
// is the identity f(g(x)) = x (since no constant_cf is present)
gdual<double, obake::packed_monomial<unsigned long long>> x(1., "x", 4);
gdual<double, obake::packed_monomial<unsigned long long>> y(1., "y", 4);
std::vector<gdual<double, obake::packed_monomial<unsigned long long>>> map, map_inv;
gdual<double, obake::packed_monomial<std::uint64_t>> x(1., "x", 4);
gdual<double, obake::packed_monomial<std::uint64_t>> y(1., "y", 4);
std::vector<gdual<double, obake::packed_monomial<std::uint64_t>>> map, map_inv;
map.push_back(sin(x * y - 1.) + x + y - 2.);
map.push_back(cos(x * y * y - 1) - y + x - 1.);
map_inv = invert_map(map);
auto I = map_inv & map;
BOOST_CHECK(EPSILON_COMPARE(I[0], gdual<double, obake::packed_monomial<unsigned long long>>(0, "x", 4), 1e-10));
BOOST_CHECK(EPSILON_COMPARE(I[1], gdual<double, obake::packed_monomial<unsigned long long>>(0, "y", 4), 1e-10));
BOOST_CHECK(EPSILON_COMPARE(I[0], gdual<double, obake::packed_monomial<std::uint64_t>>(0, "x", 4), 1e-10));
BOOST_CHECK(EPSILON_COMPARE(I[1], gdual<double, obake::packed_monomial<std::uint64_t>>(0, "y", 4), 1e-10));
}
// 3 - D cases
{
// We invert a 3-D map in x,y,z and check that the map composition
// is the identity f(g(x)) = x (since no constant_cf is present)
gdual<double, obake::packed_monomial<unsigned long long>> x(1., "x", 4);
gdual<double, obake::packed_monomial<unsigned long long>> y(1., "y", 4);
gdual<double, obake::packed_monomial<unsigned long long>> z(1., "z", 4);
std::vector<gdual<double, obake::packed_monomial<unsigned long long>>> map, map_inv;
gdual<double, obake::packed_monomial<std::uint64_t>> x(1., "x", 4);
gdual<double, obake::packed_monomial<std::uint64_t>> y(1., "y", 4);
gdual<double, obake::packed_monomial<std::uint64_t>> z(1., "z", 4);
std::vector<gdual<double, obake::packed_monomial<std::uint64_t>>> map, map_inv;
map.push_back(x * y * z + x * y - 2 * z);
map.push_back(y * z * x * x + z * y - z - y);
map.push_back(x - 2 * z + cos(x * y * z - 1.));
map_inv = invert_map(map);
auto I = map_inv & map;
BOOST_CHECK(EPSILON_COMPARE(I[0], gdual<double, obake::packed_monomial<unsigned long long>>(0, "x", 4), 1e-10));
BOOST_CHECK(EPSILON_COMPARE(I[1], gdual<double, obake::packed_monomial<unsigned long long>>(0, "y", 4), 1e-10));
BOOST_CHECK(EPSILON_COMPARE(I[2], gdual<double, obake::packed_monomial<unsigned long long>>(0, "z", 4), 1e-10));
BOOST_CHECK(EPSILON_COMPARE(I[0], gdual<double, obake::packed_monomial<std::uint64_t>>(0, "x", 4), 1e-10));
BOOST_CHECK(EPSILON_COMPARE(I[1], gdual<double, obake::packed_monomial<std::uint64_t>>(0, "y", 4), 1e-10));
BOOST_CHECK(EPSILON_COMPARE(I[2], gdual<double, obake::packed_monomial<std::uint64_t>>(0, "z", 4), 1e-10));
}
}
8 changes: 1 addition & 7 deletions tests/multiplication_perf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <boost/test/unit_test.hpp>
#include <boost/timer/timer.hpp>

#include <tbb/task_scheduler_init.h>

#include <boost/optional.hpp>

#include <obake/polynomials/packed_monomial.hpp>
Expand All @@ -15,7 +13,7 @@
#include <audi/gdual.hpp>

using namespace audi;
using gdual_d = gdual<double, obake::packed_monomial<unsigned long long>>;
using gdual_d = gdual<double, obake::packed_monomial<std::uint64_t>>;

void scalable_mul(unsigned int m, unsigned int n)
{
Expand Down Expand Up @@ -44,10 +42,6 @@ void scalable_mul(unsigned int m, unsigned int n)

BOOST_AUTO_TEST_CASE(multiplication_performance)
{
boost::optional<tbb::task_scheduler_init> tinit;
if (boost::unit_test::framework::master_test_suite().argc > 1) {
tinit.emplace(boost::lexical_cast<unsigned>(boost::unit_test::framework::master_test_suite().argv[1u]));
}
std::cout << "Testing multiplication of (1 + x1 + .. + xn)^m * (1 - x1 - .. - xn)^m: " << std::endl;
for (auto m = 10u; m < 11u; ++m) {
for (auto n = 10u; n < 11u; ++n) {
Expand Down
7 changes: 0 additions & 7 deletions tests/trigonometry_perf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

#include <boost/optional.hpp>

#include <tbb/task_scheduler_init.h>

#include <audi/functions.hpp>
#include <audi/gdual.hpp>

Expand Down Expand Up @@ -85,11 +83,6 @@ void scalable_test_sin_over_cos(int m, int n)

BOOST_AUTO_TEST_CASE(trigonometry_perf)
{
boost::optional<tbb::task_scheduler_init> tinit;
if (boost::unit_test::framework::master_test_suite().argc > 1) {
tinit.emplace(boost::lexical_cast<unsigned>(boost::unit_test::framework::master_test_suite().argv[1u]));
}

unsigned int low = 9, high = 10;

// sin and cos
Expand Down
Loading

0 comments on commit e97a3de

Please sign in to comment.