How can I configure the tasks.json file in VS Code to optimize a program?

29 views Asked by At

I'm trying to simulate the Ising model in 2D and I want to optimize my C program. I've been told that I can add the argument "-O3" in tasks.json file to do that but I don't get any result. I I don't know if it's possible that the debugger task makes the optimization not work.

The file has a normal task called "Compile main file" and other one special called "Compile main file especial". This is because I'm working in github with a group and there is people that need other configuration.

{
"tasks": [
    {
        "type": "shell",
        "label": "Compile main file",
        "command": "C:\\msys64\\ucrt64\\bin\\gcc.exe",
        "args": [
            "-Wall",
            "-g",
            "-O3",
            "algorithmsDATA.c",
            "algorithmsNET.c",
            "main.c",
            "-o",
            "ising.exe"
        ],
        "options": {
            "cwd": "${workspaceFolder}"
        },
        "problemMatcher": "$gcc",
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "detail": "Compiles all the *.c files in the working directory"
    },
    {
        "type": "shell",
        "label": "Compile main file especial",
        "command": "C:\\msys64\\ucrt64\\bin\\gcc.exe",
        "args": [
            "-Wall",
            "-g",
            "${workspaceFolder}/algorithmsDATA.c",
            "${workspaceFolder}/algorithmsNET.c",
            "${workspaceFolder}/main.c",
            "-o",
            "${workspaceFolder}/ising.exe"
        ],
        "options": {
            "cwd": "C:\\msys64\\ucrt64\\bin"
        },
        "problemMatcher": "$gcc",
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "detail": "Compiles all the *.c files in the working directory"
    }
    {
        "type": "shell",
        "label": "Buid main file with debugging activated",
        "command": "C:\\msys64\\ucrt64\\bin\\gcc.exe",
        "args": [
            "-g",
            "-Wall",
            "algorithmsDATA.c",
            "algorithmsNET.c",
            "main.c",
            "-o",
            "ising.exe"
        ],
        "options": {
            "cwd": "${workspaceFolder}"
        },
        "problemMatcher": "$gcc",
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "detail": "Compiles all the *.c files in the working in debugging mode"
    },
    {
        "type": "shell",
        "label": "Buid main file with debugging activated (especial)",
        "command": "C:\\msys64\\ucrt64\\bin\\gcc.exe",
        "args": [
            "-g",
            "-Wall",
            "${workspaceFolder}/algorithmsDATA.c",
            "${workspaceFolder}/algorithmsNET.c",
            "${workspaceFolder}/main.c",
            "-o",
            "${workspaceFolder}/ising.exe"
        ],
        "options": {
            "cwd": "C:\\msys64\\ucrt64\\bin"
        },
        "problemMatcher": "$gcc",
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "detail": "Compiles all the *.c files in the working in debugging mode"
    }
],
"version": "2.0.0"
}
0

There are 0 answers