FALCONN-LIB/FALCONN

How can I use FALCONN IN VS2017 CONMUNITY

liulin1995 opened this issue · 5 comments

I found a error : 1>"c:\codes\falconn-master\src\include\falconn\core\prefetchers.h(36): error C3861: “__builtin_prefetch”: 找不到标识符 "when I use vs2017 .How can I use it on Vs?

Currently we don't support Visual Studio unfortunately. But the prefetching is not crucial overall. If you just uncomment the __builtin_prefetch lines, FALCONN should still return the same answers (but might be a bit slower).

Let us know if that helps.

I comment all __builtin_prefetch lines in prefetchers.h.

#ifndef

 __PREFETCHERS_H__
#define __PREFETCHERS_H__

#include <cstdint>
#include <utility>
#include <vector>

#include "../eigen_wrapper.h"

namespace falconn {
namespace core {

template <typename PointType>
class StdVectorPrefetcher {
 public:
  // Parameters are points and prefetch_index.
  void prefetch(const std::vector<PointType>&, int_fast64_t) {
    static_assert(FalseStruct<PointType>::value,
                  "No prefetcher implemented for this point type.");
  }

 private:
  template <typename PT>
  struct FalseStruct : std::false_type {};
};

template <typename CoordinateType>
class StdVectorPrefetcher<
  Eigen::Matrix<CoordinateType, Eigen::Dynamic, 1, Eigen::ColMajor>> {
public:
  typedef Eigen::Matrix<CoordinateType, Eigen::Dynamic, 1, Eigen::ColMajor>
      PointType;

  void prefetch(const std::vector<PointType>& points,
               int_fast64_t prefetch_index) {
   // __builtin_prefetch((points[prefetch_index]).data(), 0, 1);
 }
};

template <typename CoordinateType, typename IndexType>
class StdVectorPrefetcher<std::vector<std::pair<IndexType, CoordinateType>>> {
 public:
 typedef std::vector<std::pair<IndexType, CoordinateType>> PointType;
  /*DefaultPrefetcher() {
    printf("In sparse prefetcher.\n");
 }*/

  void prefetch(const std::vector<PointType>& points,
               int_fast64_t prefetch_index) {
   // __builtin_prefetch((points[prefetch_index]).data(), 0, 1);
  }
};

template <typename T>
class PlainArrayPrefetcher {
 public:
  void prefetch(const T* p) {
	 
  }
};

}  // namespace core
}  // namespace falconn
#endif

And it work good in VS community 2017.
These days,I am try to build a CIBR system,and I have change the input data to my own data,it can work .
Perhaps I should learn more about the principle of FALCONN .But now,I have another question,can construct_table be stored to my comouter?For convenience ,I hope I can reuse it once it was constructed.

Great that FALCONN works after commenting out those lines. Is there a preprocessor macro for Visual Studio that we could use to make the code compile without changes?

At the moment we don't support table saving and restoring, but it is on our list of ToDos #46 .

@ludwigschmidt, I have a similar issue trying to run FALCONN from Visual Studio. However, my VS in running on Windows. From https://github.com/falconn-lib/falconn/wiki it sounds like Windows is not supported. Does this mean now I can? Thanks!

@keowang Hopefully the changes suggested by @liulin1995 also work for you. So running FALCONN on Windows could be worth a try. But we can't guarantee that it will work unfortunately.