Skip to content

Commit

Permalink
Issue/347/llvmpath (#413)
Browse files Browse the repository at this point in the history
* Run black -l 100 on:

- .github/workflows/dev_version_script.py
- .github/workflows/vb_script.py
- bin/utils.py
- doc/conf.py
- setup.py

* Add LLVM_ROOT_DIR variable that allows specifying a custom llvm path on Darwin systems.

* Fix a couple typos in README file.

* Auto update version

* Update doc/conf.py

Co-authored-by: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>

* Auto update version

* Update changelog

* Trigger CI.

* Auto update version

* Update .github/CHANGELOG.md

Co-authored-by: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>

* If brew not found, find path using which clang++.

* Auto update version

* Remove tmp var brewpath and merge few elseif clauses.

* Auto update version

---------

Co-authored-by: Dev version update bot <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com>
Co-authored-by: Lee James O'Riordan <mlxd@users.noreply.github.com>
  • Loading branch information
4 people committed Feb 22, 2023
1 parent b037f5e commit 6b58585
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
5 changes: 4 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
* Remove explicit Numpy and Scipy requirements.
[(#412)](https://github.com/PennyLaneAI/pennylane-lightning/pull/412)

* Get `llvm` installation root from the environment variable `LLVM_ROOT_DIR` (or fallback to `brew`).
[(#413)](https://github.com/PennyLaneAI/pennylane-lightning/pull/413)

* Update AVX2/512 kernel infrastructure for additional gate/generator operations.
[(#404)](https://github.com/PennyLaneAI/pennylane-lightning/pull/404)

Expand All @@ -36,7 +39,7 @@

### Contributors

Amintor Dusko, Lee James O'Riordan, Chae-Yeun Park
Amintor Dusko, Vincent Michaud-Rioux, Lee James O'Riordan, Chae-Yeun Park

---

Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ You can also pass ``cmake`` options with ``build_ext``:
$ python3 setup.py build_ext -i --define="ENABLE_OPENMP=OFF;ENABLE_NATIVE=ON"
and install the compilied library with
and install the compiled library with

.. code-block:: console
Expand Down Expand Up @@ -202,7 +202,7 @@ Contributing

We welcome contributions - simply fork the repository of this plugin, and then make a
`pull request <https://help.github.com/articles/about-pull-requests/>`_ containing your contribution.
All contributers to this plugin will be listed as authors on the releases.
All contributors to this plugin will be listed as authors on the releases.

We also encourage bug reports, suggestions for new features and enhancements, and even links to cool projects
or applications built on PennyLane.
Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def __getattr__(cls, name):
"navbar_active_link": 3,
"google_analytics_tracking_id": "UA-130507810-1",
"extra_copyrights": [
"TensorFlow, the TensorFlow logo, and any related marks are trademarks " "of Google Inc."
"TensorFlow, the TensorFlow logo, and any related marks are trademarks of Google Inc."
],
"toc_overview": True,
}
Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.29.0-dev10"
__version__ = "0.29.0-dev11"
29 changes: 15 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@ def build_extension(self, ext: CMakeExtension):
configure_args += [
"-T clangcl",
]
else:
if ninja_path:
configure_args += [
"-GNinja",
f"-DCMAKE_MAKE_PROGRAM={ninja_path}",
]
elif ninja_path:
configure_args += [
"-GNinja",
f"-DCMAKE_MAKE_PROGRAM={ninja_path}",
]

build_args = []

Expand All @@ -92,21 +91,23 @@ def build_extension(self, ext: CMakeExtension):
"-DCMAKE_SYSTEM_PROCESSOR=ARM64",
]
else: # X64 arch
llvmpath = subprocess.check_output(["brew", "--prefix", "llvm"]).decode().strip()
if shutil.which("brew"):
llvmpath = (
subprocess.check_output(["brew", "--prefix", "llvm"]).decode().strip()
)
else:
llvmpath = shutil.which("clang++")
llvmpath = Path(llvmpath).parent.parent
configure_args += [
f"-DCMAKE_CXX_COMPILER={llvmpath}/bin/clang++",
f"-DCMAKE_LINKER={llvmpath}/bin/lld",
] # Use clang instead of appleclang
# Disable OpenMP in M1 Macs
if os.environ.get("USE_OMP"):
configure_args += []
else:
configure_args += ["-DENABLE_OPENMP=OFF"]
configure_args += [] if os.environ.get("USE_OMP") else ["-DENABLE_OPENMP=OFF"]
elif platform.system() == "Windows":
configure_args += ["-DENABLE_OPENMP=OFF", "-DENABLE_BLAS=OFF"]
else:
if platform.system() != "Linux":
raise RuntimeError(f"Unsupported '{platform.system()}' platform")
elif platform.system() != "Linux":
raise RuntimeError(f"Unsupported '{platform.system()}' platform")

if not Path(self.build_temp).exists():
os.makedirs(self.build_temp)
Expand Down

0 comments on commit 6b58585

Please sign in to comment.