https://github.com/chokkan/gfqsub
Gfarmファイルシステムに置かれたファイルの局所性を考慮した簡単なジョブキューシステム。岡崎さん作。Pythonで記述。Qiitaの記事で少しだけ触れられている。
~/.gfqsub に設定を書く。
| require 'zlib' | |
| def png_chunk(type,data) | |
| [data.bytesize,type,data,Zlib.crc32(type+data)].pack("NA4A*N") | |
| end | |
| def png_save(file,width,height,raw_data) | |
| depth = 8 | |
| color_type = 2 | |
| File.open(file,'w') do |f| | 
| #!/bin/bash | |
| profs="create_time open_time close_time read_time write_time | |
| create_count open_count close_count read_count write_count | |
| read_size write_size" | |
| gfarm_mp=$(awk '/^gfarm2fs .+,user='$USER' / {print $2}' /etc/mtab) | |
| if [ "$gfarm_mp" = "" ]; then | |
| echo "no gfarm mount point" 1>&2 | 
| #!/usr/bin/env python | |
| # mpiexec -n <number_of_nodes> /path/to/demo_gfarm_pool.py" | |
| from lsst.daf.persistence import LogicalLocation | |
| from hsc.pipe.base.pool import startPool, Pool, PoolSlave | |
| import gfarm2fs | |
| # invoke gfarm2fs on workers | 
https://github.com/chokkan/gfqsub
Gfarmファイルシステムに置かれたファイルの局所性を考慮した簡単なジョブキューシステム。岡崎さん作。Pythonで記述。Qiitaの記事で少しだけ触れられている。
~/.gfqsub に設定を書く。
| module Decorator | |
| @@decorators = [] | |
| def decorate(method_name,*args) | |
| @@decorators << [method_name.to_sym,args] | |
| end | |
| def method_added(method_name) | |
| super | |
| return if @@decorators.empty? | |
| decorators = @@decorators.reverse.map{|name,args| [method(name),args]} | |
| @@decorators = [] | 
        | require_relative 'narray' | |
| def measure(m,s,&b) | |
| t = Time.now | |
| m.times(&b) | |
| printf "%s time=%.3f\n", s, Time.now-t | |
| end | |
| (2..7).each do |x| | |
| n = 10**x | 
| NCORE = ENV['NCORE'].to_i | |
| PARAMS = ENV['PARAMS'].split | |
| SH = ENV['SH'] | |
| sync = "sync_begin" | |
| task sync | |
| PARAMS.each do |param| | |
| a = [] | |
| NCORE.times.map do |core| | 
| import time | |
| import numpy as np | |
| def measure(label,ary,repeat): | |
| t = time.time() | |
| for j in range(repeat): | |
| ret = 0 | |
| for i in range(len(ary)): | |
| ret += ary[i] | |
| print "%16s: %f"%(label,time.time()-t) | 
| code = 'system gets; puts "end"' | |
| host = "tsukuba100" | |
| cmd = "ssh -x -T #{host} \"ruby -e 'eval ARGF.read(#{code.size})'\"" | |
| r0,w0 = IO.pipe | |
| r1,w1 = IO.pipe | |
| pid = spawn(cmd,:in=>r0,:out=>w1) | |
| w0.write(code) | |
| w0.puts("hostname") |