Skip to content

Commit

Permalink
sync with master
Browse files Browse the repository at this point in the history
  • Loading branch information
wxj6000 committed Feb 6, 2024
2 parents f107d4d + eaf83a4 commit db9751b
Show file tree
Hide file tree
Showing 28 changed files with 1,073 additions and 205 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github_actions.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on: [push]
on: #[push]

jobs:
build:
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: self hosted CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
build:

runs-on: self-hosted

steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install flake8 pytest coverage
- name: Build GPU4PySCF
run: |
export CUDA_HOME=/usr/local/cuda
export PATH=${CUDA_HOME}/bin:${PATH}
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:$LD_LIBRARY_PATH
sh build.sh
- name: Test with pytest
run: |
echo $GITHUB_WORKSPACE
export PYTHONPATH="${PYTHONPATH}:$GITHUB_WORKSPACE"
coverage run -m pytest
52 changes: 52 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Contributing Guidelines

We welcome contributions from everyone. Please follow the guidelines below when
adding features to the library for PySCF functions running on GPU devices.

## Principles

* Functions in GPU4PySCF are meant to be performance-optimized versions of
the features implemented in PySCF. The primary focus of this library is on
performance. It is understandable and acceptable to have some API differences
and incompatibilities with the PySCF CPU code.

* GPU4PySCF functions may process input data or objects created by PySCF. It is
important to consider this possibility and perform necessary data type
conversions in GPU4PySCF functions. However, the data or objects produced by
GPU4PySCF do not need to be directly consumed by PySCF functions. In other
words, you only need to ensure that GPU4PySCF supports PySCF functions and not
the other way around.

* GPU4PySCF uses CuPy arrays as the default array container. Please ensure that
functions in GPU4PySCF can handle any possible mixing of CuPy and NumPy
arrays, as many NumPy ufunc operations do not support this mixing.

## Naming Conventions

* If the GPU module has a corresponding one in PySCF, please consider using
the same function names and similar function signatures.

## Additional Suggestions

* If applicable, Please consider providing the `to_cpu` method to convert the
GPU4PySCF object to the corresponding PySCF object, and also providing the
`to_gpu` method in the corresponding classes in PySCF.

* Inheriting classes from the corresponding classes in PySCF is not required.
If you choose to inherit classes from PySCF, please mute the unsupported
methods. You can overwrite the unsupported methods with a dummy method that
raise a `NotImplementedError`. Alternatively, you can assign the Python
keyword `None` or `NotImplemented` to these methods.

* When writing unit tests, please consider including tests:
- To verify the values returned by the functions against the corresponding values in PySCF.
- To ensure proper handling of data conversions for those produced by PySCF CPU code.

* While examples or documentation are not mandatory, it is highly recommended to
include examples of how to invoke the new module.

* CUDA compute capability 70 (sm_70) is required. Please avoid using features
that are only available on CUDA compute capability 80 or newer. The CUDA code
should be compiled and run using CUDA 11 and CUDA 12 toolkits.

Thank you for your contributions!
3 changes: 0 additions & 3 deletions CONTRIBUTIONS.md

This file was deleted.

27 changes: 27 additions & 0 deletions examples/18-ccsd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2023 The GPU4PySCF Authors. All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import numpy as np
import pyscf
from gpu4pyscf.cc import ccsd_incore

mol = pyscf.M(
atom = 'Vitamin_C.xyz',
basis = 'cc-pvdz',
verbose=5)

mf = mol.RHF().run()
mf.with_df = None
e_tot = ccsd_incore.CCSD(mf).kernel()
2 changes: 1 addition & 1 deletion gpu4pyscf/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from . import lib, grad, hessian, solvent, scf, dft

__version__ = '0.6.17'
__version__ = '0.7.0'

# monkey patch libxc reference due to a bug in nvcc
from pyscf.dft import libxc
Expand Down
Loading

0 comments on commit db9751b

Please sign in to comment.