From 41ccad13b48bf4a985c26f2e48c8c32a946701de Mon Sep 17 00:00:00 2001 From: Ian Bell <ian.bell@nist.gov> Date: Wed, 24 Feb 2021 12:19:49 -0500 Subject: [PATCH] time mcx; 10 times slower (as expected) --- src/main.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 9869956..1c11d6f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,7 +33,7 @@ void test_vdW() { std::cout << std::chrono::duration<double>(t31 - t21).count() << " from isochoric" << std::endl; auto err = pfromderiv / pp - 1.0; - std::cout << std::setprecision(20) << "Error (fractional): " << err << std::endl; + std::cout << "Error (fractional): " << err << std::endl; } void test_vdwMix() { @@ -60,13 +60,20 @@ void test_vdwMix() { auto pfromderiv = rho*R*T - Psir + dPsirdrho0 + dPsirdrho1; auto sr = get_splus(vdW, T, rhovec); - auto dT1 = derivT(fPsir, T, rhovec); - auto dT2 = derivTmcx(fPsir, T, rhovec); - auto t2 = std::chrono::steady_clock::now(); auto pfromderiv3 = rhotot*R*T + get_pr(vdW, T, rhovec); auto t3 = std::chrono::steady_clock::now(); std::cout << std::chrono::duration<double>(t3 - t2).count() << " from isochoric (mix) " << std::endl; + + { + auto t1 = std::chrono::steady_clock::now(); + volatile auto dT1 = derivT(fPsir, T, rhovec); + auto t2 = std::chrono::steady_clock::now(); + volatile auto dT2 = derivTmcx(fPsir, T, rhovec); + auto t3 = std::chrono::steady_clock::now(); + std::cout << std::chrono::duration<double>(t2 - t1).count() << " with complex step" << std::endl; + std::cout << std::chrono::duration<double>(t3 - t2).count() << " with multicomplex " << std::endl; + } } int main(){ -- GitLab