|
4 | 4 | %% Configure parameters |
5 | 5 | %Polar-Code values |
6 | 6 | capacity = 0.5; %I(W), Channel's W Capacity |
7 | | -n_values = [4,5,6,7,8,9,10]; %value of N |
| 7 | +n_values = [4,5,6,7,8]; %value of N |
8 | 8 | code_rate = 1/4; |
9 | 9 | %EbNo |
10 | 10 | EbNo_dB = 0:5; %AWGN -4:2 %Fading 0:2:10 |
|
28 | 28 | NbitsPerSymbol = 1; %modulation parameter |
29 | 29 | constDims = 1; %modulation parameter |
30 | 30 | snrdb_values =EbNo_dB+10*log10(double(code_rate*NbitsPerSymbol*2/constDims)); |
| 31 | +%% Parfor configuration |
| 32 | +FLAG_Enable_parpool=1; % 0: Disable, 1: Enable |
| 33 | +parcore_nums = 4; |
| 34 | +if FLAG_Enable_parpool |
| 35 | + % determine the number of physical cores |
| 36 | + corenum = feature('numcores'); |
| 37 | + parcorenum = parcore_nums; |
| 38 | + % parcorenum = 15; % # of workers |
| 39 | + p = gcp('nocreate'); % Not create new pool if it does not exist |
| 40 | + if isempty(p) |
| 41 | + p = parcluster('local'); |
| 42 | + p.NumWorkers = parcorenum; |
| 43 | + parpool(p, p.NumWorkers); |
| 44 | + end |
| 45 | + if p.NumWorkers ~= parcorenum |
| 46 | + delete(p); |
| 47 | + p = parcluster('local'); |
| 48 | + p.NumWorkers = parcorenum; |
| 49 | + parpool(p, p.NumWorkers); |
| 50 | + end |
| 51 | + parallel_frames = 100*parcorenum; |
| 52 | +else |
| 53 | + parallel_frames = 10; |
| 54 | +end |
31 | 55 | %% Variable Initializations |
32 | 56 | bit_error_rate = zeros(length(n_values),length(snrdb_values)); |
33 | 57 | fer_error_rate = zeros(length(n_values),length(snrdb_values)); |
|
0 commit comments