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

License and comments for taco-tool #33

Closed
Lugatod opened this issue Mar 15, 2017 · 1 comment
Closed

License and comments for taco-tool #33

Lugatod opened this issue Mar 15, 2017 · 1 comment

Comments

@Lugatod
Copy link
Contributor

Lugatod commented Mar 15, 2017

Generate a license-comment for each use of taco-tool, probably something short referring to the MIT license and the taco url.
The taco-tool could also have an option "-nolicense" to hide this comment.

@fredrikbk
Copy link
Contributor

I've given this a some thought and I'm not sure we should try to license code we generate for the user's expressions. It sounds like shaky legal grounds and I also don't want to antagonize users.

We should discuss this in a meeting, but for now I've added the following to the generated code:

/* Generated by the Tensor Algebra Compiler (tensor-compiler.org) */

The following patch gives us licensing:

diff --git a/tools/taco.cpp b/tools/taco.cpp
index a47a198..4cada42 100644
--- a/tools/taco.cpp
+++ b/tools/taco.cpp
@@ -65,6 +65,8 @@ static void printUsageInfo() {
   cout << endl;
   printFlag("nocolor", "Print without colors.");
   cout << endl;
+  printFlag("license", "Print with the full license.");
+  cout << endl;

   /*
   cout << "Options planned for the future:" << endl;
@@ -101,6 +103,7 @@ int main(int argc, char* argv[]) {
   bool printLattice = false;
   bool evaluate = false;
   bool color = true;
+  bool license = false;

   string indexVarName = "";

@@ -146,6 +149,9 @@ int main(int argc, char* argv[]) {
     else if ("-nocolor" == arg) {
       color = false;
     }
+    else if ("-license" == arg) {
+      license = true;
+    }
     else {
       if (exprStr.size() != 0) {
         printUsageInfo();
@@ -175,10 +181,39 @@ int main(int argc, char* argv[]) {

   tensor.compile();

-  string gentext = "Generated by the Tensor Algebra Compiler (tensor-compiler.org)";
+  string gentext =
+      "Generated by the Tensor Algebra Compiler (taco) under the MIT license";
+
   std::string green = (color) ? "\033[38;5;70m" : "";
   std::string nc    = (color) ? "\033[0m"       : "";
-  cout << green << "/* " << gentext << " */" << nc << endl;
+
+  if (license) {
+    cout << green << "/* ";
+    cout << gentext << endl << endl;
+    cout << "   Copyright (c) 2016 MIT CSAIL and other contributors\n\n";
+    cout << "   Permission is hereby granted, free of charge, to any person obtaining a copy\n";
+    cout << "   of this software and associated documentation files (the \"Software\"), to deal\n";
+    cout << "   in the Software without restriction, including without limitation the rights\n";
+    cout << "   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n";
+    cout << "   copies of the Software, and to permit persons to whom the Software is\n";
+    cout << "   furnished to do so, subject to the following conditions:\n\n";
+
+    cout << "   The above copyright notice and this permission notice shall be included in all\n";
+    cout << "   copies or substantial portions of the Software.\n\n";
+
+    cout << "   THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n";
+    cout << "   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n";
+    cout << "   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n";
+    cout << "   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n";
+    cout << "   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n";
+    cout << "   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n";
+    cout << "   SOFTWARE.\n";
+    cout << " */" << nc << endl;
+  }
+  else {
+    cout << green << "/* " << gentext << " */" << nc << endl;
+  }
+

   bool hasPrinted = false;
   if (printAssemble) {

@fredrikbk fredrikbk modified the milestone: Beta release Mar 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants