numpartitions
데이터저장소 파티션 개수
설명
예제
파티션 개수
샘플 파일 mapredout.mat
에서 데이터저장소를 만듭니다. 이 파일은 mapreduce
함수의 출력 파일입니다.
ds = datastore('mapredout.mat');
디폴트 파티션 개수를 가져옵니다.
n = numpartitions(ds)
n = 1
기본적으로 ds
에는 하나의 작은 파일만 포함되므로 하나의 파티션만 있습니다.
데이터저장소를 파티셔닝하고 첫 번째 파트에 대응하는 데이터저장소를 반환합니다.
subds = partition(ds,n,1);
subds
에서 데이터를 읽습니다.
while hasdata(subds) data = read(subds); end
병렬 데이터저장소 액세스를 위한 파티션 개수
현재 병렬 풀에서 데이터저장소 액세스를 병렬화할 파티션 개수를 가져옵니다. Parallel Computing Toolbox가 설치되어 있어야 합니다.
샘플 파일 mapredout.mat
에서 데이터저장소를 만듭니다. 이 파일은 mapreduce
함수의 출력 파일입니다.
ds = datastore('mapredout.mat');
현재 병렬 풀에서 데이터저장소 액세스를 병렬화할 파티션 개수를 가져옵니다.
n = numpartitions(ds, gcp);
데이터저장소를 파티셔닝하고 각 파트에서 데이터를 읽습니다.
parfor ii=1:n subds = partition(ds,n,ii); while hasdata(subds) data = read(subds); end end
입력 인수
확장 기능
스레드 기반 환경
MATLAB®의 backgroundPool
을 사용해 백그라운드에서 코드를 실행하거나 Parallel Computing Toolbox™의 ThreadPool
을 사용해 코드 실행 속도를 높일 수 있습니다.
사용법 관련 참고 및 제한 사항:
스레드 기반 환경에서는 다음과 같은 데이터저장소에만
numpartitions
함수를 사용할 수 있습니다.ImageDatastore
객체ImageDatastore
객체로부터combine
또는transform
을 사용하여 생성한CombinedDatastore
,SequentialDatastore
또는TransformedDatastore
객체
Parallel Computing Toolbox가 있는 경우
numpartitions
함수를 다른 데이터저장소에도 사용할 수 있습니다. 이렇게 하려면backgroundPool
또는ThreadPool
을 사용하는 대신 프로세스를 지원하는 병렬 풀을 사용하는 함수를 실행하십시오(ProcessPool
또는ClusterPool
사용).
자세한 내용은 스레드 기반 환경에서 MATLAB 함수 실행하기 항목을 참조하십시오.
버전 내역
R2015a에 개발됨
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)