Skip to content
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

Merged
merged 3 commits into from
Aug 15, 2023

Conversation

AnhBe0
Copy link
Contributor

@AnhBe0 AnhBe0 commented Jul 14, 2023

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

@masterleinad
Copy link
Collaborator

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)?

@AnhBe0
Copy link
Contributor Author

AnhBe0 commented Jul 14, 2023

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.

Copy link
Collaborator

@masterleinad masterleinad left a 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; \
Copy link
Collaborator

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @masterleinad.

@masterleinad
Copy link
Collaborator

Retest this please.

Copy link
Contributor

@dalg24 dalg24 left a 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

src/ArborX_BruteForce.hpp Outdated Show resolved Hide resolved
Copy link
Contributor

@aprokop aprokop left a 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?

@Rombur
Copy link
Collaborator

Rombur commented Jul 16, 2023

Is tstRay.cpp the only place it happens?

Yes, that's the only place there is an issue. The others constexpr are fine. However, we didn't enable benchmark so there might be something wrong there too.

@aprokop
Copy link
Contributor

aprokop commented Jul 17, 2023

However, we didn't enable benchmark so there might be something wrong there too.

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.

@Rombur
Copy link
Collaborator

Rombur commented Jul 17, 2023

So the assumption is that the users using MSVC would only be interested in examples?

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.

@AnhBe0 AnhBe0 force-pushed the fixerror2 branch 2 times, most recently from d204c4b to 463f795 Compare July 17, 2023 14:27
@aprokop
Copy link
Contributor

aprokop commented Jul 19, 2023

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.

@masterleinad
Copy link
Collaborator

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

Exit code 0xc0000135

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.

@AnhBe0 AnhBe0 force-pushed the fixerror2 branch 3 times, most recently from f241c37 to f8ca0bb Compare July 20, 2023 15:09
@masterleinad
Copy link
Collaborator

@AnhBe0 Why did you remove my commits adding GitHub CI?

@AnhBe0
Copy link
Contributor Author

AnhBe0 commented Jul 20, 2023

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;
Copy link
Collaborator

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

@masterleinad
Copy link
Collaborator

I am sorry just added the #ifdef _MSVC_VER for the tstRay.cpp, did I push it in the wrong way ?

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}};
Copy link
Contributor

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}};

Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_MSVC_VERis never defined yet the code still works. This means this change is useless.

@aprokop
Copy link
Contributor

aprokop commented Aug 7, 2023

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.

@masterleinad
Copy link
Collaborator

masterleinad commented Aug 7, 2023

Please fix the merge conflicts.

@aprokop aprokop force-pushed the fixerror2 branch 2 times, most recently from 4f1ae13 to 8560fdc Compare August 7, 2023 20:43
@masterleinad
Copy link
Collaborator

Looks like there are still some problems in ArborX_Ray.hpp.

@masterleinad
Copy link
Collaborator

benchmark.lib(benchmark.cc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in bvh_driver.obj [D:\a\ArborX\ArborX\build\benchmarks\bvh_driver\ArborX_Benchmark_BoundingVolumeHierarchy.exe.vcxproj]

@@ -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)
Copy link
Collaborator

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.

AnhBe0 and others added 2 commits August 15, 2023 08:57
Co-authored-by: Daniel Arndt <arndtd@ornl.gov>
@aprokop aprokop force-pushed the fixerror2 branch 2 times, most recently from 872ccd8 to adb42b7 Compare August 15, 2023 12:59
Comment on lines 11 to 12
# FIXME: for now, skip benchmarks using Google benchmark
# when building for Windows
Copy link
Collaborator

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
@aprokop aprokop merged commit cf40dc5 into arborx:master Aug 15, 2023
1 check passed
- name: Build ArborX
shell: bash
run: |
cmake --build build --target install -- -m
Copy link
Contributor

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?

Copy link
Collaborator

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.

Copy link
Contributor

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?

Copy link
Collaborator

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

Copy link
Collaborator

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.

Copy link
Contributor

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

Copy link
Collaborator

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants