rodinia 3.1 肌细胞基准测试中的奇怪构造
Weird construct in rodinia 3.1 myocyte benchmark
我目前正在研究一个概念性的 RISCV SIMT 架构,我们的模拟器只模拟一些需要的库调用。我们正在尝试 运行 openmp
rodinia 3.1 基准测试,但由于我们只有 pthread
支持,我正在尝试将简单的静态调度 openmp
代码转换为 pthread
代码。
我在 myocyte
基准测试中发现了这种结构:
// master.c
void master(params) {
// declaration of th_id
int th_id;
// no initialization of th_id
#pragma omp parallel private(th_id)
{
// code that uses th_id as a "thread id" value
}
}
// main.c
#pragma omp parallel for
for (i=0; i<N; i++) {
master(params);
}
据我了解,开发人员依靠 master.c
代码中的 #pragma
来初始化变量 th_id
,但我找不到它在 openmp 中的说明文档。假设 th_id
被 ompenmp 识别和初始化完全正确还是错误?
此 OpenMP 基准测试代码已完全损坏。平行区的开头应该是这样的:
th_id = omp_get_thread_num();
它获取调用线程的ID,是一个介于0和执行并行区域的线程数减1之间的数字,其中0对应主线程。
再说一次,这段代码真的很烂,好像是从 Fortran 翻译过来的。数组访问越界:
int th_count[4];
...
#pragma omp parallel private(th_id)
{
...
if (th_id == th_count[4]) {
...
}
我会说你应该简单地放弃肌细胞基准。
我目前正在研究一个概念性的 RISCV SIMT 架构,我们的模拟器只模拟一些需要的库调用。我们正在尝试 运行 openmp
rodinia 3.1 基准测试,但由于我们只有 pthread
支持,我正在尝试将简单的静态调度 openmp
代码转换为 pthread
代码。
我在 myocyte
基准测试中发现了这种结构:
// master.c
void master(params) {
// declaration of th_id
int th_id;
// no initialization of th_id
#pragma omp parallel private(th_id)
{
// code that uses th_id as a "thread id" value
}
}
// main.c
#pragma omp parallel for
for (i=0; i<N; i++) {
master(params);
}
据我了解,开发人员依靠 master.c
代码中的 #pragma
来初始化变量 th_id
,但我找不到它在 openmp 中的说明文档。假设 th_id
被 ompenmp 识别和初始化完全正确还是错误?
此 OpenMP 基准测试代码已完全损坏。平行区的开头应该是这样的:
th_id = omp_get_thread_num();
它获取调用线程的ID,是一个介于0和执行并行区域的线程数减1之间的数字,其中0对应主线程。
再说一次,这段代码真的很烂,好像是从 Fortran 翻译过来的。数组访问越界:
int th_count[4];
...
#pragma omp parallel private(th_id)
{
...
if (th_id == th_count[4]) {
...
}
我会说你应该简单地放弃肌细胞基准。