Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mcxcl v2023 fails to use cfg.bc flags, cyclic bc returned error on Intel CPUs and GPUs #47

Closed
fangq opened this issue Oct 29, 2023 · 2 comments
Assignees

Comments

@fangq
Copy link
Owner

fangq commented Oct 29, 2023

Lukai Wang reported an issue when running mcxcl/mcxlabcl on Intel CPU and GPU

https://groups.google.com/g/mcx-users/c/wqsehDZb6ws

it was previously suspected that the issue was caused by Intel GPU opencl runtimes, however, after debugging, it appears that the issue was rooted in the cfg.bc flag handling code in mcxcl's kernel, specifically, an incomplete update after the following previous attempt of fixing bc problems: 9b4d76f

the test script showing the problem: running this on Intel CPU/GPU opencl runtimes, it returned inf/nan. (the output looks fine on nvidia gpus)

% only clear cfg to avoid accidentally clearing other useful data

clear cfg;
cfg.nphoton=1e7;
cfg.issrcfrom0=1;
cfg.vol=uint8(ones(40,40,100));
cfg.srcdir=[0 0 1];
cfg.gpuid=1;
cfg.autopilot=1;
cfg.prop=[0 0 1 1;0.01 10 0.9 1];
cfg.tstart=0;
cfg.unitinmm=0.1;

% a uniform planar source outside the volume
cfg.srctype='planar';
cfg.srcpos=[0 0 0];
cfg.srcparam1=[40 0 0 0];
cfg.srcparam2=[0 40 0 0];
cfg.tend=5e-9;
cfg.tstep=5e-9;
cfg.bc='ccrccr';
cfg.gpuid=3;

flux=mcxlabcl(cfg);

fcw=flux.data*cfg.tstep;
subplot(121);
imagesc(log10(abs(squeeze(fcw(:,10,:)))))
axis equal; colorbar
set(gca,'xlim',[0 size(cfg.vol,3)]);
title('a uniform planar source incident along an infinite slab');

subplot(122);
semilogy((1:size(cfg.vol,3))*cfg.unitinmm, squeeze(mean(mean(fcw,2),1)))
title('averaged light attenuation profile');
ylabel('averaged CW fluence 1/mm^2')
xlabel('depth (mm)')
@fangq fangq closed this as completed in adc0316 Oct 29, 2023
@fangq
Copy link
Owner Author

fangq commented Oct 29, 2023

the changes now fails amd gpu tests, reopen

@fangq
Copy link
Owner Author

fangq commented Sep 14, 2024

I have tested mcxcl under AMD, Intel GPUs and CPUs, as well as Apple M2 GPU, all passed the test. I am closing this ticket for now.

@fangq fangq closed this as completed Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant