由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - C++ OO approach to use multi-dim array for HPC
相关主题
求推荐:fortran好用的debug软件Help, what you can do in this situation?
什么是OS Memory management and heap structure?linux内存分配中page的几个问题
我是一个线程 (转载)转王垠雄文-Oberon 操作系统:一个被忽略的珍宝
请xiaoju和digua来讲讲COM技术吧请教一个逻辑地址到物理地址映射的问题 (转载)
我来给FP泼泼凉水吧转:王垠--一种新的操作系统设计
说说我以前做的ultra low latency架构吧Goodbug,是不是单机大于1 million/s的I/O你就输了?
C++ online Test 2题咱们好像生活在两个世界里
C++做题,麻烦师傅们再看看。大家有讨论 王垠新博文《未来计划》吗?
相关话题的讨论汇总
话题: array话题: use话题: class话题: c++话题: oo
进入Programming版参与讨论
1 (共1页)
c*******d
发帖数: 353
1
I would like to hear your comments on my design of this array class. The
purpose is to provide a fast, easy to use multi-dimensional array container.
/*
* A C/C++ OO approach to use multi-dimenisional array in HPC environment.
*
* Goal: speed, ease of use, robustness
*
* Design advantage:
* By using 1D array as data container, CPU prefetching, caching, TLB
* features are used to make data access faster. By providing error checking
* in access methods, bounds check can be easily done. Access me
s*****c
发帖数: 753
2
Why not put ndim in template also?
template class array;
Too many constructor. Either use stl:vector for dimlen, or the constructor
parameter is size_t *. Same can be done for ele. You could use a stl:vector, or an array (correct size is ensured by your main program). You could also define another template class called pixel, or point, or vector:
template class pixel
{
T data[N]
...
...
}

【在 c*******d 的大作中提到】
: I would like to hear your comments on my design of this array class. The
: purpose is to provide a fast, easy to use multi-dimensional array container.
: /*
: * A C/C++ OO approach to use multi-dimenisional array in HPC environment.
: *
: * Goal: speed, ease of use, robustness
: *
: * Design advantage:
: * By using 1D array as data container, CPU prefetching, caching, TLB
: * features are used to make data access faster. By providing error checking

c*******d
发帖数: 353
3
the purpose of this class is for high performance computing, therefore
performance and ease of use is very important, especially for people
with a heavy fortran background.
for example, the declaration should be simple:
array a3d(3,3,3);
not array a3d(vector(3,3,3)); // also overhead of creating vector
class

, or an array (correct size is ensured by your main program). You could also
define another template class called pixel, or point, or vector:

【在 s*****c 的大作中提到】
: Why not put ndim in template also?
: template class array;
: Too many constructor. Either use stl:vector for dimlen, or the constructor
: parameter is size_t *. Same can be done for ele. You could use a stl:vector, or an array (correct size is ensured by your main program). You could also define another template class called pixel, or point, or vector:
: template class pixel
: {
: T data[N]
: ...
: ...
: }

1 (共1页)
进入Programming版参与讨论
相关主题
大家有讨论 王垠新博文《未来计划》吗?我来给FP泼泼凉水吧
Multi-thread可以mutex锁资源,Multi-process怎么锁资源?说说我以前做的ultra low latency架构吧
為什麼golang algernon比C nginx慢幾十倍?golang行嗎C++ online Test 2题
用extern keyword定义的变量C++做题,麻烦师傅们再看看。
求推荐:fortran好用的debug软件Help, what you can do in this situation?
什么是OS Memory management and heap structure?linux内存分配中page的几个问题
我是一个线程 (转载)转王垠雄文-Oberon 操作系统:一个被忽略的珍宝
请xiaoju和digua来讲讲COM技术吧请教一个逻辑地址到物理地址映射的问题 (转载)
相关话题的讨论汇总
话题: array话题: use话题: class话题: c++话题: oo