Coder Social home page Coder Social logo

Comments (28)

amontoison avatar amontoison commented on September 28, 2024 1

The compilation of GALAHAD on Mac works with gcc/gfortran.

from galahad.

dpo avatar dpo commented on September 28, 2024

What version of gcc?

from galahad.

amontoison avatar amontoison commented on September 28, 2024

It was gcc 11.1.

from galahad.

amontoison avatar amontoison commented on September 28, 2024

https://stackoverflow.com/a/33401294

from galahad.

nimgould avatar nimgould commented on September 28, 2024

The SOMP = -fopenmp compiler flag should provide all the relevant include data here. Could you please go to the $GALAHAD/src/ssids directory, and try

make -f (architecture)

where (architecture) is whatever name you have in $GALAHAD/makefiles/ (e.g., mac64.osx.gfo). This will tell us what flags are being passed

from galahad.

amontoison avatar amontoison commented on September 28, 2024

I have an error when I try make -f binarybuilder.bb.fc:

sandbox:${WORKSPACE}/srcdir/GALAHAD/src/ssids # make -f binarybuilder.bb.fc
make: binarybuilder.bb.fc: No such file or directory
make: *** No rule to make target 'binarybuilder.bb.fc'.  Stop.

sandbox:${WORKSPACE}/srcdir/GALAHAD/src/ssids # ls
C                        config.h                 fkeep.F90                gpu_subtree_no_cuda.f90  solve.cu
LICENCE                  contrib.f90              gpu                      inform.f90               ssids.f90
NumericSubtree.cxx       contrib.h                gpu_alloc.f90            ldlt_app.cxx             ssidss.data
README                   contrib_free.f90         gpu_datatypes.f90        ldlt_nopiv.cxx           ssidss.f90
SymbolicSubtree.cxx      cpu                      gpu_dense_factor.f90     ldlt_tpp.cxx             subtree.f90
ThreadStats.cxx          cpu_iface.f90            gpu_factor.f90           makemaster               syrk.cu
akeep.f90                cpu_solve.f90            gpu_interfaces.f90       profile.cxx              updata_ssids
anal.f90                 cpu_subtree.f90          gpu_smalloc.f90          profile.hxx              wrappers.cxx
assemble.cu              datatypes.f90            gpu_solve.f90            profile_iface.f90
cholesky.cxx             dense_factor.cu          gpu_subtree.f90          reorder.cu
sandbox:${WORKSPACE}/srcdir/GALAHAD/src/ssids # 

from galahad.

nimgould avatar nimgould commented on September 28, 2024

from galahad.

amontoison avatar amontoison commented on September 28, 2024
sandbox:${WORKSPACE}/srcdir/GALAHAD/src/ssids # make -f $GALAHAD/makefiles/binarybuilder.bb.fc
 Compiling guess_topology  		mkdir -p /workspace/srcdir/GALAHAD/objects/binarybuilder.bb.fc/double/hw_topology
sed -f /workspace/srcdir/GALAHAD/seds/have_hwloc_def.sed ../spral/config.h > /workspace/srcdir/GALAHAD/objects/binarybuilder.bb.fc/double/config1.h
sed -f /workspace/srcdir/GALAHAD/seds/have_getcpu_undef.sed /workspace/srcdir/GALAHAD/objects/binarybuilder.bb.fc/double/config1.h > /workspace/srcdir/GALAHAD/objects/binarybuilder.bb.fc/double/config.h
cp  ../spral/compat.hxx /workspace/srcdir/GALAHAD/objects/binarybuilder.bb.fc/double/
cp  ../spral/guess_topology.cxx /workspace/srcdir/GALAHAD/objects/binarybuilder.bb.fc/double/
cp  ../spral/guess_topology.hxx /workspace/srcdir/GALAHAD/objects/binarybuilder.bb.fc/double/hw_topology/
cp  ../spral/hwloc_wrapper.hxx /workspace/srcdir/GALAHAD/objects/binarybuilder.bb.fc/double/hw_topology/
cd /workspace/srcdir/GALAHAD/objects/binarybuilder.bb.fc/double ; c++ -I. -o guess_topology.o -c -std=c++11 -fPIC -O2   -fopenmp \
          guess_topology.cxx \
                 || ( printf ' %-26s' "=> Disabling optimization " ; \
                    c++ -I. -o guess_topology.o -c -std=c++11 -fPIC -O0  -fopenmp \
                      guess_topology.cxx )
guess_topology.cxx:13:10: fatal error: 'omp.h' file not found
#include <omp.h>
         ^~~~~~~
1 error generated.
 => Disabling optimization guess_topology.cxx:13:10: fatal error: 'omp.h' file not found
#include <omp.h>
         ^~~~~~~
1 error generated.
make: *** [/workspace/srcdir/GALAHAD/src/ssids/makemaster:310: /workspace/srcdir/GALAHAD/objects/binarybuilder.bb.fc/double/libgalahad_spral.a(guess_topology.o)] Error 1

from galahad.

nimgould avatar nimgould commented on September 28, 2024

from galahad.

amontoison avatar amontoison commented on September 28, 2024

Yes, cc and c++ are alias for C and C++ compilers.
It's gcc and g++ for Linux / Windows and Clang / Clang++ on Mac and FreeBSD.

from galahad.

dpo avatar dpo commented on September 28, 2024

could you try gcc/gfortran for macOS?

from galahad.

amontoison avatar amontoison commented on September 28, 2024

Yes, I restart the compilation.
I just checked and we use gcc/gfortran for SPRAL:
https://github.com/JuliaPackaging/Yggdrasil/blob/master/S/SPRAL/build_tarballs.jl#L16-L19

@jfowkes
Do you test the compilation of SPRAL on Mac with CI?
It seems that modifications are needed for Clang / Clang++ compilers (native compilers on Mac / FreeBSD).

from galahad.

dpo avatar dpo commented on September 28, 2024

I would suggest that we forget about clang for now, and first stabilize everything with gcc/gfortran on every platform of interest.

from galahad.

nimgould avatar nimgould commented on September 28, 2024

I believe that Alexis mentioned the work-around here. If
c++ is from clang, one needs SOMP = '-fopenmp=libomp'
in the compiler.binarybuilder.bb.fc file in archdefs, which
is copied into GALAHAD's makefiles/binarybuilder.bb.fc
on installation. Give that a try ... but I agree with Dominique that
we should concentrate on gcc for the time being.

from galahad.

jfowkes avatar jfowkes commented on September 28, 2024

@amontoison SPRAL is only tested on Linux GCC in the CI but I have successfully compiled it with Homebrew GCC on Mac.

I believe it would take quite a bit of nontrivial work to make SPRAL work with Clang given how complex it is.

from galahad.

nimgould avatar nimgould commented on September 28, 2024

I tried flang/clang, and the flag

SOMP = -fopenmp=libomp -I/usr/lib/llvm-14/lib/clang/14.0.0/include

did the trick here ... but as you see it needs to know where the system header is. The alternative

-I/usr/lib/gcc/x86_64-linux-gnu/11/include/omp.h

also worked, and is marginally more portable.

Unfortunately, a following ssids compile

clang++ -I. -o NumericSubtree.o -c -std=c++11 -fPIC -O -fopenmp=libomp -I/usr/lib/llvm-14/lib/clang/14.0.0/include NumericSubtree.cxx

produces a wave of errors, typically
./ssids/cpu/kernels/assemble.hxx:212:42: error: variable 'add_a_blk_sz' must have explicitly specified data sharing attributes
add_a_block(iblk, std::min(iblk+add_a_blk_sz,snode.num_a), node, aval, scaling);

As I don't know c++, I have no idea what this means, and I can't find any compiler flag to disable it (if that is even possible). This does not happen with icx which is also built on top of LLVM, so I suspect it is just clang being too fussy.

from galahad.

jfowkes avatar jfowkes commented on September 28, 2024

from galahad.

nimgould avatar nimgould commented on September 28, 2024

Very interesting. In the block

  #pragma omp taskgroup
  for(int iblk=0; iblk<snode.num_a; iblk+=add_a_blk_sz) {
     #pragma omp task default(none) \
        firstprivate(iblk) \
        shared(snode, node, aval, scaling, ldl)
     add_a_block(iblk, std::min(iblk+add_a_blk_sz,snode.num_a), node, aval, scaling);
  }

what precisely would you remove? I'm willing to try, but need hand holding

from galahad.

jfowkes avatar jfowkes commented on September 28, 2024

If my understanding is correct then removing the default(none) after #pragma omp task should fix it.

from galahad.

nimgould avatar nimgould commented on September 28, 2024

I'll try tomorrow once I "get back" from Edinburgh

from galahad.

amontoison avatar amontoison commented on September 28, 2024

Ok, so the issue is in spral and not in GALAHAD. We could move the issue to the GitHub SPRAL repository directly.
I agree with Dominique, we should compile GALAHAD with gcc/gfortran on all relevant platforms.

@jfowkes I did two CI scripts for a C++ code a few months ago, you can easily adapt them for SPRAL:
https://github.com/bbopt/nomad/blob/master/.github/workflows/ci.yml
https://github.com/bbopt/nomad/blob/master/.cirrus.yml

from galahad.

jfowkes avatar jfowkes commented on September 28, 2024

Thanks @amontoison, I've created a SPRAL pull request to test with Clang/Flang:
ralna/spral#97
Flang doesn't seem to be working though, any suggestions? We should discuss there.

from galahad.

nimgould avatar nimgould commented on September 28, 2024

Good call, Jari. removing the three default (none)s fixed the compiler errors, and the sls exhaustive test now runs ... and ssids gives the right answer. I should add that this is with flang/clang as compiled from https://github.com/flang-compiler/llvm.git . Next I need to make sure that these changes don't ruin ssids under other compilers. Progress on an otherwise hopeless day!

from galahad.

nimgould avatar nimgould commented on September 28, 2024

Oh, I should add that I needed to set the galahad variables
OPENMP = -fopenmp -lstdc++ -lhwloc
SOMP = -fopenmp=libomp -I/usr/lib/llvm-14/lib/clang/14.0.0/include
and the other is of course not portable (but presumably will be when flang is finally
released as part of clang

from galahad.

nimgould avatar nimgould commented on September 28, 2024

OK, the updates also work for gcc and icc. icx fails, but I think it did before. Jari, are you planning to make these changes in spral as well?

from galahad.

jfowkes avatar jfowkes commented on September 28, 2024

@nimgould yes I will make these changes to SPRAL, could you point me to the three default(none) statements you removed?

from galahad.

nimgould avatar nimgould commented on September 28, 2024

Yes, in assemble.hxx (as per $GALAHAD/src/ssids/cpu/kernel/), lines 209, 281 and 389

from galahad.

jfowkes avatar jfowkes commented on September 28, 2024

@nimgould done, fixed in SPRAL.

from galahad.

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.