fangohr / octopus-in-spack

Develop Octopus in spack (software packaging)
BSD 3-Clause "New" or "Revised" License
3 stars 4 forks source link

Debug flags are being set even when not on debug varinat #69

Closed iamashwin99 closed 1 year ago

iamashwin99 commented 1 year ago

Here is the stdout of octopus from spack :

Version                : 12.1
Commit                 :
Build time             : Mon Feb 27 21:57:54 CET 2023
Configuration options  : maxdim3 openmp mpi sse2 avx libxc5 libxc_fxc
Optional libraries     : cgal metis netcdf parmetis pfft nlopt
Architecture           : x86_64
C compiler             : /opt_mpsd/linux-debian11/dev-23a/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/openmpi-4.1.4-4lehnqllo3r6t45ix2wrdcew6lfwsdgw/bin/mpicc (/opt_mpsd/linux-debian11/dev-23a/sandybridge/spack/lib/spack/env/gcc/gcc)
C compiler flags       : -g -O2
C++ compiler           : /opt_mpsd/linux-debian11/dev-23a/sandybridge/spack/lib/spack/env/gcc/g++
C++ compiler flags     : -g -O2
Fortran compiler       : /opt_mpsd/linux-debian11/dev-23a/sandybridge/spack/opt/spack/linux-debian11-sandybridge/gcc-11.3.0/openmpi-4.1.4-4lehnqllo3r6t45ix2wrdcew6lfwsdgw/bin/mpif90 (/opt_mpsd/linux-debian11/dev-23a/sandybridge/spack/lib/spack/env/gcc/gfor
Fortran compiler flags : -O2 -ffree-line-length-none -fallow-argument-mismatch -fallow-invalid-boz -fopenmp

-g option is set even though debug variant isnt specified when installed with the spec:

octopus@12.1%gcc@11.3.0+mpi+netcdf+parmetis+arpack+cgal+pfft+python+likwid+libyaml+elpa+nlopt \
   ^parmetis@4.0.3 \
   ^cgal@5.0.3 \
   ^pfft@1.0.8-alpha \
   ^elpa@2021.11.001 \
   ^nlopt@2.7.0 \
   ^openmpi@4.1.4~cuda fabrics=ucx schedulers=slurm \
   ^ucx@1.13.1+cma~cuda+dc+dm~gdrcopy+ib_hw_tm+knem+mlx5_dv+rc+rdmacm+thread_multiple+ud+verbs+vfs~xpmem \
   ^netlib-scalapack@2.1.0 \
   ^fftw@3.3.10+openmp \
   ^hdf5@1.12.2+fortran
iamashwin99 commented 1 year ago

When the spec is :

==> Concretized octopus@12.1~debug                                                                                                                                                                                 
 -   vbpc3mk  octopus@12.1%gcc@10.3.0~arpack~cgal~cuda~debug~elpa~libvdwxc~libyaml~likwid~metis~netcdf~nlopt~parmetis~pfft~python~scalapack build_system=autotools dev_path=/opt_mpsd/linux-debian11/ashwins_playgr
ound/testenv/octopus arch=linux-debian11-sandybridge                                                                                                                                                               
 -   niiefxk      ^fftw@3.3.10%gcc@10.3.0+mpi~openmp~pfft_patches build_system=autotools precision=double,float arch=linux-debian11-sandybridge                                                                    
 -   t6vw4kt      ^gsl@2.7.1%gcc@10.3.0~external-cblas build_system=autotools arch=linux-debian11-sandybridge                                                                                                      
 -   a5iywtf      ^libxc@5.2.3%gcc@10.3.0~cuda+shared build_system=autotools arch=linux-debian11-sandybridge                                                                                                       
 -   3ghqhuj          ^perl@5.36.0%gcc@10.3.0+cpanm+shared+threads build_system=generic arch=linux-debian11-sandybridge                                                                                            
 -   zsdgtyu              ^berkeley-db@18.1.40%gcc@10.3.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-debian11-sandybridge                                                              
 -   6ix6jwv              ^bzip2@1.0.8%gcc@10.3.0~debug~pic+shared build_system=generic arch=linux-debian11-sandybridge                                                                                            
 -   gcf45td                  ^diffutils@3.8%gcc@10.3.0 build_system=autotools arch=linux-debian11-sandybridge                                                                                                     
 -   d3dfqhn              ^gdbm@1.23%gcc@10.3.0 build_system=autotools arch=linux-debian11-sandybridge                                                                                                             
 -   rd7yhu6                  ^readline@8.1.2%gcc@10.3.0 build_system=autotools arch=linux-debian11-sandybridge                                                                                                    
 -   5qwtnlb      ^openblas@0.3.21%gcc@10.3.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile patches=d3d9b15 symbol_suffix=none threads=none arch=linux-debian11-sandybridge      
 -   2m2n2xl      ^openmpi@4.1.4%gcc@10.3.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics
=none schedulers=none arch=linux-debian11-sandybridge                                                                                                                                                              
 -   asvgql7          ^hwloc@2.8.0%gcc@10.3.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-debian11-sandybridge
 -   rroo6q5              ^libpciaccess@0.16%gcc@10.3.0 build_system=autotools arch=linux-debian11-sandybridge                            
 -   c7gqzo5                  ^util-macros@1.19.3%gcc@10.3.0 build_system=autotools arch=linux-debian11-sandybridge                       
 -   jyhbf7z              ^libxml2@2.10.1%gcc@10.3.0~python build_system=autotools arch=linux-debian11-sandybridge                        
 -   lsxxshu                  ^libiconv@1.16%gcc@10.3.0 build_system=autotools libs=shared,static arch=linux-debian11-sandybridge         
 -   mqoliwj                  ^xz@5.2.7%gcc@10.3.0~pic build_system=autotools libs=shared,static arch=linux-debian11-sandybridge          
 -   ahe7aye              ^ncurses@6.3%gcc@10.3.0~symlinks+termlib abi=none build_system=autotools arch=linux-debian11-sandybridge        
 -   fthfh3n          ^numactl@2.0.14%gcc@10.3.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-debian11-sandybridge   
 -   vqg3gy4              ^autoconf@2.69%gcc@10.3.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-debian11-sandybridge
 -   cdcgnfe              ^automake@1.16.5%gcc@10.3.0 build_system=autotools arch=linux-debian11-sandybridge
 -   qm6xnr3              ^libtool@2.4.7%gcc@10.3.0 build_system=autotools arch=linux-debian11-sandybridge                                                                                                         
 -   cv2zrpx              ^m4@1.4.19%gcc@10.3.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-debian11-sandybridge
 -   6v677ee                  ^libsigsegv@2.13%gcc@10.3.0 build_system=autotools arch=linux-debian11-sandybridge
 -   cejzfsq          ^openssh@9.1p1%gcc@10.3.0+gssapi build_system=autotools arch=linux-debian11-sandybridge
 -   q46qru3              ^krb5@1.19.3%gcc@10.3.0+shared build_system=autotools arch=linux-debian11-sandybridge
 -   dldwdq6                  ^bison@3.8.2%gcc@10.3.0 build_system=autotools arch=linux-debian11-sandybridge
 -   qswwooj                  ^gettext@0.21.1%gcc@10.3.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-debian11-sandybridge
 -   r4o7pte                      ^tar@1.34%gcc@10.3.0 build_system=autotools zip=pigz arch=linux-debian11-sandybridge
 -   imrfkbg                          ^pigz@2.7%gcc@10.3.0 build_system=makefile arch=linux-debian11-sandybridge
 -   hq5voyc                          ^zstd@1.5.2%gcc@10.3.0+programs build_system=makefile compression=none libs=shared,static arch=linux-debian11-sandybridge
 -   dn3ajuo              ^libedit@3.1-20210216%gcc@10.3.0 build_system=autotools arch=linux-debian11-sandybridge
 -   mbccjsa              ^openssl@1.1.1s%gcc@10.3.0~docs~shared build_system=generic certs=mozilla arch=linux-debian11-sandybridge
 -   5eoktyi                  ^ca-certificates-mozilla@2022-10-11%gcc@10.3.0 build_system=generic arch=linux-debian11-sandybridge
 -   vd6mgev          ^pkgconf@1.8.0%gcc@10.3.0 build_system=autotools arch=linux-debian11-sandybridge                                                                                                             
 -   otz2jki          ^pmix@4.1.2%gcc@10.3.0~docs+pmi_backwards_compatibility~restful build_system=autotools arch=linux-debian11-sandybridge
 -   gjnv2ps              ^libevent@2.1.12%gcc@10.3.0+openssl build_system=autotools arch=linux-debian11-sandybridge
 -   pmej54i          ^zlib@1.2.13%gcc@10.3.0+optimize+pic+shared build_system=makefile arch=linux-debian11-sandybridge

The flags set during the configure phase turns out to be :

───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: spack-build-02-configure-out.txt
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ ==> octopus: Executing phase: 'configure'
.........
       │  'FCFLAGS=-O2 -ffree-line-length-none -fallow-argument-mismatch -fallow-invalid-boz' 'FFLAGS=O2 -ffree-line-length-none -fallow-argument-mismatch -fallow-invalid-boz'

But then during the build phase:

───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: spack-build-03-build-out.txt
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ ==> octopus: Executing phase: 'build'
   2   │ ==> [2023-03-22-17:39:30.590260] 'make' '-j16' 'V=1'
   3   │ make  all-recursive
.
.
.
  17   │ Making all in GKlib
  18   │ make[4]: Entering directory '/opt_mpsd/linux-debian11/ashwins_playground/testenv/octopus/external_libs/metis-5.1/GKlib'
  19   │ depbase=`echo b64.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
  20   │ /bin/bash ../../../libtool  --tag=CC   --mode=compile /opt_mpsd/linux-debian11/ashwins_playground/spack/opt/spack/linux-debian11-sandybridge/gcc-10.3.0/openmpi-4.1.4-2m2n2xlq5myksltbmkztle554xiv7c7t/bin
       │ /mpicc -DHAVE_CONFIG_H -I. -I../../..  -DNDEBUG -DNDEBUG2    -g -O2 -MT b64.lo -MD -MP -MF $depbase.Tpo -c -o b64.lo b64.c &&\
  21   │ mv -f $depbase.Tpo $depbase.Plo

so the -g gets added some where in between

iamashwin99 commented 1 year ago

The -g dosent seem to be added during compilation of octopus though, I added the optimisation to -O3 to check:

5867   │   /opt_mpsd/linux-debian11/ashwins_playground/spack/opt/spack/linux-debian11-sandybridge/gcc-10.3.0/openmpi-4.1.4-2m2n2xlq5myksltbmkztle554xiv7c7t/bin/mpif90 -O3 -ffree-line-length-none -fallow-argument-mismatch -fallow-invalid-boz -fopenmp -I ../external_libs/bpdn -I ../external_libs/dftd3 -I ../external_libs/spglib-1.9.9/src/ -I /opt_mpsd/linux-debian11/ashwins_playground/spack/opt/spack/linux-debian11-sandybridg
       │ e/gcc-10.3.0/libxc-5.2.3-a5iywtfdac6yrpni2sva7zy5hetbcr7j/include -I/opt_mpsd/linux-debian11/ashwins_playground/spack/opt/spack/linux-debian11-sandybridge/gcc-10.3.0/fftw-3.3.10-niiefxktnnokwz2ntmvixx6sncl5kguf/include  -c  -o sternheimer/kdotp_calc.lo sternheimer/kdotp_calc_oct.f90
5868   │ libtool: compile:  /opt_mpsd/linux-debian11/ashwins_playground/spack/opt/spack/linux-debian11-sandybridge/gcc-10.3.0/openmpi-4.1.4-2m2n2xlq5myksltbmkztle554xiv7c7t/bin/mpif90 -O3 -ffree-line-length-none -fallow-argument-mismatch -fallow-invalid-boz -fopenmp -I ../external_libs/bpdn -I ../external_libs/dftd3 -I ../external_libs/spglib-1.9.9/src/ -I /opt_mpsd/linux-debian11/ashwins_playground/spack/opt/spack/linux-de
       │ bian11-sandybridge/gcc-10.3.0/libxc-5.2.3-a5iywtfdac6yrpni2sva7zy5hetbcr7j/include -I/opt_mpsd/linux-debian11/ashwins_playground/spack/opt/spack/linux-debian11-sandybridge/gcc-10.3.0/fftw-3.3.10-niiefxktnnokwz2ntmvixx6sncl5kguf/include -c sternheimer/kdotp_calc_oct.f90 -o sternheimer/kdotp_calc.o
Version                : 12.1                                                                                                                                                                                      
Commit                 :                                                                                                                                                                                           
Build time             : Thu Mar 23 10:26:39 CET 2023                                                                                                                                                              
Configuration options  : maxdim3 openmp mpi sse2 avx libxc5 libxc_fxc                                                                                                                                              
Optional libraries     : gdlib metis                                                                                                                                                                               
Architecture           : x86_64                                                                                                                                                                                    
C compiler             : /opt_mpsd/linux-debian11/ashwins_playground/spack/opt/spack/linux-debian11-sandybridge/gcc-10.3.0/openmpi-4.1.4-2m2n2xlq5myksltbmkztle554xiv7c7t/bin/mpicc (/opt_mpsd/linux-debian11/ashwi
ns_playground/spack/lib/spack/env/gcc/gcc)                                                                                                                                                                         
C compiler flags       : -g -O2                                                                                                                                                                                    
C++ compiler           : /opt_mpsd/linux-debian11/ashwins_playground/spack/lib/spack/env/gcc/g++                                                                                                                   
C++ compiler flags     : -g -O2                                                                                                                                                                                    
Fortran compiler       : /opt_mpsd/linux-debian11/ashwins_playground/spack/opt/spack/linux-debian11-sandybridge/gcc-10.3.0/openmpi-4.1.4-2m2n2xlq5myksltbmkztle554xiv7c7t/bin/mpif90 (/opt_mpsd/linux-debian11/ashw
ins_playground/spack/lib/spack/env/gcc/gfortr                                                                                                                                                                      
Fortran compiler flags : -O3 -ffree-line-length-none -fallow-argument-mismatch -fallow-invalid-boz -fopenmp

The C compiler flags and C++ ones dont seem to have been picked up, testing again with our latest commit with refactored Flags sections : https://github.com/fangohr/octopus-in-spack/pull/70

iamashwin99 commented 1 year ago

This issue is solved with the MR: #70

                           Running octopus                                                                                                                                                                         

Version                : 12.1                                                                                                                                                                                      
Commit                 :                                                                                                                                                                                           
Build time             : Thu Mar 23 11:22:51 CET 2023                                                                                                                                                              
Configuration options  : maxdim3 openmp mpi sse2 avx libxc5 libxc_fxc
Optional libraries     : gdlib metis
Architecture           : x86_64
C compiler             : /opt_mpsd/linux-debian11/ashwins_playground/spack/opt/spack/linux-debian11-sandybridge/gcc-10.3.0/openmpi-4.1.4-2m2n2xlq5myksltbmkztle554xiv7c7t/bin/mpicc (/opt_mpsd/linux-debian11/ashwins_playground/spack/lib/spack/env/gcc/gcc)
C compiler flags       : -O2 -fallow-argument-mismatch -fallow-invalid-boz
C++ compiler           : /opt_mpsd/linux-debian11/ashwins_playground/spack/lib/spack/env/gcc/g++
C++ compiler flags     : -O2 -fallow-argument-mismatch -fallow-invalid-boz
Fortran compiler       : /opt_mpsd/linux-debian11/ashwins_playground/spack/opt/spack/linux-debian11-sandybridge/gcc-10.3.0/openmpi-4.1.4-2m2n2xlq5myksltbmkztle554xiv7c7t/bin/mpif90 (/opt_mpsd/linux-debian11/ashwins_playground/spack/lib/spack/env/gcc/gfortr
Fortran compiler flags : -O2 -ffree-line-length-none -fallow-argument-mismatch -fallow-invalid-boz -fopenmp