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

OpenCL & Multicore Support #2423

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

JonathanLStoff
Copy link

I edited the python setup.py to add the option to compile with OpenCL and/or Multicore Support for faster runtimes.

My dataframe (226x26000) ran 2x as fast on OpenCL vs single core version.

In order to run this model properly, changes to CMDSTANPY must be made which I will be making a fork and pull request for soon.

Feel free to reach out if I can be any help: [email protected]

Added configurable openCL/multicore CPU vars when building the model. Requires changes to cmdstanpy to work.
@facebook-github-bot
Copy link
Contributor

Hi @StoffAudioLLC!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

python/setup.py Outdated Show resolved Hide resolved
Copy link
Contributor

@AlexandroLuis AlexandroLuis left a comment

Choose a reason for hiding this comment

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

please, remove the donation button!

README.md Outdated
# Prophet: Automatic Forecasting Procedure

# Prophet: Automatic Forecasting Procedure With python OPENCL/Multi-Core options
[![Donate with PayPal](https://raw.githubusercontent.com/stefan-niedermann/paypal-donate-button/master/paypal-donate-button.png)](https://www.paypal.com/donate?hosted_button_id=9ELH753DDE98Y)
Copy link
Contributor

Choose a reason for hiding this comment

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

remove it.

import platform
from pathlib import Path
from shutil import copy, copytree, rmtree
from typing import List

import cmdstanpy.utils as utils
print(utils.cmdstan_path())
Copy link
Contributor

Choose a reason for hiding this comment

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

remove path info

removed button
@donggu-kang
Copy link

MODEL_MULTI_CORES = True

I created a new virtual environment in ubuntu20 and Python 3.8.10
Then I changed this setting to True and built it with the command below.
python3 setup.py install

I confirmed that Prophet 1.1.2 version was installed in my virtual environment without an error message.

After making all conditions, including the dataset, as identical as possible, I measured the usage of each Core/Thread used by Prophet and how much time spent on computation was reduced.

However, disappointingly, multi-core was not used and the computation time was almost the same.

Did I make a mistake?

Does there seem to be a problem with my environment?

...
cmdstanpy 1.0.4
pystan 2.19.1.1
pandas 1.5.3
prophet 1.1.2

@JonathanLStoff
Copy link
Author

MODEL_MULTI_CORES = True

I created a new virtual environment in ubuntu20 and Python 3.8.10

Then I changed this setting to True and built it with the command below.

python3 setup.py install

I confirmed that Prophet 1.1.2 version was installed in my virtual environment without an error message.

After making all conditions, including the dataset, as identical as possible, I measured the usage of each Core/Thread used by Prophet and how much time spent on computation was reduced.

However, disappointingly, multi-core was not used and the computation time was almost the same.

Did I make a mistake?

Does there seem to be a problem with my environment?


...

cmdstanpy 1.0.4

pystan 2.19.1.1

pandas 1.5.3

prophet 1.1.2

Thanks for checking it out! As of now, only a few functions in Stan utilize opencl and multithreading. So this can create a faster execution time, but will not run the whole model on multiple cores. I made a version that did just that, but the execution time was way worse as it had to copy the data into memory multiple times.

I also made a version that runs 10x faster and uses cuda (30/40 series cards) for some of the functions that do not use opencl. Check it out: https://github.com/StoffAudioLLC/CuProphet

@WardBrian WardBrian linked an issue Oct 12, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using CMDSTAN with OPENCL/GPU for prophet
4 participants