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

64 bit support #88

Open
looooo opened this issue Jul 22, 2024 · 21 comments
Open

64 bit support #88

looooo opened this issue Jul 22, 2024 · 21 comments
Labels

Comments

@looooo
Copy link
Contributor

looooo commented Jul 22, 2024

Comment:

Trying to setup a feedstock for pastix, I run into this issue:

-- Found SCOTCH: $PREFIX/lib/libscotch.so;$PREFIX/lib/libscotcherr.so;$BUILD_PREFIX/x86_64-conda-linux-gnu/sysroot/usr/lib/libpthread.so;$PREFIX/lib/libz.so;$BUILD_PREFIX/x86_64-conda-linux-gnu/sysroot/usr/lib/libm.so;$BUILD_PREFIX/x86_64-conda-linux-gnu/sysroot/usr/lib/librt.so
CMake Error at CMakeLists.txt:448 (message):
  PASTIX_INT64 is enabled and provided Scotch is not compiled with int64
  support, please build with -DPASTIX_INT64=OFF or install a 64 bits version
  of Scotch.

while scotch is optional for pastix, it might be possible to compile scotch with 64 bit support?

@looooo
Copy link
Contributor Author

looooo commented Aug 27, 2024

#90

@minrk
Copy link
Member

minrk commented Sep 26, 2024

closed by #90, thanks!

@minrk minrk closed this as completed Sep 26, 2024
@Tobias-Fischer
Copy link
Contributor

Are you sure @minrk? I think @looooo said that it does not fix this issue.

@looooo
Copy link
Contributor Author

looooo commented Sep 26, 2024

I can't reproduce this issue with libscotch 7.0.5. So I guess it's ok to close this issue. Thanks.

@looooo
Copy link
Contributor Author

looooo commented Sep 26, 2024

@looooo
Copy link
Contributor Author

looooo commented Sep 26, 2024

hmm strange locally I cannot reproduce with pixi, but the feedstock builds still fail with the same issue

CMake Error at CMakeLists.txt:455 (message):
  PASTIX_INT64 is enabled and provided Scotch is not compiled with int64
  support, please build with -DPASTIX_INT64=OFF or install a 64 bits version
  of Scotch.

also running conda-build locally seems to work fine.

@minrk minrk reopened this Sep 26, 2024
@minrk minrk closed this as completed Sep 26, 2024
@minrk minrk reopened this Sep 26, 2024
@minrk
Copy link
Member

minrk commented Sep 26, 2024

Sorry, I misunderstood! I'll let @looooo decide when to close

@looooo
Copy link
Contributor Author

looooo commented Nov 20, 2024

Seems like 64bit works on osx arm, but not on the other platforms.

@looooo
Copy link
Contributor Author

looooo commented Nov 20, 2024

is it possible to add this test to the feedstock?

#include <stdio.h>
#include <stdint.h>
#include <scotch.h>
int main() {
  if (sizeof(SCOTCH_Num) == 8)
    return 0;
  else
    return 1;
}

Actually I don't understand why osx-arm64 uses 64 bit ints as the definition seems to be the same for different platforms:

typedef int SCOTCH_Num;

@minrk
Copy link
Member

minrk commented Nov 21, 2024

sizeof(SCOTCH_Num) is 4 on osx-arm64 with current builds of scotch 7.0.5 build 2

@minrk
Copy link
Member

minrk commented Nov 22, 2024

#94 adds a test. It passes on all platforms (including osx-arm64, which I had to test locally) if the assert is that sizeof(SCOTCH_Num) == 4, is that what you expect?

@looooo
Copy link
Contributor Author

looooo commented Nov 22, 2024

For 64bit size of(Scotch_Num) should be 8. But it's possible to build pastix with PASTIX_INT64=Off.
Now the only question is why the osx-arm build of pastix reports:

CMake Error at CMakeLists.txt:458 (message):
  PASTIX_INT64 is disabled and provided Scotch is not compiled with int32
  support, please build with -DPASTIX_INT64=ON or install a 32 bits version
  of Scotch.

the pastix osx-arm build uses libscotch: 7.0.5-h9f781f6_2

@minrk
Copy link
Member

minrk commented Nov 23, 2024

Check the full cmake error log, it might be misinterpreting an error

@looooo
Copy link
Contributor Author

looooo commented Nov 23, 2024

-- Performing Test SCOTCH_Num_4
-- Performing Test SCOTCH_Num_4 - Failed
-- Performing Test SCOTCH_Num_8
-- Performing Test SCOTCH_Num_8 - Failed
-- Found SCOTCH: /Users/runner/miniforge3/conda-bld/pastix-split_1732099993387/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeh/lib/libscotch.dylib;/Users/runner/miniforge3/conda-bld/pastix-split_1732099993387/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeh/lib/libscotcherr.dylib;/Users/runner/miniforge3/conda-bld/pastix-split_1732099993387/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeh/lib/libz.dylib;/Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/usr/lib/libm.tbd
CMake Error at CMakeLists.txt:458 (message):
  PASTIX_INT64 is disabled and provided Scotch is not compiled with int32
  support, please build with -DPASTIX_INT64=ON or install a 32 bits version
  of Scotch.

seems like both tests fail. Is it possible that there might be an issue with cross compiling?

@minrk
Copy link
Member

minrk commented Nov 23, 2024

If the test involves executing the result, that definitely cannot work. You'll need to bypass that, as is common in cross compiling. You'll have to check that project's cmake to see how exactly.

@looooo
Copy link
Contributor Author

looooo commented Nov 23, 2024

Ok I will look into this. Just to clarify:
Here we are also cross-compiling. How is it possible this test can run here?

@minrk
Copy link
Member

minrk commented Nov 24, 2024

You can't generally expect to run compiled executables for testing the environment when cross compiling. That means you either need to be able to compute the test without execution (possible in this particular case, since SCOTCH_Num is defined purely in the header and doesn't require compiling to find), or allow explicit user input to provide the answer to the test without running it, which is the more general solution.

Basically, this check and any call to check_c_source_runs must always be optional and overridable if you want to support cross compilation, e.g. by user setting -DPTSCOTCH_Num_8=ON. But it looks like this code explicitly prohibits that to ensure the executable test always runs, which would be a mistake.

@looooo
Copy link
Contributor Author

looooo commented Nov 30, 2024

still there is something odd. When I compile pastix locally on osx-arm I see the following:

-- Performing Test SCOTCH_Num_4
-- Performing Test SCOTCH_Num_4 - Failed
-- Performing Test SCOTCH_Num_8
-- Performing Test SCOTCH_Num_8 - Success

also the tests seem to work.

@minrk
Copy link
Member

minrk commented Nov 30, 2024

I'm not sure what's up there, since the test seems to be giving the wrong result. Here's a simple pixi project which shows sizeof(SCOTCH_Num) is 4: https://gist.github.com/minrk/b29f7a1f89844fbce2d695a2ba944f68

Run it with:

pixi run test

which should install the env, run the build, and output:

✨ Pixi task (test): ./test
sizeof(SCOTCH_Num)=4

@looooo
Copy link
Contributor Author

looooo commented Nov 30, 2024

Thanks for creating the pixi-project. I tried it and can reproduce the test with the same output sizeof(SCOTCH_Num)=4

Now I added the test to the calculix/pastix project and there I get:

✨ Pixi task (test_libscotch_test): ./build/libscotch_test
sizeof(SCOTCH_Num)=8

looking at the pixi.lock file I see that I used a different build of libscotch. Actually a build I compiled myself for 64 bit support... stupid me, sry for the noise.

@minrk
Copy link
Member

minrk commented Nov 30, 2024

Glad it's figured out!

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

No branches or pull requests

3 participants