Closed wuseyu closed 1 year ago
Hi,
the -fpp flag stands for "fortran pre-processor flag", which allows us to use the #ifdef statements in the code. gfortran use -cpp to achieve this. You should probably also include "-ffree-line-length-none", depending on your compiler.
The file that seems to crash is part of the MHD module, which is not well tested. Were you hoping to include baryons, or just dark matter?
Sincerely, Joachim
From: wuseyu @.> Sent: 17 October 2022 02:53 To: jharno/cubep3m @.> Cc: Subscribed @.***> Subject: [jharno/cubep3m] [Question] Makefile not working (Issue #12)
⚠ External sender. Take care when opening links or attachments. Do not provide your login details.
Hello, I have some question when I tried to transplant it for linux.
The gcc version I am using is 9.3.0,
hmpi version is 1.1.1 ,
openblas version is 0.3.18,
fftw version is 3.3.8,
hdf5 version is 1.10.1
At the beginning I met FFLAGS question :
fpp: The platform is recommended to be modified to “-cpp”
axN:I found it only work in ifort,so I delete it.
Then I met my current problem.
What can I do for deal with them?
— Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjharno%2Fcubep3m%2Fissues%2F12&data=05%7C01%7CJoachim.Harnois-Deraps%40newcastle.ac.uk%7C64819d02787649a9caa608daafe258ce%7C9c5012c9b61644c2a91766814fbe3e87%7C1%7C0%7C638015683928813588%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=wcWBgL3eIPMb3hBHXFojdzyzN61ECN5I0xgbRwcBlGw%3D&reserved=0, or unsubscribehttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAISJHK4K5OGWZ27EPDEJX3WDSWQNANCNFSM6AAAAAARGTQWUA&data=05%7C01%7CJoachim.Harnois-Deraps%40newcastle.ac.uk%7C64819d02787649a9caa608daafe258ce%7C9c5012c9b61644c2a91766814fbe3e87%7C1%7C0%7C638015683928813588%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=XE9OGkUY%2BeUU63iWrilBoR97O5eAWKYInWW9mWQWUKI%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.***>
I am also trying to build cubep3m.
Error:
mpif90 -cpp -g -w -O3 -DDIAG -ffree-line-length-none -c mpi_tvd_mhd.f90
mpi_tvd_mhd.f90:576:33:
576 | comm_cart, ierr)
| 1
......
639 | call mpi_reduce(amaxl,amax,1,MPI_REAL,MPI_MAX,0,comm_cart, ierr)
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
mpi_tvd_mhd.f90:577:50:
577 | call mpi_bcast(cmax,1,MPI_REAL,0,comm_cart, ierr)
| 1
......
643 | call mpi_bcast(amax,1,MPI_REAL,0,comm_cart, ierr)
| 2
Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/INTEGER(4)).
make: *** [Makefile_linux_arm64:25: mpi_tvd_mhd.o] Error 1
Here is the relevant part of the Makefile:
SHELL = /bin/sh
FC=mpif90
#TACC Lonestar
FFTWLIB=/usr/lib/x86_64-linux-gnu/
FFTWINC=/usr/include/
#Mckenzie
LDLIBS= -lfftw3_mpi -lfftw3 -lsfftw_mpi -lsfftw -lm -ldl
#Mckenzie
FFLAGS=-cpp -g -w -O3 -DDIAG -ffree-line-length-none # -axN -DNGP -DMHD #-check bounds -DDEBUG #-DDEBUG_LOW #-DDEBUG_VEL -DDEBUG_CCIC -DDEBUG_RHOC -openmp -DDEBUG_LOW
#OPTIONAL FLAGS :: -DMHD -DDEBUG_CCIC -DDEBUG_CRHO -DDEBUG_RHOC -DPOINTSRC ##-DBFTEST
OBJS= mpi_tvd_mhd.o gas_density_buffer.o fine_gas_mass.o checkpoint.o coarse_cic_mass.o coarse_cic_mass_buffer.o coarse_force.o coarse_force_buffer.o coarse_mass.o coarse_max_dt.o coarse_mesh.o coarse_power.o coarse_velocity.o cubepm.o delete_particles.o fftw3ds.o fine_cic_mass.o fine_cic_mass_buffer.o fine_mesh.o fine_ngp_mass.o fine_ngp_mass_halos.o fine_velocity.o halofind.o fftw2.o kernel_initialization.o link_list.o mpi_initialization.o particle_initialization.o particle_mesh.o particle_pass.o projection.o report_pair.o set_pair.o indexedsort.o timers.o timestep.o update_position.o variable_initialization.o
run: cubep3m
cubep3m: $(OBJS)
$(FC) $(FFLAGS) $^ -o $@ -L$(FFTWLIB) $(LDLIBS)
mpi_tvd_mhd.o: mpi_tvd_mhd.f90
$(FC) $(FFLAGS) -c $<
...
Ubuntu 22.04.1, x86_64
gcc version is 11.3.0,
openblas version is 0.3.20,
fftw version is 3.3.8,
hdf5 version is 1.10.7
Any help is very welcome!
Dear Martin,
The module that causes this problem seems to be the mpi_tvd_mhd, which is part of the MHD code that is not supported. Are you trying to compile for dark matter only or baryons?
Thanks for the quick answer, Joachim! Dark matter only for now.
Hi, I'm also interested in build it, but the makefile seems not work for my computer. Are there any documents or instructions? I'm compile for baryons. Thanks.
@jharno Now I am trying to migrate this software to a new operating system,which using gcc and openmpi in x86,also clang and openmpi in arm. Can you give some general solutions? Thanks for your reply.
Unfortunately Cubep3m is not well tested for baryons. The baryons modules exist as magneto-hydrodynamics were included in a previous version of the code (adiabatic only, no sub-gris physics), but support for this has been discontinued. I would recommend trying another hydro-code. Sorry.
The makefile for dm-only are Make_PP_THREADS and Makefile_p3dfft_nested
I'll try it, thanks.
Can you try with: Makefile_fftw3?
@jharno
Hello, I used "Make_PP_THREADS" according to your suggestion under the x86, in this file, flag "-shared-intel", "-fpp", and "-xhost" can't work ,so I deleted "-shared-intel" and "-xhost",and replaced "-fpp" to "-cpp".(I don't know what the consequences of deleting them will be, but their existence hinders the operation of the program)
But after that I ran into some problems, luckily I solved them by adding some flags,which includes " -fallow-argument-mismatch -Wno-error -ffree-form -ffixed-line-length-none -ffree-form".
And now I met the last error message.
It seems like some Grammatical errors, but I have no experience to solve the gfortran problem.So can you give me some suggestions?
Thanks again for your reply,hope it doesn't bother you.
Can you try with: Makefile_fftw3?
I used to use this file too, but the results were not ideal. It doesn't work for me.
@wuseyu You may want to check https://github.com/jharno/cubep3m/pull/13. It is a draft PR that adds Makefile based on gfortran and fftw3
@martin-g OK, I will check it.
I am also worried about the message that says "-Wline-truncation". That should not happen with the -ffixed-line-lenght-none flag.
This is my current configuration about Make_PP_THREADS. Now when it compiles it will focus on three problems. They should be solved by " -ffixed-line-lenght-none" but not. ps: Maybe my gcc version is too old? It's 10.3.0.
Note that you have twice the -ffree-form flag
Could you try -ffree-line-length-none?
Thanks for your suggestion! This fflag seems to be working fine, but some files cannot be generated properly.
You have to remove the -openmp
flag for those files.
OK, I will try it.
Thanks for your help, Martin, your response time is faster than mine! Out of curiosity, I'd be interested to know what science you are trying to achieve with your runs. Feel free to contact me privately if interested in chatting.
@jharno I'm afraid I still need your help. Thanks for your previous guidance, I had quite a few problems linking the library after that, but I solved it all using fftw2's library and generated the executable, but now the service seems to be starting It crashed before, what is the reason for the problem,I found some similar error questions, but none of them gave an exact solution (maybe I'm looking in the wrong direction). looking forward to your reply.
OK, That's good progress, we're nearly there.
The code now compiled, and is looking for a file named checkpoints_high, which specifies at which redshifts you want the particle dumped.
If, instead, you bash source the README file (and read it as well, it is very short, but contains a few key info), it should now work.
Thanks for your reply, it really helped me a lot. I will try it after my class, hope everything is fine.
@wuseyu Could you please attach your Makefile here ? Thanks!
All my makefiles are included in the source_threads/ directory.
I recently used Makefile_fftw3.
@jharno I guess you used it with Intel compiler ? As I shared at https://github.com/jharno/cubep3m/pull/13 I cannot make it work with GNU Fortran and FFTW3. I will add Github Actions workflow to my draft PR that will show the compilation errors!
OK
@martin-g There are modifications I made,hope it can help you.
I've merged the work to the main branch, thanks for your help in compiling cubep3m with gfort!
Closing this issue now
Hello, I have some question when I tried to transplant it for linux.
At the beginning I met FFLAGS question :
fpp: The platform is recommended to be modified to “-cpp”
axN:I found it only work in ifort,so I delete it.
Then I met my current problem.
They seem to be the same kind of problem.
What can I do for deal with them?