Pointer error

it’s my first time using Threads for parallel computing as i’m new to it, and i wanted to work with the parallel for loop using @threads, there are 4 threads and i put the macro before the for loop then i called the code using `@everywhere include(“parallel_mcmc.jl”) and i call the function after that i got something as you see below that i don’t know what does it mean and i don’t know how to solve the problem.

julia> @everywhere include("parallel_mcmc.jl")

julia> relay_basis(pi/4,pi/2,"name",6)
julia(25402,0x7000059a1000) malloc: *** error for object 0x7fa9ecde2970: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

signal (6): Abort trap: 6
in expression starting at REPL[7]:1
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 151494634 (Pool: 151476520; Big: 18114); GC: 368
julia(25402,0x7000069a7000) malloc: *** error for object 0x7fa9ecde2970: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

Hi @marouane1994. You haven’t included enough information to be able to tell why you’re getting that particular error. You might want to have a look at the following post for some tips that will help you update your post in a way that will help us narrow down the source of your problem:

Having said that, here are a few thoughts that might be helpful. First, I could be wrong but it seems like you’re trying your first experiments with threading in julia on a complex example. It would be a good idea to try out threading on some self-contained very simple toy examples so you understand the basics of how threading works before trying to apply it to your existing mcmc code. The examples in the following blog post on threading in julia are a good place to start:

Along with the parallel computing section of the julia manual. Reading through the whole parallel computing manual section is probably a good idea.

Secondly, are you trying to combine distributed memory parallelism and threading? The @everywhere call is used for distributed memory computing. The call

julia> @everywhere include("parallel_mcmc.jl")

will run julia> include("parallel_mcmc.jl") on all of the julia worker processes attached to your current julia instance. Worker processes are separate julia processes with their own memory address spaces that communicate with the master julia process by passing messages. They are completely separate from threading. So unless you’re mixing distributed memory parallel computing and threading, you’ll want to get rid of the @everywhere statement

1 Like