Cmake failure

Issue #410 resolved
Tobias Duswald created an issue

Dear blaze-team, dear Mr. Iglberger,

I tried to use blaze for one of my projects and encountered unexpected difficulties during the installation process. I cloned the latest master from this git and ran

cd blaze && mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/ ..

This produced the following error:

-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring blaze version 3.9
-- Looking for sgemm_
-- Looking for sgemm_ - not found
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Looking for dgemm_
-- Looking for dgemm_ - found
-- Found BLAS: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Accelerate.framework  
-- Looking for cheev_
-- Looking for cheev_ - found
-- Found LAPACK: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Accelerate.framework;-lm;-ldl  
CMake Error at CMakeLists.txt:144 (math):
  math cannot parse the expression: "/1024": syntax error, unexpected
  exp_DIVIDE (1).


Cache size not found automatically. Using default value as cache size.
-- Found OpenMP_CXX: -Xclang -fopenmp (found version "5.0") 
-- Found OpenMP: TRUE (found version "5.0")  
-- Configuring incomplete, errors occurred!
See also "<path>/CMakeFiles/CMakeOutput.log".
See also "<path>/CMakeFiles/CMakeError.log".

I’m running macOS 11.4 or the M1 Notebook. CMake version 3.20.5 installed via brew. Commenting out the lines 143-145 in CMakeLists.txt allowed me to install and run everything, but I thought you might want to hear about that.

Kind regards,
Tobias

Comments (7)

  1. Klaus Iglberger

    Hi Tobias!

    Thanks a lot for taking the time to report this problem. With commit ff611fc we have already pushed a potential fix for the issue. We suspect that it is a syntax issue, but unfortunately we don’t experience the problem with our CMake version. Could you therefore please give it a second try to see if the problem is indeed fixed? We apologize for the inconvenience and appreciate the extra effort. Thanks,

    Best regards,

    Klaus!

  2. Tobias Duswald reporter

    Hi Klaus,

    Thanks for the reply and the proposed fix. Just checked the latest commit but it did not solve the problem. I believe it’s in fact related to lines 126-129. On my MacBook Pro, the command sysctl -n hw.l3cachesize does not return a value. So after line 129, the variable temp is empty and flag is 0 causing the error later on when dividing nothing by 1024.

    In fact sysctl -a | grep l3 shows no results either on my MacBook. The cache structure of Apple silicon (M1) is quite special and apparently, it does not have the L3 cache. I attached the output of sysctl -a | grep cache at the end, maybe one of those numbers can be used to determine the cache sizes for blaze? For instance, one could introduce an additional if statement as

    set(APPLE_SILICON "${DETECTED_ARCH}" STREQUAL "arm64")
    if (APPLE_SILICON)
      execute_process(COMMAND sysctl -n hw.l1icachesize
                      OUTPUT_VARIABLE tmp
                      RESULT_VARIABLE flag
                      ERROR_QUIET)
    endif (APPLE_SILICON)
    

    which fixed the problem for me. But maybe / probably there is a nicer way to include it into the existing CMakeLists.txt.

    Hope that helps 🙂

    Best, Tobias

    sysctl -a | grep cache
    hw.cacheconfig: 8 1 1 0 0 0 0 0 0 0
    hw.cachelinesize: 128
    hw.cachesize: 3616980992 65536 4194304 0 0 0 0 0 0 0
    hw.l1dcachesize: 65536
    hw.l1icachesize: 131072
    hw.l2cachesize: 4194304
    

  3. Klaus Iglberger

    Hi Tobias!

    Thanks for the additional information. We have pushed commit 89ee947. With that you shouldn’t get any CMake errors anymore. Thanks again,

    Best regards,

    Klaus!

  4. Klaus Iglberger

    Commit 89ee947 improves the cache size detection for Windows, Unix, and macOS in the CMakeLists.txt file. The fix is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.9.

  5. Log in to comment