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
If we use NMODL and NVHPC to translate and compile mechanisms for GPU execution, the resulting
special-corecrashes when run on a machine without a GPU when--gpuis not passed.The expected behaviour is:
--gpu+ no attached GPU: meaningful error message--gpu+ attached GPU: correct results, calculated on GPU--gpu: correct results, calculated on CPU, regardless of whether a GPU is attachedThe problem is, presumably, that NMODL emits code like
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