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

GPU required specifications #50

Closed
Eidantz opened this issue Oct 21, 2018 · 2 comments
Closed

GPU required specifications #50

Eidantz opened this issue Oct 21, 2018 · 2 comments

Comments

@Eidantz
Copy link

Eidantz commented Oct 21, 2018

Hey, I try to run this code:

clear cfg;
cfg.unitinmm=0.1; %set the grid to 100um
cfg.nphoton=1e7;

prop=[ 0.019 7.8   0.89 1.37     % medium 1: skin & skull
   0.004 0.009 0.89 1.37     % medium 2: CSF
   0.02  9.0   0.89 1.37     % medium 3: gray matter
   0.08 40.9   0.84 1.37    % medium 4: white matter
   ];

cfg.prop=[0 0 1 1];
% define layer structure
cfg.vol=ones(500,500,1500);
j=15;
for i=1:100 % define 100 layers with random brain optical properties
cfg.vol(:,:,j:j+1)=i;
j=j+15;
randomm=randi([1,4]);
cfg.prop=[cfg.prop;prop(randomm,:)];
end
cfg.vol=uint8(cfg.vol);

% define the source position
cfg.srcpos=[200,250,0]+1;
cfg.srcdir=[0 0 1];

% time-domain simulation parameters
cfg.tstart=0;
cfg.tend=5e-9;
cfg.tstep=5e-10;

% GPU thread configuration
cfg.autopilot=1;
cfg.gpuid=1;

%% running simulation with boundary reflection enabled
cfg.isreflect=1; % enable reflection at exterior boundary
cfg.isrefint=1;  % enable reflection at interior boundary too
cfg.issavedet=1; % enable recording partial pathlength of detected photons
cfg.detpos=[101 251 1 2];
for i=1:1
tic;
[f,det,vol,seeds]=mcxlab(cfg);
toc;
end
fprintf(sprintf('simulation number: %d is done..............................',i));

And I got this warning and error.

WARNING: GPU memory can not hold all time gates, disabling normalization to allow multiple runs
MCXLAB ERROR -2 in unit mcx_core.cu:1756: out of memory
Error from thread (0): out of memory
C++ Error: MCXLAB Terminated due to an exception!
Elapsed time is 2.533999 seconds.

I know my GPU is not that strong (GEFORCE 930MX) and I am willing to upgrade my GPU but what are the required specifications of the GPU to run simulations like this properly

@Eidantz
Copy link
Author

Eidantz commented Oct 22, 2018

I saw the list: http://mcx.space/gpubench/
Sorry for bothering you
Eidan.

@Eidantz Eidantz closed this as completed Oct 22, 2018
@fangq
Copy link
Owner

fangq commented Oct 23, 2018

The estimation of the total memory needed by an MCX simulation is straightforward, from your script, you requested a volume of 500x500x1500 voxels, and a total of 10 time-gates, each voxel uses a 4-byte single-precision number to store fluence. if you convert this to bytes, you need 50050015004/1024/102410 = 14 GB global memory. In addition, MCX need twice of that size internally to improve accuracy, so, your simulation requires 14*2 = 28GB GPU memory.

if you look at all the GPUs on the market, you can almost never find a GPU with such amount of memory, except the super expensive v100 GPU. So, your simulation is just not realistic.

Even you can find a GPU with such a large memory, to produce a fluence map that every voxel has decent SNR will require a huge amount of photons. The runtime will also be unrealistic. Think about this, if you run a simulation on a grid with 100x100x100 voxels, if you refine the grid to 200x200x200, you will need 64 times more run-times to produce a simulation with comparable SNR - 8 fold comes from the increase number of voxels, and another 8-fold comes from launching 8x more photons to produce the same SNR.

My suggestion is always: start with a small domain, run a small number of photons, and see if your solution is acceptable, then gradually increase the photon number or domain size. Do not go the other way around.

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

2 participants