Skip to content

Commit

Permalink
Use plain void legate::start() (old function ignored args anyway)
Browse files Browse the repository at this point in the history
Legate has auto-configure now and LEGATE_CONFIG or the legate must be
used.
This was always ignored, and I am not sure that the return value was
used (or an exception was raised anyway).
Now, an exception should be raised, which should be OK everywhere.

Signed-off-by: Sebastian Berg <[email protected]>
  • Loading branch information
seberg committed Dec 12, 2024
1 parent 96bb744 commit db0c041
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 29 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,8 @@ if __name__ == "__main__":

int main(int argc, char** argv)
{
// First we initialize Legate and cuPyNumeric
int32_t errcode = legate::start(argc, argv);
if (errcode != 0) {
throw std::runtime_error("legate::start() errorcode: " + std::to_string(errcode));
}
// First we initialize Legate use either `legate` or `LEGATE_CONFIG` to customize launch
legate::start();

// Then let's create a new logical column
legate::dataframe::LogicalColumn col_a = legate::dataframe::sequence(20, -10);
Expand Down
9 changes: 3 additions & 6 deletions cpp/examples/hello.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@
#include <legate_dataframe/parquet.hpp>
#include <legate_dataframe/unaryop.hpp>

int main(int argc, char** argv)
int main(void)
{
// First we initialize Legate
int32_t errcode = legate::start(argc, argv);
if (errcode != 0) {
throw std::runtime_error("legate::start() errorcode: " + std::to_string(errcode));
}
// First we initialize Legate use either `legate` or `LEGATE_CONFIG` to customize launch
legate::start();

// Then let's create a new logical column
legate::dataframe::LogicalColumn col_a = legate::dataframe::sequence(20, -10);
Expand Down
7 changes: 2 additions & 5 deletions cpp/examples/third_party/third_party_hello.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@

int main(int argc, char** argv)
{
// First we initialize Legate
int32_t errcode = legate::start(argc, argv);
if (errcode != 0) {
throw std::runtime_error("legate::start() errorcode: " + std::to_string(errcode));
}
// First we initialize Legate use either `legate` or `LEGATE_CONFIG` to customize launch
legate::start();

// Then let's create a new logical column
legate::dataframe::LogicalColumn col_a = legate::dataframe::sequence(10, 0);
Expand Down
15 changes: 2 additions & 13 deletions cpp/tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,13 @@

class Environment : public ::testing::Environment {
public:
Environment(int argc, char** argv) : argc_(argc), argv_(argv) {}

void SetUp() override
{
const char* argv[] = {"./test", "--gpus", "2"}; // TODO: make configurable
int argc = 3;
EXPECT_EQ(legate::start(argc, (char**)argv), 0);
}
void SetUp() override { legate::start(); }
void TearDown() override { EXPECT_EQ(legate::finish(), 0); }

private:
int argc_;
char** argv_;
};

int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
::testing::AddGlobalTestEnvironment(new Environment(argc, argv));
::testing::AddGlobalTestEnvironment(new Environment());
return RUN_ALL_TESTS();
}

0 comments on commit db0c041

Please sign in to comment.