diff --git a/source-code/tasks.c b/source-code/tasks.c deleted file mode 100644 index 03877e9..0000000 --- a/source-code/tasks.c +++ /dev/null @@ -1,19 +0,0 @@ -@Task -@LibDeps("stdio.h","stdlib.h") -float get_average_rand(float values[]){ - return 5; -} - -@ModuleName("Tattitto") -@TaskCloud -@LibDeps("math.h") -int is_even(int number){ - if(number%2==0)return 1; - else return 0; -} - -@LibDeps("stdio.h","string.h") -@TaskDevice -void printaaaa(String text){ - printf("aaaa %s\n",text); -} \ No newline at end of file diff --git a/src/rpc_go/Dockerfile b/src/rpc_go/Dockerfile deleted file mode 100644 index 8c39b35..0000000 --- a/src/rpc_go/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# Running as native wasm runtime -FROM scratch - -COPY ./build/server.wasm . - -EXPOSE 8080 - -CMD ["./server.wasm"] \ No newline at end of file diff --git a/src/rpc_go/Makefile b/src/rpc_go/Makefile deleted file mode 100644 index 11c0274..0000000 --- a/src/rpc_go/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -container_build: go_build - docker build --platform wasi/wasm -t rpc-go-wasm . - -go_build: generate - GOOS=wasip1 GOARCH=wasm go build -o build/server.wasm server/main.go - -generate: - protoc --proto_path=proto proto/*.proto --go_out=. --go-grpc_out=. \ No newline at end of file diff --git a/src/rpc_go/build/server.wasm b/src/rpc_go/build/server.wasm deleted file mode 100644 index c8a6dd5..0000000 Binary files a/src/rpc_go/build/server.wasm and /dev/null differ diff --git a/src/rpc_go/go.mod b/src/rpc_go/go.mod deleted file mode 100644 index 3769660..0000000 --- a/src/rpc_go/go.mod +++ /dev/null @@ -1,15 +0,0 @@ -module thesis/rpc_go - -go 1.23.2 - -require ( - google.golang.org/grpc v1.67.1 - google.golang.org/protobuf v1.35.1 -) - -require ( - golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.24.0 // indirect - golang.org/x/text v0.17.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect -) diff --git a/src/rpc_go/go.sum b/src/rpc_go/go.sum deleted file mode 100644 index a8432dc..0000000 --- a/src/rpc_go/go.sum +++ /dev/null @@ -1,14 +0,0 @@ -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= -google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= diff --git a/src/rpc_go/readme.md b/src/rpc_go/readme.md deleted file mode 100644 index cdde6ad..0000000 --- a/src/rpc_go/readme.md +++ /dev/null @@ -1,8 +0,0 @@ -## Appunti - -Tinygo per compilare go files in wasi. Non è possibile utilizzarlo con Grpc perché non supporta la libreria "net/http" - -docker build --platform wasi/wasm -t rpc-go-wasm . -docker run --runtime=io.containerd.wasmedge.v1 --platform=wasi/wasm rpc-go-wasm - -Provato anche con wasip2, tuttora non supporta l'apertura di socket \ No newline at end of file diff --git a/src/task_splitter/code_generator.py b/src/task_splitter/code_generator.py deleted file mode 100644 index 8feabdb..0000000 --- a/src/task_splitter/code_generator.py +++ /dev/null @@ -1,47 +0,0 @@ - -import ast - -def __get_include_from_annotation(libdeps): - - result = "" - - for lib in libdeps: - result += f"#include <{lib}>\n" - - return result - -def __get_main_function_from_function(fun): - - main_function = f""" -int main() {{ - - {fun['name']}({', '.join(['0' for _ in fun['args'].split(',')])}); - return 0; -}}\n - """ - return main_function - -def get_code_from_function(fun): - - # Get the function content - function_content = f"{fun['return_type']} {fun['name']}({fun['args']}) {fun['content']}" - - # Get the main function - main_function = __get_main_function_from_function(fun) - - # Get the dependencies from the annotations - libdeps = "" - for ann in fun['annotations']: - if ann['tag'] == "@LibDeps": - libdeps= ast.literal_eval(ann['args']) - break - - # Get the include statements - include_statements = __get_include_from_annotation(libdeps=libdeps) - - return include_statements + '\n' + function_content + '\n' + main_function - -def build_code_from_functions(functions): - - for fun in functions: - fun["code"] = get_code_from_function(fun) diff --git a/src/task_splitter/code_processor.py b/src/task_splitter/code_processor.py deleted file mode 100644 index ff20bf7..0000000 --- a/src/task_splitter/code_processor.py +++ /dev/null @@ -1,89 +0,0 @@ -import os -import re -import yaml - -def __extract_functions(file_content): - - # Regular expression to match C function definitions - REGULAR_EXPRESSION_C = r"(^\w[\w\s\*]+)\s+(\w+)\s*\(([^)]*)\)\s*(\{[^{}]*\})" - REGULAR_EXPRESSION_ANNOTATION = r"(^\@[A-Z]\w+){1}(\(.+\))*" - - - function_pattern = re.compile(REGULAR_EXPRESSION_C, re.MULTILINE) - function_matches = function_pattern.finditer(file_content) - - annotation_pattern = re.compile(REGULAR_EXPRESSION_ANNOTATION, re.MULTILINE) - - functions = [] - positions = [] - - for match in function_matches: - positions.append(match.start()) - annotation_matches = annotation_pattern.finditer(file_content) - prev = 0 - - if len(positions) > 1: - prev = positions[-2] - - annotations = [] - - for ann in annotation_matches: - if ann.start() >= prev: - - if ann.start() > match.start(): - break - - ann_tag = ann.group(1).strip() - ann_arg = ann.group(2) - - if ann_arg is not None: - ann_arg = ann_arg.replace("(","[").replace(")","]") - - annotations.append( - { - "tag": ann_tag, - "args": ann_arg - } - ) - - - func_return_type = match.group(1).strip() - func_name = match.group(2) - func_args = match.group(3).strip() - func_content = match.group(4).strip() - - # function_contents.append( - # f"{func_return_type} {func_name}({func_args}) {match.group(4)}" - # ) - functions.append({ - "name": func_name, - "return_type": func_return_type, - "args": func_args, - "annotations": annotations, - "content": func_content - }) - - return functions - -def create_independent_files(functions, output_dir): - - for fun in functions: - - filename = f"{fun['name']}.c" - with open(output_dir + filename, "w") as f: - - # Write the code - f.write(fun["code"]) - -def extract_functions_from_file(input_file): - - with open(input_file, "r") as file: - file_content = file.read() - - functions = __extract_functions(file_content) - return functions - -def save_functions_to_yaml(functions, output_file): - - with open(output_file, "w") as file: - yaml.dump(functions, file, sort_keys=False) diff --git a/src/task_splitter/__init__.py b/src/wasm_builder/__init__.py similarity index 100% rename from src/task_splitter/__init__.py rename to src/wasm_builder/__init__.py diff --git a/src/wasm_runtime_builder/Dockerfile b/src/wasm_runtime_builder/Dockerfile deleted file mode 100644 index 75c89a1..0000000 --- a/src/wasm_runtime_builder/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -# Build phase -FROM emscripten/emsdk AS build -RUN mkdir -p /build -WORKDIR /build -COPY src ./src -RUN emcc ./src/main.c -o ./main.wasm -RUN chmod a+x ./main.wasm - -# Run phase -FROM scratch -COPY --from=build /build/main.wasm /main.wasm -ENTRYPOINT [ "/main.wasm" ] \ No newline at end of file diff --git a/src/wasm_runtime_builder/readme.md b/src/wasm_runtime_builder/readme.md deleted file mode 100644 index 86efc2a..0000000 --- a/src/wasm_runtime_builder/readme.md +++ /dev/null @@ -1,25 +0,0 @@ -# Build ed esecuzione - -## Build a due fasi -Creazione del file .wasm con l'immagine di emcc e creazione del container con supporto wasm. -`docker build --platform wasi/wasm -t main-wasm .` - -## Run -Esecuzione container con platform wasm. -`docker run --runtime=io.containerd.wasmedge.v1 --platform=wasi/wasm main-wasm` - -# TODO -## Studio - -- studio wasm -- compilare c++ con wasm -- creazione container con wasm runtinme -- definizione tag per codice - -## Python module -- divide il codice in diverse task -- aggrega le task in base al target - -## Build e run -- container che builda tutti i task -- run del container con wasm \ No newline at end of file