Skip to content

Commit

Permalink
sycl: Fix broken sqrt call
Browse files Browse the repository at this point in the history
sycl: Better compiler flags
  • Loading branch information
tom91136 committed Nov 19, 2020
1 parent 099e6ed commit f527c4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ endif ()
add_definitions(-DNUM_TD_PER_THREAD=${NUM_TD_PER_THREAD})

set(DEBUG_OPTIONS -O2 -fno-omit-frame-pointer ${CXX_EXTRA_FLAGS})
set(RELEASE_OPTIONS -Ofast -ffast-math -march=native ${CXX_EXTRA_FLAGS})
set(RELEASE_OPTIONS -Ofast -ffast-math -march=native -mtune=native ${CXX_EXTRA_FLAGS})

target_compile_options(bude PUBLIC "$<$<CONFIG:RelWithDebInfo>:${RELEASE_OPTIONS}>")
target_compile_options(bude PUBLIC "$<$<CONFIG:Release>:${RELEASE_OPTIONS}>")
Expand Down
8 changes: 5 additions & 3 deletions sycl/src/vec-pose-inner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,12 @@ void fasten_main(
const float x = lpos[i].x() - p_atom.x;
const float y = lpos[i].y() - p_atom.y;
const float z = lpos[i].z() - p_atom.z;
const float distij = clsycl::native::sqrt(x * x + y * y + z * z);

//TODO replace with:
// const float distij = clsycl::distance(lpos[id], clsycl::float3(p_atom.x, p_atom.y, p_atom.z));
// XXX as of oneapi-2021.1-beta10, the cl::sycl::native::sqrt variant is significantly slower for no apparent reason
const float distij = clsycl::sqrt(x * x + y * y + z * z);

// XXX as of oneapi-2021.1-beta10, the following variant is significantly slower for no apparent reason
//const float distij = clsycl::distance(lpos[i], clsycl::float3(p_atom.x, p_atom.y, p_atom.z));

// Calculate the sum of the sphere radii
const float distbb = distij - radij;
Expand Down

0 comments on commit f527c4c

Please sign in to comment.