Skip to content

Commit

Permalink
Merge pull request #7956 from kmaehashi/third-party-submodules
Browse files Browse the repository at this point in the history
Reorganize third party code under `third_party` directory
  • Loading branch information
asi1024 committed Oct 23, 2023
2 parents 9de37f9 + acc4a50 commit 22845e9
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 259 deletions.
11 changes: 7 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[submodule "cupy/_core/include/cupy/jitify"]
path = cupy/_core/include/cupy/jitify
url = https://github.com/NVIDIA/jitify.git
[submodule "cupy/_core/include/cupy/cccl"]
[submodule "third_party/cccl"]
path = third_party/cccl
url = https://github.com/NVIDIA/cccl.git
[submodule "third_party/jitify"]
path = third_party/jitify
url = https://github.com/NVIDIA/jitify.git
[submodule "third_party/dlpack"]
path = third_party/dlpack
url = https://github.com/dmlc/dlpack.git
2 changes: 1 addition & 1 deletion cupy/_core/dlpack.pxd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from cupy._core.core cimport _ndarray_base


cdef extern from './include/cupy/dlpack/dlpack.h' nogil:
cdef extern from './include/cupy/_dlpack/dlpack.h' nogil:
int device_CUDA 'kDLCUDA'
int managed_CUDA 'kDLCUDAManaged'
int device_ROCM 'kDLROCM'
Expand Down
2 changes: 1 addition & 1 deletion cupy/_core/dlpack.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import cupy
import cupy._core.core as core


cdef extern from './include/cupy/dlpack/dlpack.h' nogil:
cdef extern from './include/cupy/_dlpack/dlpack.h' nogil:
cdef int DLPACK_VERSION

cdef enum DLDeviceType:
Expand Down
12 changes: 1 addition & 11 deletions cupy/_core/include/cupy/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
# "include" directory

All files and directories in this directory will be copied to the distribution (sdist and wheel).
Note that items starting with `.` (e.g., `cub/.git`) are excluded.
Note that items starting with `.` (e.g., `.git`) are excluded.
See `setup.py` for details.

## Jitify
The `Jitify` folder is a git submodule for the Jitify project.
Including the Jitify header as a submodule for building the `cupy.cuda.jitify` module.
For further information on Jitify, see the [Jitify repo](https://github.com/NVIDIA/jitify).

## DLPack
The `dlpack` folder stores the DLPack header for building the `cupy._core.dlpack` module,
see `README.md` therein.
For further information on DLPack, see the [DLPack repo](https://github.com/dmlc/dlpack).
1 change: 1 addition & 0 deletions cupy/_core/include/cupy/_dlpack/LICENSE
1 change: 1 addition & 0 deletions cupy/_core/include/cupy/_dlpack/dlpack.h
1 change: 1 addition & 0 deletions cupy/_core/include/cupy/_jitify/LICENSE
1 change: 1 addition & 0 deletions cupy/_core/include/cupy/_jitify/jitify.hpp
4 changes: 0 additions & 4 deletions cupy/_core/include/cupy/dlpack/README.md

This file was deleted.

232 changes: 0 additions & 232 deletions cupy/_core/include/cupy/dlpack/dlpack.h

This file was deleted.

2 changes: 1 addition & 1 deletion cupy/cuda/cupy_jitify.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#if !defined(CUPY_NO_CUDA) && !defined(CUPY_USE_HIP)

#include <cupy/jitify/jitify.hpp>
#include <cupy/_jitify/jitify.hpp>
namespace jitify {
namespace detail {
const char* jitify_ver = _xstr_(CUPY_JITIFY_VERSION_CODE);
Expand Down
2 changes: 1 addition & 1 deletion install/cupy_builder/_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def get_features(ctx: Context) -> Dict[str, Feature]:
'cupy._core.dlpack',
],
'include': [
'cupy/dlpack/dlpack.h',
'cupy/_dlpack/dlpack.h',
],
'libraries': [],
}
Expand Down
3 changes: 2 additions & 1 deletion install/cupy_builder/_preflight.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ def preflight_check(ctx: Context) -> bool:
source_root = ctx.source_root
is_git = os.path.isdir(os.path.join(source_root, '.git'))
for submodule in ('third_party/cccl',
'cupy/_core/include/cupy/jitify'):
'third_party/jitify',
'third_party/dlpack'):
dirpath = os.path.join(source_root, submodule)
if os.path.isdir(dirpath):
if 0 < len(os.listdir(dirpath)):
Expand Down
4 changes: 2 additions & 2 deletions install/cupy_builder/cupy_setup_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,11 @@ def make_extensions(ctx: Context, compiler, use_cython):
# compile_args.append('-DJITIFY_PRINT_ALL')

# if any change is made to the Jitify header, we force recompiling
s['depends'] = ['./cupy/_core/include/cupy/jitify/jitify.hpp']
s['depends'] = ['./cupy/_core/include/cupy/_jitify/jitify.hpp']

if module['name'] == 'dlpack':
# if any change is made to the DLPack header, we force recompiling
s['depends'] = ['./cupy/_core/include/cupy/dlpack/dlpack.h']
s['depends'] = ['./cupy/_core/include/cupy/_dlpack/dlpack.h']

for f in module['file']:
s_file = copy.deepcopy(s)
Expand Down
2 changes: 1 addition & 1 deletion install/cupy_builder/install_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def get_compiler_setting(ctx: Context, use_hip):
cupy_header = os.path.join(
cupy_builder.get_context().source_root, 'cupy/_core/include')
global _jitify_path
_jitify_path = os.path.join(cupy_header, 'cupy/jitify')
_jitify_path = os.path.join(cupy_header, 'cupy/_jitify')
global _cub_path
if rocm_path:
_cub_path = os.path.join(rocm_path, 'include', 'hipcub')
Expand Down
12 changes: 12 additions & 0 deletions third_party/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@
The `cccl` folder is a git submodule for the CCCL project, the new home for Thrust, CUB, and
libcu++. The CCCL headers are used at both build- and run- time.
For further information on CUB, see the [CCCL repo](https://github.com/NVIDIA/cccl).

## Jitify

The `jitify` folder is a git submodule for the Jitify project.
Including the Jitify header as a submodule for building the `cupy.cuda.jitify` module.
For further information on Jitify, see the [Jitify repo](https://github.com/NVIDIA/jitify).

## DLPack

The `dlpack` folder is a git submodule for the DLPack project.
Including the Jitify header as a submodule for building the `cupy._core.dlpack` module.
For further information on DLPack, see the [DLPack repo](https://github.com/dmlc/dlpack).
1 change: 1 addition & 0 deletions third_party/dlpack
Submodule dlpack added at 365b82

0 comments on commit 22845e9

Please sign in to comment.