ginkgo-project / ginkgo

Numerical linear algebra software package
https://ginkgo-project.github.io/
BSD 3-Clause "New" or "Revised" License
384 stars 86 forks source link

Fail to build on 32-bit x86 windows #1562

Closed xq114 closed 3 weeks ago

xq114 commented 4 months ago

When I try to build ginkgo release 1.7.0 on x86 windows, I got this error:

C:\Users\runneradmin\ginkgo\v1.7.0\source\core\reorder\amd.cpp(188,49): error C2398: Element '2': conversion from '__int64' to 'gko::size_type' requires a narrowing conversion [C:\Users\runneradmin\ginkgo\v1.7.0\source\build_0efb1889\core\ginkgo.vcxproj]

https://github.com/ginkgo-project/ginkgo/blob/v1.7.0/core/reorder/amd.cpp#L188

It seems there should be an explicit conversion.

upsj commented 4 months ago

To make it short: We don't really support 32bit builds, since pure 32 bit CPUs are rather uncommon nowadays

xq114 commented 4 months ago

Same error exists on WebAssembly:

/home/runner/ginkgo/v1.7.0/source/core/reorder/amd.cpp:188:20: error: non-constant-expression cannot be narrowed from type 'value_type' (aka 'long long') to 'size_type' (aka 'unsigned long') in initializer list [-Wc++11-narrowing]
        host_exec, col_idxs_plus_workspace_size + 6 * num_rows};
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/ginkgo/v1.7.0/source/core/reorder/amd.cpp:220:37: note: in instantiation of member function 'gko::experimental::reorder::Amd<long long>::generate_impl' requested here
GKO_INSTANTIATE_FOR_EACH_INDEX_TYPE(GKO_DECLARE_AMD);
                                    ^
/home/runner/ginkgo/v1.7.0/source/core/reorder/amd.cpp:188:20: note: insert an explicit cast to silence this issue
        host_exec, col_idxs_plus_workspace_size + 6 * num_rows};
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                   static_cast<size_type>(                    )
1 error generated.

I think it will do no harm to support as more platform as possible. Anyway, the fix is straightforward as gcc supposes: add a static_cast<size_type>() to amd.cpp. if there is a need, I can make a pr