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

weights and sphere are Nan #5

Open
armand-hoxha25 opened this issue Nov 1, 2017 · 8 comments
Open

weights and sphere are Nan #5

armand-hoxha25 opened this issue Nov 1, 2017 · 8 comments

Comments

@armand-hoxha25
Copy link

armand-hoxha25 commented Nov 1, 2017

Hello and thanks for the toolbox. I have question regarding some of the data i have. I have run the cudaica on a couple of datasets and i receive an error. I traced it down to the point where the weights and sphere matrix from cudaica are all NaN. This does not happen on every dataset, however some of the other datasets are retreive results which appear to be different from pop_runica. Otherwise the cudaica works properly on other datasets with almost identical results to pop_runica (i run pop_runica with 'cudaica' option, and using [wts,sph]=cudaica(EEG.data); ). Is there something wrong with the data i have?

at the end of each Step in ica i get:
Step 100 - epsilon: -nan, lrate 0.001000000, wchange -nan, angledelta -nan deg

@fraimondo
Copy link
Owner

fraimondo commented Nov 2, 2017 via email

@armand-hoxha25
Copy link
Author

armand-hoxha25 commented Nov 2, 2017

Hello thanks for the reply, I ran the EEGLAB ica and i do not see the same issue, as in i get good decomposition of the data.
I attached the cudaica outputs from my cudaica (weights, and sphere). these are the files that are created by cudaica, i did not put in the fdt file, but if you want i can attach that one too.
cudaica_out.tar.gz

in case its my graphic card here is my cuda ica initialization
List of cuda devices:

=====================

Device: 0
CUDA Device capabilities:
Name: GeForce GTX 780
Global Mem: 3159031808
Mem: 3159031808
Mem per Block: 49152
Regs per Block: 65536
Warp size: 32
Mem pitch: 2147483647
Max Threads per Block: 1024
Max Threads Dim: 1024 x 1024 x 64
Max Grid Size: 2147483647 x 65535 x 65535
Total Const Mem: 65536
Major: 3
Minor: 5
Clock Rate: 1019500
Texture Alignment: 512
Device Overlap: 1
Multiprocessor Count: 12
Kernel Timeout Enabled: 1
Integrated: 0
Can Map host mem: 1
Compute mode: 0
Concurrent kernels: 1
ECC Enabled: 0
PCI Bus ID: 1
PCI Device ID: 0
TCC Driver: 0

Selecting device 0 Success!

In matlab the outcomes of weights and sphere are 64x64 matrix of NaN .

@fraimondo
Copy link
Owner

fraimondo commented Nov 2, 2017 via email

@CloudyDory
Copy link

Hi,

I also got 64*64 NaN matrix out of cudaica.

Here is the .sc file:

DataFile /home/yunhui/Downloads/Subj10/cudaica1270.fdt
 
chans 64
frames 174375
WeightsOutFile /home/yunhui/Downloads/Subj10/cudaica1270.wts
SphereFile /home/yunhui/Downloads/Subj10/cudaica1270.sph
sphering on
bias on
extended 1
 
 
 
pca 0
lrate 1.0e-4
 
blocksize 0
 
stop 1.0e-7
 
maxsteps 512
posact off
 
annealstep 0.98
 
annealdeg 60
momentum 0
verbose on

And every step I get:

Step xxx - epsilon:    -nan, lrate 0.000100000, wchange    -nan, angledelta -nan deg - Elapsed time: 352203 tics = 0 h 0 m 0 s

Yet ICA runs fine using "runica()" with "'extended', 1" options in the EEGLAB with exactly the same dataset. Fraimondo can you please help me on this problem?

@CloudyDory
Copy link

After debugging I found NaNs are produced at line 1010 of infomax.cu:

HANDLE_ERROR(cudaMemcpyFromSymbol(&h_change, SYMBOL(dotResult), sizeof(h_change)));

After this line, the value of h_change changes to NaN.

I am not familiar with CUDA programming, however. Anyone knows what is the cause of this problem?

@fraimondo
Copy link
Owner

The value of h_change changes to NaN after that line because that is the line when the value is copied from GPU memory to CPU memory.

Can you provide the full output?
If you run binica < cudaica1270.sc, do you have the same problem? The .SC files are compatible with the CPU binary version, and it should produce the same result.

@CloudyDory
Copy link

CloudyDory commented May 3, 2018

Hi, thanks for the reply. After further debugging, the NaN originates in the following line of whitening.cu:
host_eigd[i] = 0.5 * sqrt(host_eigd[i]);

It may produce NaN because if the data is rank-deficient (like if you rereference the data to average reference, or remove and interpolate channels), some of the eigenvalues are very close to zero, but negative. They produce NaN after taking the square root.

I have used EEGLAB for more than one year now, and it seems strange that Matlab can always produce close-to-zero but positive results when it calculates eigenvalues from double precision, rank-deficient covariance matrix.

@fraimondo
Copy link
Owner

fraimondo commented May 3, 2018 via email

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

3 participants