Skip to content

Commit

Permalink
Merge pull request #2574 from ye-luo/fix-intel-sqrt-prec
Browse files Browse the repository at this point in the history
Require high precision sqrt in mixed precision builds with Intel compiler
  • Loading branch information
ye-luo committed Jul 6, 2020
2 parents 59676fa + 9a37d8c commit db91362
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CMake/IntelCompilers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ SET( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -restrict
# Set prefetch flag
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qopt-prefetch" )

IF(MIXED_PRECISION)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -prec-sqrt" )
ENDIF()
#check if -ftz is accepted
CHECK_CXX_COMPILER_FLAG( "${CMAKE_CXX_FLAGS} -ftz" INTEL_FTZ )
IF( INTEL_FTZ)
Expand Down
7 changes: 7 additions & 0 deletions src/QMCWaveFunctions/tests/test_hybridrep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ TEST_CASE("Hybridrep SPO from HDF diamond_2x1x1", "[wavefunction]")
ions_.update();
elec_.update();

ParticleSet::RealType r;
ParticleSet::PosType dr;
elec_.getDistTable(0).get_first_neighbor(0, r, dr, false);
std::cout << std::setprecision(14) << "check r^2 against dr^2. "
<< "r = " << r << " dr = " << dr << std::endl;
REQUIRE(std::abs(r * r - dot(dr, dr)) < std::numeric_limits<double>::epsilon());

// for vgl
SPOSet::ValueMatrix_t psiM(elec_.R.size(), spo->getOrbitalSetSize());
SPOSet::GradMatrix_t dpsiM(elec_.R.size(), spo->getOrbitalSetSize());
Expand Down

0 comments on commit db91362

Please sign in to comment.