pyhawkes icon indicating copy to clipboard operation
pyhawkes copied to clipboard

Multi-Threading resample seems not working for continuous process.

Open Vccxx opened this issue 4 years ago • 0 comments

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 :

3c86d9744c4f3aa8b3ab644174878f2

I check the cpu usage using top command, finding that the program only using one cpu when resampling:

d3daecdcb35b85749675e88abf698a5

I'm sure I have install gslrandom on my machine (both pip and apt): 68e47ba8cc80348754d963f05d7079f

b77fdd67163229d441a1ba070a0d96c

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.

Vccxx avatar Nov 09 '20 07:11 Vccxx