Halide Tutorial 03
halideã®ãããã°ææ³ã«ã¤ãã¦ã®ãã¥ã¼ããªã¢ã«ã C++ãªãã¸ã§ã¯ãã¯èªèº«ã®ååãæããªãã®ã§ãFunc gradient("gradient")ã¨ããã¤ãã¦ããã ãã¤ãã©ã¤ã³ã®çä¼¼ã³ã¼ããçæãããã
#include "Halide.h" #include <stdio.h> using namespace Halide; int main(int argc, char **argv) { Func gradient("gradient"); Var x("x"), y("y"); gradient(x, y) = x + y; // Halide will also output an HTML version of this output, which // supports syntax highlighting and code-folding, so it can be // nicer to read for large pipelines. Open gradient.html with your // browser after running this tutorial. gradient.compile_to_lowered_stmt("gradient.html", {}, HTML); printf("Success!\n"); return 0; }
Halide Tutorial 02
æ¦è¦
libpngãç¨ãã¦å ¥åããç»åã«å¯¾ãã¦å¦çãå®è¡ãããã¥ã¼ããªã¢ã«ã å ¥åããç»åã®è¼åº¦ã1.5åããã Algorithmé¨åãåå²ï¼ã¯ã³ã©ã¤ã³ã§ã¯ãªãï¼ãã¦ããããã¨ãç´¹ä»ãã¦ããã
// Halide tutorial lesson 2: Processing images // The only Halide header file you need is Halide.h. It includes all of Halide. #include "Halide.h" // Include some support code for loading pngs. #include "halide_image_io.h" using namespace Halide::Tools; int main(int argc, char **argv) { // First we'll load the input image we wish to brighten. Halide::Buffer<uint8_t> input = load_image("images/rgb.png"); // Next we define our Func object that represents our one pipeline // stage. Halide::Func brighter; // Our Func will have three arguments, representing the position // in the image and the color channel. Halide treats color // channels as an extra dimension of the image. Halide::Var x, y, c; // Normally we'd probably write the whole function definition on // one line. Here we'll break it apart so we can explain what // we're doing at every step. // 1è¡ã§æ¸ããªãããã ããåå²OK // brighter(x, y, c) = Halide::cast<uint8_t>(min(input(x, y, c) * 1.5f, 255)); // For each pixel of the input image. Halide::Expr value = input(x, y, c); // Cast it to a floating point value. value = Halide::cast<float>(value); // Multiply it by 1.5 to brighten it. Halide represents real // numbers as floats, not doubles, so we stick an 'f' on the end // of our constant. value = value * 1.5f; // Clamp it to be less than 255, so we don't get overflow when we // cast it back to an 8-bit unsigned int. value = Halide::min(value, 255.0f); // Cast it back to an 8-bit unsigned integer. value = Halide::cast<uint8_t>(value); // Define the function. brighter(x, y, c) = value; Halide::Buffer<uint8_t> output = brighter.realize(input.width(), input.height(), input.channels()); // Save the output for inspection. It should look like a bright parrot. save_image(output, "brighter.png"); // See figures/lesson_02_output.jpg for a small version of the output. printf("Success!\n"); return 0; }
å®è¡ã³ãã³ã
g++ lesson_02*.cpp -g -I ../include -I ../tools -L ../bin -lHalide `libpng-config --cflags --ldflags` -lpthread -ldl -o lesson_02 -std=c++11 -ljpeg LD_LIBRARY_PATH=../bin ./lesson_02
Halide Tutorial 01
x+yã®å ç®é¢æ°ã¨ãç»åã®x座æ¨ã¨y座æ¨ã®indexãå ç®ãããã¹ããä½æãããã¥ã¼ããªã¢ã«ã ãªãã¸ããªã®ä¸ã®tutorialã®ã³ã¼ãã«ã¯ããããããã³ã¡ã³ãããã£ã±ãä¹ã£ã¦ããããè¦è¿ããããããã«æä½éåãé¨åãæãåºãã¦ã¿ãã æ¼ç®ãå®ç¾©ãã¦Funcã«ç»é²ãã¦è§£å度ãæå®ããã Hardwareä¾åã®é¨åã®è¨è¿°ã¯ä»å¾ã®ãã¥ã¼ããªã¢ã«ããªï¼
#include "Halide.h" #include <stdio.h> int main(int argc, char **argv) { Halide::Func gradient; Halide::Var x, y; Halide::Expr e = x + y; gradient(x, y) = e; Halide::Buffer<int32_t> output = gradient.realize(800, 600); // Let's check everything worked, and we got the output we were // expecting: for (int j = 0; j < output.height(); j++) { for (int i = 0; i < output.width(); i++) { // We can access a pixel of an Buffer object using similar // syntax to defining and using functions. if (output(i, j) != i + j) { printf("Something went wrong!\n" "Pixel %d, %d was supposed to be %d, but instead it's %d\n", i, j, i+j, output(i, j)); return -1; } } } printf("Success!\n"); return 0; }
g++ lesson_01*.cpp -g -I ../include -L ../bin -lHalide -lpthread -ldl -o lesson_01 -std=c++11 LD_LIBRARY_PATH=../bin ./lesson_01
Halide(release_2017_05_03) install @ubuntu16.04
åèurl
https://github.com/halide/Halide/tree/release_2017_05_03
Halideã®ãã©ã«ãã®ç´ä¸ã§llvmã¨clangããã«ããã¦ããhalideããã«ããããããã (Halideã®githubã¨ãã«ããæ¸ãã¦ãããå¥ã«ç´ä¸ã«ãããªãã¦ãããã®ã§ã¯ï¼ï¼ /opt/Halideã«ããããã¤ã³ã¹ãã¼ã«ãã¦ããã
git clone https://github.com/halide/Halide.git cd Halide git checkout release_2017_05_03 #ãã®ãã©ã«ãä¸ã§llvmã¨ãclangãã«ã
build llvm and clang
ç§ã®ç°å¢ã§ã¯ä¸è¨ã®ãã®ã追å ã§å¿ è¦ã§ããã
sudo apt install opam libxml2-dev
svn co https://llvm.org/svn/llvm-project/llvm/branches/release_37 llvm3.7 svn co https://llvm.org/svn/llvm-project/cfe/branches/release_37 llvm3.7/tools/clang cd llvm3.7 mkdir build cd build cmake -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_TARGETS_TO_BUILD="X86;ARM;NVPTX;AArch64;Mips;PowerPC" -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_BUILD_TYPE=Release .. make -j8
ç°å¢å¤æ°ã.bashrcã¨ãã«è¿½å ãã¦ããã
export LLVM_CONFIG=/opt/Halide/llvm3.7/build/bin/llvm-config export CLANG=/opt/Halide/llvm3.7/build/bin/clang
Halide build
cd .. #halide root directoryã«ç§»å make -j8
ç°å¢å¤æ°ã諸ã 追å
export HALIDE_ROOT=/opt/Halide export LD_LIBRARY_PATH="/opt/Halide/include:/opt/Halide/bin:$LD_LIBRARY_PATH"
ã¤ã³ã¹ãã¼ã«æå確èª
# ç°å¢å¤æ°èªã¿è¾¼ãã§ldconfigã¨ããã¦ãã(tutorialå®è¡ã ããªããããªãï¼ cd tutorial g++ lesson_01*.cpp -g -I ../include -L ../bin -lHalide -lpthread -ldl -o lesson_01 -std=c++11 LD_LIBRATY_PATH=../bin ./lesson_01
ä¸è¨ãå®è¡ãã¦Success!ã¨ã§ãã°OK
tmuxã®ãã¼æä½ãvim風ã«ããè¨å®
# prefixãã¼ãC-aã«å¤æ´ãã set -g prefix C-a # C-bã®ãã¼ãã¤ã³ãã解é¤ãã unbind C-b # ãã¼ã¹ããã¼ã¯ã®ãã£ã¬ã¤ãæ¸ãã set -sg escape-time 1 # ã¦ã£ã³ãã¦ã®ã¤ã³ããã¯ã¹ã1ããå§ãã set -g base-index 1 # ãã¤ã³ã®ã¤ã³ããã¯ã¹ã1ããå§ãã setw -g pane-base-index 1 # è¨å®ãã¡ã¤ã«ããªãã¼ããã #bind r source-file ~/.tmux.conf \; display "Reloaded!" # C-a*2ã§tmuxå ã®ããã°ã©ã ã«C-aãéã bind C-a send-prefix # | ã§ãã¤ã³ã縦ã«åå²ãã bind | split-window -h # - ã§ãã¤ã³ã横ã«åå²ãã bind - split-window -v # Vimã®ãã¼ãã¤ã³ãã§ãã¤ã³ã移åãã bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R bind -r C-h select-window -t :- bind -r C-l select-window -t :+ # Vimã®ãã¼ãã¤ã³ãã§ãã¤ã³ããªãµã¤ãºãã bind -r H resize-pane -L 5 bind -r J resize-pane -D 5 bind -r K resize-pane -U 5 bind -r L resize-pane -R 5 # ãã¦ã¹æä½ãæå¹ã«ãã setw -g mouse on # 256è²ç«¯æ«ã使ç¨ãã set-option -g default-terminal "screen-256color" # ã¹ãã¼ã¿ã¹ãã¼ã®è²ãè¨å®ãã #set -g status-fg white #set -g status-bg black
sshå ã®ãµã¼ãã§Flaskãå®è¡ããã¼ã«ã«ç°å¢ãã©ã¦ã¶ã§é²è¦§
æè¿ãå¤éã®ãã¼ã¿ãåæ±ãäºãå¤ããªã£ã¦ããã®ã§ãDataBaseãå¯è¦åããããã«Webç³»ã®åå¼·ãå§ãããã¨æãã¾ãã ã¾ãPythonã®Webãã¬ã¼ã ã¯ã¼ã¯ã®FlaskãSSHã§æ¥ç¶ãã¦ãããµã¼ãã§ä½¿ãããããªè¨å®ãè¦ã¤ãããã¨æãã¾ãã Flaskã¯PythonãAnacondaã§ã¤ã³ã¹ãã¼ã«ãã¦ããã¨ããã©ã«ãã§å ¥ã£ã¦ãããã¤è»½éã§ããããã«ä½¿ãããããã®ã§ã¾ãã¯ããã§ãã£ã¦ã¿ã¾ãã
# app.py from flask import Flask app = Flask(__name__) @app.route("/") def index(): return "Hello World!" if __name__ == "__main__": app.run(host="0.0.0.0", port=8088)
ãã¼ã«ã«ã®éçºç°å¢ã®ãã©ã¦ã¶ã§http://{sshå
ã®ip address}:8088
ã§Hello Worldã¨è¡¨ç¤ºããã¾ãã
ããããã®æ¹æ³ã§ã¯åä¸ã®ãã¼ã«ã«ã«å ¥ã£ã¦ããäººå ¨å¡ã«ã¿ãã¦ãã¾ãã¨ãããã¨ãããã è¦ãããããªãå ´åã¯å¯¾çãå¿ è¦ï¼ï¼
Centos7ã«Redmineãã¤ã³ã¹ãã¼ã«
åèURL :
Centos ã¤ã³ã¹ãã¼ã«
bitnami ã¤ã³ã¹ãã¼ã«
https://cloudpack.media/10562
http://ossfan.net/setup/redmine-03.html
mysqlã®ã¤ã³ã¹ãã¼ã«ä»è¿ã§ã¨ã©ã¼ã«ãªãã®ã§ä»¥ä¸ã®ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ãã¦ããã¾ãã
yum install -y perl-Data-Dumper
bitnamiãåèURLã«å¾ã£ã¦ã¤ã³ã¹ãã¼ã«
/opt/redmine
ã«ã¤ã³ã¹ãã¼ã«
ãã¡ã¤ã¢ã¦ã©ã¼ã«è¨å®
firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https firewall-cmd --reload
redmineãèªåèµ·å
systemctl list-unit-files -t service | grep redmine systemctl enable redmine.service
redmineãã¼ãå¤æ´
http://kuttsun.blogspot.jp/2015/10/bitnami-redmine-farendfancy.html
https://www.redminecrm.com/pages/a1-theme
/opt/redmine/apps/redmine/htdocs/public/themes
ã«ãã¼ããã©ã«ããããã¾ãã