|
96 | 96 | %% Extra settings needed for better usability
|
97 | 97 | warning('off','MATLAB:prnRenderer:opengl'); % suppress unneccessary warnings from export_fig when running without OpenGL
|
98 | 98 |
|
| 99 | + % output GPU information (if requested) |
| 100 | + if strcmp(parameters.code_type, 'cuda') || strcmp(parameters.code_type, 'matlab_gpu') |
| 101 | + gpuDevice() |
| 102 | + end |
| 103 | + |
99 | 104 | %% Start of simulations
|
100 | 105 | % Creates an output file to which output is written at a later stage
|
101 | 106 | output_pressure_file = fullfile(parameters.output_dir,sprintf('sub-%03d_%s_output_table%s.csv', ...
|
|
117 | 122 | t1_info = niftiinfo(filename_t1);
|
118 | 123 | t1_grid_step_mm = t1_info.PixelDimensions(1);
|
119 | 124 | focal_distance_t1 = norm(parameters.focus_pos_t1_grid - parameters.transducer.pos_t1_grid);
|
120 |
| - parameters.expected_focal_distance_mm = focal_distance_t1 * t1_grid_step_mm; |
| 125 | + parameters.expected_focal_distance_mm = focal_distance_t1 * t1_grid_step_mm; |
| 126 | + clear filename_t1 t1_info focal_distance_t1 t1_grid_step_mm; |
121 | 127 | end
|
122 | 128 |
|
123 | 129 | % if there is no specification of usepseudoCT, go for default of 0
|
|
428 | 434 | [kwaveDiffusion, time_status_seq, maxT, focal_planeT, maxCEM43, focal_planeCEM43]= ...
|
429 | 435 | run_heating_simulations(sensor_data, kgrid, kwave_medium, sensor, source, parameters, trans_pos_final);
|
430 | 436 |
|
| 437 | + % apply gather in case variables are GPU arrays |
| 438 | + maxT = gather(maxT); |
| 439 | + focal_planeT = gather(focal_planeT); |
| 440 | + maxCEM43 = gather(maxCEM43); |
| 441 | + focal_planeCEM43 = gather(focal_planeCEM43); |
| 442 | + |
431 | 443 | save(filename_heating_data, 'kwaveDiffusion','time_status_seq',...
|
432 | 444 | 'heating_window_dims','sensor','maxT','focal_planeT','maxCEM43','focal_planeCEM43','-v7.3');
|
433 | 445 |
|
|
0 commit comments