Hello Matt
I changed my original code to simple code for you as below.
I found the problem of larch 0.9.74 in multi-processing.
You can check it with the below code. How can I fix this problem?
------------------------------------------------------------------------------------------------------------
############# Multi-processing test ########################
import larch
from larch import Group
from larch.utils import *
from larch.xafs import *
from
larch.io import *
import numpy as np
import os
import torch.multiprocessing as mp
dPath = r'C:\Users\Administrator\Desktop\RL\feffit_error_test'
os.chdir(dPath)
fname1 = 'feff0001.dat' # N=1, Reff=1.9 N
path1 = feffpath(os.path.join(dPath,'FEFF1', fname1))
#################################
path_lists=[path1]
path_lists[0].s02=0.86
################################################
class Func():
def __init__(self, path_lists):
self.path_lists=path_lists
def step(self):
self.path_lists[0].e0, self.path_lists[0].degen, self.path_lists[0].deltar, self.path_lists[0].sigma2 = [2, 5, 0.001, 0.004]
## Theory path들의 합과 theory FFT
theory_sum=Group(label='theory_group_sum')
ff2chi(self.path_lists, group=theory_sum)
new_state=theory_sum.chi
return new_state
class TestClass():
def __init__(self, path_lists):
self.path_lists=path_lists
def test(self):
func1 = Func(self.path_lists)
s=func1.step()
############################################
T_func=TestClass(path_lists)
F_func=Func(path_lists)
if __name__ == '__main__':
process_list=[]
p_N =mp.Process(target=T_func.test,)
p_N.start()
process_list.append(p_N)
for process in process_list:
process.join()
##################################################################
#####Problem##########
File "C:\ProgramData\anaconda3\envs\xraylarch\Lib\multiprocessing\process.py", line 314, in _bootstrap
self.run()
File "C:\ProgramData\anaconda3\envs\xraylarch\Lib\multiprocessing\process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "c:\Users\Administrator\Desktop\RL\feffit_error_test\test-ff2chi-problem.py", line 40, in test
s=func1.step()
^^^^^^^^^^^^
File "c:\Users\Administrator\Desktop\RL\feffit_error_test\test-ff2chi-problem.py", line 30, in step
ff2chi(self.path_lists, group=theory_sum)
File "C:\ProgramData\anaconda3\envs\xraylarch\Lib\site-packages\larch\xafs\feffdat.py", line 658, in ff2chi
path.create_path_params(params=params)
File "C:\ProgramData\anaconda3\envs\xraylarch\Lib\site-packages\larch\xafs\feffdat.py", line 392, in create_path_params
parname = self.pathpar_name(pname)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\envs\xraylarch\Lib\site-packages\larch\xafs\feffdat.py", line 331, in pathpar_name
return f'{parname}_{self.dataset}_{self.hashkey}'
^^^^^^^^^^^^
AttributeError: 'FeffPathGroup' object has no attribute 'dataset'