epiqc / ScaffCC

Compilation, analysis and optimization framework for the Scaffold quantum programming language.
BSD 2-Clause "Simplified" License
188 stars 53 forks source link

-o is not working for QFT #31

Closed ryanxw closed 4 years ago

ryanxw commented 5 years ago

$ ./scaffold.sh -o Algorithms/QFT/qft.scaffold

/bin/bash: line 5: 104 Segmentation fault ./build/Release+Asserts/bin/opt -load ./build/Release+Asserts/lib/Scaffold.so -Optimize qft12.inlined.ll 2> qft_optimized.qasmf > /dev/null [Scaffold.makefile] Optimized circuit written to qft_optimized.qasmf ...

kangz12345 commented 4 years ago

I have the same problem, but does it happen to QFT only? I tried to compile a toy code with -o option and I got the same segmentation fault.

This is the toy code:

int main() {
    qbit a[1];
    cbit m[1];
    int ang = 15;

    X(a[0]);
    H(a[0]);
    Rz(a[0], ang);
    Rz(a[0], ang*2);
    H(a[0]);
    X(a[0]);

    m[0] = MeasX(a[0]);

    return 0;
}
AndrewLitteken commented 4 years ago

Fixed in #41, Pull latest version

kangz12345 commented 4 years ago

Thank you for the rapid update, but I was on the ScaffCC_OSX branch and I think the checkout to origin/master changes some settings so that it no longer works on macOS. How can I pull the latest version and at the same time maintain the compatibility on macOS?

AndrewLitteken commented 4 years ago

The latest version of the master should be compatible on macOS and Ubuntu, the README is not correct. It does require that you have CMake and Ninja installed so that LLVM can be installed correctly.

Is there a particular issue you’re having?

kangz12345 commented 4 years ago

I was not able to run ./build.sh, so I cloned the git repo again and rebuilt. Now it works, thank you!