-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compile errors with MSVC(alternative to #904) #908
Conversation
The indentation is off. How is this different from #904 and why did you choose to create a new pull request (instead of pushing to the other one)? |
I just fixed the indentation. The different is for the SFINAE, to fix the error I use ""::value" instead of "{}".For the new pull request, Dr. Bruno told me to create it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this better if we don't have to have different versions for NVCC
and MSVC
.
test/tstRay.cpp
Outdated
@@ -172,7 +172,7 @@ BOOST_AUTO_TEST_CASE(intersects_box) | |||
{ \ | |||
float t0; \ | |||
float t1; \ | |||
constexpr auto inf = KokkosExt::ArithmeticTraits::infinity<float>::value; \ | |||
auto const inf = KokkosExt::ArithmeticTraits::infinity<float>::value; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer if we can only make this const
for MSVC
and constexpr
otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @masterleinad.
Retest this please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I like this approach better than #904
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than constexpr
-> const
, this looks fine. I also think we should switch all Kokkos::is_view<View>::value
to Kokkos::is_view_v<View>
.
I'm not sure about the constexpr
. Is tstRay.cpp
the only place it happens?
Yes, that's the only place there is an issue. The others |
So the assumption is that the users using MSVC would only be interested in examples? I think that's reasonable, though it would have been nice to be able to run benchmarks too. |
No it's just that getting Boost to work is already a total pain and we didn't have the courage to install google benchmark. |
d204c4b
to
463f795
Compare
I'm not sure I understand what's going on. My understanding was that @AnhBe0's patch was able to compile and run tests and examples, and only benchmarks were not enabled. However, I see that @masterleinad disabled some of the tests and examples. |
Right, I am running into
for the disabled tests, see https://github.com/arborx/ArborX/actions/runs/5599297250/jobs/10240076970. It's not clear to me what that means but that was the best compromise I was able to come up with until now. Maybe, @AnhBe0 wants to investigate some more. |
f241c37
to
f8ca0bb
Compare
@AnhBe0 Why did you remove my commits adding |
I am sorry just added the #ifdef _MSVC_VER for the tstRay.cpp, did I push it in the wrong way ? |
constexpr Box unit_box{{0, 0, 0}, {1, 1, 1}}; | ||
constexpr auto inf = KokkosExt::ArithmeticTraits::infinity<float>::value; | ||
#endif | ||
auto const inf = KokkosExt::ArithmeticTraits::infinity<float>::value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should still be constexpr
when using linux
You force-pushed squashing and overwriting all commits in this branch. I'll just push the commits again. |
test/tstRay.cpp
Outdated
// use const instead of constexpr because MSVC shows error(error:expression | ||
// must have a constant value) | ||
#ifdef _MSVC_VER | ||
const Box unit_box{{0, 0, 0}, {1, 1, 1}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An alternative would be to define a macro
#ifdef _MSVC_VER
#define ARBORX_MSVC_CONSTEXPR const
#else
#define ARBORX_MSVC_CONSTEXPR constexpr
#endif
and then do things like
ARBORX_MSVC_CONSTEXPR Box unit_box{{0, 0, 0}, {1, 1, 1}};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We looking at this more but it looks like we may not need to change this constexpr after all. We may only need to change the inf
.
test/tstRay.cpp
Outdated
using ArborX::Sphere; | ||
using ArborX::Experimental::Ray; | ||
|
||
#ifdef _MSVC_VER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_MSVC_VER
is never defined yet the code still works. This means this change is useless.
We decided to simplify this PR to only be able to compile, but not run anything due to the difficulties of proper linking/runtime to the boost. |
Please fix the merge conflicts. |
4f1ae13
to
8560fdc
Compare
Looks like there are still some problems in |
|
@@ -4,7 +4,9 @@ find_package(benchmark 1.5.4 REQUIRED) | |||
message(STATUS "Found benchmark: ${benchmark_DIR} (version \"${benchmark_VERSION}\")") | |||
|
|||
add_subdirectory(brute_force_vs_bvh) | |||
add_subdirectory(bvh_driver) | |||
if(NOT WIN32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a FIXME
with a suitable comment describing we this gets disabled here.
Co-authored-by: Daniel Arndt <arndtd@ornl.gov>
872ccd8
to
adb42b7
Compare
benchmarks/CMakeLists.txt
Outdated
# FIXME: for now, skip benchmarks using Google benchmark | ||
# when building for Windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That explains the "what" but not the "why".
Skip benchmarks that depend on Google Benchmark
- name: Build ArborX | ||
shell: bash | ||
run: | | ||
cmake --build build --target install -- -m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We build but we don't actually run anything. Is that an oversight?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we have problems with boost at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just Boost.Test or also Boost.Program_options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had issue with both. They both need to be compiled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that #902 successfully ran tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that #902 successfully ran tests.
I don't understand that comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand that comment
#902 had
- name: Build ArborX
shell: bash
run: |
cmake --build build --target install -- -m
cd build
ctest -C Debug -V
and ran the tests (without enabling benchmarks).
This PR fixes the errors we get when using MSVC:
MSVC crashes when doing SFINAE on the return type, so we changed the "{}" to "::value"
MSVC does not support M_PI, use Kokkos facility instead
replace constexpr with const in a few places