提交记录 13638
提交时间 |
评测时间 |
2020-08-05 20:13:03 |
2020-08-05 20:13:06 |
#define BLOCK_SIZE_L1 32
#define BLOCK_SIZE_L2 64
#define BLOCK_SIZE_L3 128
#define MIN(a,b) ((a)<(b)?(a):(b))
#pragma GCC optimize("-Ofast","-funroll-all-loops","-ffast-math","-ftree-vectorize")
__attribute__((optimize("tree-vectorize"))) void matrix_multiply(int n,const double* B,const double* A,double* C)
{
__attribute__((aligned(64))) double c[BLOCK_SIZE_L1][BLOCK_SIZE_L3];
for(int ii=0;ii<n;ii+=BLOCK_SIZE_L3)
for(int kk=0;kk<n;kk+=BLOCK_SIZE_L1)
{
#define ui BLOCK_SIZE_L3
#define uk BLOCK_SIZE_L1
#define uj BLOCK_SIZE_L2
for(int k=0;k<uk;++k)
for(int i=0;i<ui;++i) c[k][i]=0;
for(int jj=0;jj<n;jj+=BLOCK_SIZE_L2)
{
const double*__restrict__ bb=B+jj+kk*n;
const double*__restrict__ aa=A+ii+jj*n;
for(int k=0;k<uk;++k)
for(int j=0;j<uj;j++)
for(int i=0;i<ui;i++)
c[k][i]+=aa[i+j*n]*bb[j+k*n];
}
double*__restrict__ cc=C+ii+kk*n;
for(int k=0;k<uk;++k)
for(int i=0;i<ui;++i)
cc[i+k*n]+=c[k][i];
#undef ui
#undef uj
#undef uk
}
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 312.577 ms | 8 MB + 40 KB | Accepted | Score: 100 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:30:54 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠