漢は黙って lightweight cloud OS, Bare metal programming ですね! レイトレーシングアプリを lightweight な VM(OS) で 100 万ノード規模で動かせる可能性出てきました.
OSv + aobench でまずは来るべき時代の準備してみましょう!
サンプルコードはこちらにあります.
バイナリとイメージを作る.
バイナリ(OSv では Linux .so 形式?)は通常の C++ アプリと同じように Makefile とかでコンパイルしてつくっておきます.
OSv 用イメージを作る.
capstan を用いてイメージを作ります. capstan をインストールしておきます. http://osv.io/capstan/
Capistanfile 書きます.
#
# Name of the base image. Capstan will download this automatically from
# Capstan repository.
#
base: cloudius/osv-base
#
# The command line passed to OSv to start up the application.
#
cmdline: /tools/ao.so
#
# The command to use to build the application. In this example, we just use
# make.
#
build: make
#
# List of files that are included in the generated image.
#
files:
/tools/ao.so: ao.so
イメージ作ります.
$ capstan build
実行する.
$ capstan run
Cool!
TODO
- STDOUT か OSv REST API 経由で aobench 画像出力するとよさげ.
- Capstan で qemu での実行が失敗すると tty がハングしてつらい
- OpenMP(gomp)など, アプリに依存 .so ライブラリがあるときのアプリの作り方をどうすか?