Skip to content

Commit

Permalink
add license files to examples and generated content (#629)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjwilke authored Apr 6, 2023
1 parent aafb1cd commit 9d2504d
Show file tree
Hide file tree
Showing 18 changed files with 329 additions and 3 deletions.
64 changes: 63 additions & 1 deletion cmake/legate_helper_functions.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#=============================================================================
# Copyright 2023 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================

macro(legate_include_rapids)
if (NOT _LEGATE_HAS_RAPIDS)
if(NOT EXISTS ${CMAKE_BINARY_DIR}/LEGATE_RAPIDS.cmake)
Expand Down Expand Up @@ -151,7 +167,6 @@ header: str = """
else()
# libraries are built in a common spot
set(libdir ${CMAKE_BINARY_DIR}/legate_${target})
message("libdir to binary dir")
endif()
add_custom_target("${target}_generate_install_info_py" ALL
COMMAND ${CMAKE_COMMAND}
Expand Down Expand Up @@ -255,6 +270,22 @@ endfunction()
function(legate_cpp_library_template target output_sources_variable)
set(file_template
[=[
/* Copyright 2023 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#pragma once

#include "legate.h"
Expand Down Expand Up @@ -284,6 +315,22 @@ struct Task : public legate::LegateTask<T> {

set(file_template
[=[
/* Copyright 2023 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#include "legate_library.h"
#include "core/mapping/mapping.h"

Expand Down Expand Up @@ -386,6 +433,21 @@ endfunction()
function(legate_python_library_template target)
set(file_template
[=[
# Copyright 2023 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from legate.core import (
Library,
ResourceConfig,
Expand Down
17 changes: 17 additions & 0 deletions examples/hello/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#=============================================================================
# Copyright 2023 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================

cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)

project(hello VERSION 1.0 LANGUAGES C CXX)
Expand All @@ -7,6 +23,7 @@ set(BUILD_SHARED_LIBS ON)

find_package(legate_core REQUIRED)

legate_cpp_library_template(src TARGET hello)
legate_add_cpp_subdirectory(src TARGET hello EXPORT hello-export)

legate_add_cffi(${CMAKE_CURRENT_SOURCE_DIR}/src/hello_cffi.h TARGET hello)
Expand Down
16 changes: 16 additions & 0 deletions examples/hello/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
<!--
Copyright 2023 NVIDIA Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
# Legate Hello World Application

Here we illustrate a minimal example to get a Legate library up and running.
Expand Down
17 changes: 17 additions & 0 deletions examples/hello/examples/cunumeric-variance.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
#!/usr/bin/env python3

# Copyright 2023 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from typing import Any

import cunumeric
Expand Down
17 changes: 17 additions & 0 deletions examples/hello/examples/hello-world.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
<!--
Copyright 2023 NVIDIA Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# Basic Hello, World Application

The code for this example can be found in the [library file](../hello/hello.py) and [example](hello-world.py).
Expand Down
18 changes: 18 additions & 0 deletions examples/hello/examples/hello-world.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
#!/usr/bin/env python3

# Copyright 2023 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#


from hello import print_hello, print_hellos

print_hello("Hello, world")
Expand Down
17 changes: 17 additions & 0 deletions examples/hello/examples/variance.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
<!--
Copyright 2023 NVIDIA Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# Variance Example

The code for this example can be found in the [library file](../hello/hello.py) and [example](variance.py).
Expand Down
17 changes: 17 additions & 0 deletions examples/hello/examples/variance.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
#!/usr/bin/env python3

# Copyright 2023 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from typing import Any

from hello import iota, square, sum, to_scalar
Expand Down
17 changes: 17 additions & 0 deletions examples/hello/hello/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
#!/usr/bin/env python3

# Copyright 2023 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from .library import user_lib
from .hello import iota, print_hello, print_hellos, square, sum, to_scalar
17 changes: 17 additions & 0 deletions examples/hello/hello/hello.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
#!/usr/bin/env python3

# Copyright 2023 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import struct
from enum import IntEnum
from typing import Any
Expand Down
2 changes: 1 addition & 1 deletion examples/hello/setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright 2021-2022 NVIDIA Corporation
# Copyright 2023 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
15 changes: 15 additions & 0 deletions examples/hello/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#=============================================================================
# Copyright 2023 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================

legate_cpp_library_template(hello TEMPLATE_SOURCES)

Expand Down
16 changes: 16 additions & 0 deletions examples/hello/src/hello_cffi.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/* Copyright 2023 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

enum HelloOpCode {
_OP_CODE_BASE = 0,
HELLO_WORLD = 1,
Expand Down
16 changes: 16 additions & 0 deletions examples/hello/src/hello_world.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/* Copyright 2023 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#include "hello_world.h"
#include "legate_library.h"

Expand Down
18 changes: 17 additions & 1 deletion examples/hello/src/hello_world.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/* Copyright 2023 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#pragma once

#include "hello_cffi.h"
Expand All @@ -7,4 +23,4 @@ namespace hello {

extern Legion::Logger logger;

}
}
Loading

0 comments on commit 9d2504d

Please sign in to comment.