1 | %****************************************************************************** |
---|
2 | % WARPLab Setup |
---|
3 | % |
---|
4 | % File : wl_setup.m |
---|
5 | % Authors: Chris Hunter (chunter [at] mangocomm.com) |
---|
6 | % Patrick Murphy (murphpo [at] mangocomm.com) |
---|
7 | % Erik Welsh (welsh [at] mangocomm.com) |
---|
8 | % License: Copyright 2013, Mango Communications. All rights reserved. |
---|
9 | % Distributed under the WARP license (http://warpproject.org/license) |
---|
10 | % |
---|
11 | %****************************************************************************** |
---|
12 | % MODIFICATION HISTORY: |
---|
13 | % |
---|
14 | % Ver Who Date Changes |
---|
15 | % ----- ---- -------- ------------------------------------------------------- |
---|
16 | % 3.00a ejw 8/21/13 Update to use new WARPLab MEX transport; |
---|
17 | % Added mex/ directory to MATLAB path |
---|
18 | % |
---|
19 | %****************************************************************************** |
---|
20 | |
---|
21 | function wl_setup |
---|
22 | |
---|
23 | REQUIRED_MEX_VERSION = '1.0.4a'; |
---|
24 | |
---|
25 | |
---|
26 | fprintf('Setting up WARPLab Paths...\n'); |
---|
27 | |
---|
28 | %------------------------------------------------------------------------------ |
---|
29 | % Remove any paths from previous WARPLab installations |
---|
30 | |
---|
31 | % NOTE: We had to add in code involving regular expressions to catch a absolute vs |
---|
32 | % relative path issue that we found. For example, if ./util exists in the path, |
---|
33 | % then the previous version of the code will run forever because it will find |
---|
34 | % the file using 'which' but then the absolute path returned will not be in the |
---|
35 | % actual path. Now, we use regular expressions to make sure the path exists |
---|
36 | % before removing it. |
---|
37 | |
---|
38 | % Remove legacy WARPLab v6 paths |
---|
39 | % NOTE: warplab_defines is not used in WARPLab v7 |
---|
40 | done = false; |
---|
41 | while(~done) |
---|
42 | [wl_path,ig,ig] = fileparts(which('warplab_defines')); |
---|
43 | if(~isempty(wl_path)) |
---|
44 | fprintf(' removing path ''%s''\n',wl_path); |
---|
45 | |
---|
46 | my_path = regexprep( sprintf('%s', path), ';', ' ' ); |
---|
47 | search_term = regexprep( sprintf('%s ',wl_path), '\\', '\\\\' ); |
---|
48 | path_comp = regexp( sprintf('%s',my_path), sprintf('%s',search_term), 'match' ); |
---|
49 | |
---|
50 | if ( ~isempty( path_comp ) ) |
---|
51 | rmpath(wl_path) |
---|
52 | else |
---|
53 | done = true; |
---|
54 | end |
---|
55 | else |
---|
56 | done = true; |
---|
57 | end |
---|
58 | end |
---|
59 | |
---|
60 | % Check on .../M_Code_Reference/classes |
---|
61 | done = false; |
---|
62 | while(~done) |
---|
63 | [wl_path,ig,ig] = fileparts(which('wl_node')); |
---|
64 | if(~isempty(wl_path)) |
---|
65 | fprintf(' removing path ''%s''\n',wl_path); |
---|
66 | |
---|
67 | my_path = regexprep( sprintf('%s', path), ';', ' ' ); |
---|
68 | search_term = regexprep( sprintf('%s ',wl_path), '\\', '\\\\' ); |
---|
69 | path_comp = regexp( sprintf('%s',my_path), sprintf('%s',search_term), 'match' ); |
---|
70 | |
---|
71 | if ( ~isempty( path_comp ) ) |
---|
72 | rmpath(wl_path) |
---|
73 | else |
---|
74 | done = true; |
---|
75 | end |
---|
76 | else |
---|
77 | done = true; |
---|
78 | end |
---|
79 | end |
---|
80 | |
---|
81 | % Check on .../M_Code_Reference/util |
---|
82 | done = false; |
---|
83 | while(~done) |
---|
84 | [wl_path,ig,ig] = fileparts(which('wl_ver')); |
---|
85 | if(~isempty(wl_path)) |
---|
86 | fprintf(' removing path ''%s''\n',wl_path); |
---|
87 | |
---|
88 | my_path = regexprep( sprintf('%s', path), ';', ' ' ); |
---|
89 | search_term = regexprep( sprintf('%s ',wl_path), '\\', '\\\\' ); |
---|
90 | path_comp = regexp( sprintf('%s',my_path), sprintf('%s',search_term), 'match' ); |
---|
91 | |
---|
92 | if ( ~isempty( path_comp ) ) |
---|
93 | rmpath(wl_path) |
---|
94 | else |
---|
95 | done = true; |
---|
96 | end |
---|
97 | else |
---|
98 | done = true; |
---|
99 | end |
---|
100 | end |
---|
101 | |
---|
102 | % Check on .../M_Code_Reference/util/inifile |
---|
103 | done = false; |
---|
104 | while(~done) |
---|
105 | [wl_path,ig,ig] = fileparts(which('inifile')); |
---|
106 | if(~isempty(wl_path)) |
---|
107 | fprintf(' removing path ''%s''\n',wl_path); |
---|
108 | |
---|
109 | my_path = regexprep( sprintf('%s', path), ';', ' ' ); |
---|
110 | search_term = regexprep( sprintf('%s ',wl_path), '\\', '\\\\' ); |
---|
111 | path_comp = regexp( sprintf('%s',my_path), sprintf('%s',search_term), 'match' ); |
---|
112 | |
---|
113 | if ( ~isempty( path_comp ) ) |
---|
114 | rmpath(wl_path) |
---|
115 | else |
---|
116 | done = true; |
---|
117 | end |
---|
118 | else |
---|
119 | done = true; |
---|
120 | end |
---|
121 | end |
---|
122 | |
---|
123 | % Check on .../M_Code_Reference/config |
---|
124 | done = false; |
---|
125 | while(~done) |
---|
126 | [wl_path,ig,ig] = fileparts(which('wl_config.ini')); |
---|
127 | if(~isempty(wl_path)) |
---|
128 | fprintf(' removing path ''%s''\n',wl_path); |
---|
129 | |
---|
130 | my_path = regexprep( sprintf('%s', path), ';', ' ' ); |
---|
131 | search_term = regexprep( sprintf('%s ',wl_path), '\\', '\\\\' ); |
---|
132 | path_comp = regexp( sprintf('%s',my_path), sprintf('%s',search_term), 'match' ); |
---|
133 | |
---|
134 | if ( ~isempty( path_comp ) ) |
---|
135 | rmpath(wl_path) |
---|
136 | else |
---|
137 | done = true; |
---|
138 | end |
---|
139 | else |
---|
140 | done = true; |
---|
141 | end |
---|
142 | end |
---|
143 | |
---|
144 | % Check on .../M_Code_Reference/mex |
---|
145 | done = false; |
---|
146 | while(~done) |
---|
147 | [wl_path,ig,ig] = fileparts(which('wl_mex_udp_transport')); |
---|
148 | if(~isempty(wl_path)) |
---|
149 | fprintf(' removing path ''%s''\n',wl_path); |
---|
150 | |
---|
151 | my_path = regexprep( sprintf('%s', path), ';', ' ' ); |
---|
152 | search_term = regexprep( sprintf('%s ',wl_path), '\\', '\\\\' ); |
---|
153 | path_comp = regexp( sprintf('%s',my_path), sprintf('%s',search_term), 'match' ); |
---|
154 | |
---|
155 | if ( ~isempty( path_comp ) ) |
---|
156 | rmpath(wl_path) |
---|
157 | else |
---|
158 | done = true; |
---|
159 | end |
---|
160 | else |
---|
161 | done = true; |
---|
162 | end |
---|
163 | end |
---|
164 | |
---|
165 | |
---|
166 | |
---|
167 | %------------------------------------------------------------------------------ |
---|
168 | % Add new paths |
---|
169 | |
---|
170 | % Add .../M_Code_Reference/classes |
---|
171 | myPath = sprintf('%s%sclasses',pwd,filesep); |
---|
172 | fprintf(' adding path ''%s''\n',myPath); |
---|
173 | addpath(myPath) |
---|
174 | |
---|
175 | % Add .../M_Code_Reference/util |
---|
176 | myPath = sprintf('%s%sutil',pwd,filesep); |
---|
177 | fprintf(' adding path ''%s''\n',myPath); |
---|
178 | addpath(myPath) |
---|
179 | |
---|
180 | % Add .../M_Code_Reference/util/inifile |
---|
181 | myPath = sprintf('%s%sutil%sinifile',pwd,filesep,filesep); |
---|
182 | fprintf(' adding path ''%s''\n',myPath); |
---|
183 | addpath(myPath) |
---|
184 | |
---|
185 | % Add .../M_Code_Reference/mex |
---|
186 | myPath = sprintf('%s%smex',pwd,filesep); |
---|
187 | fprintf(' adding path ''%s''\n',myPath); |
---|
188 | addpath(myPath) |
---|
189 | |
---|
190 | % Add .../M_Code_Reference/config |
---|
191 | configPath = sprintf('%s%sconfig',pwd,filesep); |
---|
192 | fprintf(' adding path ''%s''\n',configPath); |
---|
193 | addpath(configPath) |
---|
194 | |
---|
195 | configFile = sprintf('%s%swl_config.ini',configPath,filesep); |
---|
196 | |
---|
197 | % Example of adding a user path to WARPLab setup: |
---|
198 | % In this example, C:\WARP_Repository\ResearchApps\PHY\WARPLAB\WARPLab7\M_Code_Reference\mex is added to the MATLAB path |
---|
199 | % |
---|
200 | % myPath = sprintf('C:%sWARP_Repository%sResearchApps%sPHY%sWARPLAB%sWARPLab7%sM_Code_Reference%smex',filesep,filesep,filesep,filesep,filesep,filesep,filesep); |
---|
201 | % fprintf(' adding path ''%s''\n',myPath); |
---|
202 | % addpath(myPath) |
---|
203 | |
---|
204 | fprintf(' saving path\n\n\n'); |
---|
205 | savepath |
---|
206 | |
---|
207 | %------------------------------------------------------------------------------ |
---|
208 | % Read config file |
---|
209 | |
---|
210 | IP = ''; |
---|
211 | host = ''; |
---|
212 | port_unicast = ''; |
---|
213 | port_bcast = ''; |
---|
214 | transport = ''; |
---|
215 | max_transport_payload_size = ''; |
---|
216 | |
---|
217 | % Read existing config file for defaults |
---|
218 | if(exist(configFile)) |
---|
219 | fprintf('A wl_config.ini file was found in your path. Values specified in this\n'); |
---|
220 | fprintf('configuration file will be used as defaults in the construction of the\n'); |
---|
221 | fprintf('new file.\n'); |
---|
222 | |
---|
223 | readKeys = {'network', '', 'host_address',''}; |
---|
224 | IP = inifile(configFile, 'read', readKeys); |
---|
225 | IP = IP{1}; |
---|
226 | |
---|
227 | readKeys = {'network', '', 'host_ID', ''}; |
---|
228 | host = inifile(configFile, 'read', readKeys); |
---|
229 | host = host{1}; |
---|
230 | |
---|
231 | readKeys = {'network', '', 'unicast_starting_port', ''}; |
---|
232 | port_unicast = inifile(configFile, 'read', readKeys); |
---|
233 | port_unicast = port_unicast{1}; |
---|
234 | |
---|
235 | readKeys = {'network', '', 'bcast_port', ''}; |
---|
236 | port_bcast = inifile(configFile, 'read', readKeys); |
---|
237 | port_bcast = port_bcast{1}; |
---|
238 | |
---|
239 | readKeys = {'network', '', 'transport', ''}; |
---|
240 | transport = inifile(configFile, 'read', readKeys); |
---|
241 | transport = transport{1}; |
---|
242 | |
---|
243 | readKeys = {'network', '', 'max_transport_payload_size', ''}; |
---|
244 | max_transport_payload_size = inifile(configFile, 'read', readKeys); |
---|
245 | max_transport_payload_size = max_transport_payload_size{1}; |
---|
246 | end |
---|
247 | |
---|
248 | % Sane Defaults |
---|
249 | if(isempty(IP)) |
---|
250 | IP = '10.0.0.250'; |
---|
251 | end |
---|
252 | if(isempty(host)) |
---|
253 | host = '250'; |
---|
254 | end |
---|
255 | if(isempty(port_unicast)) |
---|
256 | port_unicast = '9000'; |
---|
257 | end |
---|
258 | if(isempty(port_bcast)) |
---|
259 | port_bcast = '10000'; |
---|
260 | end |
---|
261 | % if(isempty(transport)) % Moved lower in the function |
---|
262 | % transport = 'java'; |
---|
263 | % end |
---|
264 | if(isempty(max_transport_payload_size)) |
---|
265 | max_transport_payload_size = '1470'; |
---|
266 | end |
---|
267 | |
---|
268 | inifile(configFile,'new') |
---|
269 | |
---|
270 | writeKeys = {'config_info', '', 'date_created', date}; |
---|
271 | inifile(configFile, 'write', writeKeys, 'tabbed') |
---|
272 | |
---|
273 | [MAJOR,MINOR,REVISION] = wl_ver(); |
---|
274 | writeKeys = {'config_info', '', 'wl_ver', sprintf('%d.%d.%d', MAJOR, MINOR, REVISION)}; |
---|
275 | inifile(configFile, 'write', writeKeys, 'tabbed') |
---|
276 | |
---|
277 | fprintf('\n\n') |
---|
278 | fprintf('------------------------------------------------------------\n') |
---|
279 | fprintf('Please enter a WARPLab Ethernet interface address.\n\n') |
---|
280 | fprintf('Pressing enter without typing an input will use a default\n') |
---|
281 | fprintf('IP address of: %s\n\n', IP); |
---|
282 | |
---|
283 | % Sanity check input due to errors users were experiencing on the forums |
---|
284 | ip_valid = 0; |
---|
285 | |
---|
286 | while( ip_valid == 0 ) |
---|
287 | |
---|
288 | temp = input('WARPNet Ethernet Interface Address: ','s'); |
---|
289 | if( isempty(temp) ) |
---|
290 | temp = IP; |
---|
291 | ip_valid = 1; |
---|
292 | fprintf(' defaulting to %s\n',temp); |
---|
293 | else |
---|
294 | if ( regexp( temp, '\d+\.\d+\.\d+\.\d+' ) == 1 ) |
---|
295 | ip_valid = 1; |
---|
296 | fprintf(' setting to %s\n',temp) |
---|
297 | else |
---|
298 | fprintf(' %s is not a valid IP address. Please enter a valid IP address.\n',temp); |
---|
299 | end |
---|
300 | end |
---|
301 | end |
---|
302 | |
---|
303 | if(ispc) |
---|
304 | [status, tempret] = system('ipconfig /all'); |
---|
305 | elseif(ismac||isunix) |
---|
306 | [status, tempret] = system('ifconfig -a'); |
---|
307 | end |
---|
308 | tempret = strfind(tempret,temp); |
---|
309 | |
---|
310 | if(isempty(tempret)) |
---|
311 | warning('No interface found. Please ensure that your network interface is connected and configured with static IP %s',temp); |
---|
312 | pause(1) |
---|
313 | end |
---|
314 | |
---|
315 | writeKeys = {'network', '', 'host_address', temp}; |
---|
316 | inifile(configFile, 'write', writeKeys, 'tabbed') |
---|
317 | |
---|
318 | fprintf('\n\n') |
---|
319 | fprintf('------------------------------------------------------------\n') |
---|
320 | fprintf('Please enter a WARPLab host ID.\n') |
---|
321 | fprintf('Valid host IDs are integers in the range of [200,254]\n\n') |
---|
322 | fprintf('Pressing enter without typing an input will use a default\n') |
---|
323 | fprintf('host ID of: %s\n\n', host); |
---|
324 | |
---|
325 | temp = input('WARPLab Host ID: ', 's'); |
---|
326 | if(isempty(temp)) |
---|
327 | temp = host; |
---|
328 | if(isempty(str2num(temp))) |
---|
329 | error('Host ID must be an integer in the range of [200,254]'); |
---|
330 | else |
---|
331 | if((str2num(temp) < 200) || ((str2num(temp) > 254))) |
---|
332 | error('Host ID must be an integer in the range of [200,254]'); |
---|
333 | end |
---|
334 | end |
---|
335 | fprintf(' defaulting to %s\n', temp); |
---|
336 | else |
---|
337 | if(isempty(str2num(temp))) |
---|
338 | error('Host ID must be an integer in the range of [200,254]'); |
---|
339 | else |
---|
340 | if((str2num(temp) < 200) || ((str2num(temp) > 254))) |
---|
341 | error('Host ID must be an integer in the range of [200,254]'); |
---|
342 | end |
---|
343 | end |
---|
344 | |
---|
345 | fprintf(' setting to %s\n', temp); |
---|
346 | end |
---|
347 | |
---|
348 | writeKeys = {'network', '', 'host_ID', temp}; |
---|
349 | inifile(configFile, 'write', writeKeys, 'tabbed') |
---|
350 | |
---|
351 | fprintf('\n\n') |
---|
352 | fprintf('------------------------------------------------------------\n') |
---|
353 | fprintf('Please enter a unicast starting port.\n\n') |
---|
354 | fprintf('Pressing enter without typing an input will use a default\n') |
---|
355 | fprintf('unicast starting port of: %s\n\n', port_unicast); |
---|
356 | |
---|
357 | temp = input('Unicast Starting Port: ', 's'); |
---|
358 | if(isempty(temp)) |
---|
359 | temp = port_unicast; |
---|
360 | fprintf(' defaulting to %s\n', temp); |
---|
361 | else |
---|
362 | fprintf(' setting to %s\n', temp); |
---|
363 | end |
---|
364 | |
---|
365 | writeKeys = {'network', '', 'unicast_starting_port', temp}; |
---|
366 | inifile(configFile, 'write', writeKeys, 'tabbed') |
---|
367 | |
---|
368 | |
---|
369 | fprintf('\n\n') |
---|
370 | fprintf('------------------------------------------------------------\n') |
---|
371 | fprintf('Please enter a broadcast port.\n\n') |
---|
372 | fprintf('Pressing enter without typing an input will use a default\n') |
---|
373 | fprintf('broadcast port of: %s\n\n', port_bcast); |
---|
374 | |
---|
375 | temp = input('Broadcast Port: ', 's'); |
---|
376 | if(isempty(temp)) |
---|
377 | temp = port_bcast; |
---|
378 | fprintf(' defaulting to %s\n', temp); |
---|
379 | else |
---|
380 | fprintf(' setting to %s\n', temp); |
---|
381 | end |
---|
382 | |
---|
383 | writeKeys = {'network', '', 'bcast_port', temp}; |
---|
384 | inifile(configFile, 'write', writeKeys, 'tabbed') |
---|
385 | |
---|
386 | |
---|
387 | fprintf('\n\n') |
---|
388 | fprintf('------------------------------------------------------------\n') |
---|
389 | %%%%%%%% Transport Setup %%%%%%%% |
---|
390 | I_JAVA = 1; |
---|
391 | I_WL_MEX_UDP = 2; |
---|
392 | |
---|
393 | TRANS_NAME_LONG{I_JAVA} = 'Java UDP'; |
---|
394 | TRANS_NAME_SHORT{I_JAVA} = 'java'; |
---|
395 | TRANS_NAME_LONG{I_WL_MEX_UDP} = 'WARPLab Mex UDP'; |
---|
396 | TRANS_NAME_SHORT{I_WL_MEX_UDP} = 'wl_mex_udp'; |
---|
397 | |
---|
398 | TRANS_AVAIL(I_JAVA) = true; |
---|
399 | TRANS_AVAIL(I_WL_MEX_UDP) = false; |
---|
400 | |
---|
401 | fprintf('Select from the following available transports:\n') |
---|
402 | |
---|
403 | try |
---|
404 | version = wl_mex_udp_transport('version'); |
---|
405 | version = sscanf(version, '%d.%d.%d%c'); |
---|
406 | version_req = sscanf(REQUIRED_MEX_VERSION, '%d.%d.%d%c'); |
---|
407 | |
---|
408 | % Version must match required version |
---|
409 | if(version(1) == version_req(1) && version(2) == version_req(2) && version(3) == version_req(3) && version(4) >= version_req(4)) |
---|
410 | TRANS_AVAIL(I_WL_MEX_UDP) = true; |
---|
411 | else |
---|
412 | [major, minor, rev] = wl_ver(); |
---|
413 | wl_version = sprintf('v%d.%d.%d', major, minor, rev); |
---|
414 | version = wl_mex_udp_transport('version'); |
---|
415 | version_req = REQUIRED_MEX_VERSION; |
---|
416 | fprintf('\nERROR: MEX transport version mismatch: \n') |
---|
417 | fprintf('ERROR: WARPLab %s requires MEX transport version %s.\n', wl_version, version_req ) |
---|
418 | fprintf('ERROR: Current complied version is %s. \n', version) |
---|
419 | fprintf('ERROR: Please recompile to use the MEX transport:\n', version) |
---|
420 | fprintf('ERROR: http://warpproject.org/trac/wiki/WARPLab/MEX \n\n') |
---|
421 | end |
---|
422 | |
---|
423 | catch me |
---|
424 | fprintf(' For better transport performance, please setup the WARPLab Mex UDP transport: \n') |
---|
425 | fprintf(' http://warpproject.org/trac/wiki/WARPLab/MEX \n') |
---|
426 | TRANS_AVAIL(I_WL_MEX_UDP) = false; |
---|
427 | end |
---|
428 | |
---|
429 | % Set MEX to be the default transport if available |
---|
430 | if(isempty(transport)) |
---|
431 | if(TRANS_AVAIL(I_WL_MEX_UDP)) |
---|
432 | transport = 'wl_mex_udp'; |
---|
433 | else |
---|
434 | transport = 'java'; |
---|
435 | end |
---|
436 | end |
---|
437 | |
---|
438 | % Check if any transports are available |
---|
439 | if(any(TRANS_AVAIL)==0) |
---|
440 | error('no supported transports were found installed on your computer'); |
---|
441 | end |
---|
442 | |
---|
443 | defaultSel = 1; |
---|
444 | sel = 1; |
---|
445 | for k = 1:length(TRANS_AVAIL) |
---|
446 | if(TRANS_AVAIL(k)) |
---|
447 | if(strcmp(TRANS_NAME_SHORT{k}, transport)) |
---|
448 | defaultSel = sel; |
---|
449 | fprintf('[%d] (default) %s\n', sel, TRANS_NAME_LONG{k}) |
---|
450 | else |
---|
451 | fprintf('[%d] %s\n', sel, TRANS_NAME_LONG{k}) |
---|
452 | end |
---|
453 | selectionToIndex(sel) = k; |
---|
454 | sel = sel + 1; |
---|
455 | end |
---|
456 | end |
---|
457 | |
---|
458 | temp = input('Selection: '); |
---|
459 | if(isempty(temp)) |
---|
460 | temp = defaultSel; |
---|
461 | end |
---|
462 | |
---|
463 | if(temp>(sel-1)) |
---|
464 | error('invalid selection') |
---|
465 | end |
---|
466 | |
---|
467 | transport = TRANS_NAME_SHORT{selectionToIndex(temp)}; |
---|
468 | |
---|
469 | fprintf(' setting to %s\n', transport); |
---|
470 | |
---|
471 | writeKeys = {'network', '', 'transport', transport}; |
---|
472 | inifile(configFile, 'write', writeKeys, 'tabbed') |
---|
473 | |
---|
474 | fprintf('\n\n') |
---|
475 | fprintf('------------------------------------------------------------\n') |
---|
476 | %%%%%%%% Transport Setup %%%%%%%% |
---|
477 | PAYLOAD_SIZE{1} = '1470'; |
---|
478 | PAYLOAD_SIZE{2} = '5000'; |
---|
479 | PAYLOAD_SIZE{3} = '8966'; |
---|
480 | |
---|
481 | fprintf('Select from the following maximum transport payload size:\n') |
---|
482 | |
---|
483 | sel = 1; |
---|
484 | for k = 1:3 |
---|
485 | |
---|
486 | % Check if this exercises jumbo mode |
---|
487 | if (str2num(PAYLOAD_SIZE{k}) <= 1470) |
---|
488 | jumbo = '(non-jumbo)'; |
---|
489 | else |
---|
490 | jumbo = '(jumbo)'; |
---|
491 | end |
---|
492 | |
---|
493 | if(strcmp(PAYLOAD_SIZE{k}, max_transport_payload_size)) |
---|
494 | defaultSel = sel; |
---|
495 | fprintf('[%d] (default) %s bytes %s\n', sel, PAYLOAD_SIZE{k}, jumbo) |
---|
496 | else |
---|
497 | fprintf('[%d] %s bytes %s\n', sel, PAYLOAD_SIZE{k}, jumbo) |
---|
498 | end |
---|
499 | selectionToIndex(sel) = k; |
---|
500 | sel = sel + 1; |
---|
501 | end |
---|
502 | |
---|
503 | fprintf('\nDepending on your host NIC and network setup you may be able to\n') |
---|
504 | fprintf('use larger packets to increase your transport performance.\n\n') |
---|
505 | |
---|
506 | temp = input('Selection: '); |
---|
507 | |
---|
508 | if(isempty(temp)) |
---|
509 | temp = defaultSel; |
---|
510 | end |
---|
511 | |
---|
512 | if(temp > (sel - 1)) |
---|
513 | error('invalid selection') |
---|
514 | end |
---|
515 | |
---|
516 | max_transport_payload_size = PAYLOAD_SIZE{selectionToIndex(temp)}; |
---|
517 | |
---|
518 | fprintf(' setting maximum transport payload size to %s bytes\n', max_transport_payload_size); |
---|
519 | |
---|
520 | writeKeys = {'network', '', 'max_transport_payload_size', max_transport_payload_size}; |
---|
521 | inifile(configFile, 'write', writeKeys, 'tabbed') |
---|
522 | |
---|
523 | |
---|
524 | fprintf('\n\n') |
---|
525 | fprintf('------------------------------------------------------------\n') |
---|
526 | fprintf('\n\nSetup Complete\nwl_ver():\n'); |
---|
527 | wl_ver() |
---|
528 | fprintf('\n') |
---|
529 | |
---|
530 | % Catch 64-bit support issues in Matlab during wl_setup |
---|
531 | try |
---|
532 | temp_1 = uint64(0); |
---|
533 | temp_2 = uint64(0); |
---|
534 | result = temp_1 + temp_2; |
---|
535 | catch |
---|
536 | warning('Matlab version does not support uint64 arithmetic. Please use Matlab R2011a or later.'); |
---|
537 | end |
---|
538 | |
---|
539 | end |
---|