Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A segmentation fault occurs when my array is large. #870

Closed
crazyfireji opened this issue Aug 22, 2024 · 3 comments
Closed

A segmentation fault occurs when my array is large. #870

crazyfireji opened this issue Aug 22, 2024 · 3 comments

Comments

@crazyfireji
Copy link

crazyfireji commented Aug 22, 2024

As I mensioned in title, here is my code, it works when nx_g<=10000, but can't works over it. Error info: [42194] signal (11.1): Segmentation fault. My compute mem morethan 700G

function get_Axy_MPI(nx_g, nx0, rank, nprocs, k)
	u_local = zeros(nx0, nx_g)

	if rank == 0
	
		A = zeros(nx_g, nx_g)#calculate_Axy(k) #get_A()#zeros(nx_g, nx_g)

		for sendrank in 0:nprocs-1
		# 计算每个进程的起始行和结束行
			if sendrank == 0
				ilo = 1
				ihi = rows_per_process[1]
				# @show sendrank, ilo,ihi
			else
				ilo = sum(rows_per_process[1:sendrank]) + 1
				ihi = ilo + rows_per_process[sendrank+1] - 1
				@show sendrank, ilo,ihi
			end
			
			#data_on_root = A[ilo:ihi, :]
			sendtag = sendrank + 1000
			MPI.Isend(A[ilo:ihi, :], sendrank, sendtag, comm)
			
			@show ilo, ihi
			
		end

	end

	recievetag = rank + 1000

	MPI.Irecv!(u_local, root, recievetag, comm)
	
	if rank ==0 println("Done!!!")end
	
	MPI.Barrier(comm)
	
	return u_local
	
end

image
image

@giordano
Copy link
Member

Can you please show the output of

using MPI
MPI.versioninfo()

What's the mpiexec command you're running? Is it the launcher of the MPI library used by MPI.jl?

@crazyfireji
Copy link
Author

crazyfireji commented Aug 22, 2024

Can you please show the output of

using MPI
MPI.versioninfo()

What's the mpiexec command you're running? Is it the launcher of the MPI library used by MPI.jl?
It's MPI info

julia> MPI.versioninfo()
MPIPreferences:
  binary:  MPICH_jll
  abi:     MPICH

Package versions
  MPI.jl:             0.20.16
  MPIPreferences.jl:  0.1.11
  MPICH_jll:          4.2.1+1

Library information:
  libmpi:  /home/zju_jyc/.julia/artifacts/b7a943fb6a811908b073b8af69d955f16703ca2b/lib/libmpi.so
  libmpi dlpath:  /home/zju_jyc/.julia/artifacts/b7a943fb6a811908b073b8af69d955f16703ca2b/lib/libmpi.so
  MPI version:  4.1.0
  Library version:  
    MPICH Version:      4.2.1
    MPICH Release date: Wed Apr 17 15:30:02 CDT 2024
    MPICH ABI:          16:1:4
    MPICH Device:       ch3:nemesis
    MPICH configure:    --prefix=/workspace/destdir --build=x86_64-linux-musl --host=x86_64-linux-gnu --disable-dependency-tracking --disable-doc --enable-fast=all,O3 --enable-static=no --with-device=ch3 --with-hwloc=/workspace/destdir
    MPICH CC:           cc    -DNDEBUG -DNVALGRIND -O3
    MPICH CXX:          c++   -DNDEBUG -DNVALGRIND -O3
    MPICH F77:          gfortran   -O3
    MPICH FC:           gfortran   -O3
    MPICH features:    

run command is : mpirun -n 10 julia PrL_MPI.jl

using MPI
using JLD2
using FFTW

MPI.Init()
comm = MPI.COMM_WORLD
rank = MPI.Comm_rank(comm)
nprocs = MPI.Comm_size(comm)

include("fun_mpi.jl")

const root = 0
nx_g = 90000#size(xx,1)*j2
Ndims = n

nx0 = rows_per_process[rank+1]
# @show rank, nx0

Axy = get_Axy_MPI(nx_g, nx0, rank, nprocs, k)

MPI.Finalize()

@giordano
Copy link
Member

run command is : mpirun -n 10 julia PrL_MPI.jl

That doesn't really answer my question. What's mpirun? Can you please show the output of the command

mpirun --version

in the terminal?

Also

  • don't share screenshots, they're hard to read and are not searchable, they don't help who wants to help you. Instead, post output of commands as plain text, quoted as code blocks
  • speaking of code blocks, please quote them with triple backticks
    ```
    like this
    ```
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants