SPECFEM / specfem3d

SPECFEM3D_Cartesian simulates acoustic (fluid), elastic (solid), coupled acoustic/elastic, poroelastic or seismic wave propagation in any type of conforming mesh of hexahedra (structured or not).
GNU General Public License v3.0
409 stars 227 forks source link

🐛 [BUG] - cannot compile xsmooth_sem without first compiling xspecfem3D #1607

Closed bch0w closed 1 year ago

bch0w commented 1 year ago

Description

I was trying to compile the xsmooth_sem executable for SPECFEM v4.0.0 (latest master branch version) and kept hitting the following compiler error:

ifort -g  -xHost -fpe0 -ftz -assume buffered_io -assume byterecl -align sequence -std08 -diag-disable 6477 -implicitnone -gen-interfaces -warn all,noexternal -O3 -check nobounds  -module ./obj -I./obj -I.  -I./setup -c -o obj/smooth_sem.postprocess.o src/tomography/postprocess_sensitivity_kernels/smooth_sem.F90
src/tomography/postprocess_sensitivity_kernels/smooth_sem.F90(72): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [KDTREE_SEARCH]
  use kdtree_search
------^
src/tomography/postprocess_sensitivity_kernels/smooth_sem.F90(744): error #6404: This name does not have a type, and must have an explicit type.   [KDTREE_NODES_LOCATION]
    allocate(kdtree_nodes_location(NDIM,NSPEC_AB),stat=ier)
-------------^
src/tomography/postprocess_sensitivity_kernels/smooth_sem.F90(746): error #6404: This name does not have a type, and must have an explicit type.   [KDTREE_NODES_INDEX]
    allocate(kdtree_nodes_index(NSPEC_AB),stat=ier)
-------------^
src/tomography/postprocess_sensitivity_kernels/smooth_sem.F90(748): error #6911: The syntax of this substring is invalid.   [KDTREE_NODES_LOCATION]
    kdtree_nodes_location(:,:) = 0.0; kdtree_nodes_index(:) = 0
----^
compilation aborted for src/tomography/postprocess_sensitivity_kernels/smooth_sem.F90 (code 1)
make: *** [src/tomography/postprocess_sensitivity_kernels/rules.mk:208: obj/smooth_sem.postprocess.o] Error 1

I realized that the compiler was looking for obj/search_kdtree.shared.o but could not find it, leading to the compiler error.

I realized however that xspecfem3D also requires this shared object file, and that building xspecfem3D first would then allow xsmooth_sem to be built successfully.

Likely users will do a make all and not encounter this problem, but thought I'd mention it, as it seems like this should be a quick fix to include building the search_kdtree object in the compile of xsmooth_sem, although how to do this pushes on the limit of my knowledge of FORTRAN and make files.

Just to note, looks like this was introduced in a5310f393a4b710b54acbba9f426657ebe98cfc5 as I am able to compile just xsmooth_sem by itself in earlier versions of the code. This also affects the latest devel branch of the code c4641f3d.

Affected SPECFEM3D version

v4.0.0

Your software and hardware environment

Cluster running RHEL8.7; ifort==2021.6.0

Reproduction steps

git clone https://github.com/SPECFEM/specfem3d.git --depth=1 
cd specfem3d
./configure F90=ifort FC=ifort MPIFC=mpiifort CC=icc MPICC=mpiicc
make xsmooth_sem

OS

Linux

danielpeter commented 1 year ago

good catch! i'll fix this shortly...

danielpeter commented 1 year ago

addressed by commit ef34b81ae12

bch0w commented 1 year ago

Thanks @danielpeter!