https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102320
Bug ID: 102320 Summary: Set cpu affinity error Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: zhuguanghong at uniontech dot com CC: jakub at gcc dot gnu.org Target Milestone: --- libgomp/config/linux/affinity.c this is error ? ....... void gomp_init_affinity (void) { if (gomp_places_list == NULL) { if (!gomp_affinity_init_level (1, ULONG_MAX, true)) return; } struct gomp_thread *thr = gomp_thread (); pthread_setaffinity_np (pthread_self (), gomp_cpuset_size, (cpu_set_t *) gomp_places_list[0]); // this set one cpu ?because parse_affinity thr->place = 1; thr->ts.place_partition_off = 0; thr->ts.place_partition_len = gomp_places_list_len; } ....... parse_affinity ...... while (needed--) 11 { 10 void *p = gomp_places_list[gomp_places_list_len]; 9 gomp_affinity_init_place (p); 8 if (gomp_affinity_add_cpus (p, cpu_beg, 1, 0, true))//different cpuset ,GOMP_CPU_AFFINITY=0-x ,gomp_places_list[0] is ? 7 ++gomp_places_list_len; 6 cpu_beg += cpu_stride; 5 } ...... //error GOMP_CPU_AFFINITY=0-x