gs_lesson2

Two models without any inputs or outputs.

C Version

Model Code:

1#include <stdio.h>
2
3int main(int argc, char *argv[]) {
4  printf("Hello from C\n");
5  return 0;
6}
7

Model YAML:

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

C++ Version

Model Code:

1#include <iostream>
2
3int main(int argc, char *argv[]) {
4  std::cout << "Hello from C++" << std::endl;
5  return 0;
6}

Model YAML:

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

Fortran Version

Model Code:

1PROGRAM main
2  USE fygg
3
4  PRINT *, "Hello from Fortran"
5
6END PROGRAM main

Model YAML:

1models:
2  - name: fortran_model1
3    language: fortran  # Runs the fortran script using default Fortran
4    args: ./src/gs_lesson2.f90
5
6  - name: fortran_model2
7    language: fortran
8    args: ./src/gs_lesson2.f90

Julia Version

Model Code:

1println("Hello from Julia")

Model YAML:

1models:
2  - name: julia_model1
3    language: julia  # Runs the julia script using default Julia
4    args: ./src/gs_lesson2.jl
5
6  - name: julia_model2
7    language: julia
8    args: ./src/gs_lesson2.jl

Matlab Version

Model Code:

1disp('Hello from Matlab');

Model YAML:

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

Python Version

Model Code:

1print('Hello from Python')

Model YAML:

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

R Version

Model Code:

1print('Hello from R')

Model YAML:

1models:
2  - name: R_model1
3    language: R  # Runs the R script using default R
4    args: ./src/gs_lesson2.R
5    
6  - name: R_model2
7    language: R
8    args: ./src/gs_lesson2.R