gs_lesson2 Example

Python Version

Model Code:

1
print('Hello from Python')

Model YAML:

1
2
3
4
5
6
7
8
models:
  - name: python_model1
    language: python  # Runs the python script using default Python
    args: ./src/gs_lesson2.py

  - name: python_model2
    language: python
    args: ./src/gs_lesson2.py

Matlab Version

Model Code:

1
disp('Hello from Matlab');

Model YAML:

1
2
3
4
5
6
7
8
models:
  - name: matlab_model1
    language: matlab  # Runs the script using a Matlab engine
    args: ./src/gs_lesson2.m

  - name: matlab_model2
    language: matlab
    args: ./src/gs_lesson2.m

C Version

Model Code:

1
2
3
4
5
6
7
#include <stdio.h>

int main(int argc, char *argv[]) {
  printf("Hello from C\n");
  return 0;
}

Model YAML:

1
2
3
4
5
6
7
8
models:
  - name: c_model1
    language: c  # Compiles the C code with necessary cis_interface libraries
    args: ./src/gs_lesson2.c

  - name: c_model2
    language: c
    args: ./src/gs_lesson2.c

C++ Version

Model Code:

1
2
3
4
5
6
#include <iostream>

int main(int argc, char *argv[]) {
  std::cout << "Hello from C++" << std::endl;
  return 0;
}

Model YAML:

1
2
3
4
5
6
7
8
models:
  - name: cpp_model1
    language: c  # Compiles the C++ code with necessary cis_interface libraries
    args: ./src/gs_lesson2.cpp

  - name: cpp_model2
    language: c
    args: ./src/gs_lesson2.cpp