-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
Runtime OpenCL device selection, allow seed=0 and fix allow-undefined user_header bug #954
Merged
rok-cesnovar
merged 11 commits into
develop
from
feature/825-runtime-opencl-device-selection
Dec 8, 2020
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5f07e80
add opencl arg
rok-cesnovar 4416271
Merge branch 'develop' into feature/825-runtime-opencl-device-selection
rok-cesnovar 5521fa3
Merge branch 'opencl_args_and_zero_seed_allowed' into feature/825-run…
rok-cesnovar 660feb4
Merge branch 'develop' into feature/825-runtime-opencl-device-selection
rok-cesnovar 2953c97
refactor opencl runtime args
rok-cesnovar b908c37
alloweed seed = 0
rok-cesnovar 31b40ad
fix allow-undefined not incuding user header
rok-cesnovar 26dd6b8
add _name
rok-cesnovar 065a68f
Merge commit 'f8a7285137978afdd116e0c432774ab457e581db' into HEAD
yashikno 9b291e7
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot 54ae958
remove seed=0 fail test
rok-cesnovar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef CMDSTAN_ARGUMENTS_ARG_OPENCL_HPP | ||
#define CMDSTAN_ARGUMENTS_ARG_OPENCL_HPP | ||
|
||
#include <cmdstan/arguments/arg_opencl_device.hpp> | ||
#include <cmdstan/arguments/arg_opencl_platform.hpp> | ||
#include <cmdstan/arguments/categorical_argument.hpp> | ||
|
||
namespace cmdstan { | ||
|
||
class arg_opencl : public categorical_argument { | ||
public: | ||
arg_opencl() { | ||
_name = "opencl"; | ||
_description = "OpenCL options"; | ||
|
||
_subarguments.push_back(new arg_opencl_device()); | ||
_subarguments.push_back(new arg_opencl_platform()); | ||
} | ||
}; | ||
|
||
} // namespace cmdstan | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef CMDSTAN_ARGUMENTS_ARG_OPENCL_DEVICE_HPP | ||
#define CMDSTAN_ARGUMENTS_ARG_OPENCL_DEVICE_HPP | ||
|
||
#include <cmdstan/arguments/singleton_argument.hpp> | ||
|
||
namespace cmdstan { | ||
|
||
class arg_opencl_device : public int_argument { | ||
public: | ||
arg_opencl_device() : int_argument() { | ||
_name = "device"; | ||
_description = "ID of the OpenCL device to use"; | ||
_validity = "device >= 0 or -1 to use the compile-time device ID"; | ||
_default = "-1"; | ||
_default_value = -1; | ||
_constrained = true; | ||
_good_value = 1; | ||
_bad_value = -1.0; | ||
_value = _default_value; | ||
} | ||
|
||
bool is_valid(int value) { return value >= 0 || value == _default_value; } | ||
}; | ||
|
||
} // namespace cmdstan | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef CMDSTAN_ARGUMENTS_ARG_OPENCL_PLATFORM_HPP | ||
#define CMDSTAN_ARGUMENTS_ARG_OPENCL_PLATFORM_HPP | ||
|
||
#include <cmdstan/arguments/singleton_argument.hpp> | ||
|
||
namespace cmdstan { | ||
|
||
class arg_opencl_platform : public int_argument { | ||
public: | ||
arg_opencl_platform() : int_argument() { | ||
_name = "platform"; | ||
_description = "ID of the OpenCL platform to use"; | ||
_validity = "platform >= 0 or -1 to use the compile-time platform ID"; | ||
_default = "-1"; | ||
_default_value = -1; | ||
_constrained = true; | ||
_good_value = 1; | ||
_bad_value = -1.0; | ||
_value = _default_value; | ||
} | ||
|
||
bool is_valid(int value) { return value >= 0 || value == _default_value; } | ||
}; | ||
|
||
} // namespace cmdstan | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ class arg_seed : public int_argument { | |
arg_seed() : int_argument() { | ||
_name = "seed"; | ||
_description = "Random number generator seed"; | ||
_validity = "integer > 0 or -1 to generate seed from system time"; | ||
_validity = "integer >= 0 or -1 to generate seed from system time"; | ||
_default = "-1"; | ||
_default_value = -1; | ||
_constrained = true; | ||
|
@@ -25,7 +25,7 @@ class arg_seed : public int_argument { | |
.total_milliseconds(); | ||
} | ||
|
||
bool is_valid(int value) { return value > 0 || value == _default_value; } | ||
bool is_valid(int value) { return value >= 0 || value == _default_value; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes to this file is a fix for #941 |
||
|
||
unsigned int random_value() { | ||
if (_value == _default_value) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a minor fix for #953