Skip to content

Commit

Permalink
[Bin] Launcher output for 'occa translate' now requires the '--launch…
Browse files Browse the repository at this point in the history
…er' flag
  • Loading branch information
dmed256 committed Jul 6, 2019
1 parent f738155 commit 386bc4c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
20 changes: 9 additions & 11 deletions bin/occa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ bool runTranslate(const json &args) {
const json &arguments = args["arguments"];

const std::string mode = options["mode"];
const bool printLauncher = options["launcher"];
const std::string filename = arguments[0];

if (!io::exists(filename)) {
Expand Down Expand Up @@ -193,17 +194,12 @@ bool runTranslate(const json &args) {
<< "*/\n";
}

if ((mode == "CUDA")
|| (mode == "HIP")
|| (mode == "OpenCL")) {
if (printLauncher && (
(mode == "CUDA")
|| (mode == "HIP")
|| (mode == "OpenCL"))) {
launcherParser = &(((occa::lang::okl::withLauncher*) parser)->launcherParser);

std::cout << "---[ Laucher ]--------------------------\n"
<< launcherParser->toString()
<< "========================================\n\n"
<< "---[ Kernel ]---------------------------\n"
<< parser->toString()
<< "========================================\n";
std::cout << launcherParser->toString();
} else {
std::cout << parser->toString();
}
Expand Down Expand Up @@ -331,6 +327,8 @@ int main(const int argc, const char **argv) {
.isRequired()
.withArg()
.expandsFunction("occa modes"))
.addOption(cli::option('l', "launcher",
"Output the launcher source instead"))
.addOption(cli::option('k', "kernel-props",
"Kernel properties")
.reusable()
Expand All @@ -343,7 +341,7 @@ int main(const int argc, const char **argv) {
"Add additional define")
.reusable()
.withArg())
.addOption(cli::option('v',"verbose",
.addOption(cli::option('v', "verbose",
"Verbose output"))
.addArgument("FILE",
"An .okl file",
Expand Down
22 changes: 13 additions & 9 deletions tests/run_bin_tests
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@

set -e

OCCA=$(dirname "$0")/../bin/occa
OCCA_DIR=$(dirname $(cd $(dirname "${BASH_SOURCE[0]}") && pwd))
BIN_OCCA="${OCCA_DIR}/bin/occa"

function verbose_run {
echo "$@"
"$@"
}

verbose_run "${OCCA}" autocomplete
verbose_run "${OCCA}" clear
verbose_run "${OCCA}" compile --help
verbose_run "${OCCA}" env
verbose_run "${OCCA}" info
verbose_run "${OCCA}" modes
verbose_run "${OCCA}" translate --help
verbose_run "${OCCA}" version
verbose_run "${BIN_OCCA}" autocomplete
verbose_run "${BIN_OCCA}" clear
verbose_run "${BIN_OCCA}" compile --help
verbose_run "${BIN_OCCA}" env
verbose_run "${BIN_OCCA}" info
verbose_run "${BIN_OCCA}" modes
verbose_run "${BIN_OCCA}" translate --help
verbose_run "${BIN_OCCA}" translate --mode Serial examples/cpp/01_add_vectors/addVectors.okl
verbose_run "${BIN_OCCA}" translate --mode CUDA examples/cpp/01_add_vectors/addVectors.okl
verbose_run "${BIN_OCCA}" translate --mode CUDA --launcher examples/cpp/01_add_vectors/addVectors.okl
verbose_run "${BIN_OCCA}" version

0 comments on commit 386bc4c

Please sign in to comment.