Thread callback for OpenMP backend
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start with the test.c reproducer, the omp_cb callback, and the openblas_set_threads_callback_function entry point. Read the callback example in pull request #4577 and trace the callback arguments used during cblas_dgemm. Done means the reproducer completes without a segmentation fault, including when the callback uses the OpenMP loop.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi,
I'm trying to leverage #4577 in a project (scikit-learn) that has a mix of OpenMP and OpenBLAS built with the pthreads threading layer to make OpenBLAS use the OpenMP threadpool. Ideally we'd use an OpenBLAS built with the OpenMP threading layer but it's outside of our control because it comes from a dependency.
I naively tried the example callback presented in https://github.com/OpenMathLib/OpenBLAS/pull/4577#issue-2204960832, but I can't make it work. Here's a simple reproducer, just a gemm:
test.c
# include <stdio.h>
# include <stdlib.h>
# include <stddef.h>
# include <omp.h>
# include <cblas.h>
void omp_cb (int sync, openblas_dojob_callback dojob, int numjobs, size_t jobdata_elsize, void *jobdata, int dojob_data)
{
#pragma omp parallel for
for(int i = 0; i < numjobs; i++)
{
printf("thread: %d, i: %d\n", omp_get_thread_num(), i);
void *element_adrr = (void *) (((char *)jobdata) + ((unsigned) i)*jobdata_elsize);
dojob(i, element_adrr, dojob_data);
}
return;
}
void test()
{
int n = 100;
double *A = (double *)malloc(n * n * sizeof(double));
double *B = (double *)malloc(n * n * sizeof(double));
double *C = (double *)malloc(n * n * sizeof(double));
for(int i = 0; i < n * n; i++)
{
A[i] = 1.0;
B[i] = 1.0;
C[i] = 0.0;
}
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, n, n, n, 1.0, A, n, B, n, 0.0, C, n);
free(A);
free(B);
free(C);
}
int main()
{
openblas_set_threads_callback_function(omp_cb);
test();
}
Compile command:
gcc -o test test.c -fopenmp -I/home/jeremie/R/installs/OpenBLAS/include -Wl,-rpath,/home/jeremie/R/installs/OpenBLAS/lib -L/home/jeremie/R/installs/OpenBLAS/lib -lopenblas
It just results in a segfault at the first step of the loop. Note that it still segfaults if I remove the omp pragma and just use a sequential loop in the callback.
Any help would be greatly appreciated.
- Ngôn ngữ chính
- C
- Star
- 7.6k
- Fork
- 1.7k
- Merge trung bình
- 1 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 46
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của OpenMathLib/OpenBLAS
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
OpenMathLib/OpenBLAS#6069 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Missing cgroup awarenessĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
OpenMathLib/OpenBLAS#6059 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
OpenMathLib/OpenBLAS#6029 · 21 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
OpenMathLib/OpenBLAS#6028 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
OpenMathLib/OpenBLAS#6005 · 21 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của OpenMathLib/OpenBLAS
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
trezor/trezor-firmware#7997 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area/ysql kind/bug priority/medium status/awaiting-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
yugabyte/yugabyte-db#34415 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
KhronosGroup/OpenCL-Headers#318 ·
-
Build failure: mumbleĐang mở0.kind: build failure
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Maintainer thường phản hồi trong vòng 1 ngày