Skip to content

Restore windows CI#3387

Merged
Lestropie merged 4 commits into
devfrom
restore_windows_ci
Jun 4, 2026
Merged

Restore windows CI#3387
Lestropie merged 4 commits into
devfrom
restore_windows_ci

Conversation

@Lestropie
Copy link
Copy Markdown
Member

This PR is a merge of the changes in #3384 and #3386. Both changes must be in place for compilation to proceed in the CI check. Therefore I'm merging the two together in the hope of producing a PR that passes checks before merging.

Lestropie added 3 commits June 4, 2026 09:45
Replace the namespace-scope thread-local MR::DWI::Tractography::rng with a
function-local thread_local accessed via a rng() accessor, lazily constructed
on first use. The previous extern thread_local definition triggered
compilation failures under GCC 16 on Windows due to changes in thread-local
storage handling; the Meyers idiom sidesteps that codepath while preserving
identical per-thread semantics. All call sites across the seeding, algorithm,
and tracking code were updated to invoke rng() accordingly.

Session prompts:
1. > Implement a Meyers-style accessor function for variable
   > MR::DWI::Tractography::rng, to prevent compilation failures on Windows
   > due to TLS changes in GCC16.

Generated-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Lestropie Lestropie self-assigned this Jun 4, 2026
@Lestropie Lestropie added build Windows CI/tests meta Meta-issue grouping multiple issues / PRs labels Jun 4, 2026
@Lestropie Lestropie changed the title Restore windows ci Restore windows CI Jun 4, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 25 out of 41. Check the log or trigger a new build to see more.

}

if (uniform(rng) < val / max_val) {
if (uniform(rng()) < val / max_val) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: no header providing "MR::DWI::Tractography::rng" is directly included [misc-include-cleaner]

cpp/core/dwi/tractography/algorithms/iFOD1.h:23:

- #include "dwi/tractography/tracking/method.h"
+ #include "dwi/tractography/rng.h"
+ #include "dwi/tractography/tracking/method.h"

}

if (uniform(rng) < val / max_val) {
if (uniform(rng()) < val / max_val) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: no header providing "MR::DWI::Tractography::rng" is directly included [misc-include-cleaner]

cpp/core/dwi/tractography/algorithms/iFOD2.h:25:

- #include "dwi/tractography/tracking/method.h"
+ #include "dwi/tractography/rng.h"
+ #include "dwi/tractography/tracking/method.h"

}

float get_metric(const Eigen::Vector3f &, const Eigen::Vector3f &) override { return uniform(rng); }
float get_metric(const Eigen::Vector3f &, const Eigen::Vector3f &) override { return uniform(rng()); }
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: all parameters should be named in a function [readability-named-parameter]

Suggested change
float get_metric(const Eigen::Vector3f &, const Eigen::Vector3f &) override { return uniform(rng()); }
float get_metric(const Eigen::Vector3f & /*position*/, const Eigen::Vector3f & /*direction*/) override { return uniform(rng()); }

}

float get_metric(const Eigen::Vector3f &, const Eigen::Vector3f &) override { return uniform(rng); }
float get_metric(const Eigen::Vector3f &, const Eigen::Vector3f &) override { return uniform(rng()); }
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: no header providing "MR::DWI::Tractography::rng" is directly included [misc-include-cleaner]

cpp/core/dwi/tractography/algorithms/nulldist.h:22:

- #include "dwi/tractography/tracking/method.h"
+ #include "dwi/tractography/rng.h"
+ #include "dwi/tractography/tracking/method.h"

}

float get_metric(const Eigen::Vector3f &, const Eigen::Vector3f &) override { return uniform(rng); }
float get_metric(const Eigen::Vector3f &, const Eigen::Vector3f &) override { return uniform(rng()); }
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: all parameters should be named in a function [readability-named-parameter]

Suggested change
float get_metric(const Eigen::Vector3f &, const Eigen::Vector3f &) override { return uniform(rng()); }
float get_metric(const Eigen::Vector3f & /*position*/, const Eigen::Vector3f & /*direction*/) override { return uniform(rng()); }

} while (seed.value() < selector);
p = {seed.index(0) + uniform(rng) - 0.5f, seed.index(1) + uniform(rng) - 0.5f, seed.index(2) + uniform(rng) - 0.5f};
p = {seed.index(0) + uniform(rng()) - 0.5f,
seed.index(1) + uniform(rng()) - 0.5f,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: floating point literal has suffix 'f', which is not uppercase [readability-uppercase-literal-suffix]

Suggested change
seed.index(1) + uniform(rng()) - 0.5f,
seed.index(1) + uniform(rng()) - 0.5F,

} while (seed.value() < selector);
p = {seed.index(0) + uniform(rng) - 0.5f, seed.index(1) + uniform(rng) - 0.5f, seed.index(2) + uniform(rng) - 0.5f};
p = {seed.index(0) + uniform(rng()) - 0.5f,
seed.index(1) + uniform(rng()) - 0.5f,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'ssize_t' (aka 'long') to 'result_type' (aka 'float') [bugprone-narrowing-conversions]

       seed.index(1) + uniform(rng()) - 0.5f,
       ^

p = {seed.index(0) + uniform(rng) - 0.5f, seed.index(1) + uniform(rng) - 0.5f, seed.index(2) + uniform(rng) - 0.5f};
p = {seed.index(0) + uniform(rng()) - 0.5f,
seed.index(1) + uniform(rng()) - 0.5f,
seed.index(2) + uniform(rng()) - 0.5f};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: floating point literal has suffix 'f', which is not uppercase [readability-uppercase-literal-suffix]

Suggested change
seed.index(2) + uniform(rng()) - 0.5f};
seed.index(2) + uniform(rng()) - 0.5F};

p = {seed.index(0) + uniform(rng) - 0.5f, seed.index(1) + uniform(rng) - 0.5f, seed.index(2) + uniform(rng) - 0.5f};
p = {seed.index(0) + uniform(rng()) - 0.5f,
seed.index(1) + uniform(rng()) - 0.5f,
seed.index(2) + uniform(rng()) - 0.5f};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'ssize_t' (aka 'long') to 'result_type' (aka 'float') [bugprone-narrowing-conversions]

       seed.index(2) + uniform(rng()) - 0.5f};
       ^

const Eigen::Vector3i &v(fixel.get_voxel());
const Eigen::Vector3f vp(
v[0] + uniform_float(rng) - 0.5, v[1] + uniform_float(rng) - 0.5, v[2] + uniform_float(rng) - 0.5);
v[0] + uniform_float(rng()) - 0.5, v[1] + uniform_float(rng()) - 0.5, v[2] + uniform_float(rng()) - 0.5);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'double' to 'Scalar' (aka 'float') [bugprone-narrowing-conversions]

          v[0] + uniform_float(rng()) - 0.5, v[1] + uniform_float(rng()) - 0.5, v[2] + uniform_float(rng()) - 0.5);
                                                                                ^

Required for new test mrinfo_json_keyval
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

const Eigen::Vector3i &v(fixel.get_voxel());
const Eigen::Vector3f vp(
v[0] + uniform_float(rng) - 0.5, v[1] + uniform_float(rng) - 0.5, v[2] + uniform_float(rng) - 0.5);
v[0] + uniform_float(rng()) - 0.5, v[1] + uniform_float(rng()) - 0.5, v[2] + uniform_float(rng()) - 0.5);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'double' to 'Scalar' (aka 'float') [bugprone-narrowing-conversions]

          v[0] + uniform_float(rng()) - 0.5, v[1] + uniform_float(rng()) - 0.5, v[2] + uniform_float(rng()) - 0.5);
                                             ^

const Eigen::Vector3i &v(fixel.get_voxel());
const Eigen::Vector3f vp(
v[0] + uniform_float(rng) - 0.5, v[1] + uniform_float(rng) - 0.5, v[2] + uniform_float(rng) - 0.5);
v[0] + uniform_float(rng()) - 0.5, v[1] + uniform_float(rng()) - 0.5, v[2] + uniform_float(rng()) - 0.5);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'double' to 'Scalar' (aka 'float') [bugprone-narrowing-conversions]

          v[0] + uniform_float(rng()) - 0.5, v[1] + uniform_float(rng()) - 0.5, v[2] + uniform_float(rng()) - 0.5);
          ^

const Eigen::Vector3i &v(fixel.get_voxel());
const Eigen::Vector3f vp(
v[0] + uniform_float(rng) - 0.5, v[1] + uniform_float(rng) - 0.5, v[2] + uniform_float(rng) - 0.5);
v[0] + uniform_float(rng()) - 0.5, v[1] + uniform_float(rng()) - 0.5, v[2] + uniform_float(rng()) - 0.5);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'int' to 'result_type' (aka 'float') [bugprone-narrowing-conversions]

          v[0] + uniform_float(rng()) - 0.5, v[1] + uniform_float(rng()) - 0.5, v[2] + uniform_float(rng()) - 0.5);
                                                                                ^

const Eigen::Vector3i &v(fixel.get_voxel());
const Eigen::Vector3f vp(
v[0] + uniform_float(rng) - 0.5, v[1] + uniform_float(rng) - 0.5, v[2] + uniform_float(rng) - 0.5);
v[0] + uniform_float(rng()) - 0.5, v[1] + uniform_float(rng()) - 0.5, v[2] + uniform_float(rng()) - 0.5);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'int' to 'result_type' (aka 'float') [bugprone-narrowing-conversions]

          v[0] + uniform_float(rng()) - 0.5, v[1] + uniform_float(rng()) - 0.5, v[2] + uniform_float(rng()) - 0.5);
                                             ^

const Eigen::Vector3i &v(fixel.get_voxel());
const Eigen::Vector3f vp(
v[0] + uniform_float(rng) - 0.5, v[1] + uniform_float(rng) - 0.5, v[2] + uniform_float(rng) - 0.5);
v[0] + uniform_float(rng()) - 0.5, v[1] + uniform_float(rng()) - 0.5, v[2] + uniform_float(rng()) - 0.5);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'int' to 'result_type' (aka 'float') [bugprone-narrowing-conversions]

          v[0] + uniform_float(rng()) - 0.5, v[1] + uniform_float(rng()) - 0.5, v[2] + uniform_float(rng()) - 0.5);
          ^


Eigen::Vector3f MethodBase::random_direction(const float max_angle, const float sin_max_angle) {
float phi = 2.0 * Math::pi * uniform(rng);
float phi = 2.0 * Math::pi * uniform(rng());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'double' to 'float' [bugprone-narrowing-conversions]

  float phi = 2.0 * Math::pi * uniform(rng());
              ^


Eigen::Vector3f MethodBase::random_direction(const float max_angle, const float sin_max_angle) {
float phi = 2.0 * Math::pi * uniform(rng);
float phi = 2.0 * Math::pi * uniform(rng());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: no header providing "MR::Math::pi" is directly included [misc-include-cleaner]

cpp/core/dwi/tractography/tracking/method.cpp:17:

+ #include "math/math.h"


Eigen::Vector3f MethodBase::random_direction(const float max_angle, const float sin_max_angle) {
float phi = 2.0 * Math::pi * uniform(rng);
float phi = 2.0 * Math::pi * uniform(rng());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: variable 'phi' of type 'float' can be declared 'const' [misc-const-correctness]

Suggested change
float phi = 2.0 * Math::pi * uniform(rng());
float const phi = 2.0 * Math::pi * uniform(rng());

theta = max_angle * uniform(rng);
} while (sin_max_angle * uniform(rng) > sin(theta));
theta = max_angle * uniform(rng());
} while (sin_max_angle * uniform(rng()) > sin(theta));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: call to 'sin' promotes float to double [performance-type-promotion-in-math-fn]

cpp/core/dwi/tractography/tracking/method.cpp:17:

+ 
+ #include <cmath>
Suggested change
} while (sin_max_angle * uniform(rng()) > sin(theta));
} while (sin_max_angle * uniform(rng()) > std::sin(theta));

theta = max_angle * uniform(rng);
} while (sin_max_angle * uniform(rng) > sin(theta));
theta = max_angle * uniform(rng());
} while (sin_max_angle * uniform(rng()) > sin(theta));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

warning: no header providing "sin" is directly included [misc-include-cleaner]

cpp/core/dwi/tractography/tracking/method.cpp:17:

+ #include <cmath>

@Lestropie Lestropie merged commit 3d096ac into dev Jun 4, 2026
11 of 12 checks passed
@Lestropie Lestropie deleted the restore_windows_ci branch June 4, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build CI/tests meta Meta-issue grouping multiple issues / PRs Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant