Why did the parallel computing's task return the state of failure?
1 view (last 30 days)
Show older comments
%% para
ttest = struct;
htype = {'h_gyr', 'h_sul'};
dtype = {'d_gyr', 'd_sul'};
ptype = {'p_gyr', 'p_sul'};
ttype = {'t_gyr', 't_sul'};
ztype = {'z_gyr', 'z_sul'};
Dtype = {'BD', 'MDD', 'SCH'};
morp = {'depth','fractaldimension','gyrification','thickness'};
times = 10000;
load data\edge_rmcov.mat
%% obtain t and p
% disease type
for idtype = 2:length(Dtype)
ttest(idtype).name = Dtype{idtype};
% sites
for isite = 1:length(covariate(idtype).d_gyr(:,1))
for itype = 1:length(dtype) %network type
% obtain value T and value P
% [tmp_t, tmp_p] = gretna_permutation_ttest(covariate(idtype).(dtype{itype}){isite, imor}, ...
% covariate(idtype).(htype{itype}){isite, imor}, times); % T-test
% % create parallel task to perform the ttest
% % divide to four parallel task(SD, FD, GI, CT)
clu = parcluster();
job = createJob(clu);
task = createTask(job, @gretna_permutation_ttest,2, { ...
{covariate(idtype).(htype{itype}){isite, 1},covariate(idtype).(dtype{itype}){isite, 1},times}, ...
{covariate(idtype).(htype{itype}){isite, 2},covariate(idtype).(dtype{itype}){isite, 2},times}, ...
{covariate(idtype).(htype{itype}){isite, 3},covariate(idtype).(dtype{itype}){isite, 3},times}, ...
{covariate(idtype).(htype{itype}){isite, 4},covariate(idtype).(dtype{itype}){isite, 4},times} ...
});
submit(job);
wait(job);
res = fetchOutputs(job); % result of four morphological networks for one site of G-G or S-S network's edges
for imor = 1:length(morp) % save data to each morphological network
% save t and p
ttest(idtype).(ttype{itype}){isite, imor} = res{imor,1}.real;
ttest(idtype).(ptype{itype}){isite, imor} = res{imor,2};
% p->z
for i = 1:length(ttest(idtype).p_gyr{isite, imor}(1,:))
p = ttest(idtype).(ptype{itype}){isite, imor}(:, i);
z = icdf('Normal', 1-(p/2), 0, 1);
t = ttest(idtype).(ttype{itype}){isite, imor}(:, i);
Z(:, i) = z * sign(t);
end
ttest(idtype).(ztype{itype}){isite, imor} = Z;
end
end %network type(G-G and S-S)
% fprintf("%s site_%d %s process over\n", Dtype{idtype}, isite, mor_index{imor});
end %site
end % disease type
save data\edge_ttest2.mat ttest
When I use parallen task to perform the `gretna_permutation_ttest` function,the first dataset run properly, but the second dataset get fault whose task's state is failure. Why is this happening?
Result returned exactly

Result returned by exception

0 Comments
Answers (1)
Umar
on 5 Jul 2024
Hi X,
When encountering errors in the gretna_permutation_ttest function, it is crucial to follow a systematic debugging approach to pinpoint the exact cause of the failure. I put together some detailed steps to help you troubleshoot and resolve the issue:
1. Check the Error Message
Begin by examining any error messages or warnings that are generated when the second dataset fails. Understanding the specific error can offer valuable insights into what might be going wrong within the function.
% Check for error messages try % Call gretna_permutation_ttest with the second dataset catch ME disp(ME.message); end
2. Verify Input Data
Ensure that the input data provided to the gretna_permutation_ttest function for the second dataset is correctly formatted and aligns with the expected input requirements of the function. Any discrepancies in data structure can lead to errors.
3. Debug the gretna_permutation_ttest Function
If the error message points to issues within the gretna_permutation_ttest function itself, delve into the function's implementation. Look for logical errors, inconsistencies, or potential bugs that might be causing the failure.
4. Test with a Smaller Dataset
Large or complex datasets can sometimes overwhelm the system, leading to memory or computation problems. Try running the function with a smaller subset of the second dataset to isolate whether the issue is related to dataset size or content.
5. Check for Dependencies
Ensure that all required dependencies and libraries are correctly installed and accessible. Incompatibilities or missing dependencies can disrupt parallel computing tasks, impacting the function's execution.
6. Update Matlab and Parallel Computing Toolbox
Keeping Matlab and the parallel computing toolbox up to date is essential. Regular updates often include bug fixes and enhancements that can address issues related to parallel processing tasks. Make sure you are using the latest versions to leverage improvements and resolve potential compatibility issues.
By following these detailed steps and thoroughly investigating the error messages and data inputs, you can effectively diagnose and resolve the failure in the gretna_permutation_ttest function for the second dataset.
0 Comments
See Also
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!