Unverified Commit c59f4079 authored by Umang Yadav's avatar Umang Yadav Committed by GitHub
Browse files

Change the doc to mention only gpu or ref as targets (#1153)

Documentation update for valid targets
parent b5c96d34
......@@ -121,7 +121,7 @@ target
Constructs the target.
:param str name: The name of the target to construct. This can either be 'cpu' or 'gpu'.
:param str name: The name of the target to construct. This can either be 'gpu' or 'ref'.
:rtype: target
......
#include <migraphx/register_target.hpp>
#include <unordered_map>
#include <migraphx/register_target.hpp>
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
......@@ -11,7 +11,17 @@ std::unordered_map<std::string, target>& target_map()
}
void register_target(const target& t) { target_map()[t.name()] = t; }
target make_target(const std::string& name) { return target_map().at(name); }
target make_target(const std::string& name)
{
const auto it = target_map().find(name);
if(it == target_map().end())
{
MIGRAPHX_THROW("Requested target '" + name + "' is not enabled or not supported");
}
return it->second;
}
std::vector<std::string> get_targets()
{
std::vector<std::string> result;
......
......@@ -12,6 +12,11 @@ TEST_CASE(make_target)
}
}
TEST_CASE(make_invalid_target)
{
EXPECT(test::throws([&] { migraphx::make_target("mi100"); }));
}
TEST_CASE(targets)
{
auto ts = migraphx::get_targets();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment