Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

NMODL generates OpenACC code that crashes on machines without GPUs. #727

Description

@olupton

If we use NMODL and NVHPC to translate and compile mechanisms for GPU execution, the resulting special-core crashes when run on a machine without a GPU when --gpu is not passed.

The expected behaviour is:

  • --gpu + no attached GPU: meaningful error message
  • --gpu + attached GPU: correct results, calculated on GPU
  • no --gpu: correct results, calculated on CPU, regardless of whether a GPU is attached

The problem is, presumably, that NMODL emits code like

    static inline void* mem_alloc(size_t num, size_t size, size_t alignment = 16) {
        void* ptr;
        cudaMallocManaged(&ptr, num*size);
        cudaMemset(ptr, 0, num*size);
        return ptr;
    }


    static inline void mem_free(void* ptr) {
        cudaFree(ptr);
    }

that does not check --gpu. This could be changed to use these utilities in CoreNEURON:
https://github.com/BlueBrain/CoreNeuron/blob/9c821d51e90237827e5e70fe76748bc54612913a/coreneuron/utils/memory.h#L26-L114

cc: @iomaganaris

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcodegenCode generation backendgpu

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions