-
Notifications
You must be signed in to change notification settings - Fork 52
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
CI: add linting #618
CI: add linting #618
Conversation
GPMueller
commented
May 1, 2022
- add C++ format linting and clang-tidy reporting for the core library
- add C++ format linting and clang-tidy reporting for the ImGUI
- add Python format and quality linting for the core library wrappers and tests
- add Python format and quality linting for the ui-python folder
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #618 +/- ##
===========================================
+ Coverage 48.16% 48.48% +0.31%
===========================================
Files 74 75 +1
Lines 11968 12015 +47
===========================================
+ Hits 5764 5825 +61
+ Misses 6204 6190 -14 |
a159ac0
to
bd79ff0
Compare
04447dd
to
66f24f5
Compare
e1553d7
to
8c25c98
Compare
Should hopefully build with clang-15. Needed to replace uses of `REQUIRE( ... == Approx( ... ) )` with `REQUIRE_THAT( ... WithinAbs( ... ) )`.
8c25c98
to
d2a78d1
Compare
I've managed to fix the CI, except:
|
@@ -1,38 +1,37 @@ | |||
#ifdef SPIRIT_USE_CUDA |
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.
@MSallermann can you take a closer look at this file, and maybe also execute tests using CUDA on this branch?
These changes are quite difficult to review and make sure they're OK just from looking at them...
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 think it's OK. I can build and run the Code with CUDA. Many of the unit tests fail though, because the requested precision is too high. I think it would be best to use different epsilons for double and single precision builds
This test trips up the Heun and SIB solvers when requiring higher precision. This is an issue in their implementations and should really be fixed.
4a4413d
to
b8032d1
Compare
ec306f7
to
4cba9a3
Compare
- update checkout action to v3, setup-python action to v4 - add a Windows OpenMP build using LLVM - add an Ubuntu 22.04 CUDA build On Ubuntu 22.04, we get gcc 11.3 and nvidia-cuda-toolkit 11.5, which are not compatible, producing compilation errors. Therefore, a downgrade of gcc to version 10 is needed. Note: had to change `ChooseCompiler.cmake` to enable user-chosen compilers via `USER_COMPILER_CXX` etc.
4cba9a3
to
24c4cc3
Compare
@MSallermann I believe this PR is now ready |
|
REQUIRE( Approx( normal[0] ) == 0 ); | ||
REQUIRE( Approx( normal[1] ) == 0 ); | ||
REQUIRE( Approx( normal[2] ) == 1 ); | ||
REQUIRE_THAT( magnitude, WithinAbs( init_magnitude, 1e-12 ) ); |
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.
Need to set the 1e-12
epsilon value dependent on the precision, otherwise tests will fail when using single precision (float
)
int N = 10000; | ||
int N_check = std::min( 100, N ); | ||
vectorfield v1( N, Vector3{ 0.0, 0.0, 1.0 } ); | ||
vectorfield v2( N, Vector3{ 1.0, 1.0, 1.0 } ); | ||
|
||
REQUIRE( Engine::Vectormath::dot( v1, v2 ) == Approx( N ) ); | ||
REQUIRE_THAT( Engine::Vectormath::dot( v1, v2 ), WithinAbs( N, 1e-12 ) ); |
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.
Need to set the 1e-12
epsilon value dependent on the precision, otherwise tests will fail when using single precision (float
)
REQUIRE( m[0] == Approx( 0 ) ); | ||
REQUIRE( m[1] == Approx( 0 ) ); | ||
REQUIRE( m[2] == Approx( mu_s ) ); | ||
REQUIRE_THAT( m[0], WithinAbs( 0, 1e-12 ) ); |
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.
Need to set the 1e-12
epsilon value dependent on the precision, otherwise tests will fail when using single precision (float
)
// Input file | ||
auto inputfile = "core/test/input/solvers.cfg"; | ||
|
||
// State | ||
auto state = std::shared_ptr<State>( State_Setup( inputfile ), State_Delete ); | ||
|
||
// Reduce precision if float accuracy | ||
double epsilon_apprx = 1e-5; | ||
float epsilon_apprx = 1e-5; |
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.
should this epsilon be a scalar
value?
state->active_image->hamiltonian->Gradient_and_Energy( spins, grad, energy3 ); | ||
|
||
energy1 = state->active_image->hamiltonian->Energy( spins ); | ||
REQUIRE( Approx( energy3 ) == energy1 ); | ||
REQUIRE_THAT( energy3, WithinAbs( energy1, 1e-4 ) ); // TODO: why the low precision? |
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.
The variable energy1
is a float and being compared to a double (if not using CUDA). Maybe it would be better to not re-use energy1
and just declare a new scalar energy4
. Then the precision of the test can be set much higher.
@@ -1,38 +1,37 @@ | |||
#ifdef SPIRIT_USE_CUDA |
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 think it's OK. I can build and run the Code with CUDA. Many of the unit tests fail though, because the requested precision is too high. I think it would be best to use different epsilons for double and single precision builds
== Approx( Engine::Manifoldmath::norm( v1 ) * Engine::Manifoldmath::norm( v2 ) ) ); | ||
REQUIRE_THAT( | ||
Engine::Vectormath::dot( v1, v2 ), | ||
!WithinAbs( Engine::Manifoldmath::norm( v1 ) * Engine::Manifoldmath::norm( v2 ), 1e-3 ) ); |
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.
Is there a reason why the requested precision is so much lower here?
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.
because there's a not
there, we want to be sufficiently far away from the given value