pyhawkes
pyhawkes copied to clipboard
Multi-Threading resample seems not working for continuous process.
I have installed both gslrandom and enabled OpenPM support on my ubuntu 18.04 machine . But when I run resample using these code:
def genHawkesModel(dates,ids):
K = len(np.unique(ids))
network_hypers = {"p":0.25,"allow_self_connections":False}
model = ContinuousTimeNetworkHawkesModel(
K,
dt_max = 1,
network_hypers=network_hypers,
)
model.add_data(dates,ids,T=dates.max() + 1)
return model
hawkes_model = genHawkesModel(dates,ids)
N_samples = len(np.unique(ids))
hawkes_lls = [hawkes_model.log_likelihood()]
logging.info("Start iterating")
for itr in progprint_xrange(N_samples, perline=25):
hawkes_model.resample_model()
hawkes_lls.append(hawkes_model.log_likelihood())
I found this code is running too slow :
I check the cpu usage using top
command, finding that the program only using one cpu when resampling:
I'm sure I have install gslrandom on my machine (both pip and apt):
I want to know how to make sure the resample process is running in the multi-threading mode so that I can do the resample as fast as possible. Thank you and looking forward for your reply.