Error when running Kilosort

Hey, the first part of the message only just informs that the kilosort plugin was automatically updated in Brainstorm.

The error is produced in the fitTemplates.m from KiloSort plugin, which is called in line 276 in process_spikesorting_kilosort.m

To have a more insightful error message:

  1. Could you modify this file:
    brainstorm3/toolbox/process/functions/ process_spikesorting_kilosort.m
    around line 275
    (One line is Updated and 2 lines are Inserted)

From:

    try
        rez = fitTemplates(rez, DATA, uproj);  % fit templates iteratively
    catch
        if ops.GPU
            % ~\.brainstorm\plugins\kilosort\KiloSort-master\CUD?\mexGPUall.m
            % needs to be called and compile the .cu files.
            % Suggested environment: Matlab 2018a, CUDA 9.0, VS 13.
            bst_report('Error', sProcess, sInput, 'Error trying to spike-sort on the GPU. Have you set up CUDA correctly? Check https://github.com/cortex-lab/KiloSort for installation instructions');
            return;
        else
            bst_report('Error', sProcess, sInput, 'Error with Kilosort while training on the CPU');
            return;
        end
    end

To:

    try
        rez = fitTemplates(rez, DATA, uproj);  % fit templates iteratively
    catch ME  % UPDATED LINE
        if ops.GPU
            % ~\.brainstorm\plugins\kilosort\KiloSort-master\CUD?\mexGPUall.m
            % needs to be called and compile the .cu files.
            % Suggested environment: Matlab 2018a, CUDA 9.0, VS 13.
            bst_report('Error', sProcess, sInput, 'Error trying to spike-sort on the GPU. Have you set up CUDA correctly? Check https://github.com/cortex-lab/KiloSort for installation instructions');
            disp(['ME.message: ', ME.message]) % INSERTED LINE
            return;
        else
            bst_report('Error', sProcess, sInput, 'Error with Kilosort while training on the CPU');
            disp(['ME.message: ', ME.message]) % INSERTED LINE
            return;
        end
    end
  1. And run again with your data
  2. Let us know the messages you get

P.S. In the reply, you can add ``` (3 backticks) in the line before in and the line after the error message to make it easier to read. For example:

***************************************************************************
** Error: [process_spikesorting_kilosort]  Electrophysiology > Unsupervised Spike Sorting > KiloSort
...