Skip to content

Commit

Permalink
Put all array classes in an 'array' directory ('include', 'src', and …
Browse files Browse the repository at this point in the history
…'_numba'). (#17)
  • Loading branch information
jpivarski authored Oct 14, 2019
1 parent 50d3acf commit 7515064
Show file tree
Hide file tree
Showing 24 changed files with 109 additions and 108 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ add_definitions(-DVERSION_INFO="${VERSION_INFO}")
set(CMAKE_MACOSX_RPATH 1)

file(GLOB CPU_KERNEL_SOURCES "src/cpu-kernels/*.cpp")
file(GLOB LIBAWKWARD_SOURCES "src/libawkward/*.cpp")
file(GLOB LIBAWKWARD_SOURCES "src/libawkward/*.cpp" "src/libawkward/array/*.cpp")
include_directories(include)

add_subdirectory(pybind11)
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = src/cpu-kernels src/libawkward
INPUT = src/cpu-kernels src/libawkward src/libawkward/array

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down
2 changes: 1 addition & 1 deletion VERSION_INFO
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.13
0.1.14
6 changes: 3 additions & 3 deletions awkward1/_numba/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
import awkward1._numba.identity
import awkward1._numba.content
import awkward1._numba.iterator
import awkward1._numba.numpyarray
import awkward1._numba.listarray
import awkward1._numba.listoffsetarray
import awkward1._numba.array.numpyarray
import awkward1._numba.array.listarray
import awkward1._numba.array.listoffsetarray
1 change: 1 addition & 0 deletions awkward1/_numba/array/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# BSD 3-Clause License; see https://github.com/jpivarski/awkward-1.0/blob/master/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numba.typing.ctypes_utils

import awkward1.layout
from .._numba import cpu, util, content
from ..._numba import cpu, util, content

@numba.extending.typeof_impl.register(awkward1.layout.ListArray32)
@numba.extending.typeof_impl.register(awkward1.layout.ListArray64)
Expand Down Expand Up @@ -47,7 +47,7 @@ def getitem_tuple(self, wheretpe):
return outtpe.getitem_int()

def getitem_next(self, wheretpe, isadvanced):
import awkward1._numba.listoffsetarray
import awkward1._numba.array.listoffsetarray
if len(wheretpe.types) == 0:
return self
headtpe = wheretpe.types[0]
Expand All @@ -58,7 +58,7 @@ def getitem_next(self, wheretpe, isadvanced):

elif isinstance(headtpe, numba.types.SliceType):
contenttpe = self.contenttpe.carry().getitem_next(tailtpe, isadvanced)
return awkward1._numba.listoffsetarray.ListOffsetArrayType(util.indextpe(self.bitwidth), contenttpe, self.idtpe)
return awkward1._numba.array.listoffsetarray.ListOffsetArrayType(util.indextpe(self.bitwidth), contenttpe, self.idtpe)

elif isinstance(headtpe, numba.types.EllipsisType):
raise NotImplementedError("ellipsis")
Expand All @@ -71,7 +71,7 @@ def getitem_next(self, wheretpe, isadvanced):
raise NotImplementedError("array.ndim != 1")
contenttpe = self.contenttpe.carry().getitem_next(tailtpe, True)
if not isadvanced:
return awkward1._numba.listoffsetarray.ListOffsetArrayType(util.indextpe(self.bitwidth), contenttpe, self.idtpe)
return awkward1._numba.array.listoffsetarray.ListOffsetArrayType(util.indextpe(self.bitwidth), contenttpe, self.idtpe)
else:
return contenttpe

Expand Down Expand Up @@ -238,7 +238,7 @@ def lower_getitem_other(context, builder, sig, args):
return lower_getitem_tuple(context, builder, rettpe(arraytpe, wrappedtpe), (arrayval, wrappedval))

def lower_getitem_next(context, builder, arraytpe, wheretpe, arrayval, whereval, advanced):
import awkward1._numba.listoffsetarray
import awkward1._numba.array.listoffsetarray

if len(wheretpe.types) == 0:
return arrayval
Expand Down Expand Up @@ -349,7 +349,7 @@ def lower_getitem_next(context, builder, arraytpe, wheretpe, arrayval, whereval,
outcontenttpe = nextcontenttpe.getitem_next(tailtpe, True)
outcontentval = nextcontenttpe.lower_getitem_next(context, builder, nextcontenttpe, tailtpe, nextcontentval, tailval, nextadvanced)

outtpe = awkward1._numba.listoffsetarray.ListOffsetArrayType(util.indextpe(arraytpe.bitwidth), outcontenttpe, arraytpe.idtpe)
outtpe = awkward1._numba.array.listoffsetarray.ListOffsetArrayType(util.indextpe(arraytpe.bitwidth), outcontenttpe, arraytpe.idtpe)
proxyout = numba.cgutils.create_struct_proxy(outtpe)(context, builder)
proxyout.offsets = nextoffsets
proxyout.content = outcontentval
Expand Down Expand Up @@ -404,7 +404,7 @@ def lower_getitem_next(context, builder, arraytpe, wheretpe, arrayval, whereval,
contenttpe = nexttpe.getitem_next(tailtpe, True)
contentval = nexttpe.lower_getitem_next(context, builder, nexttpe, tailtpe, nextval, tailval, nextadvanced)

outtpe = awkward1._numba.listoffsetarray.ListOffsetArrayType(util.indextpe(arraytpe.bitwidth), contenttpe, arraytpe.idtpe)
outtpe = awkward1._numba.array.listoffsetarray.ListOffsetArrayType(util.indextpe(arraytpe.bitwidth), contenttpe, arraytpe.idtpe)
proxyout = numba.cgutils.create_struct_proxy(outtpe)(context, builder)
proxyout.offsets = nextoffsets
proxyout.content = contentval
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numba.typing.arraydecl

import awkward1.layout
from .._numba import cpu, util, content
from ..._numba import cpu, util, content

@numba.extending.typeof_impl.register(awkward1.layout.ListOffsetArray32)
@numba.extending.typeof_impl.register(awkward1.layout.ListOffsetArray64)
Expand Down Expand Up @@ -36,8 +36,8 @@ def getitem_range(self):
return self

def getitem_tuple(self, wheretpe):
import awkward1._numba.listarray
nexttpe = awkward1._numba.listarray.ListArrayType(util.index64tpe, util.index64tpe, self, numba.none)
import awkward1._numba.array.listarray
nexttpe = awkward1._numba.array.listarray.ListArrayType(util.index64tpe, util.index64tpe, self, numba.none)
out = nexttpe.getitem_next(wheretpe, False)
return out.getitem_int()

Expand Down Expand Up @@ -73,8 +73,8 @@ def getitem_next(self, wheretpe, isadvanced):
raise AssertionError(headtpe)

def carry(self):
import awkward1._numba.listarray
return awkward1._numba.listarray.ListArrayType(self.offsetstpe, self.offsetstpe, self.contenttpe, self.idtpe)
import awkward1._numba.array.listarray
return awkward1._numba.array.listarray.ListArrayType(self.offsetstpe, self.offsetstpe, self.contenttpe, self.idtpe)

@property
def lower_len(self):
Expand Down Expand Up @@ -251,7 +251,7 @@ def starts_stops(context, builder, offsetstpe, offsetsval, lenstarts, lenoffsets
return starts, stops

def lower_getitem_next(context, builder, arraytpe, wheretpe, arrayval, whereval, advanced):
import awkward1._numba.listarray
import awkward1._numba.array.listarray

if len(wheretpe.types) == 0:
return arrayval
Expand Down Expand Up @@ -361,7 +361,7 @@ def lower_getitem_next(context, builder, arraytpe, wheretpe, arrayval, whereval,
outcontenttpe = nextcontenttpe.getitem_next(tailtpe, True)
outcontentval = nextcontenttpe.lower_getitem_next(context, builder, nextcontenttpe, tailtpe, nextcontentval, tailval, nextadvanced)

outtpe = awkward1._numba.listoffsetarray.ListOffsetArrayType(util.indextpe(arraytpe.bitwidth), outcontenttpe, arraytpe.idtpe)
outtpe = awkward1._numba.array.listoffsetarray.ListOffsetArrayType(util.indextpe(arraytpe.bitwidth), outcontenttpe, arraytpe.idtpe)
proxyout = numba.cgutils.create_struct_proxy(outtpe)(context, builder)
proxyout.offsets = nextoffsets
proxyout.content = outcontentval
Expand Down Expand Up @@ -457,15 +457,15 @@ def lower_getitem_next(context, builder, arraytpe, wheretpe, arrayval, whereval,
raise AssertionError(headtpe)

def lower_carry(context, builder, arraytpe, carrytpe, arrayval, carryval):
import awkward1._numba.listarray
import awkward1._numba.array.listarray

proxyin = numba.cgutils.create_struct_proxy(arraytpe)(context, builder, value=arrayval)
lenoffsets = util.arraylen(context, builder, arraytpe.offsetstpe, proxyin.offsets, totpe=numba.int64)
lenstarts = builder.sub(lenoffsets, context.get_constant(numba.int64, 1))

starts, stops = starts_stops(context, builder, arraytpe.offsetstpe, proxyin.offsets, lenstarts, lenoffsets)

proxyout = numba.cgutils.create_struct_proxy(awkward1._numba.listarray.ListArrayType(arraytpe.offsetstpe, arraytpe.offsetstpe, arraytpe.contenttpe, arraytpe.idtpe))(context, builder)
proxyout = numba.cgutils.create_struct_proxy(awkward1._numba.array.listarray.ListArrayType(arraytpe.offsetstpe, arraytpe.offsetstpe, arraytpe.contenttpe, arraytpe.idtpe))(context, builder)
proxyout.starts = numba.targets.arrayobj.fancy_getitem_array(context, builder, arraytpe.offsetstpe(arraytpe.offsetstpe, carrytpe), (starts, carryval))
proxyout.stops = numba.targets.arrayobj.fancy_getitem_array(context, builder, arraytpe.offsetstpe(arraytpe.offsetstpe, carrytpe), (stops, carryval))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numba.typing.ctypes_utils

import awkward1.layout
from .._numba import cpu, util, identity, content
from ..._numba import cpu, util, identity, content

@numba.extending.typeof_impl.register(awkward1.layout.NumpyArray)
def typeof(val, c):
Expand Down
4 changes: 2 additions & 2 deletions awkward1/_numba/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,10 @@ def preprocess_slicetuple(context, builder, wheretpe, whereval):
return wheretpe3, whereval3

def wrap_for_slicetuple(context, builder, arraytpe, arrayval):
import awkward1._numba.listarray
import awkward1._numba.array.listarray

length = arraylen(context, builder, arraytpe, arrayval, totpe=numba.int64)
nexttpe = awkward1._numba.listarray.ListArrayType(index64tpe, index64tpe, arraytpe, numba.types.none)
nexttpe = awkward1._numba.array.listarray.ListArrayType(index64tpe, index64tpe, arraytpe, numba.types.none)
proxynext = numba.cgutils.create_struct_proxy(nexttpe)(context, builder)
proxynext.starts = newindex64(context, builder, numba.int64, context.get_constant(numba.int64, 1))
proxynext.stops = newindex64(context, builder, numba.int64, context.get_constant(numba.int64, 1))
Expand Down
4 changes: 2 additions & 2 deletions awkward1/signatures/Content_8cpp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.16">
<compounddef id="Content_8cpp" kind="file" language="C++">
<compoundname>Content.cpp</compoundname>
<includes local="yes">awkward/ListArray.h</includes>
<includes local="yes">awkward/array/ListArray.h</includes>
<includes local="yes">awkward/Content.h</includes>
<incdepgraph>
<node id="1">
Expand All @@ -17,7 +17,7 @@
<label>awkward/Content.h</label>
</node>
<node id="2">
<label>awkward/ListArray.h</label>
<label>awkward/array/ListArray.h</label>
</node>
</incdepgraph>
<innernamespace refid="namespaceawkward">awkward</innernamespace>
Expand Down
26 changes: 13 additions & 13 deletions awkward1/signatures/ListArray_8cpp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@
<includes local="yes">awkward/cpu-kernels/identity.h</includes>
<includes local="yes">awkward/cpu-kernels/getitem.h</includes>
<includes local="yes">awkward/Slice.h</includes>
<includes local="yes">awkward/ListOffsetArray.h</includes>
<includes local="yes">awkward/ListArray.h</includes>
<includes local="yes">awkward/array/ListOffsetArray.h</includes>
<includes local="yes">awkward/array/ListArray.h</includes>
<incdepgraph>
<node id="5">
<label>awkward/cpu-kernels/getitem.h</label>
</node>
<node id="4">
<label>awkward/cpu-kernels/identity.h</label>
</node>
<node id="1">
<label>src/libawkward/ListArray.cpp</label>
<label>src/libawkward/array/ListArray.cpp</label>
<link refid="ListArray_8cpp"/>
<childnode refid="2" relation="include">
</childnode>
Expand All @@ -34,27 +31,30 @@
<childnode refid="8" relation="include">
</childnode>
</node>
<node id="4">
<label>awkward/cpu-kernels/identity.h</label>
</node>
<node id="7">
<label>awkward/array/ListOffsetArray.h</label>
</node>
<node id="2">
<label>sstream</label>
</node>
<node id="8">
<label>awkward/array/ListArray.h</label>
</node>
<node id="6">
<label>awkward/Slice.h</label>
</node>
<node id="7">
<label>awkward/ListOffsetArray.h</label>
</node>
<node id="3">
<label>type_traits</label>
</node>
<node id="8">
<label>awkward/ListArray.h</label>
</node>
</incdepgraph>
<innernamespace refid="namespaceawkward">awkward</innernamespace>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<location file="src/libawkward/ListArray.cpp"/>
<location file="src/libawkward/array/ListArray.cpp"/>
</compounddef>
</doxygen>
42 changes: 21 additions & 21 deletions awkward1/signatures/ListOffsetArray_8cpp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,17 @@
<includes local="yes">awkward/cpu-kernels/identity.h</includes>
<includes local="yes">awkward/cpu-kernels/getitem.h</includes>
<includes local="yes">awkward/Slice.h</includes>
<includes local="yes">awkward/ListArray.h</includes>
<includes local="yes">awkward/ListOffsetArray.h</includes>
<includes local="yes">awkward/array/ListArray.h</includes>
<includes local="yes">awkward/array/ListOffsetArray.h</includes>
<incdepgraph>
<node id="5">
<label>awkward/cpu-kernels/getitem.h</label>
</node>
<node id="4">
<label>awkward/cpu-kernels/identity.h</label>
</node>
<node id="2">
<label>sstream</label>
</node>
<node id="6">
<label>awkward/Slice.h</label>
</node>
<node id="8">
<label>awkward/ListOffsetArray.h</label>
</node>
<node id="3">
<label>type_traits</label>
</node>
<node id="7">
<label>awkward/ListArray.h</label>
</node>
<node id="1">
<label>src/libawkward/ListOffsetArray.cpp</label>
<label>src/libawkward/array/ListOffsetArray.cpp</label>
<link refid="ListOffsetArray_8cpp"/>
<childnode refid="2" relation="include">
</childnode>
Expand All @@ -49,6 +34,21 @@
<childnode refid="8" relation="include">
</childnode>
</node>
<node id="8">
<label>awkward/array/ListOffsetArray.h</label>
</node>
<node id="2">
<label>sstream</label>
</node>
<node id="7">
<label>awkward/array/ListArray.h</label>
</node>
<node id="6">
<label>awkward/Slice.h</label>
</node>
<node id="3">
<label>type_traits</label>
</node>
</incdepgraph>
<innernamespace refid="namespaceawkward">awkward</innernamespace>
<sectiondef kind="func">
Expand All @@ -72,7 +72,7 @@
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="src/libawkward/ListOffsetArray.cpp" line="28" column="11" bodyfile="src/libawkward/ListOffsetArray.cpp" bodystart="28" bodyend="30"/>
<location file="src/libawkward/array/ListOffsetArray.cpp" line="28" column="11" bodyfile="src/libawkward/array/ListOffsetArray.cpp" bodystart="28" bodyend="30"/>
</memberdef>
<memberdef kind="function" id="namespaceawkward_1aa3d73a21953e0578aa577329c38dc0ed" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<templateparamlist>
Expand All @@ -94,13 +94,13 @@
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="src/libawkward/ListOffsetArray.cpp" line="33" column="11" bodyfile="src/libawkward/ListOffsetArray.cpp" bodystart="33" bodyend="35"/>
<location file="src/libawkward/array/ListOffsetArray.cpp" line="33" column="11" bodyfile="src/libawkward/array/ListOffsetArray.cpp" bodystart="33" bodyend="35"/>
</memberdef>
</sectiondef>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<location file="src/libawkward/ListOffsetArray.cpp"/>
<location file="src/libawkward/array/ListOffsetArray.cpp"/>
</compounddef>
</doxygen>
Loading

0 comments on commit 7515064

Please sign in to comment.