当我使用"#pragma omp parallel num_threads(4)"时,为什么我没有获得不同的线程ID.在这种情况下,所有线程ID都为0.但是当我评论该行并使用默认的线程数时,我得到了不同的线程ID.注意: - 变量我使用变量tid来获取线程ID.
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[])
{
int nthreads, tid;
int x = 0;
#pragma omp parallel num_threads(4)
#pragma omp parallel private(nthreads, tid)
{
/* Obtain thread number */
tid = omp_get_thread_num();
printf("Hello World from thread = %d\n", tid);
// /* Only master thread does this */
if (tid == 0)
{
nthreads = omp_get_num_threads();
printf("Number of threads = %d\n", nthreads);
}
}
}
Run Code Online (Sandbox Code Playgroud)
上述代码的输出: -
Hello World …Run Code Online (Sandbox Code Playgroud) if如果它只是被忽略,那么在一个陈述中第一个论点的重要性是什么?例如,在:
#include<stdio.h>
main()
{
if(1,0)
printf("abc");
else
printf("qwe");
}
Run Code Online (Sandbox Code Playgroud) 例如:
示例RDF字符串.
<Tom_Wilkinson_(演员)> <actedIn>"In_the_Bedroom","The_Patriot_(2000_film)","Black_Knight_(电影)","The_Last_Kiss","Cassandras_Dream"; <bornOnDate>"1948-12-12"; <isCalled>"Tom Wilkinson(Schauspieler)","טוםוילקינסון","トム·ウィルキンソン","Tom Wilkinson","וםוילקינסון","ム·ウィルキンソン"; .
给定字符串的三元组 -
<Tom_Wilkinson_(actor)> <actedIn> "In_the_Bedroom"
<Tom_Wilkinson_(actor)> <actedIn> "The_Patriot_(2000_film)"
<Tom_Wilkinson_(actor)> <actedIn> "Black_Knight_(film)"
<Tom_Wilkinson_(actor)> <actedIn> "The_Last_Kiss"
<Tom_Wilkinson_(actor)> <actedIn> "Cassandras_Dream"
<Tom_Wilkinson_(actor)> <bornOnDate> "1948-12-12"
<Tom_Wilkinson_(actor)> <isCalled> "Tom Wilkinson (Schauspieler)"
Run Code Online (Sandbox Code Playgroud)
注 - 对象之间可以有空格.比方说"Tom Wilkinson(Schauspieler)"是一个包含空格的对象.