Sharing numpy arrays in python multiprocessing pool

后端 未结 2 1553
礼貌的吻别
礼貌的吻别 2021-01-12 13:25

I\'m working on some code that does some fairly heavy numerical work on a large (tens to hundreds of thousands of numerical integrations) set of problems. Fortunately, thes

2条回答
  •  耶瑟儿~
    2021-01-12 13:49

    To make your last idea work, I think you can simply make X, param_1, and param_2 global variables by using the global keyword before modifying them inside the if statement. So add the following:

    global X
    global param_1
    global param_2
    

    directly after the if __name__ == '__main__'.

提交回复
热议问题