Hi all,
I am new to Julia but I am used to debug with C++ and Python both in gdb and Jetbrains, so I know a bit the idea!
I am running a code of someone else, it is fairly complex and several functions are defined within other files.
I have the following questions and problems that I could not solve on the Juno Debugger documentation.
-
I can only debug functions, not files. Let’s say I have not a main function but a whole file with imperative coding, can’t I debug on that?
-
I tested both Juno.@enter while Juno.@run with a simple script, like this
function test_fun()
a = rand(1:5,10)
sum(a)
x = collect(1:2:4)
end
function test_b()
a = rand(1:5,10)
sum(a)
x = collect(1:2:4)
end
function main()
test_b()
test_fun()
return 1
end
and it works very nice, I like it
- I now tried the debugger on my complex file, “with a lot of input and a lot of output”, it is a simulator of spiking neural network. This is the “main” file and the function I am trying to debug with Juno.@enter runsim().
using Printf
using PyPlot #set doplot=true to plot a raster. #doplot=false needed on cluster!!
g_axon_delay = false #load sim.jl or sim_delay.jl
include("../lib/structDefinitions.jl") # Defines value types.
include("../lib/filesystemstuff.jl") # Functions to save and load hdf5 files.
include("lib/stimCreators.jl") # Functions to define stimuli (including from language file)
if g_axon_delay
include("lib/sim_delay.jl") # The network simulation function with axonal delay.
else
include("lib/sim.jl") # The network simulation function.
end
include("lib/simplots.jl") # Functions for rasterplot and weight histogram
function runsim()
##############################################################3
# Simulation Parameters
###############################################################
doplot = true # Plot a raster and weight histogram
save_plot = true
loadtrained = false # If true, loads trained network. if false, generates a new network.
saveweights = true # Save weights to hdf5 format in Results folder. Search Nskip in sim.jl for further parameters.
saveparams = true # Save network parameters, popmembers and weights to hdf5 after simulation is done.
languageinput = true
lang_order_seed = 5432#6789 #seed that determines the permutation of input sentences
do_readout = true #collect membrane potentials
do_recording = true #collect spikerate and input currents of one neuron
do_poprec = true #collect spikerates per word of each population
langfile = "LanguageInput/Input_Sentences_allWords.txt"
partial_input = false # If true only a part of each populations neurons get stimulated. see p_input parameter in sim.jl
input_mode = "phonemes_only" # "lexeme_only" or "phonemes_only" or "" (empty is normal mode)
Results = "../Results/"
#DEBUGGERLOVES
rdl = Results*"test_idle" #directory to load weights from if loadtrained==true (and sometimes language)
#DEBUGGERLOVES
rdw = Results*"test_readout" #directory to write weights and results to
phonms = 10 #phonemetime in milliseconds
nwords = 200 #number of words to present
### and more and more
I have this issues:
a. the debugger ignores my breakpoints, it moves to the line with the #DEBUGGERLOVES, both if I click on “continue” or I click “next” in the debugger interface.
b. the debugger sticks in some external called function (not in the pasted script) and takes a life-time to come out, while in vanilla runs it takes less than 10 seconds.
Can you help me with this?
I wonder if the debug option enables some controls which slow the code, also I wonder if it is possible that the file is marked with debug symbols I cannot visualize from the Juno interface.
For completeness I run the same stuff from the REPL with Debugger, in that case I can set the breakpoints, but the life-lasting function is still there, and btw I prefer the fancy Juno interface that have to set those manually
Thanks a lot,
Alessio