Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error compiling gemm_report #16

Closed
MigMuc opened this issue Mar 30, 2017 · 6 comments
Closed

Error compiling gemm_report #16

MigMuc opened this issue Mar 30, 2017 · 6 comments
Labels

Comments

@MigMuc
Copy link

MigMuc commented Mar 30, 2017

I am trying to compile the gemm_report.d in the bench folder. But I got an error:
[mig@antergos-mig bench]$ dub build --compiler=ldmd2 -b release --single gemm_report.d The determined compiler type "ldc" doesn't match the expected type "dmd". This will probably result in build errors. dub.json(12): Error: Expected '}' or ',' - got '"'.

I guess I have to remove the commented out part for the OpenBLAS libs:
`!/usr/bin/env dub
/+ dub.json:
{
"name": "gemm_report",
"dependencies": {"mir-glas": {"path": "../"}, },
"libs": ["blas"],
"lflags": ["-L$MIR_GLAS_PACKAGE_DIR", "-L$MIR_CPUID_PACKAGE_DIR", "-L.."],
"dependencies": {
"cblas": ">1.0.0",
"mir-glas":{
"path": "../"
}
"mir-cpuid": "
>0.4.2",
},
"dflags-ldc": ["-mcpu=native"],
}
+/
"lflags": ["-L/opt/OpenBLAS/lib"],
"libs": ["openblas"],

// Set up your libblas to approporiate version, or just copy it to the benchmarks/glas folder.
// Note: GLAS is single thread for now.
...`

@9il
Copy link
Member

9il commented Mar 30, 2017

Thanks for the report! Fixed in master, cc295db.

@9il 9il closed this as completed Mar 30, 2017
@9il 9il added the bug label Mar 30, 2017
@9il
Copy link
Member

9il commented Mar 30, 2017

@MigMuc please note #18

@MigMuc
Copy link
Author

MigMuc commented Mar 30, 2017

Thanks for the quick replay. Unfortunately the patch doesn't help. I get the following error:

warning: The -noboundscheck switch is deprecated, use -boundscheck=off instead.
Linking...
Linking...
.dub/build/application-release-linux.posix-x86_64-ldc_2071-C2BA41EA50595A242D053DA240AE0475/gemm_report.o: In function `_Dmain':
../../../../.dub/packages/mir-algorithm-0.4.5/mir-algorithm/source/mir/utility.d:(.text._Dmain[_Dmain]+0x61e): undefined reference to `cblas_sgemm'
/home/miguel/Dokumente/DLang/mir-glas-0.2.0//libmir-glas.a(home.miguel.Dokumente.DLang.mir-glas-0.2.0.source.glas.precompiled.context.d.o): In function `glas_init':
../source/glas/precompiled/context.d:(.text.glas_init[glas_init]+0x17): undefined reference to `cpuid_init'
../source/glas/precompiled/context.d:(.text.glas_init[glas_init]+0x1c): undefined reference to `cpuid_dCache'
../source/glas/precompiled/context.d:(.text.glas_init[glas_init]+0x27): undefined reference to `cpuid_uCache'
collect2: Fehler: ld gab 1 als Ende-Status zurück
Error: /usr/bin/gcc failed with status: 1
ldmd2 failed with exit code 1.``

I have included my precompiled OpenBLAS lib as follows:

`
#!/usr/bin/env dub
/+ dub.json:
{
        "name": "gemm_report",
        "libs": ["blas"],
    "lflags": ["-L$MIR_GLAS_PACKAGE_DIR", "-L$MIR_CPUID_PACKAGE_DIR", "-L.."],
    "dependencies": {
                "cblas": "~>1.0.0",
        "mir-glas":{
            "path": "../"
        },
        "mir-cpuid": "~>0.4.2"
    }
}
+/
        "lflags": ["-L/opt/OpenBLAS/lib"],
        "libs": ["openblas"],
`

@9il
Copy link
Member

9il commented Mar 31, 2017

This looks like dub issue.

Please check that cblas_sgemm is defined in your BLAS library. If not, please link also Netlibs cblas. Proper openblas always have cblas_sgemm symbol.

The gemm_report.d from master works for me. Please send more information:
OS, compiler version, dub version, and how you call dub.

@MigMuc
Copy link
Author

MigMuc commented Mar 31, 2017

I have installed OpenBLAS in /opt/OpenBLAS/lib/libopenblas.so. cblas_gemm is included in the lib:
[miguel@antergos-mig bench]$ nm -D /opt/OpenBLAS/lib/libopenblas.so | grep cblas_sgemm 000000000004e6c0 T cblas_sgemm
Do I have to add anything to the *.json header (see in my post above)?

I am not familiar with dub so is there a possibility to chek the compile command?

@MigMuc
Copy link
Author

MigMuc commented Mar 31, 2017

Ok. I got it. I have to append my libs in the definition above like:

/+ dub.json:
{
        "name": "gemm_report",
        "libs": ["openblas"],
        "lflags": ["-L$MIR_GLAS_PACKAGE_DIR", "-L$MIR_CPUID_PACKAGE_DIR", "-L..", "-L/opt/OpenBLAS/lib"],
        "dependencies": {
                "cblas": "~>1.0.0",
                "mir-glas":{ "path": "../" },
                "mir-cpuid": "~>0.4.2"
        }
}
+/`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants