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

[question]how to suppress or rediret the gcc output? #829

Open
miz2019 opened this issue May 22, 2024 · 3 comments
Open

[question]how to suppress or rediret the gcc output? #829

miz2019 opened this issue May 22, 2024 · 3 comments
Labels
Question Further information is requested

Comments

@miz2019
Copy link

miz2019 commented May 22, 2024

❓ Questions and Help

In gcc-v0 , I do random searching and combine some options and params, and gcc execution report some informative message like below

aes_key.c:158:14: optimized:  Inlined SubByte/25 into KeySchedule/10 which now has time 1139.174768 and size 140, net change of +0.
aes_key.c:144:14: optimized:  Inlined SubByte/26 into KeySchedule/10 which now has time 1106.406586 and size 140, net change of +0.
aes_key.c:145:14: optimized:  Inlined SubByte/27 into KeySchedule/10 which now has time 1073.638401 and size 140, net change of +0.
aes_key.c:146:14: optimized:  Inlined SubByte/28 into KeySchedule/10 which now has time 1040.870218 and size 140, net change of +0.
aes_key.c:147:14: optimized:  Inlined SubByte/29 into KeySchedule/10 which now has time 1008.102035 and size 140, net change of +0.
aes_key.c:156:18: optimized: basic block part vectorized using 16 byte vectors
aes.c:117:3: optimized: basic block part vectorized using 16 byte vectors

that messes up my screen, how could I suppress it?

After some tracing, get here . in env/lib/python3.10/site-packages/grpc/_channel.py:926 self._channel.segregated_call

    def _blocking(self, request, timeout, metadata, credentials, wait_for_ready,
                  compression):
        state, operations, deadline, rendezvous = self._prepare(
            request, timeout, metadata, wait_for_ready, compression)
        if state is None:
            raise rendezvous  # pylint: disable-msg=raising-bad-type
        else:
            call = self._channel.segregated_call(                  #<<<<<<
                cygrpc.PropagationConstants.GRPC_PROPAGATE_DEFAULTS,
                self._method, None, _determine_deadline(deadline), metadata,
                None if credentials is None else credentials._credentials, ((
                    operations,
                    None,
                ),), self._context)
            event = call.next_event()
            _handle_event(event, state, self._response_deserializer)
            return state, call

looks like the client env fires someting to the server, and where can I config in server side to redirect or suppress the message.
I use local mode now.
Thanks.

@miz2019 miz2019 added the Question Further information is requested label May 22, 2024
@ChrisCummins
Copy link
Contributor

Hmm that's weird. I haven't seen logging messages like that before. Since it's coming from GRPC there may be an option to disable logging within that library.

Could you please share the versions of all libraries (use pip freeze) to make it easier to reproduce the problem?

@miz2019
Copy link
Author

miz2019 commented May 23, 2024

Thanks for the quick reply.

  1. pip freeze=> : requirements.txt
    maybe below is required to be executed beforehand
        pip install setuptools==65.5.0
        pip install "wheel<0.40.0"
  1. ubuntu & gcc
    Ubuntu 20.04.1 LTS
    gcc -v info
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)
  1. gcc command line to reproduce message=> gcc_build_cmd.txt

step to reproduce
I did some mod to the compilergym code. the patch is
myconda.patch
relevent code

def my_run():
    with GCC_ENV_CONSTRUCTOR_LOCK:
        env = compiler_gym.make("gcc-v0", gcc_bin='/usr/bin/gcc',benchmark="benchmark://chstone-v0/aes")
    for seed in [11]:   #use range(...) if 11 not reproduce
        env.reset()
        print(f'seed={seed}')
        random.seed(seed)
        np.random.seed(seed)
        return random_search(env)

def random_search(env: CompilerEnv):
    best = float("inf")
    for _ in range(1):
        env.reset()
        env.choices = [
            random.randint(-1, min(256, len(opt) - 1))
            for opt in env.gcc_spec.options
        ]
        best = min(objective(env), best)
    return best

def objective(env) -> int:
    """Get the objective from an environment"""
    # Retry loop to defend against flaky environment.
    for _ in range(5):
        try:
            # print(env.state.commandline)
            # print(f"Success....")
            # import pdb ; pdb.set_trace()
            size= env.observation["obj_size"]
            print(f"size={size}")
            return size
        except ServiceError as e:
            # print(f"Objective function failed: {e}")
            print(f"Objective function failed....")
            env.reset()
    return env.observation["obj_size"]

@ChrisCummins
Copy link
Contributor

Thanks @miz2019 that'll make it easier to repro.

Cheers,
Chris

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

No branches or pull requests

2 participants