Coder Social home page Coder Social logo

Comments (19)

gquintin avatar gquintin commented on August 15, 2024

Hi Erik,

Is it possible to run the following tests on your MAC and tell me the results?

  1. If you still have the binaries of the tests, run them manually on your terminal:

    ./tests.cxx_adv.notl.u8.cpp98 && echo ok || echo fail
  2. Run the same commands several times to see if the results are reproducible?

    for i in `seq 1 10`; do
        mkdir build-$i
        cd build-$i
        ../nstools/bin/nsconfig .. -Dsimd=avx2 -Dmpfr='-I/opt/local/include -L/opt/local/lib -lmpfr'
        ../nstools/bin/nstest -j$(nproc) 1>../log-n-${i}.txt 2>&1
        ../nstools/bin/nstest -j1 1>../log-1-${i}.txt 2>&1
    done
  3. Do the same but with GCC. From what I know of MACOS, GCC is by default a symlink to clang. So make sure that GCC is actually GCC:

    mkdir build-gcc
    cd build-gcc
    ../nstools/bin/nsconfig .. -Dsimd=avx2 -Dmpfr='-I/opt/local/include -L/opt/local/lib -lmpfr' -comp=gcc
    ../nstools/bin/nstest -j$(nproc) 1>../log-n-${i}.txt 2>&1
    ../nstools/bin/nstest -j1 1>../log-1-${i}.txt 2>&1

I am asking you this because I saw weird behaviors on ony of my servers when compiling with clang. I compiled NSIMD for AARCH64 and ran the tests. I got some fails. But then when I SSHed into the server and ran the tests manually it worked fine and was successful.

from nsimd.

gquintin avatar gquintin commented on August 15, 2024

Re Erik,

I have ran the tests with clang several times and got no error. Still investigating.

from nsimd.

eschnett avatar eschnett commented on August 15, 2024

I realize that the ninja tests command before the nstest command already fails. I assume it is necessary to complete so that all tests are available?

The error reported is

$ ninja -j1 tests
[1/1738] clang++ -std=c++11 -pedantic ....modules.random.philox_2x32_10.cpp11.d
FAILED: tests.modules.random.philox_2x32_10.cpp11
clang++ -std=c++11 -pedantic /Users/eschnett/src/nsimd/build/../tests/modules/random/philox_2x32_10.cpp -Wall -Wextra -Wdouble-promotion -Wconversion -Wsign-conversion -fPIC -O2 -I/Users/eschnett/src/nsimd/build/../include -DNDEBUG -I/opt/local/include -L/opt/local/lib -Wl,-rpath,/opt/local/lib -lmpfr -DAVX2 -mavx2 -DFMA -mfma -DFP16 -mf16c -L. '-Wl,-rpath,$ORIGIN' -lnsimd_avx2 -o tests.modules.random.philox_2x32_10.cpp11 -MMD -MF tests.modules.random.philox_2x32_10.cpp11.d
In file included from /Users/eschnett/src/nsimd/build/../tests/modules/random/philox_2x32_10.cpp:29:
/Users/eschnett/src/nsimd/build/../tests/modules/random/reference.hpp:239:17: error: no matching function for call to 'mulhilo64'
  uint64_t lo = mulhilo64(0xD2B74407B1CE6E93ULL, ctr.v[0], &hi);
                ^~~~~~~~~
/Users/eschnett/src/nsimd/build/../tests/modules/random/reference.hpp:116:18: note: candidate function not viable: no known conversion from 'uint64_t *' (aka 'unsigned long long *') to 'u64 *' (aka 'unsigned long *') for 3rd argument
NSIMD_INLINE u64 mulhilo64(u64 a, u64 b, u64 *hip) {
                 ^
1 error generated.
ninja: build stopped: subcommand failed.

This is with

$ clang --version
clang version 11.0.0
Target: x86_64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-11/bin

from nsimd.

gquintin avatar gquintin commented on August 15, 2024

Which clang is it? (homebrew, macports, Apple)
Because Linux clang does work. I first have to get my hands on a MAC to fix this.

from nsimd.

eschnett avatar eschnett commented on August 15, 2024

This is MacPorts Clang, most recent version.

MacPorts GCC 10 (configured as suggested above) has the same problem. There are also two additional errors:

/opt/local/include/gcc10/c++/x86_64-apple-darwin20/bits/error_constants.h:135:24: error: 'EOWNERDEAD' was not declared in this scope
  135 |       owner_dead =     EOWNERDEAD,
      |                        ^~~~~~~~~~
/opt/local/include/gcc10/c++/x86_64-apple-darwin20/bits/error_constants.h:151:34: error: 'ENOTRECOVERABLE' was not declared in this scope
  151 |       state_not_recoverable =    ENOTRECOVERABLE,
      |                                  ^~~~~~~~~~~~~~~

from nsimd.

gquintin avatar gquintin commented on August 15, 2024

I will be able to fix the Clang error but the GCC one... I am not sure...

from nsimd.

gquintin avatar gquintin commented on August 15, 2024

Installing Xcode and macports on an old Mac. It is slow....

from nsimd.

eschnett avatar eschnett commented on August 15, 2024

It turns out the GCC errors are known to GCC https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93151 and to MacPorts, and will likely be fixed there at some point.

from nsimd.

eschnett avatar eschnett commented on August 15, 2024

I just came across a web page that said that uint64_t is unsigned long long on Linux, but is unsigned long on macOS. Maybe there is a mismatch between u64 and uint64_t?

This change seems to help:

$ git diff
diff --git a/tests/modules/random/reference.hpp b/tests/modules/random/reference.hpp
index cb47ea3..bd28bff 100644
--- a/tests/modules/random/reference.hpp
+++ b/tests/modules/random/reference.hpp
@@ -235,8 +235,8 @@ NSIMD_INLINE tab64x1_t _philox2x64bumpkey(tab64x1_t key) {
 }

 NSIMD_INLINE tab64x2_t _philox2x64round(tab64x2_t ctr, tab64x1_t key) {
-  uint64_t hi;
-  uint64_t lo = mulhilo64(0xD2B74407B1CE6E93ULL, ctr.v[0], &hi);
+  u64 hi;
+  u64 lo = mulhilo64(0xD2B74407B1CE6E93ULL, ctr.v[0], &hi);
   tab64x2_t out = {{hi ^ key.v[0] ^ ctr.v[1], lo}};
   return out;
 }

from nsimd.

gquintin avatar gquintin commented on August 15, 2024

I suspected as much.

from nsimd.

eschnett avatar eschnett commented on August 15, 2024

Yes, with these changes I can build all tests.

from nsimd.

eschnett avatar eschnett commented on August 15, 2024

The errors appear random. Here are results from three runs:

-- SUMMARY: 48 fails out of 8214 tests
-- FAILED: ./tests.allocator.cpp98
-- FAILED: ./tests.c_base.fms.u64.c99
-- FAILED: ./tests.c_base.fnma.u8.c99
-- FAILED: ./tests.c_base.gt.f16.c89
-- FAILED: ./tests.c_base.load2a_ravel.u8.c99
-- FAILED: ./tests.c_base.load3a.i32.c89
-- FAILED: ./tests.c_base.load3u_ravel.f64.c99
-- FAILED: ./tests.c_base.load4u_ravel.i16.c89
-- FAILED: ./tests.c_base.nbtrue.f32.c89
-- FAILED: ./tests.c_base.neg.f64.c99
-- FAILED: ./tests.c_base.reinterpret.f64_to_f64.c89
-- FAILED: ./tests.c_base.reinterpret.i8_to_u8.c89
-- FAILED: ./tests.c_base.reinterpretl.f16_to_i16.c89
-- FAILED: ./tests.c_base.ziplo.i16.c99
-- FAILED: ./tests.cxx_adv.load4u.f64.cpp11
-- FAILED: ./tests.cxx_adv.min.u64.cpp11
-- FAILED: ./tests.cxx_adv.ne.u64.cpp98
-- FAILED: ./tests.cxx_adv.orb.i64.cpp11
-- FAILED: ./tests.cxx_adv.orl.f32.cpp98
-- FAILED: ./tests.cxx_adv.reinterpretl.i8_to_u8.cpp98
-- FAILED: ./tests.cxx_adv.shr.i32.cpp11
-- FAILED: ./tests.cxx_adv.unziplo.u16.cpp98
-- FAILED: ./tests.cxx_base.eq.f32.cpp98
-- FAILED: ./tests.cxx_base.iota.i32.cpp98
-- FAILED: ./tests.cxx_base.masko_loadu1.u32.cpp98
-- FAILED: ./tests.cxx_base.maskz_loadu1.i64.cpp98
-- FAILED: ./tests.cxx_base.notb.f32.cpp11
-- FAILED: ./tests.cxx_base.shl.u64.cpp11
-- FAILED: ./tests.cxx_base.unziplo.i64.cpp11
-- FAILED: ./tests.cxx_base.zip.i32.cpp98
-- FAILED: ./tests.cxx_base.ziphi.i64.cpp98
-- FAILED: ./tests.modules.fixed_point.andl.fp_8_2.cpp11
-- FAILED: ./tests.modules.fixed_point.andl.fp_8_6.cpp11
-- FAILED: ./tests.modules.fixed_point.max.fp_8_6.cpp98
-- FAILED: ./tests.modules.fixed_point.min.fp_8_1.cpp98
-- FAILED: ./tests.modules.fixed_point.mul.fp_4_3.cpp11
-- FAILED: ./tests.modules.fixed_point.orb.fp_16_7.cpp11
-- FAILED: ./tests.modules.fixed_point.rec.fp_4_4.cpp98
-- FAILED: ./tests.modules.spmd.abs.i64.cpp11
-- FAILED: ./tests.modules.spmd.gt.u64.cpp98
-- FAILED: ./tests.modules.spmd.notl.u64.cpp98
-- FAILED: ./tests.modules.spmd.orl.u16.cpp98
-- FAILED: ./tests.modules.spmd.reinterpret.f16_u16.cpp98
-- FAILED: ./tests.modules.tet1d.div.u16.cpp11
-- FAILED: ./tests.modules.tet1d.le.f64.cpp98
-- FAILED: ./tests.modules.tet1d.lt.i32.cpp11
-- FAILED: ./tests.modules.tet1d.mul.f64.cpp98
-- FAILED: ./tests.modules.tet1d.round_to_even.u16.cpp98



-- SUMMARY: 18 fails out of 8214 tests
-- FAILED: ./tests.c_base.abs.u64.c99
-- FAILED: ./tests.c_base.fnma.f32.c89
-- FAILED: ./tests.c_base.ge.f16.c89
-- FAILED: ./tests.c_base.to_mask.u64_to_u64.c99
-- FAILED: ./tests.c_base.upcvt.u16_to_f32.c99
-- FAILED: ./tests.cxx_adv.le.f16.cpp11
-- FAILED: ./tests.cxx_adv.upcvt.f32_to_i64.cpp98
-- FAILED: ./tests.cxx_adv.upcvt.f32_to_u64.cpp98
-- FAILED: ./tests.cxx_base.cvt.u32_to_u32.cpp98
-- FAILED: ./tests.cxx_base.eq.i8.cpp11
-- FAILED: ./tests.cxx_base.gather.i64.cpp98
-- FAILED: ./tests.cxx_base.iota.i64.cpp11
-- FAILED: ./tests.cxx_base.notl.u64.cpp11
-- FAILED: ./tests.modules.fixed_point.sub.fp_4_4.cpp11
-- FAILED: ./tests.modules.spmd.notl.f32.cpp11
-- FAILED: ./tests.modules.spmd.to_mask.i16.cpp98
-- FAILED: ./tests.modules.tet1d.max.u32.cpp98
-- FAILED: ./tests.modules.tet1d.mul.f64.cpp98



-- SUMMARY: 18 fails out of 8214 tests
-- FAILED: ./tests.c_base.iota.f64.c99
-- FAILED: ./tests.c_base.load2u_ravel.i8.c99
-- FAILED: ./tests.c_base.round_to_even.i64.c99
-- FAILED: ./tests.c_base.sub.u16.c99
-- FAILED: ./tests.c_base.trunc.i64.c89
-- FAILED: ./tests.cxx_adv.cvt.u64_to_i64.cpp98
-- FAILED: ./tests.cxx_base.masko_loadu1.f16.cpp11
-- FAILED: ./tests.cxx_base.reinterpretl.u8_to_i8.cpp11
-- FAILED: ./tests.cxx_base.shl.i64.cpp98
-- FAILED: ./tests.cxx_base.unziplo.f64.cpp98
-- FAILED: ./tests.modules.fixed_point.add.fp_4_2.cpp98
-- FAILED: ./tests.modules.fixed_point.fma.fp_16_2.cpp98
-- FAILED: ./tests.modules.spmd.cvt.u64_f64.cpp11
-- FAILED: ./tests.modules.spmd.fms.u8.cpp98
-- FAILED: ./tests.modules.spmd.lt.u8.cpp98
-- FAILED: ./tests.modules.spmd.mul.u32.cpp98
-- FAILED: ./tests.modules.tet1d.ceil.i16.cpp98
-- FAILED: ./tests.modules.tet1d.min.i16.cpp11

Luckily, the errors all go away when running in serial, i.e. without the '-j' option.

from nsimd.

gquintin avatar gquintin commented on August 15, 2024

Hi Erik, currently compiling on our MAC to debug all this.

from nsimd.

gquintin avatar gquintin commented on August 15, 2024

Hi Erik, I fixed and pushed the "uint64_t" bug. I found more and will replace them all. I keep this issue open as I have like you the behavior on MAC.

from nsimd.

gquintin avatar gquintin commented on August 15, 2024

@eschnett, I am trying on a MAC M1 and got the same errors as you with homebrew:

In file included from /opt/homebrew/Cellar/gcc/10.2.0_3/include/c++/10.2.1/system_error:39,
                 from /opt/homebrew/Cellar/gcc/10.2.0_3/include/c++/10.2.1/bits/ios_base.h:46,
                 from /opt/homebrew/Cellar/gcc/10.2.0_3/include/c++/10.2.1/ios:42,
                 from /opt/homebrew/Cellar/gcc/10.2.0_3/include/c++/10.2.1/ostream:38,
                 from /Users/gquintin/nsimd/build/../include/nsimd/cxx_adv_api.hpp:29,
                 from /Users/gquintin/nsimd/build/../tests/cxx_adv/addv.f16.cpp:33:
/opt/homebrew/Cellar/gcc/10.2.0_3/include/c++/10.2.1/aarch64-apple-darwin20/bits/error_constants.h:135:24: error: 'EOWNERDEAD' was not declared in this scope
  135 |       owner_dead =     EOWNERDEAD,
      |                        ^~~~~~~~~~
/opt/homebrew/Cellar/gcc/10.2.0_3/include/c++/10.2.1/aarch64-apple-darwin20/bits/error_constants.h:151:34: error: 'ENOTRECOVERABLE' was not declared in this scope
  151 |       state_not_recoverable =    ENOTRECOVERABLE,
      |                                  ^~~~~~~~~~~~~~~

How did you manage to compile anyway?

from nsimd.

gquintin avatar gquintin commented on August 15, 2024

I am falling back to Xcode for now.

from nsimd.

eschnett avatar eschnett commented on August 15, 2024

I installed gcc via Spack, and this works for me.

from nsimd.

gquintin avatar gquintin commented on August 15, 2024

@eschnett I have fixed the issue. I just learnt at my expense that multithreading + fork do not play well together... Back to basics with simple C programming. You can test whether it works on your mac with the following:

git clone -b v2.2 https://github.com/agenium-scale/nsimd.git
export NSTOOLS_CHECKOUT_LAST_COMMIT=1
bash build-tests for sse2/sse42/avx/avx2 with gcc
cd build-avx2-gcc
../nstools/bin/nstest -j40

I have done the POSIX part, I am now debugging the Win32 part.

from nsimd.

gquintin avatar gquintin commented on August 15, 2024

All fixes have been done to nstest, I have tested it so it should work on Linux, Windows and MacOS. I am closing this issue.

from nsimd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.