パスワードを忘れた? アカウント作成

t-nissieさんのトモダチの日記みんなの日記も見てね。 最新から新しい日記やタレこみを確認できますよ。

2495856 journal
日記

t-nissieの日記: 【電脳】FTDIで遊んでみた

日記 by t-nissie

FTDIで遊んでみた

/*
  hello-ftdi.c: flash LED 3 times.
  This example uses the libftdi API.
  Reference: http://hackaday.com/2009/09/22/introduction-to-ftdi-bitbang-mode/
  Usage:
     $ su
     # ./hello-ftdi
*/
#include <stdio.h>
#include <ftdi.h>
 
#define PIN_TX  0x01
#define PIX_RX  0x02
#define PIN_RTS 0x04
#define PIN_CTS 0x08
#define PIN_DTR 0x10
#define PIN_DSR 0x20
#define PIN_DCD 0x40
#define PIN_RI  0x80
 
#define LED PIN_TX
 
int main()
{
    unsigned char c = 0;
    struct ftdi_context ftdic;
 
    /* Initialize context for subsequent function calls */
    ftdi_init(&ftdic);
 
    /* Open FTDI device based on FT232R vendor & product IDs */
    if(ftdi_usb_open(&ftdic, 0x0403, 0x6001) < 0) {
        puts("Can't open device");
        return 1;
    }
 
    /* Enable bitbang mode with a single output line */
    ftdi_set_bitmode(&ftdic, LED, BITMODE_BITBANG);
 
    /* Endless loop: invert LED state, write output, pause 1 second */
    c ^= LED; ftdi_write_data(&ftdic, &c, 1); sleep(1);
    c ^= LED; ftdi_write_data(&ftdic, &c, 1); sleep(1);
    c ^= LED; ftdi_write_data(&ftdic, &c, 1); sleep(1);
    c ^= LED; ftdi_write_data(&ftdic, &c, 1); sleep(1);
    c ^= LED; ftdi_write_data(&ftdic, &c, 1); sleep(1);
    c ^= LED; ftdi_write_data(&ftdic, &c, 1);
}
 
/*
local variables:
  compile-command: "gcc -o hello-ftdi hello-ftdi.c -lftdi"
End:
*/

間違ってた。偶然動いてた。
誤 ftdi_set_bitmode(&ftdic, BITMODE_BITBANG, LED);
正 ftdi_set_bitmode(&ftdic, LED, BITMODE_BITBANG);

2319699 journal
日記

t-nissieの日記: How to avoid "/usr/bin/ld: cannot find -lblas" error

日記 by t-nissie

feram のコンパイルのときに

/usr/bin/ld: cannot find -lblas

ってエラーになって困って、
ググったら解決方法が見つかった話。

Dear feram users,

I encountered “/usr/bin/ld: cannot find -lblas” error,
when I did "./configure" for feram-0.18.05 on CentOS 6.2,
though I surely installed /usr/lib64/libblas.so.3.

I found solution for it in
http://linuxtoolkit.blogspot.jp/2011/11/cannot-find-llapack-when-doing-usrbinld.html.

Here, I summarized:

=== CentOS 6.2 (feram-0.18.05, 2012-03-28)
CentOS 6.2 can be installed to your x86_64 system with DVD and
CD-ROM images in http://isoredirect.centos.org/centos/6/isos/x86_64/ .
 
Network installation is also available with a CD-ROM image of
CentOS-6.2-x86_64-netinstall.iso. See
http://www.if-not-true-then-false.com/2011/centos-6-netinstall-network-installation/
for more details.
 
Select "Software Development Workstation" in the setup.
 
==== check the version of gfortran
  $ gfortran --version
  GNU Fortran (GCC) 4.4.6 ...
 
==== install fftw-3.3.1.tar.gz
  $ tar zxf fftw-3.3.1.tar.gz
  $ cd fftw-3.3.1
  $ mkdir CentOS
  $ cd CentOS
  $ ../configure --prefix=/usr/local --libdir=/usr/local/lib64 --enable-openmp --enable-threads --enable-sse2 --enable-avx --enable-shared
  $ make check
  $ su
  # make install
  # exit
 
==== install BLAS and LAPACK
  $ su
  # yum install blas.x86_64 lapack.x86_64
  # cd /usr/lib64
  # ln -s libblas.so.3 libblas.so
  # ln -s liblapack.so.3 liblapack.so
  # exit
Symbolic links are for avoiding error of "/usr/bin/ld: cannot find -lblas".
See http://linuxtoolkit.blogspot.jp/2011/11/cannot-find-llapack-when-doing-usrbinld.html for more details.
 
==== compile feram
  $ export LD_LIBRARY_PATH=/usr/local/lib64   # Do not forget it.
  $ tar Jxf feram-0.18.05.tar.xz
  $ cd feram-0.18.05
  $ mkdir CentOS
  $ cd CentOS
  $ ../configure --help
  $ ../configure
  $ cd src
  $ make
  $ make feram_mpi   # OPTIONAL
  $ ls -l feram*
  $ ldd feram

1907975 journal
Debian

t-nissieの日記: 【電脳】Debianにメール書いてみた: libfftw3-3 configure options add:--enable-openmp discard...

日記 by t-nissie

Debian Science Teamにメール書いてみた。こんなかんじで。

Subject: libfftw3-3 configure options add:--enable-openmp discard:--enable-portable-binary

Dear Debian Science Team,

As written in http://www.fftw.org/release-notes.html ,
we can set --enable-threads and --enable-openmp to the
configure options for fftw-3.3.x at the same time.
Moreover, we do not need --enable-portable-binary option
any more, because it produces portable binaries by default.
Please add libraries of /usr/lib/libfftw3*_omp.* to the
libfftw3-3 package.

Here is the patch for "rules":
===================================================================
--- rules~ 2011-11-29 09:54:36.000000000 +0900
+++ rules 2012-03-03 17:55:34.000000000 +0900
@@ -59,7 +59,7 @@
  SETCFLAGS := CFLAGS='$(CFLAGS)'

  # common configure options
-archconfflags := $(archconfflags) --prefix=/usr --enable-shared --enable-threads --enable-portable-binary
+archconfflags := $(archconfflags) --prefix=/usr --enable-shared --enable-threads --enable-openmp

  build-arch:
          # single precision
===================================================================

cf.
fftw-devel-3.3-3.fc16 RPM for i686
http://rpmfind.net//linux/RPM/fedora/16/i386/fftw-devel-3.3-3.fc16.i686.html

Thank you for your generous contributions for Debian,
(シグネチャ)

1903279 journal
日記

t-nissieの日記: 【電脳】並列化率を上げるためにさらにやるべきこと 3

日記 by t-nissie

フリーソフトウエアの強誘電体シミュレータferam-0.18.05のgfortranでの並列化率(プログラムで並列化されている部分の割合)をさらに上げるには、すでにSR11000で並列化が済んでいるので、それのプロファイルとgfortranのほうのompPとかで取ったプロファイルとを見比べながら足りないところに1つ1つOpenMPのディレクティブを入れていくだけ。valgrindとかも使えるのかなぁ。

ompPはPAPI hw-counter libraryがあるとより情報を取ってくれるらしい。

feram-0.18.05/src/18example-benchmark/で取った並列化率、並列効果の図

feramは使用メモリ量が少ないです。2GBもあれば十分です。だれか遊んでみない?

1887052 journal
日記

t-nissieの日記: 【電脳】feram-0.18.05の並列化率、並列効果の図ができたよ 3

日記 by t-nissie

フリーソフトウエアの強誘電体シミュレータferam-0.18.05並列化率、並列効果の図があがったよ。
SR11000では99%以上の並列化率なんだけど、自動並列化がないgfortranでの並列化率はまだ80%。
使っているのはFortranとOpenMP。

(2012-03-03 Made plot lines thicker.)

1882582 journal
日記

t-nissieの日記: 【電脳】フリーソフトウエアの強誘電体シミュレータferam-0.18.05リリース【閏の肉の日】

日記 by t-nissie

今日は400年(365日×400+97日=146097日)に97日しかない閏の肉の日なのでフリーソフトウエアの強誘電体シミュレータferam-0.18.05がリリースされました。

arXiv:1202.3893に載ってるPbTiO3の90°ドメイン構造が feram-0.18.05/src/17example-PbTiO3-100-900K/ で再現可能。

1120674 journal
アップグレード

t-nissieの日記: 【電脳】GPU/CUDAプログラミング cuFFTを試したい 1

日記 by t-nissie

5年以上前に買った小型のパソコンHP dc5100 (Pentium 4) に
玄人指向のGF-GT520-LE1GHを入れればUbuntuで
GPU/CUDAプログラミングが体験できるようになるのだろうか。
とりあえずcuFFTを試したい。
HP dc5100 http://h50146.www5.hp.com/products/desktops/old/dc5100sf_ct/pentium4_model.html
GF-GT520-LE1GH http://www.kuroutoshikou.com/modules/display/?iid=1598

typodupeerror

日々是ハック也 -- あるハードコアバイナリアン

読み込み中...