Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REVIEW] Adding CodeCov Info for Dask Tests #3338

Merged
merged 39 commits into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7c28b6e
Adding codecov info for dask tests
mdemoret-nv Jan 4, 2021
8dcdc63
Reverting cov command in build script to be more verbose.
mdemoret-nv Jan 5, 2021
97f3552
Missed adding code cov commands to non-Project Flash section
mdemoret-nv Jan 5, 2021
10afff8
Adding wildcard to the .coverage files that now are appended with pro…
mdemoret-nv Jan 5, 2021
32b81ac
Merge remote-tracking branch 'upstream/branch-0.18' into enh-add-dask…
mdemoret-nv Jan 7, 2021
ba7db8a
Merge remote-tracking branch 'upstream/branch-0.18' into enh-add-dask…
mdemoret-nv Jan 11, 2021
59b50e7
Updating codecov command to tag each report
mdemoret-nv Jan 11, 2021
fee5ea1
Moving ann.pxd implementations into pyx file to see if it fixes Cytho…
mdemoret-nv Jan 12, 2021
aff2f0e
Removing test_nearest_neighbors from pytest to see if coverage is fix…
mdemoret-nv Jan 13, 2021
977879e
Style cleanup
mdemoret-nv Jan 14, 2021
4fcd775
Committing temp workaround to pin ucx=1.8
mdemoret-nv Jan 15, 2021
06c0f38
Adding debug code to determine git info during CI
mdemoret-nv Jan 20, 2021
113f6a3
Moving git info commands to after the `gpuci_logger` function is avai…
mdemoret-nv Jan 21, 2021
ec2ce30
Updating copyright
mdemoret-nv Jan 21, 2021
befe45e
Another test to determine git refs in CI
mdemoret-nv Jan 22, 2021
4ce416f
Adding copyright information
mdemoret-nv Jan 22, 2021
4968008
Reverting temp changes to debug git refs in CI
mdemoret-nv Jan 22, 2021
5c727be
Merge remote-tracking branch 'upstream/branch-0.18' into enh-add-dask…
mdemoret-nv Jan 22, 2021
3296a0e
Reverting codecov binary back to installed version instead of curl.
mdemoret-nv Jan 22, 2021
17905d7
Adding back in debug code. Trying codecov -c
mdemoret-nv Jan 22, 2021
090e300
Fixing hard coded commit ID
mdemoret-nv Jan 23, 2021
eecb818
Removing debug code. Trying to use flags in codecov.yml
mdemoret-nv Jan 26, 2021
544945d
Merge branch 'branch-0.18' into enh-add-dask-codecov
mdemoret-nv Jan 27, 2021
fa45fd5
Fixing bad call to codecov-python CLI
mdemoret-nv Jan 28, 2021
8cf2a68
Removing the codecov.yml flag paths.
mdemoret-nv Feb 2, 2021
7da3824
Setting the codecov commit ID to use REPORT_HASH instead of the Jenki…
mdemoret-nv Feb 2, 2021
7deaedb
Appending the PR to codecov CLI
mdemoret-nv Feb 4, 2021
40894f3
Removing the name in favor of environment variables
mdemoret-nv Feb 4, 2021
01ea620
Merge branch 'branch-0.18' into enh-add-dask-codecov
mdemoret-nv Feb 4, 2021
90a79c3
Adding name back into codecov reports.
mdemoret-nv Feb 4, 2021
da8ae77
Reverting ignoring test_nearest_neighbors.py
mdemoret-nv Feb 8, 2021
aeef32b
Updating .coveragerc based on recommendation from docs.
mdemoret-nv Feb 8, 2021
a5a9ab4
Adding more info to the exclusions with link to the docs.
mdemoret-nv Feb 8, 2021
f311537
Merge branch 'branch-0.18' into enh-add-dask-codecov
mdemoret-nv Feb 9, 2021
415d0e7
Removing extra --ignore from gpu build
mdemoret-nv Feb 9, 2021
735f352
Merge branch 'branch-0.18' into enh-add-dask-codecov
mdemoret-nv Feb 9, 2021
f0b0def
With DNS latency fixed, reverting back to bash uploader
mdemoret-nv Feb 9, 2021
e0a3594
Merge branch 'branch-0.19' into enh-add-dask-codecov
JohnZed Feb 10, 2021
915e1e9
Merge branch 'branch-0.19' into enh-add-dask-codecov
mdemoret-nv Feb 17, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ __pycache__
*.so
*.dylib
.cache
.coverage
.coverage*
.vscode
*.swp
*.pytest_cache
Expand Down
42 changes: 35 additions & 7 deletions ci/gpu/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2018-2020, NVIDIA CORPORATION.
# Copyright (c) 2018-2021, NVIDIA CORPORATION.
##############################################
# cuML GPU build and test script for CI #
##############################################
Expand Down Expand Up @@ -128,9 +128,9 @@ if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then
gpuci_logger "Python pytest for cuml"
cd $WORKSPACE/python

pytest --cache-clear --basetemp=${WORKSPACE}/cuml-cuda-tmp --junitxml=${WORKSPACE}/junit-cuml.xml -v -s -m "not memleak" --durations=50 --timeout=300 --ignore=cuml/test/dask --ignore=cuml/raft --cov-config=.coveragerc --cov=cuml --cov-report=xml:${WORKSPACE}/python/cuml/cuml-coverage.xml --cov-report term
pytest --cache-clear --basetemp=${WORKSPACE}/cuml-cuda-tmp --junitxml=${WORKSPACE}/junit-cuml.xml -v -s -m "not memleak" --durations=50 --timeout=300 --ignore=cuml/test/dask --ignore=cuml/raft --ignore=cuml/test/test_nearest_neighbors.py --cov-config=.coveragerc --cov=cuml --cov-report=xml:${WORKSPACE}/python/cuml/cuml-coverage.xml --cov-report term
mdemoret-nv marked this conversation as resolved.
Show resolved Hide resolved

timeout 7200 sh -c "pytest cuml/test/dask --cache-clear --basetemp=${WORKSPACE}/cuml-mg-cuda-tmp --junitxml=${WORKSPACE}/junit-cuml-mg.xml -v -s -m 'not memleak' --durations=50 --timeout=300"
timeout 7200 sh -c "pytest cuml/test/dask --cache-clear --basetemp=${WORKSPACE}/cuml-mg-cuda-tmp --junitxml=${WORKSPACE}/junit-cuml-mg.xml -v -s -m 'not memleak' --durations=50 --timeout=300 --cov-config=.coveragerc --cov=cuml --cov-report=xml:${WORKSPACE}/python/cuml/cuml-dask-coverage.xml --cov-report term"


################################################################################
Expand Down Expand Up @@ -198,9 +198,9 @@ else
gpuci_logger "Python pytest for cuml"
cd $WORKSPACE/python

pytest --cache-clear --basetemp=${WORKSPACE}/cuml-cuda-tmp --junitxml=${WORKSPACE}/junit-cuml.xml -v -s -m "not memleak" --durations=50 --timeout=300 --ignore=cuml/test/dask --ignore=cuml/raft --cov-config=.coveragerc --cov=cuml --cov-report=xml:${WORKSPACE}/python/cuml/cuml-coverage.xml --cov-report term
pytest --cache-clear --basetemp=${WORKSPACE}/cuml-cuda-tmp --junitxml=${WORKSPACE}/junit-cuml.xml -v -s -m "not memleak" --durations=50 --timeout=300 --ignore=cuml/test/dask --ignore=cuml/raft --ignore=cuml/test/test_nearest_neighbors.py --cov-config=.coveragerc --cov=cuml --cov-report=xml:${WORKSPACE}/python/cuml/cuml-coverage.xml --cov-report term
mdemoret-nv marked this conversation as resolved.
Show resolved Hide resolved

timeout 7200 sh -c "pytest cuml/test/dask --cache-clear --basetemp=${WORKSPACE}/cuml-mg-cuda-tmp --junitxml=${WORKSPACE}/junit-cuml-mg.xml -v -s -m 'not memleak' --durations=50 --timeout=300"
timeout 7200 sh -c "pytest cuml/test/dask --cache-clear --basetemp=${WORKSPACE}/cuml-mg-cuda-tmp --junitxml=${WORKSPACE}/junit-cuml-mg.xml -v -s -m 'not memleak' --durations=50 --timeout=300 --cov-config=.coveragerc --cov=cuml --cov-report=xml:${WORKSPACE}/python/cuml/cuml-dask-coverage.xml --cov-report term"

################################################################################
# TEST - Run notebook tests
Expand Down Expand Up @@ -241,8 +241,36 @@ else

fi

if [ -n "\${CODECOV_TOKEN}" ]; then
codecov -t \$CODECOV_TOKEN
if [ -n "${CODECOV_TOKEN}" ]; then

gpuci_logger "Uploading Code Coverage to codecov.io"

# Directory containing reports
REPORT_DIR="${WORKSPACE}/python/cuml"

# Base name to use in Codecov UI
CODECOV_NAME="${OS},py${PYTHON},cuda${CUDA}"

# Codecov args needed by both calls
EXTRA_CODECOV_ARGS=""

# Save the OS PYTHON and CUDA flags
EXTRA_CODECOV_ARGS="${EXTRA_CODECOV_ARGS} --env OS,PYTHON,CUDA"

# If we have REPORT_HASH, use that instead. This fixes an issue where
# CodeCov uses a local merge commit created by Jenkins. Since this commit
# never gets pushed, it causes issues in Codecov
if [ -n "${REPORT_HASH}" ]; then
EXTRA_CODECOV_ARGS="${EXTRA_CODECOV_ARGS} --commit ${REPORT_HASH}"
fi

# Append the PR ID. This is needed when running the build inside docker
EXTRA_CODECOV_ARGS="${EXTRA_CODECOV_ARGS} --pr ${PR_ID}"

# Upload the two reports with separate flags. Delete the report on success
# to prevent further CI steps from re-uploading
codecov -F non-dask -f ${REPORT_DIR}/cuml-coverage.xml -n "$CODECOV_NAME,non-dask" ${EXTRA_CODECOV_ARGS} && rm ${REPORT_DIR}/cuml-coverage.xml
codecov -F dask -f ${REPORT_DIR}/cuml-dask-coverage.xml -n "$CODECOV_NAME,dask" ${EXTRA_CODECOV_ARGS} && rm ${REPORT_DIR}/cuml-dask-coverage.xml
fi

return ${EXITCODE}
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ coverage:
status:
project: off
patch: off
comment:
behavior: new

20 changes: 18 additions & 2 deletions python/.coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Configuration file for Python coverage tests
[run]
include = cuml/*
omit = cuml/test/*
plugins = Cython.Coverage
plugins = Cython.Coverage
parallel = true
source = cuml

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Don't complain about missing debug-only code:
def __repr__
if self\.debug

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

# Don't complain if non-runnable code isn't run:
if 0:
mdemoret-nv marked this conversation as resolved.
Show resolved Hide resolved
if False:
138 changes: 17 additions & 121 deletions python/cuml/neighbors/ann.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2020, NVIDIA CORPORATION.
# Copyright (c) 2019-2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -20,8 +20,6 @@
from libc.stdint cimport uintptr_t
from libcpp cimport bool

cimport cuml.common.cuda


cdef extern from "cuml/neighbors/knn.hpp" namespace "ML":
cdef cppclass knnIndexParam:
Expand Down Expand Up @@ -53,121 +51,19 @@ cdef extern from "cuml/neighbors/knn.hpp" namespace "ML":
bool encodeResidual


cdef inline check_algo_params(algo, params):
def check_param_list(params, param_list):
for param in param_list:
if not hasattr(params, param):
ValueError('algo_params misconfigured : {} \
parameter unset'.format(param))
if algo == 'ivfflat':
check_param_list(params, ['nlist', 'nprobe'])
elif algo == "ivfpq":
check_param_list(params, ['nlist', 'nprobe', 'M', 'n_bits',
'usePrecomputedTables'])
elif algo == "ivfsq":
check_param_list(params, ['nlist', 'nprobe', 'qtype',
'encodeResidual'])


cdef inline build_ivfflat_algo_params(params, automated):
cdef IVFFlatParam* algo_params = new IVFFlatParam()
if automated:
params = {
'nlist': 8,
'nprobe': 2
}
algo_params.nlist = <int> params['nlist']
algo_params.nprobe = <int> params['nprobe']
return <uintptr_t>algo_params


cdef inline build_ivfpq_algo_params(params, automated, additional_info):
cdef IVFPQParam* algo_params = new IVFPQParam()
if automated:
allowedSubquantizers = [1, 2, 3, 4, 8, 12, 16, 20, 24, 28, 32]
allowedSubDimSize = {1, 2, 3, 4, 6, 8, 10, 12, 16, 20, 24, 28, 32}
N = additional_info['n_samples']
D = additional_info['n_features']

params = {
'nlist': 8,
'nprobe': 3
}

for n_subq in allowedSubquantizers:
if D % n_subq == 0 and (D / n_subq) in allowedSubDimSize:
params['usePrecomputedTables'] = False
params['M'] = n_subq
break

if 'M' not in params:
for n_subq in allowedSubquantizers:
if D % n_subq == 0:
params['usePrecomputedTables'] = True
params['M'] = n_subq
break

for i in reversed(range(1, 4)):
min_train_points = (2 ** i) * 39
if N >= min_train_points:
params['n_bits'] = i
break

algo_params.nlist = <int> params['nlist']
algo_params.nprobe = <int> params['nprobe']
algo_params.M = <int> params['M']
algo_params.n_bits = <int> params['n_bits']
algo_params.usePrecomputedTables = \
<bool> params['usePrecomputedTables']
return <uintptr_t>algo_params


cdef inline build_ivfsq_algo_params(params, automated):
cdef IVFSQParam* algo_params = new IVFSQParam()
if automated:
params = {
'nlist': 8,
'nprobe': 2,
'qtype': 'QT_8bit',
'encodeResidual': True
}

quantizer_type = {
'QT_8bit': <int> QuantizerType.QT_8bit,
'QT_4bit': <int> QuantizerType.QT_4bit,
'QT_8bit_uniform': <int> QuantizerType.QT_8bit_uniform,
'QT_4bit_uniform': <int> QuantizerType.QT_4bit_uniform,
'QT_fp16': <int> QuantizerType.QT_fp16,
'QT_8bit_direct': <int> QuantizerType.QT_8bit_direct,
'QT_6bit': <int> QuantizerType.QT_6bit,
}

algo_params.nlist = <int> params['nlist']
algo_params.nprobe = <int> params['nprobe']
algo_params.qtype = <QuantizerType> quantizer_type[params['qtype']]
algo_params.encodeResidual = <bool> params['encodeResidual']
return <uintptr_t>algo_params


cdef inline build_algo_params(algo, params, additional_info):
automated = params is None or params == 'auto'
if not automated:
check_algo_params(algo, params)

cdef knnIndexParam* algo_params = <knnIndexParam*> 0
if algo == 'ivfflat':
algo_params = <knnIndexParam*><uintptr_t> \
build_ivfflat_algo_params(params, automated)
if algo == 'ivfpq':
algo_params = <knnIndexParam*><uintptr_t> \
build_ivfpq_algo_params(params, automated, additional_info)
elif algo == 'ivfsq':
algo_params = <knnIndexParam*><uintptr_t> \
build_ivfsq_algo_params(params, automated)

return <uintptr_t>algo_params


cdef inline destroy_algo_params(ptr):
cdef knnIndexParam* algo_params = <knnIndexParam*> <uintptr_t> ptr
del algo_params
cdef check_algo_params(algo, params)
JohnZed marked this conversation as resolved.
Show resolved Hide resolved


cdef build_ivfflat_algo_params(params, automated)


cdef build_ivfpq_algo_params(params, automated, additional_info)


cdef build_ivfsq_algo_params(params, automated)


cdef build_algo_params(algo, params, additional_info)


cdef destroy_algo_params(ptr)
Loading