Failed in 2D, v5.0.2

Hi,

I updated the cuda to 13.0 (Rocky v 8.9) and updated cryosparc to v 5.0.2. The 2D classification failed with error. Your advice is highly appreciated. Best, Lan

Timestamp: Mar 6, 2026, 6:25:05 PM
CryoSPARC Version: v5.0.2
P25 J48: 2D Class

Traceback (most recent call last):
  File "cli/run.py", line 106, in cli.run.run_job
  File "cli/run.py", line 211, in cli.run.run_job_function
  File "compute/jobs/class2D/run.py", line 605, in compute.jobs.class2D.run.run_class_2D
  File "/home/cryosparc_user/software/cryosparc/cryosparc_worker/core/run_context.py", line 235, in log_progress
    return jobs.update_job_progress(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cryosparc_user/software/cryosparc/cryosparc_worker/core/jobs.py", line 2647, in update_job_progress
    asset = assets.upload_figure(figure, job.project_uid, job.uid, name=k, format="png")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cryosparc_user/software/cryosparc/cryosparc_worker/core/assets.py", line 144, in upload_figure
    file.seek(0, 0)  # type: ignore
    ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'seek'

Sorry to bother you all. This simple problem was solved by deleting the previous 2D job and resetting the 2D classification job. Lan

A new problem with 2D classification. 700K particles for 200 classes. It usually works in the previous version even much more particles.

Your suggestions are appreciated.

Lan

Timestamp: Mar 11, 2026, 2:04:22 PM
CryoSPARC Version: v5.0.2
P28 J12: 2D Class

Traceback (most recent call last):
  File "cli/run.py", line 236, in cli.run.register_thread_excepthook.init.run_with_except_hook
  File "compute/gpu/gpucore.py", line 126, in compute.gpu.gpucore.GPUThread.run
  File "compute/gpu/gpucore.py", line 127, in compute.gpu.gpucore.GPUThread.run
  File "compute/jobs/class2D/run.py", line 818, in compute.jobs.class2D.run.class2D_engine_run.work
  File "compute/engine/newengine.py", line 1407, in compute.engine.newengine.EngineThread.compute_resid_pow
  File "compute/gpu/gpucore.py", line 376, in compute.gpu.gpucore.EngineBaseThread.ensure_allocated
  File "/home/cryosparc_user/software/cryosparc/cryosparc_worker/.pixi/envs/worker/lib/python3.12/site-packages/numba/cuda/cudadrv/devices.py", line 232, in _require_cuda_context
    return fn(*args, **kws)
           ^^^^^^^^^^^^^^^^
  File "/home/cryosparc_user/software/cryosparc/cryosparc_worker/.pixi/envs/worker/lib/python3.12/site-packages/numba/cuda/api.py", line 189, in pinned_array
    buffer = current_context().memhostalloc(bytesize)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cryosparc_user/software/cryosparc/cryosparc_worker/.pixi/envs/worker/lib/python3.12/site-packages/numba/cuda/cudadrv/driver.py", line 1378, in memhostalloc
    return self.memory_manager.memhostalloc(bytesize, mapped, portable, wc)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cryosparc_user/software/cryosparc/cryosparc_worker/.pixi/envs/worker/lib/python3.12/site-packages/numba/cuda/cudadrv/driver.py", line 889, in memhostalloc
    pointer = allocator()
              ^^^^^^^^^^^
  File "/home/cryosparc_user/software/cryosparc/cryosparc_worker/.pixi/envs/worker/lib/python3.12/site-packages/numba/cuda/cudadrv/driver.py", line 884, in allocator
    return driver.cuMemHostAlloc(size, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cryosparc_user/software/cryosparc/cryosparc_worker/.pixi/envs/worker/lib/python3.12/site-packages/numba/cuda/cudadrv/driver.py", line 348, in safe_cuda_api_call
    return self._check_cuda_python_error(fname, libfn(*args))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cryosparc_user/software/cryosparc/cryosparc_worker/.pixi/envs/worker/lib/python3.12/site-packages/numba/cuda/cudadrv/driver.py", line 408, in _check_cuda_python_error
    raise CudaAPIError(retcode, msg)
numba.cuda.cudadrv.driver.CudaAPIError: [1] Call to cuMemHostAlloc results in CUDA_ERROR_INVALID_VALUE

@Lan If the file

/home/cryosparc_user/software/cryosparc/cryosparc_worker/config.sh

does not already include the definition

export CRYOSPARC_NO_PAGELOCK=true

please add that line, retry the job and let us know if 2D classification works with that setting in place.

I have found that trick for v 5.0.1. I have added it to the master config. the 2D started working!! Thank you so much! Lan

1 Like

In case your 2D classification job runs on the master host (instead of an “external” worker host), modification of the master config.sh may be needed in v5.0.1 (see cuMemHostAlloc results in CUDA_ERROR_INVALID_VALUE (version 5.0.1) - #2 by wtempel)

Hi @Lan,

Thanks to your original error report we identified an issue with 2D Classification involving the output of intermediate plots which was fixed in the latest v5.0.3 release.

Dear wtemep and nwong,

Thank you very much for support. modification of master config.sh is also needed in v 5.0.2. It is good to know v 5.0.3 resolved this issue.

I have one suggestion for image presentation. is that possible to include a scale bar within the image for presentation or publication purpose. That would be easy for user.

Thanks!

Lan

There are various ways in which this can currently be achieved:
Example 1:

  1. Download the PDF version of the relevant plot from the event log.
  2. With a program like inkscape, move a copy of the scale bar over any class tile.

Example 2: Adapt this cryosparc-tools example to your needs.