gs_lesson1¶
A single model 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_model
3 language: c # Compiles the C code with necessary cis_interface libraries
4 args: ./src/gs_lesson1.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_model
3 language: c++ # Compiles the C++ code with necessary cis_interface libraries
4 args: ./src/gs_lesson1.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_model
3 language: fortran # Runs the fortran script using default Fortran
4 args: ./src/gs_lesson1.f90
Julia Version¶
Model Code:
1println("Hello from Julia")
Model YAML:
1models:
2 - name: julia_model
3 language: julia # Runs the julia script using default Julia
4 args: ./src/gs_lesson1.jl
Matlab Version¶
Model Code:
1disp('Hello from Matlab');
Model YAML:
1models:
2 - name: matlab_model
3 language: matlab # Runs the script using a Matlab engine
4 args: ./src/gs_lesson1.m
Python Version¶
Model Code:
1print('Hello from Python')
Model YAML:
1models:
2 - name: python_model
3 language: python # Runs the python script using default Python
4 args: ./src/gs_lesson1.py
R Version¶
Model Code:
1print('Hello from R')
Model YAML:
1models:
2 - name: R_model
3 language: R # Runs the R script using default R
4 args: ./src/gs_lesson1.R