libmir / mir-glas

[Experimental] LLVM-accelerated Generic Linear Algebra Subprograms
Other
103 stars 10 forks source link

Error compiling gemm_report #16

Closed MigMuc closed 7 years ago

MigMuc commented 7 years ago

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 commented 7 years ago

Thanks for the report! Fixed in master, https://github.com/libmir/mir-glas/commit/cc295db900a94b3a925f5eef114b74a47e558e35.

9il commented 7 years ago

@MigMuc please note #18

MigMuc commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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"
        }
}
+/`