Installing Barvinok

9 views
Skip to first unread message

Anuradha Prakash

unread,
Feb 3, 2024, 9:35:02 AMFeb 3
to isl Development
Hi,

Could you please share the exact steps to install and run barvinok.

I am currently facing the fallowing issue, https://github.com/NVlabs/timeloop/issues/222 and was hoping to understand what needs to be done to resolve this?

Hoping to hear from you at the earliest.

Thanks!

Sven Verdoolaege

unread,
Feb 3, 2024, 9:41:28 AMFeb 3
to Anuradha Prakash, isl Development
On Sat, Feb 03, 2024 at 06:32:00AM -0800, Anuradha Prakash wrote:
> Hi,
>
> Could you please share the exact steps to install and run barvinok.

Did you try the instructions in "README"?

> I am currently facing the fallowing
> issue, https://github.com/NVlabs/timeloop/issues/222 and was hoping to
> understand what needs to be done to resolve this?

Please be a bit more specific. Apparently that issue was resolved.

skimo

Dmitry N. Mikushin

unread,
Feb 3, 2024, 11:22:15 AMFeb 3
to Anuradha Prakash, isl Development
Hi Prakash,

Such a nice project deserves a good Docker container for everyone's enjoyable working experience. Would you like to jointly create one? Would you be able to test it?

Kind regards,
Dmitry.


сб, 3 февр. 2024 г. в 15:35, Anuradha Prakash <anurada...@gmail.com>:
--

---
You received this message because you are subscribed to the Google Groups "isl Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isl-developme...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isl-development/06f1368e-dd03-47ad-8230-6063148416acn%40googlegroups.com.

Anuradha Prakash

unread,
Feb 3, 2024, 10:33:30 PMFeb 3
to Dmitry N. Mikushin, isl Development
Hi,

I am hoping it doesn't involve too much experimenting since my capstone is hanging by a thread. I really need to start my architecture changes ASAP.

Thanks.

Sven Verdoolaege

unread,
Feb 4, 2024, 5:34:13 PMFeb 4
to Anuradha Prakash, isl Development
Please keep the mailing list in CC.

On Sat, Feb 03, 2024 at 09:07:04PM +0530, Anuradha Prakash wrote:
> Hi,
>
> I went over the README file, but I believe there's something going wrong in
> the setup.
>
> The last error I got on running the, ./configure --prefix=/opt
> --with-gmp-prefix=/opt --with-ntl-prefix=/opt --enable-shared-barvinok
> checking which NTL to use... system
> checking NTL/ZZ.h usability... no
> checking NTL/ZZ.h presence... no
> checking for NTL/ZZ.h... no
> configure: error: ntl not compiled with gmp support

Are you sure you installed NTL in /opt?
Which version of NTL and which version of barvinok are you trying to compile?
Posting config.log may shed some light on the issue.

> I was hoping to get a document with a bit more specification on exactly
> what needs to be done or a possible apt install command to take care of
> this?

On Ubuntu, ntl-devel may work.

skimo

Anuradha Prakash

unread,
Feb 4, 2024, 9:50:01 PMFeb 4
to sven.ver...@gmail.com, isl Development
Hi,

NTL version used is, 5.4.2. Will try installing it in /opt.
As for, barvinok version 0.39 was downloaded from https://barvinok.sourceforge.io/ but it didn't have the autogen script available in it and had to clone a version of 4.x from the git page.

However, there's a closed issue in Timeloop, https://github.com/NVlabs/timeloop/issues/222, where it supports only a version barvinok 3x. If this were a known issue, I'm hoping you could redirect the the last stable version of barvinok I could use.

Thanks,
Anuradha Prakash 

Emil Vatai

unread,
Feb 4, 2024, 10:07:43 PMFeb 4
to sven.ver...@gmail.com, Anuradha Prakash, isl Development
Dear All,

@sven, this *should* work (but it doesn't)

```bash
### BEGIN barvinok.dockerfile ###
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update
RUN apt-get install -y git build-essential python-is-python3 autoconf pkg-config libgmp-dev libntl-dev libtool llvm clang llvm-dev libc++-dev libclang-dev llvm-dev libyaml-dev bash-completion ninja-build cmake

RUN git clone git://repo.or.cz/barvinok.git
WORKDIR barvinok
RUN ./get_submodules.sh
RUN ./autogen.sh
RUN ./configure --with-pet=bundled --with-clang=system --enable-shared-barvinok --prefix=/usr
RUN make -j
RUN make isl.py
RUN make install

RUN echo 'export LD_LIBRARY_PATH=/barvinok/.libs:/barvinok/pet/.libs${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc
RUN echo 'export PYTHONPATH=/barvinok:/barvinok/pet/interface${PYTHONPATH:+:${PYTHONPATH}}' >> ~/.bashrc
```

When I run this script it segfaults:

```py
from pathlib import Path

import isl
import pet

path = Path(__file__).parent / "examples/depnodep.c"
scop = pet.scop.extract_from_C_source(str(path), "f")
```
@sven, any idea why the last command segfaults? The same thing works if I use Arch linux as an OS/base image. (Including depnodep.c in the end)

@all This version works:
```
FROM archlinux

RUN pacman -Syu --noconfirm
RUN pacman -S --noconfirm git make cmake gcc less vim pkgconf automake autoconf libtool gmp ntl llvm clang python
RUN git clone git://repo.or.cz/barvinok.git
WORKDIR barvinok
RUN ./get_submodules.sh

RUN ./autogen.sh
RUN ./configure --with-pet=bundled --with-clang=system --enable-shared-barvinok --prefix=/usr
RUN make -j
RUN make isl.py
RUN make install

RUN echo 'export LD_LIBRARY_PATH=/barvinok/.libs:/barvinok/pet/.libs${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc
RUN echo 'export PYTHONPATH=/barvinok:/barvinok/pet/interface${PYTHONPATH:+:${PYTHONPATH}}' >> ~/.bashrc
```

Best,
E

// depnodep.c for reference
#include <stdio.h>
#include <stdlib.h>

void print_arr(size_t N, double *A) {
  for (int i = 0; i < N; ++i) {
    printf("%lf, ", A[i]);
  }
  printf("\n");
}

void init_arr(size_t N, double *A) {
  for (int i = 0; i < N; ++i) {
    A[i] = random();
  }
}

const size_t N = 10;

void f(size_t N, double A[N][N]) {
#pragma scop
  for (size_t i = 1; i < N; i++) {
    for (size_t j = 0; j < N; j++) {
      A[i][j] = A[i][j] + A[i - 1][j];
    }
  }
#pragma endscop
}

int main(int argc, char *argv[]) {
  double A[N][N];

  for (int i = 0; i < N; ++i) {
    init_arr(N, A[i]);
    print_arr(N, A[i]);
  }
  f(N, A);
  for (int i = 0; i < N; ++i) {
    print_arr(N, A[i]);
  }
  return 0;
}


--

---
You received this message because you are subscribed to the Google Groups "isl Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isl-developme...@googlegroups.com.

Sven Verdoolaege

unread,
Feb 5, 2024, 12:33:42 PMFeb 5
to Anuradha Prakash, isl Development
On Mon, Feb 05, 2024 at 08:19:44AM +0530, Anuradha Prakash wrote:
> Hi,
>
> NTL version used is, 5.4.2. Will try installing it in /opt.
> As for, barvinok version 0.39 was downloaded from
> https://barvinok.sourceforge.io/ but it didn't have the autogen script
> available in it and had to clone a version of 4.x from the git page.

That's a pretty old version of barvinok,
but I guess it should work with that version of NTL.

> However, there's a closed issue in Timeloop,
> https://github.com/NVlabs/timeloop/issues/222, where it supports only a
> version barvinok 3x. If this were a known issue, I'm hoping you could
> redirect the the last stable version of barvinok I could use.

I'm not familiar with TimeLoop, so I don't know what
their requirements are.

skimo

Sven Verdoolaege

unread,
Feb 5, 2024, 12:39:36 PMFeb 5
to Emil Vatai, Anuradha Prakash, isl Development
On Mon, Feb 05, 2024 at 12:07:31PM +0900, Emil Vatai wrote:
> @sven, any idea why the last command segfaults? The same thing works if I
> use Arch linux as an OS/base image. (Including depnodep.c in the end)

Does pet link against a shared LLVM library and does it
by any chance expose isl_ symbols?
I've run into an issue before where some isl functions
from libLLVM.so were getting called instead of
the ones from libisl.so.
I'm not sure why that happens. I thought the isl functions
in LLVM were getting hidden somehow.

skimo

Emil Vatai

unread,
Feb 7, 2024, 2:38:27 AMFeb 7
to sven.ver...@gmail.com, Anuradha Prakash, isl Development
You mean like this?

root@dc596482c7f0:/barvinok# ldd pet/.libs/libpet.so | grep LLVM
libLLVM-14.so.1 => /usr/lib/llvm-14/lib/libLLVM-14.so.1 (0x00007750fa030000)
root@dc596482c7f0:/barvinok# nm -gD /usr/lib/llvm-14/lib/libLLVM-14.so.1 | grep isl_ | wc -l
5023

Tried exporting LIBRARY_PATH (didn't help). Not sure what can be done.

Also tried ubuntu 23.10 as a "quick fix" but that gives me compilation errors.

```
# ... snip ...
3.220 ar: `u' modifier ignored since `D' is the default (see `U')
11.76   CXXLD    extract_interface
12.89 /usr/bin/ld: /usr/lib/llvm-16/lib/libclangSema.a(SemaRISCVVectorLookup.cpp.o): in function `clang::CreateRISCVIntrinsicManager(clang::Sema&)':
12.89 (.text._ZN5clang27CreateRISCVIntrinsicManagerERNS_4SemaE+0x262): undefined reference to `clang::RISCV::RVVIntrinsic::computeBuiltinTypes(llvm::ArrayRef<clang::RISCV::PrototypeDescriptor>, bool, bool, bool, unsigned int, clang::RISCV::PolicyScheme, clang::RISCV::Policy)'
12.89 /usr/bin/ld: (.text._ZN5clang27CreateRISCVIntrinsicManagerERNS_4SemaE+0x2be): undefined reference to `clang::RISCV::RVVIntrinsic::computeBuiltinTypes(llvm::ArrayRef<clang::RISCV::PrototypeDescriptor>, bool, bool, bool, unsigned int, clang::RISCV::PolicyScheme, clang::RISCV::Policy)'
# ... snip ...
```

I think I saw this error before, but don't remember how I solved it (maybe some -l flag <thinking emoji>), I'll try to get back to this later...

Best,
E
--
Emil Vatai

Sven Verdoolaege

unread,
Feb 7, 2024, 1:55:29 PMFeb 7
to Emil Vatai, Anuradha Prakash, isl Development
On Wed, Feb 07, 2024 at 04:38:14PM +0900, Emil Vatai wrote:
> I think I saw this error before, but don't remember how I solved it (maybe
> some -l flag <thinking emoji>), I'll try to get back to this later...

Try

diff --git a/Makefile.am b/Makefile.am
index 093178d..56cb1fa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -115,7 +115,7 @@ libpet_la_SOURCES = \
version.cc \
pet.cc
libpet_la_LDFLAGS = -version-info @versioninfo@ $(AM_LDFLAGS) $(CLANG_RFLAG)
-libpet_la_LIBADD = $(CLANG_LIBS) $(CLANG_LDFLAGS) $(LIB_ISL)
+libpet_la_LIBADD = $(LIB_ISL) $(CLANG_LIBS) $(CLANG_LDFLAGS)

pet_CFLAGS = $(AM_CFLAGS) @LIBYAML_CPPFLAGS@
pet_LDFLAGS = $(AM_LDFLAGS) @LIBYAML_LDFLAGS@

skimo

Sven Verdoolaege

unread,
Feb 7, 2024, 2:20:41 PMFeb 7
to Emil Vatai, Anuradha Prakash, isl Development
On Wed, Feb 07, 2024 at 07:55:25PM +0100, Sven Verdoolaege wrote:
> On Wed, Feb 07, 2024 at 04:38:14PM +0900, Emil Vatai wrote:
> > I think I saw this error before, but don't remember how I solved it (maybe
> > some -l flag <thinking emoji>), I'll try to get back to this later...
>
> Try

Hmm... you may have been talking about the other error you found.
In any case, this is for not calling isl functions inside libLLVM:
Reply all
Reply to author
Forward
0 new messages