Skip to content

Commit

Permalink
Prepare for 0.2.1 release (#59)
Browse files Browse the repository at this point in the history
* Clarify that Jet is also a Python library

* Improve CudaScopedDevice comments

* Add changelog entry and set development release to 0.2.1

* Save changes to README

* Move PR #49 changelog entry to 0.2.1 release

* Add citations to README and Sphinx documentation

* Add changelog entry for citations
  • Loading branch information
Mandrenkov committed Aug 5, 2021
1 parent 07f2b68 commit b899275
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 26 deletions.
18 changes: 14 additions & 4 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
## Release 0.3.0 (development release)
## Release 0.2.1 (development release)

### New features since last release

* The Jet interpreter for XIR scripts now supports an `expval` output. [(#49)](https://github.com/XanaduAI/jet/pull/49)

### Improvements

* The `CudaTensor` class no longer includes [Taskflow](https://taskflow.github.io/) headers. [(#56)](https://github.com/XanaduAI/jet/pull/56)

### Documentation

* Links to the [Jet paper](https://arxiv.org/abs/2107.09793) are now included in the README and Sphinx documentation. [(#59)](https://github.com/XanaduAI/jet/pull/59)

* The `CudaScopedDevice` documentation is now consistent with other classes in Jet. [(#59)](https://github.com/XanaduAI/jet/pull/59)

* The documentation section of the development guide now lists system dependencies. [(#52)](https://github.com/XanaduAI/jet/pull/52)

* Static versions of jQuery and Bootstrap are no longer included in the CSS theme. [(#52)](https://github.com/XanaduAI/jet/pull/52)
Expand All @@ -12,14 +24,12 @@

This release contains contributions from (in alphabetical order):

[Mikhail Andrenkov](https://github.com/Mandrenkov).
[Mikhail Andrenkov](https://github.com/Mandrenkov), [Trevor Vincent](https://github.com/trevor-vincent).

## Release 0.2.0 (current release)

### New features since last release

* The Jet interpreter for XIR scripts now supports an `expval` output. [(#49)](https://github.com/XanaduAI/jet/pull/49)

* The Jet interpreter for XIR scripts now accepts a `dimension` option for CV circuits. [(#47)](https://github.com/XanaduAI/jet/pull/47)

* The Jet interpreter for XIR programs now supports a `probabilities` output. [(#44)](https://github.com/XanaduAI/jet/pull/44)
Expand Down
13 changes: 11 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
:alt: License
:target: https://www.apache.org/licenses/LICENSE-2.0

`Jet <https://quantum-jet.readthedocs.io>`_ is a cross-platform C++ library for
simulating quantum circuits using tensor network contractions.
`Jet <https://quantum-jet.readthedocs.io>`_ is a cross-platform C++ and Python
library for simulating quantum circuits using tensor network contractions.

Features
========
Expand Down Expand Up @@ -173,6 +173,15 @@ Support
If you are having issues, please let us know by posting the issue on our GitHub
issue tracker.

Authors
=======

Jet is the work of `many contributors <https://github.com/XanaduAI/jet/graphs/contributors>`_.

If you are doing research using Jet, please cite our paper:

Trevor Vincent, Lee J. O'Riordan, Mikhail Andrenkov, Jack Brown, Nathan Killoran, Haoyu Qi, and Ish Dhand. *Jet: Fast quantum circuit simulations with parallel task-based tensor-network contraction.* 2021. `arxiv:2107.09793 <https://arxiv.org/abs/2107.09793>`_

License
=======

Expand Down
4 changes: 4 additions & 0 deletions docs/dev/research.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Research and contribution
Research
--------

If you are doing research using Jet, please cite our paper:

Trevor Vincent, Lee J. O'Riordan, Mikhail Andrenkov, Jack Brown, Nathan Killoran, Haoyu Qi, and Ish Dhand. *Jet: Fast quantum circuit simulations with parallel task-based tensor-network contraction.* 2021. `arxiv:2107.09793 <https://arxiv.org/abs/2107.09793>`_

We are always open for collaboration, and can be contacted at [email protected].

Contribution
Expand Down
7 changes: 7 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ Features
* *Qudits.* Models quantum systems with an **arbitrary number of basis states**.

How to cite
===========

If you are doing research using Jet, please cite our paper:

Trevor Vincent, Lee J. O'Riordan, Mikhail Andrenkov, Jack Brown, Nathan Killoran, Haoyu Qi, and Ish Dhand. *Jet: Fast quantum circuit simulations with parallel task-based tensor-network contraction.* 2021. `arxiv:2107.09793 <https://arxiv.org/abs/2107.09793>`_

Support
=======

Expand Down
47 changes: 27 additions & 20 deletions include/jet/CudaTensorHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,50 +176,57 @@ ReverseVector(const std::vector<DataType> &input)
return std::vector<DataType>{input.rbegin(), input.rend()};
}

/** @class CudaScopedDevice
@brief RAII-styled device context switch. Code taken from Taskflow.
%cudaScopedDevice is neither movable nor copyable.
*/
/** @brief `%CudaScopedDevice` uses RAII to select a CUDA device context.
*
* @see https://taskflow.github.io/taskflow/classtf_1_1cudaScopedDevice.html
*
* @note A `%CudaScopedDevice` instance cannot be moved or copied.
*
* @warning This class is not thread-safe.
*/
class CudaScopedDevice {

public:
/**
@brief constructs a RAII-styled device switcher
@param device device context to scope in the guard
*/
* @brief Constructs a `%CudaScopedDevice` using a CUDA device.
*
* @param device CUDA device to scope in the guard.
*/
explicit CudaScopedDevice(int device);

/**
@brief destructs the guard and switches back to the previous device context
*/
* @brief Destructs a `%CudaScopedDevice`, switching back to the previous
* CUDA device context.
*/
~CudaScopedDevice();

private:
CudaScopedDevice() = delete;
CudaScopedDevice(const CudaScopedDevice &) = delete;
CudaScopedDevice(CudaScopedDevice &&) = delete;

int _p;
/// The previous CUDA device (or -1 if the device passed to the constructor
/// is the current CUDA device).
int prev_device_;
};

inline CudaScopedDevice::CudaScopedDevice(int dev)
inline CudaScopedDevice::CudaScopedDevice(int device)
{
JET_CUDA_IS_SUCCESS(cudaGetDevice(&_p));
if (_p == dev) {
_p = -1;
JET_CUDA_IS_SUCCESS(cudaGetDevice(&prev_device_));
if (prev_device_ == device) {
prev_device_ = -1;
}
else {
JET_CUDA_IS_SUCCESS(cudaSetDevice(dev));
JET_CUDA_IS_SUCCESS(cudaSetDevice(device));
}
}

inline CudaScopedDevice::~CudaScopedDevice()
{
if (_p != -1) {
cudaSetDevice(_p);
if (prev_device_ != -1) {
// Throwing exceptions from a destructor can be dangerous.
// See https://isocpp.org/wiki/faq/exceptions#ctor-exceptions.
cudaSetDevice(prev_device_);
}
}

Expand Down

0 comments on commit b899275

Please sign in to comment.