[Python] multi-processing(parallel process) 병렬처리하기

두꺼비·2024년 9월 13일
0
from joblib import Parallel, delayed
from tqdm import tqdm

## 처리할 함수 정의
def augmentation(i):
	restul = i + i
	return result 
    
## 병렬처리
text = Parallel(n_jobs=3)(delayed(augmentation)(i) for i in tqdm(range(10)))

다음과 같이 처리할 함수를 정의하고, 함수를 실행하면 된다.
n_jobs는 병렬처리할 job의 개수이다.

profile
두꺼비는 두껍다

0개의 댓글