Skip to content
Commit e990a4e6 authored by Lurch's avatar Lurch
Browse files

Refactored SourceModule again, new class hierarchy:

+ CudaModule
  + SourceModule
  + JitLinkModule
    + DynamicSourceModule

Splitted the "old" class SourceModule in two: class CudaModule and the "new" SourceModule.

- CudaModule is now the common base class for module loading and provides common methods. All methods here were moved from the old SourceModule.
- The "new" SourceModule's interface and system requirements are 100% unchanged, it will work under all previous configuration scenarios.
- JitLinkModule requires at least CUDA 5.5 and Compute Capabilty 3.5 (that is now guarded in the constructor), it's the swiss-army-knife for non-trivial linker invocations.
- DynamicSourceModule is a special case of JitLinkModule, it exposes the same interface as SourceModule but enables dynamic parallelism (it comes with one extra optional argument in the constructor, cudalib_dir). It's meant for the trivial cases where the user has a single source file, as before with SourceModule.

So if a PyCuda user only wants to activate dynamic parallelism, all that's required is to replace "SourceModule" with "DynamicSourceModule" given that we're able to locate "cudadevrt" automagically in method _locate_cuda_libdir(), otherwise the caller must provide the CUDA library path manually in constructor argument "cudalib_dir". I do not think this can be reduced any further.

Other changes in class JitLinkModule:
- Made all add_* methods and the link() method return self
- Moved CUDA library path detection logic into method JitLinkModule._locate_cuda_libdir(), gets called only once from constructor
parent 68dcd6ec
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment