Skip to content

Commit

Permalink
Merge branch 'branch-0.15' into 0.15-notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
BradReesWork authored Aug 20, 2020
2 parents f5f49e2 + 635fff8 commit f193fc1
Show file tree
Hide file tree
Showing 208 changed files with 3,235 additions and 1,539 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
- PR #1010 MG BFS (dask)
- PR #1018 MG personalized pagerank
- PR #1047 Updated select tests to use new dataset list that includes asymmetric directed graph
- PR #1090 Add experimental Leiden function
- PR #1077 Updated/added copyright notices, added copyright CI check from cuml
- PR #1100 Add support for new build process (Project Flash)
- PR #1093 New benchmarking notebook

## Improvements
- PR #898 Add Edge Betweenness Centrality, and endpoints to BC
- PR #913 Eliminate `rmm.device_array` usage
Expand Down Expand Up @@ -59,6 +62,7 @@
- PR #1034 Expose resolution (gamma) parameter in Louvain
- PR #1037 Centralize test main function and replace usage of deprecated `cnmem_memory_resource`
- PR #1041 Use S3 bucket directly for benchmark plugin
- PR #1056 Fix MG BFS performance
- PR #1062 Compute max_vertex_id in mnmg local data computation
- PR #1068 Remove unused thirdparty code

Expand All @@ -81,6 +85,9 @@
- PR #1057 Updated raft dependency to pull fixes on cusparse selection in CUDA 11
- PR #1066 Update cugunrock to not build for unsupported CUDA architectures
- PR #1069 Fixed CUDA 11 Pagerank crash, by replacing CUB's SpMV with raft's.
- PR #1083 Fix NBs to run in nightly test run, update renumbering text, cleanup
- PR #1087 Updated benchmarks README to better describe how to get plugin, added rapids-pytest-benchmark plugin to conda dev environments
- PR #1101 Removed unnecessary device-to-host copy which caused a performance regression

# cuGraph 0.14.0 (03 Jun 2020)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ for i in range(len(df_page)):
| | Betweenness Centrality | Single-GPU | |
| | Edge Betweenness Centrality | Single-GPU | |
| Community | | | |
| | Leiden | Single-GPU | |
| | Louvain | Single-GPU | |
| | Ensemble Clustering for Graphs | Single-GPU | |
| | Spectral-Clustering - Balanced Cut | Single-GPU | |
Expand Down
5 changes: 2 additions & 3 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ directory under the root of the `cuGraph` source tree.
* cugraph built and installed (or `cugraph` sources and built C++ extensions
available on `PYTHONPATH`)

* rapids-pytest-benchmark pytest plugin (`conda install -c rlratzel
* rapids-pytest-benchmark pytest plugin (`conda install -c rapidsai
rapids-pytest-benchmark`)
* NOTE: the `rlratzel` channel is temporary! This plugin will eventually be
moved to a more standard channel

* The benchmark datasets downloaded and installed in <cugraph>/datasets. Run the
script below from the <cugraph>/datasets directory:
Expand All @@ -37,6 +35,7 @@ cd <cugraph>/datasets

## Examples
### Python
_**NOTE: these commands must be run from the `<cugraph_root>/benchmarks` directory.**_
* Run all the benchmarks and print their names on a separate line (`-v`), and generate a report to stdout
```
(rapids) user@machine:/cugraph/benchmarks> pytest -v
Expand Down
13 changes: 13 additions & 0 deletions benchmarks/bench_algos.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Copyright (c) 2020, NVIDIA CORPORATION.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import pytest

import pytest_benchmark
Expand Down
12 changes: 12 additions & 0 deletions benchmarks/params.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# Copyright (c) 2020, NVIDIA CORPORATION.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from itertools import product

import pytest
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ HELP="$0 [<target> ...] [<flag> ...]
default action (no args) is to build and install 'libcugraph' then 'cugraph' targets
"
LIBCUGRAPH_BUILD_DIR=${REPODIR}/cpp/build
LIBCUGRAPH_BUILD_DIR=${LIBCUGRAPH_BUILD_DIR:=${REPODIR}/cpp/build}
CUGRAPH_BUILD_DIR=${REPODIR}/python/build
BUILD_DIRS="${LIBCUGRAPH_BUILD_DIR} ${CUGRAPH_BUILD_DIR}"

Expand Down Expand Up @@ -116,7 +116,7 @@ if (( ${NUMARGS} == 0 )) || hasArg cugraph; then

cd ${REPODIR}/python
if [[ ${INSTALL_TARGET} != "" ]]; then
python setup.py build_ext --inplace
python setup.py build_ext --inplace --library-dir=${LIBCUGRAPH_BUILD_DIR}
python setup.py install
else
python setup.py build_ext --inplace --library-dir=${LIBCUGRAPH_BUILD_DIR}
Expand Down
2 changes: 1 addition & 1 deletion ci/benchmark/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright (c) 2018, NVIDIA CORPORATION.
# Copyright (c) 2018-2020, NVIDIA CORPORATION.
##########################################
# cuGraph Benchmark test script for CI #
##########################################
Expand Down
2 changes: 1 addition & 1 deletion ci/checks/changelog.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2018, NVIDIA CORPORATION.
# Copyright (c) 2018-2020, NVIDIA CORPORATION.
############################
# cuGraph CHANGELOG Tester #
############################
Expand Down
189 changes: 189 additions & 0 deletions ci/checks/copyright.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# Copyright (c) 2019-2020, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import datetime
import re
import argparse
import io
import os
import git_helpers

FilesToCheck = [
re.compile(r"[.](cmake|cpp|cu|cuh|h|hpp|sh|pxd|py|pyx)$"),
re.compile(r"CMakeLists[.]txt$"),
re.compile(r"CMakeLists_standalone[.]txt$"),
re.compile(r"setup[.]cfg$"),
re.compile(r"[.]flake8[.]cython$"),
re.compile(r"meta[.]yaml$")
]

# this will break starting at year 10000, which is probably OK :)
CheckSimple = re.compile(r"Copyright \(c\) (\d{4}), NVIDIA CORPORATION")
CheckDouble = re.compile(
r"Copyright \(c\) (\d{4})-(\d{4}), NVIDIA CORPORATION")


def checkThisFile(f):
# This check covers things like symlinks which point to files that DNE
if not(os.path.exists(f)):
return False
if git_helpers and git_helpers.isFileEmpty(f):
return False
for checker in FilesToCheck:
if checker.search(f):
return True
return False


def getCopyrightYears(line):
res = CheckSimple.search(line)
if res:
return (int(res.group(1)), int(res.group(1)))
res = CheckDouble.search(line)
if res:
return (int(res.group(1)), int(res.group(2)))
return (None, None)


def replaceCurrentYear(line, start, end):
# first turn a simple regex into double (if applicable). then update years
res = CheckSimple.sub(r"Copyright (c) \1-\1, NVIDIA CORPORATION", line)
res = CheckDouble.sub(
r"Copyright (c) {:04d}-{:04d}, NVIDIA CORPORATION".format(start, end),
res)
return res


def checkCopyright(f, update_current_year):
"""
Checks for copyright headers and their years
"""
errs = []
thisYear = datetime.datetime.now().year
lineNum = 0
crFound = False
yearMatched = False
with io.open(f, "r", encoding="utf-8") as fp:
lines = fp.readlines()
for line in lines:
lineNum += 1
start, end = getCopyrightYears(line)
if start is None:
continue
crFound = True
if start > end:
e = [f, lineNum, "First year after second year in the copyright "
"header (manual fix required)", None]
errs.append(e)
if thisYear < start or thisYear > end:
e = [f, lineNum, "Current year not included in the "
"copyright header", None]
if thisYear < start:
e[-1] = replaceCurrentYear(line, thisYear, end)
if thisYear > end:
e[-1] = replaceCurrentYear(line, start, thisYear)
errs.append(e)
else:
yearMatched = True
fp.close()
# copyright header itself not found
if not crFound:
e = [f, 0, "Copyright header missing or formatted incorrectly "
"(manual fix required)", None]
errs.append(e)
# even if the year matches a copyright header, make the check pass
if yearMatched:
errs = []

if update_current_year:
errs_update = [x for x in errs if x[-1] is not None]
if len(errs_update) > 0:
print("File: {}. Changing line(s) {}".format(
f, ', '.join(str(x[1]) for x in errs if x[-1] is not None)))
for _, lineNum, __, replacement in errs_update:
lines[lineNum - 1] = replacement
with io.open(f, "w", encoding="utf-8") as out_file:
for new_line in lines:
out_file.write(new_line)
errs = [x for x in errs if x[-1] is None]

return errs



def getAllFilesUnderDir(root, pathFilter=None):
retList = []
for (dirpath, dirnames, filenames) in os.walk(root):
for fn in filenames:
filePath = os.path.join(dirpath, fn)
if pathFilter(filePath):
retList.append(filePath)
return retList


def checkCopyright_main():
"""
Checks for copyright headers in all the modified files. In case of local
repo, this script will just look for uncommitted files and in case of CI
it compares between branches "$PR_TARGET_BRANCH" and "current-pr-branch"
"""
retVal = 0

argparser = argparse.ArgumentParser(
description="Checks for a consistent copyright header")
argparser.add_argument("--update-current-year", dest='update_current_year',
action="store_true", required=False, help="If set, "
"update the current year if a header is already "
"present and well formatted.")
argparser.add_argument("--git-modified-only", dest='git_modified_only',
action="store_true", required=False, help="If set, "
"only files seen as modified by git will be "
"processed.")

(args, dirs) = argparser.parse_known_args()
if args.git_modified_only:
files = git_helpers.modifiedFiles(pathFilter=checkThisFile)
else:
files = []
for d in [os.path.abspath(d) for d in dirs]:
if not(os.path.isdir(d)):
raise ValueError(f"{d} is not a directory.")
files += getAllFilesUnderDir(d, pathFilter=checkThisFile)

errors = []
for f in files:
errors += checkCopyright(f, args.update_current_year)

if len(errors) > 0:
print("Copyright headers incomplete in some of the files!")
for e in errors:
print(" %s:%d Issue: %s" % (e[0], e[1], e[2]))
print("")
n_fixable = sum(1 for e in errors if e[-1] is not None)
path_parts = os.path.abspath(__file__).split(os.sep)
file_from_repo = os.sep.join(path_parts[path_parts.index("ci"):])
if n_fixable > 0:
print("You can run {} --update-current-year to fix {} of these "
"errors.\n".format(file_from_repo, n_fixable))
retVal = 1
else:
print("Copyright check passed")

return retVal


if __name__ == "__main__":
import sys
sys.exit(checkCopyright_main())
34 changes: 26 additions & 8 deletions ci/checks/style.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
#!/bin/bash
# Copyright (c) 2018, NVIDIA CORPORATION.
# Copyright (c) 2018-2020, NVIDIA CORPORATION.
########################
# cuGraph Style Tester #
########################

# Ignore errors and set path
set +e
# Assume this script is run from the root of the cugraph repo

# Make failing commands visible when used in a pipeline and allow the script to
# continue on errors, but use ERRORCODE to still allow any failing command to be
# captured for returning a final status code. This allows all style check to
# take place to provide a more comprehensive list of style violations.
set -o pipefail
ERRORCODE=0
PATH=/conda/bin:$PATH

# Activate common conda env
source activate gdf

# Run flake8 and get results/return code
FLAKE=`flake8 --config=python/.flake8 python`
FLAKE_RETVAL=$?
ERRORCODE=$((ERRORCODE | $?))

# Run clang-format and check for a consistent code format
CLANG_FORMAT=`python cpp/scripts/run-clang-format.py 2>&1`
CLANG_FORMAT_RETVAL=$?
ERRORCODE=$((ERRORCODE | ${CLANG_FORMAT_RETVAL}))

# Output results if failure otherwise show pass
if [ "$FLAKE" != "" ]; then
Expand All @@ -36,8 +43,19 @@ else
echo -e "\n\n>>>> PASSED: clang format check\n\n"
fi

RETVALS=($FLAKE_RETVAL $CLANG_FORMAT_RETVAL)
IFS=$'\n'
RETVAL=`echo "${RETVALS[*]}" | sort -nr | head -n1`
# Check for copyright headers in the files modified currently
#COPYRIGHT=`env PYTHONPATH=ci/utils python ci/checks/copyright.py cpp python benchmarks ci 2>&1`
COPYRIGHT=`env PYTHONPATH=ci/utils python ci/checks/copyright.py --git-modified-only 2>&1`
CR_RETVAL=$?
ERRORCODE=$((ERRORCODE | ${CR_RETVAL}))

# Output results if failure otherwise show pass
if [ "$CR_RETVAL" != "0" ]; then
echo -e "\n\n>>>> FAILED: copyright check; begin output\n\n"
echo -e "$COPYRIGHT"
echo -e "\n\n>>>> FAILED: copyright check; end output\n\n"
else
echo -e "\n\n>>>> PASSED: copyright check\n\n"
fi

exit $RETVAL
exit ${ERRORCODE}
2 changes: 1 addition & 1 deletion ci/cpu/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2018, NVIDIA CORPORATION.
# Copyright (c) 2018-2020, NVIDIA CORPORATION.
#########################################
# cuGraph CPU conda build script for CI #
#########################################
Expand Down
Loading

0 comments on commit f193fc1

Please sign in to comment.