Cytnx icon indicating copy to clipboard operation
Cytnx copied to clipboard

Compiler for HPTT

Open pcchen opened this issue 2 years ago • 7 comments

The compiler setup does not pass to the HPTT

If I do something like

CC=/opt/homebrew/bin/gcc-11 CXX=/opt/homebrew/bin/g++-11 cmake -DUSE_OMP=OFF -DUSE_HPTT=ON  ..

and

make

It will clone HPTT. But it will use system compiler (apple's clang) instead of the CC=/opt/homebrew/bin/gcc-11 CXX=/opt/homebrew/bin/g++-11. (Then it will fail)

How to make HPTT part also use the specific compiler I want to use?

pcchen avatar Mar 29 '23 07:03 pcchen

Try specify the compiler via -DCMAKE_C_COMPILER and -DCMAKE_CXX_COMPILER, instead of CXX and CC which set enviroment variables of OS.

kaihsin avatar Apr 16 '23 00:04 kaihsin

I saw similar things even when I set CMAKE_C_COMPILER and CMAKE_CXX_COMPILER. Gcc is still used.

yingjerkao avatar Apr 17 '23 06:04 yingjerkao

@jeffry1829 Is this resolved?

kaihsin avatar Aug 02 '23 10:08 kaihsin

not yet, I'm investigating. I suspect we only need to add cmake_args to ExternalProject_Add

jeffry1829 avatar Aug 02 '23 14:08 jeffry1829

I see in the workflow cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_INSTALL_PREFIX=/home/runner/work/Cytnx_lib -DUSE_MKL=on -DUSE_HPTT=on -DHPTT_ENABLE_FINE_TUNE=on -DHPTT_ENABLE_AVX=off -DBUILD_PYTHON=on -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DRUN_TESTS=on hptt is always turned. Is this the required dependency? Because if I turn it off, some of the tests will not pass.

yingjerkao avatar Dec 11 '24 05:12 yingjerkao

This should not be required. Although I don't see why we would want to make it off

On Wed, Dec 11, 2024, 00:28 Ying-Jer Kao @.***> wrote:

I see in the workflow cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_INSTALL_PREFIX=/home/runner/work/Cytnx_lib -DUSE_MKL=on -DUSE_HPTT=on -DHPTT_ENABLE_FINE_TUNE=on -DHPTT_ENABLE_AVX=off -DBUILD_PYTHON=on -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DRUN_TESTS=on hptt is always turned. Is this the required dependency? Because if I turn it off, some of the tests will not pass.

— Reply to this email directly, view it on GitHub https://github.com/Cytnx-dev/Cytnx/issues/149#issuecomment-2533671992, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFCX3SOLYIIRGAVLRGV56FD2E7EOLAVCNFSM6AAAAABTMVB2U2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZTGY3TCOJZGI . You are receiving this because you commented.Message ID: @.***>

kaihsin avatar Dec 11 '24 05:12 kaihsin

HPTT is off by default in Install.sh. BTW, I always use CMakePresets.json to switch between different build configurations, instead of using Install.sh.

I frequently ran tests on different configurations before. I didn't notice any test fails when switching HPTT. What tests fail now?

Here is my CMakePresets.json (some entries are duplicated) for refering:

{
    "version": 6,
    "cmakeMinimumRequired": {
        "major": 3,
        "minor": 25,
        "patch": 0
    },
    "buildPresets": [
        {
            "name": "default",
            "configurePreset": "default",
            "jobs": 16
        },
        {
            "name": "cuda",
            "inherits": "default",
            "configurePreset": "cuda"
        },
        {
            "name": "omp",
            "inherits": "default",
            "configurePreset": "omp"
        },
        {
            "name": "mkl",
            "inherits": "default",
            "configurePreset": "mkl"
        },
        {
            "name": "all",
            "inherits": "default",
            "configurePreset": "all"
        }
    ],
    "testPresets": [
        {
            "name": "default",
            "configurePreset": "default",
            "output": {
                "outputOnFailure": true,
                "verbosity": "verbose"
            }
        },
        {
            "name": "cuda",
            "description": "",
            "displayName": "cuda",
            "configurePreset": "cuda",
            "inherits": [
                "default"
            ]
        },
        {
            "name": "omp",
            "description": "",
            "displayName": "omp",
            "configurePreset": "omp",
            "inherits": [
                "default"
            ]
        },
        {
            "name": "mkl",
            "description": "",
            "displayName": "mkl",
            "configurePreset": "mkl",
            "inherits": [
                "default"
            ]
        },
        {
            "name": "all",
            "description": "",
            "displayName": "all",
            "configurePreset": "all",
            "inherits": [
                "default"
            ]
        }
    ],
    "configurePresets": [
        {
            "name": "default",
            "displayName": "default",
            "description": "default",
            "binaryDir": "${sourceDir}/build/${presetName}",
            "cacheVariables": {
                "CMAKE_BUILD_TYPE": "Release",
                "CMAKE_INSTALL_PREFIX": "MY_CMAKE_INSTALL_PREFIX",
                "USE_MKL": "OFF",
                "BUILD_PYTHON": "ON",
                "BACKEND_TORCH": "OFF",
                "USE_HPTT": "OFF",
                "HPTT_ENABLE_FINE_TUNE": "OFF",
                "USE_CUDA": "OFF",
                "USE_CUTT": "OFF",
                "CUTT_ENABLE_FINE_TUNE": "OFF",
                "USE_MAGMA": "OFF",
                "USE_CUTENSOR": "OFF",
                "CUTENSOR_ROOT": "MY_CUTENSOR_ROOT",
                "USE_CUQUANTUM": "OFF",
                "CUQUANTUM_ROOT": "MY_CUQUANTUM_ROOT",
                "CMAKE_EXPORT_COMPILE_COMMANDS": "1",
                "USE_OMP": "OFF",
                "RUN_TESTS": "ON",
                "USE_DEBUG": "OFF",
                "CMAKE_CUDA_HOST_COMPILER": "MY_CMAKE_CUDA_HOST_COMPILER"
            }
        },
        {
            "name": "debug",
            "displayName": "debug",
            "description": "debug",
            "binaryDir": "${sourceDir}/build/${presetName}",
            "inherits": "default",
            "cacheVariables": {
                "CMAKE_BUILD_TYPE": "Debug",
                "USE_DEBUG": "ON"
            }
        },
        {
            "name": "cuda",
            "displayName": "cuda",
            "description": "cuda",
            "binaryDir": "${sourceDir}/build/${presetName}",
            "inherits": "debug",
            "cacheVariables": {
                "USE_CUDA": "ON",
                "USE_CUTENSOR": "ON",
                "CUTENSOR_ROOT": "MY_CUTENSOR_ROOT",
                "USE_CUQUANTUM": "ON",
                "CUQUANTUM_ROOT": "MY_CUQUANTUM_ROOT"
            }
        },
        {
            "name": "omp",
            "displayName": "omp",
            "description": "omp",
            "binaryDir": "${sourceDir}/build/${presetName}",
            "inherits": "debug",
            "cacheVariables": {
                "USE_OMP": "ON"
            }
        },
        {
            "name": "mkl",
            "displayName": "mkl",
            "description": "mkl",
            "binaryDir": "${sourceDir}/build/${presetName}",
            "inherits": "debug",
            "cacheVariables": {
                "USE_MKL": "ON"
            }
        },
        {
            "name": "all",
            "displayName": "all",
            "description": "cannot enable omp and hptt at the same time",
            "binaryDir": "${sourceDir}/build/${presetName}",
            "inherits": ["cuda"],
            "cacheVariables": {
                "USE_MKL": "ON",
                "USE_HPTT": "ON",
                "USE_CUTT": "ON"
            }
        }
    ]
}

IvanaGyro avatar Dec 11 '24 05:12 IvanaGyro