source /opt/dtk/env.sh

#cd /opt/dtk/.hip/
#./replace_origin.sh
#cd -

cd build;
export CPLUS_INCLUDE_PATH=${ROCM_PATH}/include:${ROCM_PATH}:/opencl/include
export LD_LIBRARY_PATH=/public/software/compiler/intel-compiler-2017.5.239/mkl/lib/intel64_lin/:$LD_LIBRARY_PATH
#export PATH=/home/huchen/FAISS/swig-4.0.2-build/bin/:$PATH
export CPLUS_INCLUDE_PATH=${ROCM_PATH}/hiprand/include/:${ROCM_PATH}/rocrand/include:$CPLUS_INCLUDE_PATH
export LD_LIBRARY_PATH=${ROCM_PATH}/hipblas/lib/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=${ROCM_PATH}/llvm/lib:$LD_LIBRARY_PATH

export BUILD_DIR=`pwd`
export LD_LIBRARY_PATH=${BUILD_DIR}/faiss/gpu/test/:${BUILD_DIR}/faiss/:${BUILD_DIR}/lib/:$LD_LIBRARY_PATH
#export HIP_KERNEL_PRINTF=1
#make -j95 VERBOSE=1
export HIP_VISIBLE_DEVICES=3

#export MKL_DEBUG_CPU_TYPE=5

#export HIP_LAUNCH_BLOCKING=1
#export HIP_LOG_LEVEL=7

#export AMD_LOG_LEVEL=4
#export AMD_OCL_WAIT_COMMAND=1

ctest

#./faiss/gpu/test/TestGpuIndexFlat > hc_test.log 2>&1 
#./faiss/gpu/test/TestGpuIndexFlat
#ctest -R TestGpuIndexFlat.IP_Float32

#ctest -R TestGpuIndexIVFFlat.Float32_32_Add_L2
#./faiss/gpu/test/TestGpuIndexIVFFlat
#./faiss/gpu/test/TestGpuIndexIVFPQ
#./faiss/gpu/test/TestGpuIndexIVFScalarQuantizer

#ctest -R TestGpuIndexIVFPQ
#ctest -R TestGpuIndexFlat

#gdb --args ./faiss/gpu/test/TestGpuIndexIVFPQ --gtest_filter=TestGpuIndexIVFPQ.Query_L2_MMCodeDistance
#./faiss/gpu/test/TestGpuIndexIVFPQ --gtest_filter=TestGpuIndexIVFPQ.Query_L2_MMCodeDistance
#./faiss/gpu/test/TestGpuIndexIVFPQ --gtest_filter=TestGpuIndexIVFPQ.Query_IP_MMCodeDistance
#./faiss/gpu/test/TestGpuIndexIVFPQ --gtest_filter=TestGpuIndexIVFPQ.Query_IP_MMCodeDistance > hc_test.log 2>&1

##./faiss/gpu/test/TestGpuIndexFlat
##./faiss/gpu/test/TestCodePacking
##./faiss/gpu/test/TestGpuIndexBinaryFlat
##./faiss/gpu/test/TestGpuMemoryException
##./faiss/gpu/test/TestGpuSelect
##./faiss/gpu/test/TestGpuDistance

#ctest -V -R TestGpuSelect.test1Warp
