mpicc -DFUNDERSC=1 -DDOUBLE_PRECISION -o pthread.o -c pthread.c
pthread.c: In function 'get_cpu_c_':
pthread.c:154:16: error: implicit declaration of function 'sched_getcpu' [-Wimplicit-function-declaration]
154 | return sched_getcpu();
| ^~~~~~~~~~~~
pthread.c: In function 'set_cpu_c_':
pthread.c:163:5: error: unknown type name 'cpu_set_t'
163 | cpu_set_t cpuset;
| ^~~~~~~~~
pthread.c:164:5: error: implicit declaration of function 'CPU_ZERO' [-Wimplicit-function-declaration]
164 | CPU_ZERO(&cpuset);
| ^~~~~~~~
pthread.c:165:5: error: implicit declaration of function 'CPU_SET' [-Wimplicit-function-declaration]
165 | CPU_SET(core_id, &cpuset);
| ^~~~~~~
pthread.c:166:20: error: implicit declaration of function 'pthread_setaffinity_np'; did you mean 'pthread_setname_np'? [-Wimplicit-function-declaration]
166 | const int rc = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
| ^~~~~~~~~~~~~~~~~~~~~~
| pthread_setname_np
pthread.c:166:66: error: 'cpu_set_t' undeclared (first use in this function); did you mean 'cpuset'?
166 | const int rc = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
| ^~~~~~~~~
| cpuset
pthread.c:166:66: note: each undeclared identifier is reported only once for each function it appears in
--
You received this message because you are subscribed to the Google Groups "pencil-code-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pencil-code-dis...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pencil-code-discuss/3909476.5fSG56mABF%40kishore-thinkpad-e495.
Hi Wlad & Kishore,
@Wlad: this compilation error is strange. First, I assume that you are compiling with MULTITHREADUNG=on
in Makefile.local? Otherwise, this source should not be compiled. Second,
#define _GNU_SOURCE
So, which is your mpicc?
We are aware that averages (and spectra) are no longer written out at t=0. We are working on it, but not yet successful.
Best,
Matthias
To view this discussion visit https://groups.google.com/d/msgid/pencil-code-discuss/239609193ee547c09ddcf01fe5247265%40su.se.
I assume that you are compiling with MULTITHREADUNG=on
in Makefile.local?
which is your mpicc?
% mpicc -v
mpicc for MPICH version 4.2.3
Using built-in specs.
COLLECT_GCC=/opt/local/bin/gcc-mp-14
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin24/14.2.0/lto-wrapper
Target: x86_64-apple-darwin24
Configured with: /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc14/gcc14/work/gcc-14.2.0/configure --prefix=/opt/local --build=x86_64-apple-darwin24 --enable-languages=c,c++,objc,obj-c++,lto,fortran,jit --libdir=/opt/local/lib/gcc14 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-14 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-14 --with-gxx-include-dir=/opt/local/include/gcc14/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --with-zstd=/opt/local --enable-checking=release --disable-multilib --enable-lto --enable-libstdcxx-time --with-build-config=bootstrap-debug --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --enable-host-shared --with-darwin-extra-rpath=/opt/local/lib/libgcc --with-libiconv-prefix=/opt/local --disable-tls --with-gxx-libcxx-include-dir=/opt/local/libexec/gcc14/libc++/include/c++/v1 --with-pkgversion='MacPorts gcc14 14.2.0_3+stdlib_flag' --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.0 (MacPorts gcc14 14.2.0_3+stdlib_flag)
To view this discussion visit https://groups.google.com/d/msgid/pencil-code-discuss/239609193ee547c09ddcf01fe5247265%40su.se.
Hi Wlad,
Nope
Then I conclude that you tried to build one of the helpers (read_videofiles etc.).
I pushed a fix to Makefile.src.
Best,
Matthias
To view this discussion visit https://groups.google.com/d/msgid/pencil-code-discuss/aa98ba62a9854ea7b88ef80e2756997b%40su.se.
% pc_build
No such file: </etc/issue>
No such file: </etc/version>
Use of uninitialized value $linux_type in index at /Users/wlyra/pencil-code/lib/perl/Pencil/ConfigFinder.pm line 283.
Found config file </Users/wlyra/pencil-code/config/hosts/wlyra/host-caronte-Darwin.conf>
Running make 'FC=mpif90' 'FFLAGS=-fbounds-check -Wall -Wunused -O3 -I/opt/local/include' 'FFLAGS_DOUBLE=-fdefault-real-8 -fdefault-double-8' 'F77=mpif77' 'CC=mpicc' 'CFLAGS=-DFUNDERSC=1' 'CFLAGS_DOUBLE=-DDOUBLE_PRECISION' 'default_to_be'
MAKING src/Makefile.inc
touch src/.build-history
echo wlyra"@"`hostname` "("`date`")" >> src/.build-history
( cd src && \
echo "===== " /Library/Developer/CommandLineTools/usr/bin/make FROM_PARENT=src/ -f Makefile.src code "====="; \
/Library/Developer/CommandLineTools/usr/bin/make FROM_PARENT=src/ -f Makefile.src default_to_be \
)
===== /Library/Developer/CommandLineTools/usr/bin/make FROM_PARENT=src/ -f Makefile.src code =====
sed: 2: "s/.*nprocx *= *\([0-9][ ...": undefined label ';T del;:del;d'
sed: 2: "s/.*nprocy *= *\([0-9][ ...": undefined label ';T del;:del;d'
sed: 2: "s/.*nprocz *= *\([0-9][ ...": undefined label ';T del;:del;d'
sed: 2: "s/.*nprocx *= *\([0-9][ ...": undefined label ';T del;:del;d'
sed: 2: "s/.*nprocy *= *\([0-9][ ...": undefined label ';T del;:del;d'
sed: 2: "s/.*nprocz *= *\([0-9][ ...": undefined label ';T del;:del;d'
sed: 2: "s/^.*nprocx *= *\([^,]* ...": undefined label 'cont;T del;:del;d;:cont;s/\([a-zA-Z_][a-zA-Z_]*\)/$(\1)/g;s/^\(.*\)$/nprocx= \1/'
sed: 2: "s/^.*nprocy *= *\([^,]* ...": undefined label 'cont;T del;:del;d;:cont;s/\([a-zA-Z_][a-zA-Z_]*\)/$(\1)/g;s/^\(.*\)$/nprocy= \1/'
sed: 2: "s/^.*nprocz *= *\([^,]* ...": undefined label 'cont;T del;:del;d;:cont;s/\([a-zA-Z_][a-zA-Z_]*\)/$(\1)/g;s/^\(.*\)$/nprocz= \1/'
Makefile.src:437: *** Cannot build: ncpus /= nprocx*nprocy*nprocz.. Stop.
make: *** [default_to_be] Error 2
'make FC=mpif90 FFLAGS=-fbounds-check -Wall -Wunused -O3 -I/opt/local/include FFLAGS_DOUBLE=-fdefault-real-8 -fdefault-double-8 F77=mpif77 CC=mpicc CFLAGS=-DFUNDERSC=1 CFLAGS_DOUBLE=-DDOUBLE_PRECISION default_to_be' failed: <Inappropriate ioctl for device>
Hi,
sorry for the inconveniences. I also think that the nprocs problem is due to deviant behavior of sed on MacOS. I'll try to find solutions.
Wlad, which is your version of sed?
The compilation failure of pthread should be fixed for now (wrong dependency).
When using multithreading, though, we would need pthread.c to be compiled,
so I will add a corresponding option to the config for gcc.
Best,
Matthias
Mac users might have to add an include path such as
/opt/homebrew/Cellar/hwloc/2.11.1/share/hwloc/tests/hwloc/ports/include/netbsd
to their gcc compiler options to be able to compile pthread.c
Best,
Matthias
The sed error is because of a missing GNU extension in Mac's sed.
Let me see whether I can find a workaround.
Matthias
Hi Wlad,
the sed issue is now sorted. Can you compile on Mac?
Best,
Matthias
To view this discussion visit https://groups.google.com/d/msgid/pencil-code-discuss/3df6cfac71c345268bb653847412a47c%40su.se.
Hi,
Trying to compile on Mac I get the following error (it worked a week or so ago):
mpif90 cparam.o cdata.o mpicomm.o noborder_profiles.o boundcond.o nodebug.o debug_io_dist.o deriv.o diagnostics.o nofarray_alloc.o farray.o filter.o nofixed_point.o nofourier.o general.o geometrical_types.o ghost_check.o ghostfold_mpicomm.o grid.o nogsl.o noimplicit_diffusion.o initcond.o noinitial_condition.o nohdf5_io.o io_dist.o file_io_f95.o nolsode_for_chemistry.o messages.o noNSCBC.o param_io.o persist.o nopower_spectrum.o nopython.o register.o shared_variables.o nosignal_handling.o slices.o slices_methods.o snapshot.o nosolid_cells_mpicomm.o nosolid_cells.o nostreamlines.o nostruct_func.o sub.o syscalls.o syscalls_ansi.o notestperturb.o notimeavg.o noweno_transport.o noyinyang.o noyinyang_mpi.o magnetic.a particles_main.a morton_helper.o chemistry.o nochiral.o nocosmicray.o nocosmicrayflux.o density.o density_methods.o nodetonate.o nodustdensity.o nodustvelocity.o temperature_ionization.o eos_chemistry.o noforcing.o nogravity.o noheatflux.o hydro.o nohyperresi_strict.o nohypervisc_strict.o noimplicit_physics.o nointerstellar.o nolorenz_gauge.o noneutraldensity.o noneutralvelocity.o noopacity.o nopointmasses.o nopoisson.o nopolymer.o pscalar_nolog.o noradiation.o noselfgravity.o noSGS_hydro.o noshear.o noshock.o nospecial.o noascalar.o notestfield.o notestflow.o notestscalar.o viscosity.o nogpu.o dummy_astaroth_ansi.o notraining.o start.o -ldl -o start.x
mpif90 cparam.o cdata.o mpicomm.o noborder_profiles.o boundcond.o nodebug.o debug_io_dist.o deriv.o diagnostics.o nofarray_alloc.o farray.o filter.o nofixed_point.o nofourier.o general.o geometrical_types.o ghost_check.o ghostfold_mpicomm.o grid.o nogsl.o noimplicit_diffusion.o initcond.o noinitial_condition.o nohdf5_io.o io_dist.o file_io_f95.o nolsode_for_chemistry.o messages.o noNSCBC.o param_io.o persist.o nopower_spectrum.o nopython.o register.o shared_variables.o nosignal_handling.o slices.o slices_methods.o snapshot.o nosolid_cells_mpicomm.o nosolid_cells.o nostreamlines.o nostruct_func.o sub.o syscalls.o syscalls_ansi.o notestperturb.o notimeavg.o noweno_transport.o noyinyang.o noyinyang_mpi.o magnetic.a particles_main.a morton_helper.o chemistry.o nochiral.o nocosmicray.o nocosmicrayflux.o density.o density_methods.o nodetonate.o nodustdensity.o nodustvelocity.o temperature_ionization.o eos_chemistry.o noforcing.o nogravity.o noheatflux.o hydro.o nohyperresi_strict.o nohypervisc_strict.o noimplicit_physics.o nointerstellar.o nolorenz_gauge.o noneutraldensity.o noneutralvelocity.o noopacity.o nopointmasses.o nopoisson.o nopolymer.o pscalar_nolog.o noradiation.o noselfgravity.o noSGS_hydro.o noshear.o noshock.o nospecial.o noascalar.o notestfield.o notestflow.o notestscalar.o viscosity.o nogpu.o timestep.o notraining.o equ.o pencil_check.o run.o -ldl -o run.x
Undefined symbols for architecture arm64:
Undefined symbols for architecture arm64:
"_copy_addr_c_", referenced from:
___syscalls_MOD_copy_addr_real in syscalls.o
___syscalls_MOD_copy_addr_dble_1d in syscalls.o
___syscalls_MOD_copy_addr_dble in syscalls.o
___syscalls_MOD_copy_addr_real_4d in syscalls.o
___syscalls_MOD_copy_addr_real_3d in syscalls.o
___syscalls_MOD_copy_addr_real_2d in syscalls.o
___syscalls_MOD_copy_addr_int_2d in syscalls.o
...
"_copy_addr_c_", referenced from:
___syscalls_MOD_copy_addr_real in syscalls.o
___syscalls_MOD_copy_addr_dble_1d in syscalls.o
___syscalls_MOD_copy_addr_dble in syscalls.o
___syscalls_MOD_copy_addr_real_4d in syscalls.o
___syscalls_MOD_copy_addr_real_3d in syscalls.o
___syscalls_MOD_copy_addr_real_2d in syscalls.o
___syscalls_MOD_copy_addr_int_2d in syscalls.o
...
"_copy_addr_c_bool_", referenced from:
___syscalls_MOD_copy_addr_log_1d in syscalls.o
"_copy_addr_c_bool_", referenced from:
___syscalls_MOD_copy_addr_log_1d in syscalls.o
"_directory_exists_c_", referenced from:
___syscalls_MOD_readlink in syscalls.o
___syscalls_MOD_directory_exists in syscalls.o
"_directory_exists_c_", referenced from:
___syscalls_MOD_readlink in syscalls.o
___syscalls_MOD_directory_exists in syscalls.o
"_extract_string_c_", referenced from:
___syscalls_MOD_extract_str in syscalls.o
"_extract_string_c_", referenced from:
___syscalls_MOD_extract_str in syscalls.o
"_file_size_c_", referenced from:
___file_io_MOD_file_size in file_io_f95.o
"_file_size_c_", referenced from:
___file_io_MOD_file_size in file_io_f95.o
"_get_env_var_c_", referenced from:
___syscalls_MOD_get_env_var in syscalls.o
"_get_env_var_c_", referenced from:
___syscalls_MOD_get_env_var in syscalls.o
"_get_pid_c_", referenced from:
___syscalls_MOD_get_pid in syscalls.o
"_get_pid_c_", referenced from:
___syscalls_MOD_get_pid in syscalls.o
"_getmortonrank3d_", referenced from:
___general_MOD_find_proc_coords in general.o
___general_MOD_find_proc_coords_general in general.o
"_getmortonrank3d_", referenced from:
___general_MOD_find_proc_coords in general.o
___general_MOD_find_proc_coords_general in general.o
"_getmortonrank_", referenced from:
___general_MOD_find_proc_general in general.o
___general_MOD_find_proc in general.o
"_getmortonrank_", referenced from:
___general_MOD_find_proc_general in general.o
___general_MOD_find_proc in general.o
"_is_nan_c_", referenced from:
___syscalls_MOD_is_nan_4d in syscalls.o
___syscalls_MOD_is_nan_3d in syscalls.o
___syscalls_MOD_is_nan_2d in syscalls.o
___syscalls_MOD_is_nan_1d in syscalls.o
___syscalls_MOD_is_nan_0d in syscalls.o
"_is_nan_c_", referenced from:
___syscalls_MOD_is_nan_4d in syscalls.o
___syscalls_MOD_is_nan_3d in syscalls.o
___syscalls_MOD_is_nan_2d in syscalls.o
___syscalls_MOD_is_nan_1d in syscalls.o
___syscalls_MOD_is_nan_0d in syscalls.o
"_islink_c_", referenced from:
___syscalls_MOD_islink in syscalls.o
"_islink_c_", referenced from:
___syscalls_MOD_islink in syscalls.o
"_mem_usage_c_", referenced from:
___syscalls_MOD_memusage in syscalls.o
"_mem_usage_c_", referenced from:
___syscalls_MOD_memusage in syscalls.o
"_readlink_c_", referenced from:
___syscalls_MOD_readlink in syscalls.o
"_readlink_c_", referenced from:
___syscalls_MOD_readlink in syscalls.o
"_sizeof_real_c_", referenced from:
___syscalls_MOD_sizeof_real in syscalls.o
"_sizeof_real_c_", referenced from:
___syscalls_MOD_sizeof_real in syscalls.o
"_system_c_", referenced from:
___syscalls_MOD_system_cmd in syscalls.o
"_system_c_", referenced from:
___syscalls_MOD_system_cmd in syscalls.o
"_write_binary_file_c_", referenced from:
___file_io_MOD_write_binary_file_str in file_io_f95.o
___file_io_MOD_write_binary_file_char in file_io_f95.o
ld: symbol(s) not found for architecture arm64
"_write_binary_file_c_", referenced from:
___file_io_MOD_write_binary_file_str in file_io_f95.o
___file_io_MOD_write_binary_file_char in file_io_f95.o
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
make[2]: *** [run.x] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [start.x] Error 1
make[1]: *** [code] Error 2
make: *** [default_to_be] Error 2
'make -j FFLAGS_DOUBLE=-fdefault-real-8 -fdefault-double-8 CFLAGS_DOUBLE=-DDOUBLE_PRECISION LD_MPI= CFLAGS_FFTW3= FFLAGS_FFTW3= LD_FFTW3= CFLAGS_FFTW2= FFLAGS_FFTW2= LD_FFTW2= FC=mpif90 F77=mpif77 CFLAGS=-DFUNDERSC=0 FFLAGS=-O -O0 -Wall -finit-real=sNaN -finit-integer=-2147483648 -g -fbacktrace -fimplicit-none -fcheck=all -ffpe-trap=invalid,zero,overflow -I/opt/homebrew/Cellar/hwloc/2.11.2/share/hwloc/tests/hwloc/ports/include/netbsd/ LDFLAGS_HELPER=-dynamic OMPFFLAGS=-fopenmp OMPLFLAGS=-lgomp PPFLAGS=-cpp FSTD_95=-std=f95 FSTD_2003=-std=f2003 LDMPI=-I/usr/lib/openmpi/include -pthread -I/usr/lib/openmpi/lib -L/usr/lib/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl -Wl,--export-dynamic -lnsl -lutil -lm -ldl -I/opt/homebrew/Cellar/hwloc/2.11.2/share/hwloc/tests/hwloc/ports/include/netbsd/ CC=mpicc default_to_be' failed: <Inappropriate ioctl for device>
Any ideas what is wrong?
Nils
To view this discussion visit
https://groups.google.com/d/msgid/pencil-code-discuss/47a5f415b6c04c919a3a672fbcdba174%40su.se.
Hi Nils,
could you do
nm src/syscalls_ansi.o | grep copy_addr
?
I suspect that the output will not be
_copy_addr_c_
but
copy_addr_c_
or copy_addr_c
which wold explain the error. We have then to examine the compilation options.
Best,
Matthias
Hi Matthias
Thanks for your suggestion.
The output is:
% nm src/syscalls_ansi.o | grep copy_addr
0000000000000c8c T _copy_addr_c
0000000000000cac T _copy_addr_c_bool
Does this make any sense?
To view this discussion visit
https://groups.google.com/d/msgid/pencil-code-discuss/a218785fb0c14d929b32b9a10ae33ba5%40su.se.
Hi Nils,
given that _copy_addr_c_ is undefined and in src/syscalls_ansi.o you do find _copy_addr_c,
it means that a pending underscore is missing in the symbols created by the C compiler.
So, you would have to add
-DFUNDERSC=1
to the CFLAGS.
Best,
Matthias
Hi Matthias
Yes, now it works – thanks!
Best,
To view this discussion visit
https://groups.google.com/d/msgid/pencil-code-discuss/b767d3e9ebd346cfbc3215ff3c1ad008%40su.se.