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

ffbidx indexer from PSI #14

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

fleon-psi
Copy link

Fast feedback indexer using Nvidia GPUs for indexing.

Short operating instruction:

  1. Compile FFBIDX:

export BASE_DIR=
git clone --recurse-submodules https://github.com/paulscherrerinstitute/fast-feedback-indexer/
cd fast-feedback-indexer
mkdir build
cd build
cmake .. -DCMAKE_CUDA_ARCHITECTURES="70;75;80" -DCMAKE_INSTALL_PREFIX=${BASE_DIR}/ffbidx
make
sudo make install

This will place FFBIDX files in $BASE_DIR/ffbidx (if it is not included, /usr/local is the target directory).
The CUDA architecture settings are optimized for V100/A100/T4 GPU devices.
You might want to change CUDA architectures of you have older/newer devices, see Nvidia documentation for details.

  1. Compile CrystFEL with the following options:

export BASE_DIR= # the same as above
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${BASE_DIR}/ffbidx/lib/pkgconfig
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${BASE_DIR}/ffbidx/lib
git clone https://github.com/fleon-psi/crystfel
cd crystfel
git checkout fast_indexer.0.11.0
meson -Dprefix=$BASE_DIR/crystfel/ build
cd build
ninja
ninja install

Requires forked version of CrystFEL at the moment.
BASE_DIR has to be the same as used for FFBIDX.

Then you can add "--indexing=ffbidx" to indexamajig options. FFBIDX lib directory has to be in the LD_LIBRARY_PATH for the execution.

To print possible configuration options, you can run:
indexamajig --help-ffbidx

@pmiddend
Copy link
Contributor

I tried compiling CrystFEL with this out of curiosity and got this error:

include/ffbidx/c_api.h:86:23: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘=’ token

which occurs in this piece of code:

struct config_runtime {             // pinned memory
    float_type length_threshold;    // threshold for determining equal vector length (|va| - threshold < |vb| < |va| + threshold)
    float_type triml;               // lower trim value for distance to nearest integer objective value - 0 < triml < trimh
    float_type trimh;               // higher trim value for distance to nearest integer objective value - triml < trimh < 0.5
    float_type delta;               // log2 curve position: score = log2(trim(dist(x)) + delta)
    float_type dist1;               // maximum distance to int for single coordinate
    float_type dist3;               // maximum distance to int for tripple coordinates
    // ============= HERE
    unsigned min_spots=6;           // vector refinement: minimum number of spots to fit against (0: no refinement)
    unsigned num_halfsphere_points; // number of sample points on half sphere for finding vector candidates
    unsigned num_angle_points;      // number of sample points in rotation space for finding cell candidates (0: auto)
};

I've never seen this default value syntax before and gcc (11) doesn't seem to like it. What could be my mistake here?

@fleon-psi
Copy link
Author

fleon-psi commented Sep 30, 2024

I tried compiling CrystFEL with this out of curiosity and got this error:
...
I've never seen this default value syntax before and gcc (11) doesn't seem to like it. What could be my mistake here?

Thank you @pmiddend for reporting the issue! Yes, one line from C++ was accidently copied to C code (default initialization of struct members is OK in C++, but not in C) in the fast feedback indexer repository. This should be now fixed.

@pmiddend
Copy link
Contributor

pmiddend commented Oct 1, 2024

Thanks for the quick answer @fleon-psi! I was not only able to compile it, but also run it on our Maxwell cluster, clocking in at ~50fps. Though I'm not sure if it's really using the GPU. Is there a CPU fallback?

@fleon-psi
Copy link
Author

Good to hear compilation works - thanks @pmiddend .
There is no CPU fallback - if the code executed without errors, it run on a GPU.

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

Successfully merging this pull request may close these issues.

3 participants