Skip to content

Commit

Permalink
Added OpenMPTarget Jenkins Test (#24)
Browse files Browse the repository at this point in the history
* Added OpenMPTarget

* fix to exclude in _conftest and views

* Update .jenkins

* Use ROCm OpenMPTarget

* Dockerfile and Jenkins updates

* Update .jenkins
  • Loading branch information
jrmadsen authored Jun 9, 2021
1 parent fa7bf8e commit 5033325
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 40 deletions.
85 changes: 80 additions & 5 deletions .jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,18 @@ pipeline {
-DENABLE_CTP=ON \
-DPython3_EXECUTABLE=$(which python3)'''
sh 'cmake --build build --target all --parallel ${BUILD_JOBS} -- VERBOSE=1'
sh 'cmake --build build --target analyze-pykokkos-base-compile-time'
sh 'cmake --build build --target analyze-pykokkos-base-compile-time | tee build/${STAGE_NAME}-pykokkos-base-compile-time.txt'
sh 'cmake --build build --target install --parallel ${BUILD_JOBS}'
sh 'cd build && PYTHONPATH=${PWD} python3 $(which pytest) -s .'
sh 'cd build && PYTHONPATH=${PWD} python3 ./ex-numpy.py'
sh 'cd /tmp && python3 -c "import kokkos; print(kokkos.__file__)"'
}
post {
always {
sh 'ls build/*-compile-time.*'
archiveArtifacts 'build/*-compile-time.*'
}
}
}
stage('CUDA') {
agent {
Expand Down Expand Up @@ -109,13 +115,19 @@ pipeline {
-DENABLE_TIMING=ON \
-DPython3_EXECUTABLE=$(which python3)'''
sh 'cmake --build build --target all --parallel $((${BUILD_JOBS}/2)) -- VERBOSE=1'
sh 'cmake --build build --target analyze-pykokkos-base-compile-time'
sh 'cmake --build build --target analyze-pykokkos-base-compile-time | tee build/${STAGE_NAME}-pykokkos-base-compile-time.txt'
sh 'cmake --build build --target install --parallel ${BUILD_JOBS}'
sh 'cd build && cat nvcc-compile-time.csv'
sh 'cd build && mv nvcc-compile-time.csv ${STAGE_NAME}-nvcc-compile-time.csv && cat ${STAGE_NAME}-nvcc-compile-time.csv'
sh 'cd build && PYTHONPATH=${PWD} python3 $(which pytest) -s .'
sh 'cd build && PYTHONPATH=${PWD} python3 ./ex-numpy.py'
sh 'cd /tmp && python3 -c "import kokkos; print(kokkos.__file__)"'
}
post {
always {
sh 'ls build/*-compile-time.*'
archiveArtifacts 'build/*-compile-time.*'
}
}
}
stage('CUDA-UVM') {
agent {
Expand Down Expand Up @@ -155,6 +167,7 @@ pipeline {
sh '''cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_UNITY_BUILD=OFF \
-DENABLE_VIEW_RANKS=3 \
-DENABLE_LAYOUTS=ON \
-DENABLE_MEMORY_TRAITS=OFF \
-DENABLE_EXAMPLES=ON \
Expand All @@ -163,13 +176,75 @@ pipeline {
-DENABLE_CTP=ON \
-DPython3_EXECUTABLE=$(which python3)'''
sh 'cmake --build build --target all --parallel $((${BUILD_JOBS}/2)) -- VERBOSE=1'
sh 'cmake --build build --target analyze-pykokkos-base-compile-time'
sh 'cmake --build build --target analyze-pykokkos-base-compile-time | tee build/${STAGE_NAME}-pykokkos-base-compile-time.txt'
sh 'cmake --build build --target install --parallel ${BUILD_JOBS}'
sh 'cd build && cat nvcc-compile-time.csv'
sh 'cd build && mv nvcc-compile-time.csv ${STAGE_NAME}-nvcc-compile-time.csv && cat ${STAGE_NAME}-nvcc-compile-time.csv'
sh 'cd build && PYTHONPATH=${PWD} python3 $(which pytest) -s .'
sh 'cd build && PYTHONPATH=${PWD} python3 ./ex-numpy.py'
sh 'cd /tmp && python3 -c "import kokkos; print(kokkos.__file__)"'
}
post {
always {
sh 'ls build/*-compile-time.*'
archiveArtifacts 'build/*-compile-time.*'
}
}
}
stage('OpenMPTarget') {
agent {
dockerfile {
filename 'Dockerfile.hipcc'
dir 'scripts/docker'
label 'rocm-docker && vega && AMD_Radeon_Instinct_MI60'
args '-v /tmp/ccache.kokkos:/tmp/ccache --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --env HIP_VISIBLE_DEVICES=$HIP_VISIBLE_DEVICES'
}
}
environment {
OMP_NUM_THREADS = 8
OMP_PLACES = 'threads'
OMP_PROC_BIND = 'spread'
PYTHONPATH = '/usr/local/lib/python3.8/site-packages'
}
steps {
sh 'echo "/opt/rocm/llvm/lib" > /etc/ld.so.conf.d/llvm.conf && ldconfig'
sh 'ccache --zero-stats'
sh 'rm -rf build /tmp/kokkos-build /tmp/kokkos-source'
sh 'git clone -b develop https://github.com/kokkos/kokkos.git /tmp/kokkos-source'
sh '''cmake -B /tmp/kokkos-build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_CXX_STANDARD=17 \
-DKokkos_ENABLE_SERIAL=ON \
-DKokkos_ENABLE_OPENMPTARGET=ON \
-DKokkos_ARCH_VEGA906=ON \
-DBUILD_SHARED_LIBS=ON \
/tmp/kokkos-source'''
sh 'cmake --build /tmp/kokkos-build --target all --parallel ${BUILD_JOBS}'
sh 'cmake --build /tmp/kokkos-build --target install --parallel ${BUILD_JOBS}'
sh 'python3 -m pip install -r requirements.txt'
sh 'python3 -m pip install pytest'
sh '''cmake -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_UNITY_BUILD=OFF \
-DENABLE_LAYOUTS=ON \
-DENABLE_MEMORY_TRAITS=OFF \
-DENABLE_EXAMPLES=ON \
-DENABLE_WERROR=OFF \
-DENABLE_CTP=ON \
-DPython3_EXECUTABLE=$(which python3)'''
sh 'cmake --build build --target all --parallel ${BUILD_JOBS} -- VERBOSE=1'
sh 'cmake --build build --target analyze-pykokkos-base-compile-time | tee build/${STAGE_NAME}-pykokkos-base-compile-time.txt'
sh 'cmake --build build --target install --parallel ${BUILD_JOBS}'
sh 'cd build && PYTHONPATH=${PWD} python3 $(which pytest) -s .'
sh 'cd build && PYTHONPATH=${PWD} python3 ./ex-numpy.py'
sh 'cd /tmp && python3 -c "import kokkos; print(kokkos.__file__)"'
}
post {
always {
sh 'ls build/*-compile-time.*'
archiveArtifacts 'build/*-compile-time.*'
}
}
}
}
}
Expand Down
12 changes: 8 additions & 4 deletions kokkos/test/_conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ def generate_variant(*_args, **_kwargs):
def get_variants(exclude=[]):
"""Return a list of all view variants"""
_variants = []

def _skip(_key, _value):
return _key in exclude.keys() and _value in exclude[_key]

for _dims in range(1, get_max_concrete_dims()):
_shape = []
_idx = []
Expand All @@ -131,16 +135,16 @@ def get_variants(exclude=[]):
_idx.append((i + 1) % 2)

for _dtype in get_dtypes():
if _dtype in exclude:
if _skip("dtypes", _dtype):
continue
for _space in get_memory_spaces():
if _space in exclude:
if _skip("memory_spaces", _space):
continue
for _layout in get_layouts():
if _layout in exclude:
if _skip("layouts", _layout):
continue
for _trait in get_memory_traits():
if _trait in exclude:
if _skip("memory_traits", _trait):
continue
_variant = {}
_variant["dtype"] = _dtype
Expand Down
50 changes: 27 additions & 23 deletions kokkos/test/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def tearDown(self):

def _print_info(self, _data):
print(
"[{}]> concrete type : {}".format(
self.shortDescription(), type(_data[0]).__name__
"[{}]> concrete type : {}{}".format(
self.shortDescription(), " " * 7, type(_data[0]).__name__
)
)
print(
Expand Down Expand Up @@ -116,18 +116,18 @@ def test_view_access(self):
"""view_access"""

print("")
for itr in conf.get_variants(exclude=[kokkos.Atomic]):
for itr in conf.get_variants({"memory_traits": [kokkos.Atomic]}):
_shape = itr[0]
_idx = itr[1]
_zeros = itr[2]
_kwargs = itr[3]

_data = conf.generate_variant(_shape, **_kwargs)

_host = [_data[0].create_mirror_view(), _data[1].create_mirror_view()]

self._print_info(_data)

_host = [_data[0].create_mirror_view(), _data[1].create_mirror_view()]

_host[0][_idx] = 1
_host[1][_idx] = 2

Expand All @@ -145,18 +145,18 @@ def test_view_iadd(self):
"""view_iadd"""

print("")
for itr in conf.get_variants(exclude=[kokkos.Atomic]):
for itr in conf.get_variants({"memory_traits": [kokkos.Atomic]}):
_shape = itr[0]
_idx = itr[1]
_zeros = itr[2]
_kwargs = itr[3]

_data = conf.generate_variant(_shape, **_kwargs)

_host = [_data[0].create_mirror_view(), _data[1].create_mirror_view()]

self._print_info(_data)

_host = [_data[0].create_mirror_view(), _data[1].create_mirror_view()]

_host[0][_idx] = 1
_host[1][_idx] = 2

Expand All @@ -175,18 +175,18 @@ def test_view_isub(self):
"""view_isub"""

print("")
for itr in conf.get_variants(exclude=[kokkos.Atomic]):
for itr in conf.get_variants({"memory_traits": [kokkos.Atomic]}):
_shape = itr[0]
_idx = itr[1]
_zeros = itr[2]
_kwargs = itr[3]

_data = conf.generate_variant(_shape, **_kwargs)

_host = [_data[0].create_mirror_view(), _data[1].create_mirror_view()]

self._print_info(_data)

_host = [_data[0].create_mirror_view(), _data[1].create_mirror_view()]

_host[0][_idx] = 10
_host[1][_idx] = 20

Expand All @@ -205,18 +205,18 @@ def test_view_imul(self):
"""view_imul"""

print("")
for itr in conf.get_variants(exclude=[kokkos.Atomic]):
for itr in conf.get_variants({"memory_traits": [kokkos.Atomic]}):
_shape = itr[0]
_idx = itr[1]
_zeros = itr[2]
_kwargs = itr[3]

_data = conf.generate_variant(_shape, **_kwargs)

_host = [_data[0].create_mirror_view(), _data[1].create_mirror_view()]

self._print_info(_data)

_host = [_data[0].create_mirror_view(), _data[1].create_mirror_view()]

_host[0][_idx] = 1
_host[1][_idx] = 2

Expand All @@ -235,18 +235,20 @@ def test_view_imul(self):
def test_view_create_mirror(self):
"""view_create_mirror"""
print("")
for itr in conf.get_variants(exclude=[kokkos.Atomic, kokkos.Unmanaged]):
for itr in conf.get_variants(
{"memory_traits": [kokkos.Atomic], "layouts": [kokkos.Unmanaged]}
):
_shape = itr[0]
_idx = itr[1]
_zeros = itr[2]
_kwargs = itr[3]

_data = conf.generate_variant(_shape, **_kwargs)

_host = [_data[0].create_mirror_view(), _data[1].create_mirror_view()]

self._print_info(_data)

_host = [_data[0].create_mirror_view(), _data[1].create_mirror_view()]

_host[0][_idx] = 1
_host[1][_idx] = 2

Expand Down Expand Up @@ -286,18 +288,18 @@ def test_view_create_mirror_view(self):
"""view_create_mirror_view"""

print("")
for itr in conf.get_variants(exclude=[kokkos.Atomic]):
for itr in conf.get_variants({"memory_traits": [kokkos.Atomic]}):
_shape = itr[0]
_idx = itr[1]
_zeros = itr[2]
_kwargs = itr[3]

_data = conf.generate_variant(_shape, **_kwargs)

_host = [_data[0].create_mirror_view(), _data[1].create_mirror_view()]

self._print_info(_data)

_host = [_data[0].create_mirror_view(), _data[1].create_mirror_view()]

_host[0][_idx] = 1
_host[1][_idx] = 2

Expand Down Expand Up @@ -344,7 +346,9 @@ def test_view_create_mirror_view(self):
def test_view_deep_copy(self):
"""view_deep_copy"""
print("")
for itr in conf.get_variants(exclude=[kokkos.Atomic, kokkos.Unmanaged]):
for itr in conf.get_variants(
{"memory_traits": [kokkos.Atomic], "layouts": [kokkos.Unmanaged]}
):
_shape = itr[0]
_idx = itr[1]
_zeros = itr[2]
Expand All @@ -354,10 +358,10 @@ def test_view_deep_copy(self):

_data = conf.generate_variant(_shape, **_kwargs)

_host = [_data[0].create_mirror_view(), _data[1].create_mirror_view()]

self._print_info(_data)

_host = [_data[0].create_mirror_view(), _data[1].create_mirror_view()]

_host[0][_idx] = 1
_host[1][_idx] = 2

Expand Down
9 changes: 6 additions & 3 deletions scripts/docker/Dockerfile.hipcc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ FROM $BASE

ARG ADDITIONAL_PACKAGES

ENV PATH=/opt/rocm/bin:$PATH

RUN apt-get update && apt-get install -y \
bc \
git \
Expand All @@ -15,9 +17,10 @@ RUN apt-get update && apt-get install -y \
apt-get --purge autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
python3 -m pip install 'cmake==3.18.4'

ENV PATH=/opt/rocm/bin:$PATH
python3 -m pip install 'cmake==3.18.4' && \
update-alternatives --install /usr/bin/clang clang /opt/rocm/llvm/bin/clang 50 --slave /usr/bin/clang++ clang++ /opt/rocm/llvm/bin/clang++ && \
update-alternatives --install $(which cc) cc /usr/bin/clang 50 && \
update-alternatives --install $(which c++) c++ /usr/bin/clang++ 50

RUN git clone https://github.com/jrmadsen/compile-time-perf.git /tmp/ctp-source && \
cmake -B /tmp/ctp-build /tmp/ctp-source && \
Expand Down
6 changes: 3 additions & 3 deletions scripts/docker/Dockerfile.nvcc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ RUN apt-get update && apt-get install -y \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
python3 -m pip install 'cmake==3.18.4' && \
update-alternatives --install $(which gcc) gcc $(which gcc-7) 20 --slave $(which g++) g++ $(which g++-7) && \
update-alternatives --install $(which cc) cc $(which gcc) 20 && \
update-alternatives --install $(which c++) c++ $(which g++) 20
update-alternatives --install $(which gcc) gcc $(which gcc-7) 50 --slave $(which g++) g++ $(which g++-7) && \
update-alternatives --install $(which cc) cc $(which gcc) 50 && \
update-alternatives --install $(which c++) c++ $(which g++) 50

RUN git clone https://github.com/jrmadsen/compile-time-perf.git /tmp/ctp-source && \
cmake -B /tmp/ctp-build /tmp/ctp-source && \
Expand Down
4 changes: 2 additions & 2 deletions scripts/docker/Dockerfile.openmptarget
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ RUN LLVM_VERSION=887c7660bdf3f300bd1997dcfd7ace91787c0584 && \
make install && \
echo "${LLVM_DIR}/lib" > /etc/ld.so.conf.d/llvm.conf && ldconfig && \
rm -rf ${SCRATCH_DIR} && \
update-alternatives --install $(which cc) cc $(which clang) 20 && \
update-alternatives --install $(which c++) c++ $(which clang++) 20
update-alternatives --install $(which cc) cc $(which clang) 50 && \
update-alternatives --install $(which c++) c++ $(which clang++) 50

RUN git clone https://github.com/jrmadsen/compile-time-perf.git /tmp/ctp-source && \
cmake -B /tmp/ctp-build /tmp/ctp-source && \
Expand Down

0 comments on commit 5033325

Please sign in to comment.