This document contains a summary of 3 papers on deep residual networks and squeeze-and-excitation networks:
1. Kaiming He et al. "Deep Residual Learning for Image Recognition" which introduced residual networks for image recognition.
2. Andreas Veit et al. "Residual Networks Behave Like Ensembles of Relatively Shallow Networks" which analyzed how residual networks behave like ensembles.
3. Jie Hu et al. "Squeeze-and-Excitation Networks" which introduced squeeze-and-excitation blocks to help convolutional networks learn channel dependencies.
The document also references the PyTorch ResNet implementation and provides URLs to the first and third papers. It contains non-English
This document contains a summary of 3 papers on deep residual networks and squeeze-and-excitation networks:
1. Kaiming He et al. "Deep Residual Learning for Image Recognition" which introduced residual networks for image recognition.
2. Andreas Veit et al. "Residual Networks Behave Like Ensembles of Relatively Shallow Networks" which analyzed how residual networks behave like ensembles.
3. Jie Hu et al. "Squeeze-and-Excitation Networks" which introduced squeeze-and-excitation blocks to help convolutional networks learn channel dependencies.
The document also references the PyTorch ResNet implementation and provides URLs to the first and third papers. It contains non-English
21. “MANAGED” オプションなしでビルド
pgcc -ta=tesla -Minfo=accel laplace2d.c jacobi.c
laplace2d.c:
PGC-S-0155-Compiler failed to translate accelerator region (see -Minfo
messages): Could not find allocated-variable index for symbol (laplace2d.c: 47)
calcNext:
47, Accelerator kernel generated
Generating Tesla code
48, #pragma acc loop gang /* blockIdx.x */
Generating reduction(max:error)
50, #pragma acc loop vector(128) /* threadIdx.x */
48, Accelerator restriction: size of the GPU copy of Anew,A is unknown
50, Loop is parallelizable
PGC-F-0704-Compilation aborted due to previous errors. (laplace2d.c)
PGC/x86-64 Linux 18.7-0: compilation aborted
jacobi.c:
–ta=tesla:managed から “managed” を削除
36. OPENACC DATA ディレクティブ
§ data ディレクティブは、個々のループをま
たいで、データがデバイスに存在するライフ
タイムを定義する。
§ データ領域中は、デバイスがデータを所有
している。
§ data クローズは、データ領域でのデータ
転送と形状を表現する。
定義
#pragma acc data clauses
{
< Sequential and/or Parallel code >
}
!$acc data clauses
< Sequential and/or Parallel code >
!$acc end data
37. STRUCTURED DATA ディレクティブ
使⽤例
#pragma acc data copyin(a[0:N],b[0:N]) copyout(c[0:N])
{
#pragma acc parallel loop
for(int i = 0; i < N; i++){
c[i] = a[i] + b[i];
}
}
動作
ホスト メモリ デバイス メモリ
A B C
デバイス上に A の
メモリ領域を確保
A を CPU からデ
バイスにコピー
A
デバイス上に B の
メモリ領域を確保
B を CPU から
デバイスにコピー
B
デバイス上に C の
メモリ領域を確保
デバイス上で
ループを実⾏
C’
C をデバイスから
CPU へコピー
C’
デバイス上の
C を解放
デバイス上の
B を解放
デバイス上の
A を解放
38. #pragma acc data copy(A[0:n*m]) copyin(Anew[0:n*m])
while ( err > tol && iter < iter_max ) {
err=0.0;
#pragma acc parallel loop reduction(max:err) copyin(A[0:n*m]) copy(Anew[0:n*m])
for( int j = 1; j < n-1; j++) {
for( int i = 1; i < m-1; i++ ) {
Anew[OFFSET(j, i, m)] = 0.25 * ( A[OFFSET(j, i+1, m)] + A[OFFSET(j, i-1, m)]
+ A[OFFSET(j-1, i, m)] + A[OFFSET(j+1, i, m)]);
error = fmax( error, fabs(Anew[OFFSET(j, i, m)] - A[OFFSET(j, i , m)]));
}
}
#pragma acc parallel loop copyin(Anew[0:n*m]) copyout(A[0:n*m])
for( int j = 1; j < n-1; j++) {
for( int i = 1; i < m-1; i++ ) {
A[OFFSET(j, i, m)] = Anew[OFFSET(j, i, m)];
}
}
iter++;
}
最適化されたデータ転送
必要な時のみ A をコピー。
Anew の初期条件はコピーす
るが、最終的な値はしない。
47. ⾮構造 DATA ディレクティブ
§ データのライフタイムは、必ずしもきれいに構造
化されているとは限らない。
§ Enter data ディレクティブはデバイスのメモリ
確保を処理する。
§ メモリ確保のために、create か copyin のど
ちらかを使うことができる。
§ 複数の enter data ディレクティブを挿⼊する
ことができるので、その enter data ディレク
ティブが、data 領域の開始とは限らない。
Enter Data ディレクティブ
#pragma acc enter data clauses
< Sequential and/or Parallel code >
#pragma acc exit data clauses
!$acc enter data clauses
< Sequential and/or Parallel code >
!$acc exit data clauses
48. ⾮構造 DATA ディレクティブ
§ Exit data では、デバイスのメモリ解放を処理
する。
§ メモリ解放のために、delete か copyout のど
ちらかを使うことができる。
§ ある配列に対して、enter data の数だけ
exit data を挿⼊する。
§ これらは、別々の関数に挿⼊することができる。
Exit Data ディレクティブ
#pragma acc enter data clauses
< Sequential and/or Parallel code >
#pragma acc exit data clauses
!$acc enter data clauses
< Sequential and/or Parallel code >
!$acc exit data clauses
49. ⾮構造 DATA クローズ
copyin ( list ) enter data に際し、デバイス上にメモリを確保し、ホストからデバイスへデータ
をコピー。
copyout ( list ) exit data に際し、デバイスからホストへデータをコピーし、デバイス上のメモリ
を解放。
create ( list ) enter data に際し、データ転送なしでデバイス上にメモリを確保。
delete ( list ) exit data に際し、データ転送なしでデバイス上のメモリを解放。