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

[WIP] setup.py uses CMake #176

Merged
merged 59 commits into from
Nov 25, 2021
Merged

[WIP] setup.py uses CMake #176

merged 59 commits into from
Nov 25, 2021

Conversation

chaeyeunpark
Copy link
Contributor

@chaeyeunpark chaeyeunpark commented Nov 12, 2021

  • setup.py is rewritten to use CMake.
  • Compiling guide for MSVC is added (README.rst).

@codecov
Copy link

codecov bot commented Nov 12, 2021

Codecov Report

Merging #176 (7da1e65) into master (5c19079) will decrease coverage by 7.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##            master     #176      +/-   ##
===========================================
- Coverage   100.00%   92.97%   -7.03%     
===========================================
  Files            4        4              
  Lines          184      185       +1     
===========================================
- Hits           184      172      -12     
- Misses           0       13      +13     
Impacted Files Coverage Δ
pennylane_lightning/lightning_qubit.py 88.88% <100.00%> (-11.12%) ⬇️
pennylane_lightning/_serialize.py 98.61% <0.00%> (-1.39%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c19079...7da1e65. Read the comment docs.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2021

Test Report (C++) on Ubuntu

       1 files  ±0         1 suites  ±0   0s ⏱️ ±0s
   345 tests ±0     345 ✔️ ±0  0 💤 ±0  0 ±0 
1 919 runs  ±0  1 919 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 7da1e65. ± Comparison against base commit 5c19079.

♻️ This comment has been updated with latest results.

@chaeyeunpark chaeyeunpark force-pushed the cmake_setup_py_actions_wheel branch from e4b68f0 to 23b61fe Compare November 12, 2021 19:40
@chaeyeunpark
Copy link
Contributor Author

Windows tests fail as python does not find a correct DLL path. https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew can be a reason?

@mlxd
Copy link
Member

mlxd commented Nov 16, 2021

It may also be worth enabling the CI wheel builders to export the built wheels for this PR (they are normally disabled outside master). As a quick workaround, we can remove this line:

if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' }}

and re-add it after we pull down the wheel. Same as for Mac x86_64 and M1 (to verify OpenMP no longer fails).

@chaeyeunpark
Copy link
Contributor Author

It may also be worth enabling the CI wheel builders to export the built wheels for this PR (they are normally disabled outside master). As a quick workaround, we can remove this line:

if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' }}

and re-add it after we pull down the wheel. Same as for Mac x86_64 and M1 (to verify OpenMP no longer fails).

See https://github.com/PennyLaneAI/pennylane-lightning/actions/runs/1467603819 and https://github.com/PennyLaneAI/pennylane-lightning/actions/runs/1467603816

@chaeyeunpark chaeyeunpark requested a review from mlxd November 16, 2021 16:17
@mlxd
Copy link
Member

mlxd commented Nov 22, 2021

Hi @chaeyeunpark I had time to compare the wheels on Python3.9 for Linux. The performance is pretty much the same for both (nice work on that). I did notice that the size of the wheels, as well as the exported symbols, differ between the current version and this version. I think for now to minimize the differences we can add some additional compile-time flags that are turned on by-default for the Linux/Mac setuptools versions:

## Allows overflows of integer ops; should never be a problem and can potentially add some improvements
-fwrapv

## Allows more optimal external library calls
-fno-plt

## Avoid intermediate files hitting the disk; speeds up compilation in some cases
-pipe

I think this should be enough to get an almost apples-to-apples binary comparison. With the above changes, and disabling the wheels being stored, I am happy to see this being merged in.

I suspect the CodeCov issue will resolve itself too with another commit. If not, we can see about whether it makes sense to add another test, or just override its complaint.

@chaeyeunpark
Copy link
Contributor Author

Hi @mlxd, I made those changes https://github.com/PennyLaneAI/pennylane-lightning/pull/176/files#diff-f8588b38421f6ebc8fdb5eaaca2d2a160b4e38a5092a2ffa045f7cd5075823eaR10-R17. However, tests still fail (probably because of the new Pennylane features). We may merge this after #179 is merged.

@mlxd
Copy link
Member

mlxd commented Nov 23, 2021

Hi @mlxd, I made those changes https://github.com/PennyLaneAI/pennylane-lightning/pull/176/files#diff-f8588b38421f6ebc8fdb5eaaca2d2a160b4e38a5092a2ffa045f7cd5075823eaR10-R17. However, tests still fail (probably because of the new Pennylane features). We may merge this after #179 is merged.

Awesome work! Thanks @chaeyeunpark

Fixed --build options
@maliasadi
Copy link
Member

We may merge this after #179 is merged.

Nice work @chaeyeunpark! PR #179 is also merged.

Copy link
Member

@mlxd mlxd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Chae-Yeun, I added two more comments. Happy to merge after these are addressed.

@@ -19,6 +19,9 @@ jobs:
with:
python-version: '3.7'

- name: Get latest CMake and ninja
uses: lukka/get-cmake@latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason to prefer this over a pip installation of both cmake and ninja?

if platform.system() == "Windows" and sys.version_info[:2] >= (3, 8):
# Add the current directory to DLL path.
# See https://docs.python.org/3/whatsnew/3.8.html#bpo-36085-whatsnew
os.add_dll_directory(os.path.dirname(os.path.abspath(__file__)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can add a Pylint ignore comment here to ignore the warnings. Or, should we add tests as recommended?

@mlxd mlxd self-requested a review November 25, 2021 17:55
@chaeyeunpark chaeyeunpark merged commit 19a8a85 into master Nov 25, 2021
@chaeyeunpark chaeyeunpark deleted the cmake_setup_py_actions_wheel branch November 25, 2021 18:57
chaeyeunpark added a commit that referenced this pull request Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants